sun, 20-sep-2015, 09:50
1991 contacts

1991 contacts

Yesterday I was going through my journal books from the early 90s to see if I could get a sense of how much bicycling I did when I lived in Davis California. I came across the list of my network contacts from January 1991 shown in the photo. I had an email, bitnet and uucp address on the UC Davis computer system. I don’t have any record of actually using these, but I do remember the old email clients that required lines be less than 80 characters, but which were unable to edit lines already entered.

I found the statistics for 109 of my bike rides between April 1991 and June 1992, and I think that probably represents most of them from that period. I moved to Davis in the fall of 1990 and left in August 1993, however, and am a little surprised I didn’t find any rides from those first six months or my last year in California.

I rode 2,671 miles in those fifteen months, topping out at 418 miles in June 1991. There were long gaps in the record where I didn’t ride at all, but when I rode, my average weekly mileage was 58 miles and maxed out at 186 miles.

To put that in perspective, in the last seven years of commuting to work and riding recreationally, my highest monthly mileage was 268 miles (last month!), my average weekly mileage was 38 miles, and the farthest I’ve gone in a week was 81 miles.

The road biking season is getting near to the end here in Fairbanks as the chances of significant snowfall on the roads rises dramatically, but I hope that next season I can push my legs (and hip) harder and approach some of the mileage totals I reached more than twenty years ago.

tags: bicycling  bitnet  uucp  email 
sun, 18-mar-2012, 14:58

A week ago I set up a Tumblr site with the idea I’d post photos on there, hopefully at least once a day. Sort of a photo-based microblog. After a week of posting stuff I realized it would be really easy to set something like this up on my own site. It works like this:

  • Email myself a photo where the subject line has a keyword in it that procmail recognizes, sending the email off to a Python script.
  • The Python script processes the email, extracting the photo name and caption from the text portion of the email, rotates and resizes the photo, and saves it in a place accessable from my web server. The photo metadata (size, when the photo was taken, caption and path) is stored in a database.
  • A Django app generates the web page from the data in the database.

There are a few tricky bits here. First is handling the rotation of the photos. At least with my phone, the image data is always stored in landscape format, but there’s an EXIF tag that indicates how the data should be rotated for display. So I read that tag and rotate appropriately, using the Python Imaging Library (PIL):

import StringIO
import Image
import ExifTags

orientation_key = 274

if orientation_key in exif:
    orientation = exif[orientation_key]
    if orientation == 3:
        image_data = image_data.rotate(180, expand = True)
    elif orientation == 6:
        image_data = image_data.rotate(270, expand = True)
    elif orientation == 8:
        image_data = image_data.rotate(90, expand = True)

For simplicity, I hard coded the orientation_key above, but it’s probably better to get the value from the ExifTags library. That can be done using this list comprehension:

orientation_key = [key for key, value in \
     ExifTags.TAGS.iteritems() if value == 'Orientation'][0]

Resizing the image is relatively easy:

(x, y) = image_data.size
if x > y:
    if x > 600:
        image_600 = image_data.resize(
                (600, int(round(600 / float(x) * y))),
        image_600 = image_data
    if y > 600:
        image_600 = image_data.resize(
                (int(round(600 / float(y) * x)), 600),
        image_600 = image_data

And the whole thing is wrapped up in the code that parses the pieces of the email message:

import email

msg = email.message_from_file(sys.stdin)
headers = msg.items()
body = []
for part in msg.walk():
    if part.get_content_maintype() == 'multipart':
    content_type = part.get_content_type()
    if content_type == "image/jpeg":
        image_data =
            part.get_payload(decode = True)
    elif content_type == "text/plain":
        charset = get_charset(part, get_charset(msg))
        text = unicode(part.get_payload(decode = True), charset, "replace")

body = u"\n".join(body).strip()

The get_charset function is:

def get_charset(message, default="ascii"):
    """Get the message charset"""

    if message.get_content_charset():
        return message.get_content_charset()

    if message.get_charset():
        return message.get_charset()

    return default

Once these pieces are wrapped together, called via procmail, and integrated into Django, it looks like this: photolog. There’s also a link to it in the upper right sidebar of this blog if you’re viewing this page in a desktop web browser.

tags: photolog  blog  Python  email 
Meta Photolog Archives