> `cat /dev/urandom` since well after you started_ 

c u t u p @ c u t u p . o r g

 xml 

[geektool weather] last modified: 03/25/2007 02:03 pm

screenshot

My weather desktop using geektool, weather.com, and wunderground.com.

Open geektool preference pane, new entry, set the drop down to picture, paste the url or a picture, and set the refresh rate to something nice that doesnt get us in trouble, like 1800 (seconds). The weather.com photo/maps are nice because the picture name remains the same as it updates. I made four of these and arranged them swankly.

For the center forecast part, I used a shell command (new entry -> shell). I used wunderground cause i can get a fairly uncluttered html page to parse. Weather.com's page is huge and awful, but they do provide an rss feed that might be more polite to gank data out of. But anyhoo, first I grab the data with lynx:

/sw/bin/lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=ZIPCODE

then pipe it into awk:

awk '/Temp/ || /Wind/ || /Cond/ && !/Fore/ {printf $1 ": "; for (i=2; i<=10; i++) printf $i " " }'

This throws away all the lines except Temperature, Wind, and Conditions (and excludes the 'Forecast and Conditions' line), and prints it all on one line. Another site would need a different awk line, but you get the idea.

Join the two lines above with a pipe (|), paste into geektool as one long line and set the color and font and background and everything and, neat desktop. I put a echo; before the first command to generate a newline, so it was more centered on the background.

To use noaa.gov weather is a bit trickier. go to this page http://weather.noaa.gov/weather/PAccus.html, where instead of PA is your two letter state code. Then select a location from the drop-down list "Current Weather Conditions". This will be the url you want to grab with lynx. And the awk will be:

awk '/Sky/ || / Temp/ || /Wind /' | head -n 3 | awk '{printf $0}'



[geektool bash] last modified: 03/25/2007 02:03 pm

So there's a Tiger compatible version of GeekTool floating around finally, and I've been playing around with it the past couple days.

I'm still a beginner at shell scripting and the whole gestalt of modern computing, and I've found this not only fun to play with, but also quite educational, especially with regards to those geekiest of tools, bash one-liners.

I've learned a lot from this, for instance that I like awk. It certainly isn't awkward, lol. And take away my propensity for just doing cool crap because I can, and this thing can still be really quite actually real-world useful. It's already replaced half my Dashboard - I find the displayed information simultaneously more noticible and less in the way.

So here's where I'll put my setup, and any other stuff I found that works nice with GeekTool even if it might not maybe be all that actually useful all the time. And of course, links to the work of others.

My Dealy:

Here's what I got on my desktop right now:

I also have separate group that displays the latest satellite weather maps. Sweet.

Weather:

Geektool can display pictures from a url. So the trick is to find .jpgs online that are refreshed every so often and where the name of the file does not change. I found a bunch at weather.com and some more at uswx.com. Right now I have a group, separate from all the other stuff, that has three pictures running:

http://image.weather.com/images/sat/usvis_600x405.jpg
//us visible satellite
http://image.weather.com/images/sat/regions/northeast_sat_720x486.jpg
// northeast infrared satellite
http://www.intellicast.com/WeatherImg/Satellite/world.gif
// world satellite

There's still room for more, but for now this replaces my US Weather dashboard widget nicely. Notice that you call tell from the picture urls that the filename is not likely to change. If there's a date or time in the name of the picture, this wouldn't be so easy.

STUFF I HAD TO FIGURE OUT:

By default, Geek Tool windows are black text. My backgrounds are usually dark, so I have to change the text color to white before I can even see anything there. I wouldn't mention it except that I couldn't figure out whether my command wasn't working or the display was wierd when I got started.

OTHER STUFF THAT MAY BE OF INTEREST:

I picked this up somewhere, it seems to show all the connections on your network

netstat -ab -f inet | grep -i established | sort +4

This one's neat. It shows the IP's of everyone that visited your site:

tail -5000 /var/log/httpd/access_log | grep -v 127.0.0.1 | awk '{print $1}' | uniq

Or even:

tail -5000 /var/log/httpd/access_log | grep -v 127.0.0.1 | awk '{print $1}' | uniq | nslookup -silent | awk '/name = /'

which gives you their hostname. I'm not clear on how to translate this information into a more useful domain name, when I do I imagine I will probably end up using this a lot.

RESOURCES:

macoshints search for "geek tool"




[All Posts] [top]

tags:

bash
geektool
weather