Posted on Feb 18, 2008

OS X bash script to download entire picasaweb albums

I found this great tool to download an entire picasaweb album except it didn’t work in OS X. After a quick search on a couple of man pages I found the difference when using OS X’s mktemp and fixed things. Now I can easily grab my favorite albums from friends and family and load them into iPhoto. What a huge time-saver!


#!/bin/bash
# Distributed under the terms of the GNU General Public License v3 or later
# AUTHOR: Lo?c Cerf
# e-mail: magicbanana@gmail.com
WGET_OPT="-q -T 180 -t 3 -c"
EX_USAGE=64
EX_NOHOST=68
if [ -z "$1" -o "$1" = "--help" -o "$1" = "-h" ]
then
echo "Usage: $0 url [destination]"
exit
fi
page=${1#*picasaweb.google.*/}
if [ "$page" = "$1" ]
then
echo "\"$1\" is not the URL of a PicasaWeb album or gallery" 1>&2
exit $EX_USAGE
fi
tempfoo=`basename $0`
temp=`mktemp ${tempfoo}.XXXXXX` || exit 1
if wget $WGET_OPT -O $temp "$1"
then
finalPage=${page#*/}
if [ -z "$finalPage" -o "$finalPage" = "$page" ]
then
# $temp is a gallery
if [ -z "$2" ]
then
destination=`grep -m 1 "^var _user" $temp`
destination=${destination##*nickname:\"}
set "$1" "${destination%%\"*}"
fi
mkdir -p "$2"
cd "$2"
grep -E -o "$1"[/]?[[:alnum:]:.%~_-]+ $temp | sort | uniq |
while read album
do
"$0" $album &
done
else
# $temp is an album
if [ -z "$2" ]
then
destination=`grep -m 1 "^var _album" $temp`
destination=${destination##*title:\"}
set "$1" "${destination%%\"*}"
fi
grep -E -o {id:\"[0-9]+\",s:\"[[:alnum:]:\\.%~_-]+ $temp |
while read picture
do
picture=${picture##*\"}
picture=${picture/\x2Fs144/}
wget $WGET_OPT -P "$2" ${picture//\x2F//} &
done
fi
else
exit $EX_NOHOST
fi
rm $temp

Posted on Feb 8, 2008

Ice rain camping explained

Our camping trip to Green Ridge State Park last weekend was a pretty interesting adventure. A total of nine guys showed up for a three day/two night trip. We left early Friday morning and came back Sunday afternoon.

Friday hovered just above freezing, and of course we had lots of precipitation. We arrived, took note of the horrible conditions, and decided it would be best to have a raging fire. After putting on a bunch of my rain gear including one of my favorite pieces of gear I had for the trip, a REI taku rain hat, I set out looking for recently fallen trees and kindling for the fire. Ice rain led way to snow later in the evening, just after we ate dinner. The snow fell for a few hours and stopped around midnight. I was somewhat bummed the snow stopped because there wasn’t really any snow on the ground to begin with.

We drank lots of beer and bourbon Friday night and Saturday morning I woke up last with a raging headache. As soon as I got up Adam gave me some hot coffee. Then, Adam and Ed prepared a breakfast full of sausage, scrapple, and eggs for Dom and I. I got to clean up after the meal — but hey, I won’t complain about that.

It drizzled off and on Saturday morning but by the afternoon it was only cloudy. Precipitation aside, I decided it was time to take a long hike while most everyone else went to the gun range. Ed’s dog Rascal came along with me on the five or so mile hike. One of the most interesting things about the hike is that there is no trail, no man-made markers, nothing letting you know where you really are. You really have to pay attention down in the valley too because every twist or turn looks the same. I usually end up marking my way at a few points with very stick creations of some sort. Also useful though is the dog, sun, and the occasional semi-waterfall. The dog actually knows his way best I think. Each time I’ve gone hiking with dogs, they’ve been incredibly adept at finding their way back home.

We had a very hard time keeping the fire going Saturday night. The wood was so wet from continual rain/ice rain/snow that it was just soaked right through. I think our biggest mistake was choosing to cut up a few trees that were slightly dry-rotted, which meant that they were all the more soaked. We did have a chainsaw with us so we’d take a truck and the chainsaw with a couple axes and bring back an entire bed of wood. I think we made five total runs with the truck during the entire trip.

Saturday’s dinner was incredible. Never underestimate the beauty of good steak — filet mignon to be exact — – while you’re toughing the elements. We grilled those babies on kabobs along with peppers and onions right on top of the fire. Delicious!

I think it may have been a bit too delicious though because a few hours later we heard a pack of coyotes stalking our campground and howling. Adam, Dom, and I packed up some weapons and joked we were coyote hunting and set out in the dark woods looking for some trouble. Nothing happened, we never found anything, but it was fun to joke around and hunt a little at night.

We started packing up early Sunday morning and left. Nothing exciting to talk about there. Got home safe and learned a bunch about my gear which I’ll probably write about another time.

Posted on Feb 1, 2008

Ice rain camping

We are on our way to western Maryland for a camping trip. The outlook for today isn’t all that great. It’s ice raining right now and will be for the rest of the day.

We just drove up sidling hill and there was a ton of ice and slush on the road. Almost at my exit though so I gotta go! Lots of firewood to find and cut to keep us warm.