After reading a Lifehacker article this last week, I discovered and dived into a Mac app called GeekTool. Similar to Rainmeter for the PC, “GeekTool is a PrefPane (System Preferences module) for Panther or Tiger to show system logs, unix commands output, or images (i.e. from the internet) on your desktop (or even in front of all windows).”
I got a few scripts from Nicinabox, a few from IamAwesome, and the rest were either grabbed from other sites or I wrote them myself.
NOTE: A few of these scripts require Lynx - a text-only web browser.
Here’s the current setup:
And here are the details:
Font: Century Gothic
Scripts:
FullTimedate "+%l:%M:%S %p"
Daydate "+%d"
Monthdate +%B
Day of Weekdate +%A
CPUtop -l 1| awk '/CPU usage/ {print $8, $9}'
top -l 1| awk '/CPU usage/ {print $10, $11}'
top -l 1| awk '/CPU usage/ {print $12, $13}'
Memorytop -l 1 | awk '/PhysMem/ {print "Used: " $8 " \nFree: " $10}'
Networkmyen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
if [ "$myen0" != "" ]
then
echo "Ethernet: $myen0"
else
echo "Ethernet: INACTIVE"
fi
myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
if [ "$myen1" != "" ]
then
echo "Airport: $myen1"
else
echo "Airport: INACTIVE"
fi
wip=`curl --silent https://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`
echo "External: $wip"
Weather Templynx -dump https://printer.wunderground.com/auto/printer/CA/YOURCITY.html |awk '/Temp/{printf $2, ": "; for (i=3; i<=3; i++) printf $i " " }'
Weather Conditionslynx -dump https://printer.wunderground.com/auto/printer/CA/YOURCITY.html|awk '/Cond/ && !/Fore/ {for (i=2; i<=10; i++) printf $i " " }'
Weather Sunrisecurl https://m.wund.com/US/CA/YOURCITY.html | grep 'Sunrise' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed -e 's/Sunrise/Sunrise: /g' | sed -e 's/PST//g'
Weather Sunsetcurl https://m.wund.com/US/CA/YOURCITY.html | grep 'Sunset' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed -e 's/Sunset/Sunset: /g' | sed -e 's/PST//g'
Weather Forecastcurl --silent "https://xml.weather.yahoo.com/forecastrss?p=YOURZIP&u=f" | grep -e "Forecast:" -A 2 | tail -n 2 | sed -e 's/<br \/>//' -e 's/<BR \/>//' | sed "s/\(.*\)\.\ \(.*\)/\1\?\2/" | tr "?" "\n" | sed "s/High\:\ \(.*\)\ Low\:\ \(.*\)/\?H\: \1\ L\:\ \2/" | sed "s/\?\(.*\)/\\1/"
PHP Scripts (placed in ~/Sites/)
Weather Image:
(Be Sure to replace CITYDATA in $url with your own city from Yahoo)
<?php
$url="https://weather.yahoo.com/forecast/YOURCITYCODE.html";
$ch = curl_init();
$timeout = 0; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
$divStart = "<div class=\"forecast-icon\"";
$strEnd = "'); _background-image/* */: none;";
$start = strpos($file_contents, $divStart) + 50;
$end = strpos($file_contents, $strEnd);
$length = $end-$start;
$imagepath=substr($file_contents, $start , $length);
$image=imagecreatefrompng($imagepath);
imagealphablending($image, true);
imagesavealpha($image, true);
header('Content-Type: image/png');
imagepng($image);
?>
Gmail
(Be Sure to replace USERNAME and PASSWORD with yours from gmail)<?php
$url = 'https://USERNAME:PASSWORD@mail.google.com/mail/feed/atom';
$buffer = file_get_contents($url);
$xml = new SimpleXMLElement($buffer);
echo $xml->fullcount . " unread\n";
foreach($xml->entry as $entry){
echo $entry->title . " (from: " . $entry->author->name . ")\n";
}
?>
Writer. Musician. Adventurer. Nerd.
Purveyor of GIFs and dad jokes.