Wednesday, September 09, 2009

Unix for fun and profit

So today, someone asked me for a favor. A simple favor.

Or so I thought.

Some background:

See, about a year ago, we went to the Raleigh Drum Circle birthday bash, which is basically a get together for the drum circle that meets in Raleigh. It happens about this time every year. We brought our Nikon D40, and took a bunch of pictures, then posted them on flickr. Some of them turned out pretty good, I think.

So today, someone from the drum circle asked if he could use some of them for the drumcircle newsletter, flyers, and things of that nature. He wanted to get some higher resolution versions to use for the above purposes. Well, color me flattered! I was happy to comply. However, I had a problem. Between the camera and flickr, I'd lost the original filenames...flickr had the descriptions I put in, but not the original filenames. I originally took about 350 pictures, and only posted 40 or so. How would I find the originals for the 6 or so the drum circle guy wanted without inspecting each of the 350 originals?

I didn't have the original filename, but I did have the exif data. So I conceived a fiendish plan! The exif data includes, among many other juicy details, the date and time the picture was taken. Flickr shows that data, and I could cross-reference the data from the original files to find the file I wanted. So, I wrote a quick python script:


#!/usr/bin/python

import os
from PIL import Image

for filename in os.listdir(os.curdir):
    img = Image.open(filename)
    print filename, img._getexif()[36867]


The PIL interface to exif data is unfortunately pretty raw at this point. To interpret the dictionary you get from _getexif(), look in the ExifTags module in PIL. That's where I found the magic number '36867'.

The script doesn't have any error checking or other features, but it took less that 5 minutes to write, and gives me results I need.

# python ~/python/imagedates.py > /tmp/imgdates.txt
# grep "20:01:24" /tmp/imgdates.txt
dsc_3626.jpg 2008:09:15 20:01:24

Viola! The file I wanted. A few more greps, and I had everything I need.

I could probably turn this into a more generic tool, with error checking, commandline arguments, an API to flickr, and whatnot, but quick and dirty got the job done.

Monday, September 08, 2008

One of those days.

I just spent the last 30 minutes breaking into my own house.

Nice to know the kids are such heavy sleepers.

Labels: ,

Friday, August 15, 2008

Public service announcement

Do not go so the new animated Star Wars movie. It is horrible. Absolutely, unredeemably horrible. Do Not Want.

Brought the kids to see it, since I'd heard it was 'ok, for the kids'. Bad idea. It was not 'ok' for kids. It was horrible. The dialog. The voice acting. The 'plot'. The animation was at least decent, but everything else...I have not the words to express how horrible it was.

Thursday, July 17, 2008

Garlic Hummus, a poem

4 cloves garlic, 1 can garbanzos, liquid reserved.

Food processor. Whir. Add some liquid. Whir.

Scrap, scrape, whir.

Grind black pepper.

Pinch salt. Some cilantro. Dollop tahini.

Whir.

Drizzle olive oil

Whir.

Drizzle drizzle.

Whir.

Done. Scrape, scrape. Refrigerate.

Monday, April 07, 2008

Alligators and milk

I have just conducted an unscientific experiment.

Method:

3 boys.
6 cups of milk.
- 2 pink, 1 orange, and three blue.

In the 2 pink and one orange cup, put a small amount of skim milk, purchased This Afternoon from the local farmer's market.

In the three blue cups, put an approximately equal amount of 2% milk from lowes foods, purchased Yesterday.

Do not allow The Boys to observe which cup contains which milk.

Place 2 cups in front of each Boy. One blue, one pink or orange. Ask Boys to taste each cup of milk in front of them, and then place the cup they prefer in the center of the Table. (I forgot to mention The Table above, but it is critical to this experiment.)

Results:

Boys 1 & 2 chose the Pink cups, containing the Farmer's Market milk. Boy three chose both the Orange and Blue cups. Despite the predilection of boys for Colors Other Than Pink, it is interesting to note that Boys 1 & 2 chose the pink cups over the blue. Boys 1 & 2 indicated that the milk in the Pink cups tasted 'like honey', and asked for more. Boy 3 said they both were the same, but wanted the milk in the orange cup because it 'tasted healthier'.

Conclusion:

None whatsoever. The sample size was too small, and the study was not double-blinded. More research is recommended.

Alligators:

We've just returned from New Orleans, and I should post about that, too.

Saturday, September 22, 2007

Four things...

I've been...lacking...in my weekend chores lately. Today I did better, though, so I'm happy. I:

  1. Replaced the leaky showerhead in the boy's bathroom

  2. Mowed and weedwhacked the lawn

  3. Ran some cat5 under the house to connect the downstairs computer - I even did the 'wall-plate' thing, instead of just a bare hole in the wall.

  4. Replaced the broken toilet seat. I don't know how it got broken, and I don't want to. It's replaced now.


Not a lot, but it's progress. I still have a #5 I want to get done - play 'Sorry' with the kids after supper. Joni's making latkes for supper now. The kids are all downstairs playing around instead of cleaning the playroom. So maybe no supper or game for them if they keep it up. :-/

Wednesday, September 19, 2007

Oh, yeah!!!1!!l!

Thanks to my lovely and talented wife, I now own a Jayne Cobb hat! Aren't I just the luckiest?

Yes. Yes I am.

[edit - the wife wasn't happy with the lack of excitement in the title, and the shortness of the post overall]

William Shakespeare - Sonnet #18


Shall I compare thee to a Summer's day?
Thou art more lovely and more temperate:
Rough winds do shake the darling buds of May,
And Summer's lease hath all too short a date:
Sometime too hot the eye of heaven shines,
And oft' is his gold complexion dimm'd;
And every fair from fair sometime declines,
By chance or nature's changing course untrimm'd:
But thy eternal Summer shall not fade
Nor lose possession of that fair thou owest;
Nor shall Death brag thou wanderest in his shade,
When in eternal lines to time thou growest:

So long as men can breathe, or eyes can see,
So long lives this, and this gives life to thee.