Archive for October, 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:
# 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:
IFS=$(echo -en "\n\b")
for img in $@; do
    file_type=`file -b $img`
    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
            # Current format: " Date/Time : yyyy:mm:dd hh:mm:ss"
            # jhead requires: yyyy:mm:dd-hh:mm:ss
            # Strip non-essential information
            jhead -purejpg "$img"
            # Put the date/time back
            jhead -mkexif -ts$DT "$img"
        echo "$img" is not a JPG - ignoring $file_type

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


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


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)”


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)”]


assert_errors_on u, :login, [“can’t be blank”, “is too short (minimum is 2 characters)”]