Archive for 2010

Improved improved GPS removal

Friday, October 22nd, 2010

I updated my jpeg geotag-removal script to recurse subdirectories. With that came the requirement to filter out irelevant files (not jpeg, no EXIF information). Below is the new script. I hope you find it useful:
#!/bin/bash
# Will remove non-essential EXIF from a jpeg while retaining Date/Time value.
# Use it to remove GPS information from pictures I want to put on the internet.
 
# Created Wed Aug 11 18:43:03 PDT 2010
 
# For handling spaces. See:
# http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
 
for img in $@; do
 
    file_type=`file -b $img`
    file_type=${file_type:0:15}
 
    if [ -d "$img" ]; then
        echo "$img" is a directory - recursing
    $0 "$img/*"
 
    elif [ $file_type == "JPEG image data" ]; then
        # Grab the original date/time
        DT=`jhead "$img"|grep 'Date/Time'`
 
        # If the date information started out
        # blank, trying to tack it back on
        # will result in an error
        if [ "$DT" == '' ]; then
            continue;
        else
 
            # Current format: " Date/Time : yyyy:mm:dd hh:mm:ss"
            # jhead requires: yyyy:mm:dd-hh:mm:ss
            DT=${DT:15:25}-${DT:25}
 
            # Strip non-essential information
            jhead -purejpg "$img"
 
            # Put the date/time back
            jhead -mkexif -ts$DT "$img"
 
        fi
    else
        echo "$img" is not a JPG - ignoring $file_type
    fi
done

Hacking Tracks to accept shorter usernames

Monday, October 18th, 2010

I’m looking at Tracks/Shuffle to manage to-do lists on my phone/computer. I’m scouring the tubes for one that doesn’t involve me handing my data off to someone else. I like Shuffle because it can synch to any Tracks server you specify, and since Tracks is free software, it’s easy to install on any server.

In an effort to be able to use my usual login (kj), I H@X0R-H@X0R-H@X0R-ed the code to lower the minimum login from 3 to 2 characters. It’s not rocket science, but I hope it’ll save somebody else a bit of grepping:

In app/models/user.rb, line 115, change

validates_length_of :login, :within => 3..80

to

validates_length_of :login, :within => 2..80

In spec./models/user_spec.rb, line 81, change

it_should_validate_length_of :login, :within => 3..80

to

it_should_validate_length_of :login, :within => 2..80

If you’re feeling really ambitious, you could even change the error messages to be accurate. In test/unit/user_test.rb,. line 87:

assert_error_on u, :login, “is too short (minimum is 3 characters)”

to

assert_error_on u, :login, “is too short (minimum is 2 characters)”

Again in test/unit/user_test.rb,. this time on line 107:

assert_errors_on u, :login, ["can't be blank", "is too short (minimum is 3 characters)"]

to

assert_errors_on u, :login, ["can't be blank", "is too short (minimum is 2 characters)"]

Improved GPS removal

Friday, August 13th, 2010

I recently posted about a way to remove the GPS information from pictures. I wrote a script that will retain the Date/Time information. It requires jhead.
#!/bin/bash
# Will remove non-essential EXIF from a jpeg
# while retaining Date/Time value. I use it to
# remove GPS information from pictures I
# want to put on the internet.
 
# Created Wed Aug 11 18:43:03 PDT 2010
 
# For handling spaces. See:
# http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
 
for img in $@; do
    echo Working on "$img"
 
    # Grab the original date/time
    DT=`jhead "$img"|grep 'Date/Time'`
 
    # Current format: " Date/Time : yyyy:mm:dd hh:mm:ss"
    # jhead requires: yyyy:mm:dd-hh:mm:ss
    DT=${DT:15:25}-${DT:25}
 
    # Strip non-essential information
    jhead -purejpg "$img"
 
    # Put the date/time back
    jhead -mkexif -ts$DT "$img"
done

It accepts image files as arguments. You can pass as many or as few as you feel like. If you’re interested in keeping other non-essential exif data, you might want to look into the jhead argument “-te”.

Removing GPS data from an image

Wednesday, August 11th, 2010

I constantly forget how to remove the geotags from my pictures before I put them on the internet. Here’s an imperfect way to do so:
jhead -purejpg /path/to/image.jpg
Source

This will get rid of timestamps and other ancillary information that you may want to keep attached to the image. It seems like it would be pretty simple to write a script that uses jhead with no arguments to grab the Date/Time field, then run it again with -purejpg to remove all extraneous data, then run it a third time with the appropriate arguments to re-set the Date/Time field.

Intermittent server outages

Saturday, August 7th, 2010

I noticed while I was in Portland last week that the server was down. When I got home, I discovered that the UPS was off. I pushed the button and turned it back on.

A day or two later, it was off again. I eventually figured out what it was:

Likes to sit on the UPS The newest family member. Likes to swat at Penny

The causes of the outages

Penny likes to sit atop the UPS. The newest member of our family likes to swat at Penny. Apparently, sometimes she hits the UPS power button instead.

I taped some cardboard over the button. I do not anticipate any further outages.

Penny investigates the addition, no doubt contemplating how to H@X0R her way around it.

Technology as explained by my mother: The Internet

Wednesday, July 7th, 2010

I was lamenting to my mother the difficulty in explaining technical answers to people who have limited experience with technology. She sighed sympathetically and said something along the lines of, “It’s very difficult for people who are used to dealing with a physical object to understand this thing fluttering all around us, breaking all the laws of physics.”
“Wait, where did you think the Internet is?”
She made a fluttering motion with her hands, “All around us. Like God.”

Technology as explained by my mother

Friday, July 2nd, 2010

Someday I’d like to rent out a hall or theater and charge $5 a head for my mom to answer the audience’s technical questions. The audience would require a certain amount of savvy to realize that her answers are hilarious, not informative.

I’ll probably never get around to renting that space, so in the mean time, I’ll be posting them here, in a series I call “Technology As Explained By My Mother “. The first installment has already been posted. I’ve got a few such episodes drafted, I can be reasonably certain this will be at least a three-part series. I hope you enjoy them as much as I do.

Facial hair in the news

Wednesday, June 30th, 2010

Some exciting news for those of us who love facial hair:
AUSSIE women find facial hair attractive and more men have sex and are “wilder in the bedroom”.

Even fish are in on it.

Technology as explained by my mother: Links

Tuesday, June 29th, 2010

I was fielding technology questions from a family friend who had a hilarious misunderstanding about what a link was (he expressed a concern that too many people would link to his web page and cause a short circuit). I went to tell my mom so we could both laugh about it, but first I quizzed her to make sure she knew what a link was.

I asked something along the lines of “If I told you Google links to CNN, would you know what that meant?”

A google is a thing that appears there and you click it and it does something, whether you want it to or not.

She stopped to tell me to stop making that face. I didn’t catch what she said when she continued because I was trying to keep a straight face.

Random Blogroll Category v1.5.1

Monday, June 28th, 2010

I just committed a minor revision to my WordPress plugin Random Blogroll Category. The line that was supposed to remove an extraneous HTML tag was completely wrong. The latest version will put out valid HTML.

It’s worth noting that I have no further plans for developing this plugin unless it is broken by a future WordPress update.