Myles Braithwaite

Geektool Setup

I recently installed Geektool on my MacBook Pro. I used so many sources to set it up that I thought it would be a good idea that I write a blog post about some of the more complicated configurations.

My Geektool Setup
My Geektool Setup

Sunrise & Sunset

Sunrise <span class=& Sunset data-downloadable=”true” >

I am getting the sunrise & sunset data from weather underground mobile website.

Sunrise

curl --silent http://m.wund.com/global/stations/71265.html | grep 'Sunrise' | sed -e :a -e 's/]*&gt;//g;/&lt;/N;//ba' | sed -e 's/Sunrise/Sunrise: /g' | sed -e 's/EST//g'

Sunset

curl --silent http://m.wund.com/global/stations/71265.html | grep 'Sunset' | sed -e :a -e 's/]*&gt;//g;/&lt;/N;//ba' | sed -e 's/Sunset/Sunset: /g' | sed -e 's/EST//g'

IP Addresses

<span class=IP Addresses data-downloadable=”true” >
#!/bin/sh
myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
wip=`/usr/bin/curl --silent http://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`
INACTIVE='INACTIVE'

if [ "$myen0" != "" ]
then
    echo "Ethernet: $myen0"
else
    echo "Ethernet: $INACTIVE"
fi

if [ "$myen1" != "" ]
then
    echo "Wireless: $myen1"
else
    echo "Wireless: $INACTIVE"
fi

if [ "$wip" != "" ]
then
    echo "External: $wip"
else
    echo "External: $INAVTIVE"
fi

Weather Image

Weather Image

I am using Yahoo Weather to get the weather image.

#!/bin/sh
# Get weather image
# Add this to your crontab.

YAHOO_WEATHER_HTML=`curl --silent "http://weather.yahoo.com/canada/ontario/toronto-4118/?unit=c"`
curl --silent -o /tmp/weather.html "http://weather.yahoo.com/canada/ontario/toronto-4118/?unit=c"

if [[ $YAHOO_WEATHER_HTML ]]; then
        curl --silent -o /tmp/weather.png $(grep 'div class="forecast-icon" style="background:url' /tmp/weather.html | awk -F"'" '{ printf $2 }')
fi

Weather Forecast

Weather Image
curl --silent "http://weather.yahooapis.com/forecastrss?p=CAXX0504&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's///' -e 's/<b>//' -e 's///' -e 's///' -e 's///' -e 's///'</b>
Read this next
You might enjoy