67

tl;dr! I use GT and AppleScript to only display some work-related stuff when I'm at work. You can watch a video and check out the AppleScript I use here, on my website!

Weather

Uses two scripts: Weather Icon Curl, and Weather Icon Display. The "Weather Icon Curl" script curls a page from yahoo weather (I'm in Baltimore, but you just have to replace one URL in the script with the appropriate URL for your area to make it work) I use this URL

http://weather.yahoo.com/united-states/maryland/baltimore-2358820/

then the script will download the page, parse it for the icon used, and download that. The "Weather Icon Display" script then displays the previously curl'd icon.

Weather Icon Curl

curl -o /tmp/weather.html http://weather.yahoo.com/united-states/maryland/baltimore-2358820/;
curl -o /tmp/currenttemp.png  `grep "div class="forecast-icon" style="background:url" /tmp/weather.html | awk -F"'" '{ printf $2 }'`

Weather Icon Display

Displays /tmp/currenttemp.png

Remote Office Ping

Uses a total of 6 scripts. One to display all of the office locations, and one script for each location's pings response time. This is a bit more complex. I used one script ("Remote Office Labels") to display each remote office location. Then I used a separate script for each location's ping ("Remote Office Ping"). It pings a router in each office 10 times ever 5 minutes, averages the pings, and displays the average. The tricky part is that I only display this script when I'm on my work network.

Remote Office Labels

echo "Toronto:rDenver:rLos Angeles:rAmsterdam:rHong Kong:"

Remote Office Ping

HOST=*Remote IP* ping -q -c 10 $HOST | grep "round-trip" |sed 's/// /g' | awk '{print $8}' | awk '{printf("%dn",$1 + 0.5);}'

Screenshots

screenshot 1

screenshot 2

Comments

User Avatar
timdwyer 1372 days ago
Got the weather icon to work except now it doesn't refresh. I set it up last night and this morning it is still showing the moon icon.

Any thoughts how to fix this?

Thanks!
User Avatar
Mykneegrows 1125 days ago
Try changing the refresh time
User Avatar
Russ77 1248 days ago
I added a "myDay.glet" file to the collections under "Show short version of day of week" to replace the Day.glet file above, which didn't seem to work from this page's link.

Also, here is a link to replace the outdated author's link at the top of this webpage:

**@Timdwyer** Re: icon not changing. All backslashes \ must be double-backslashed \\ in comment edit pane to even show up in comments. ( I had to use 4 backslashes in a row to get 2 in a row to be visible. ) If you copy and pasted what the author has at the top of this page, instead of downloading the "Weather icon curl.glet" , then it wouldn't work.

Or...Maybe either your weather icon is linked to another zip code showing that weather or you didn't set a refresh time to update that icon's window.

Here is what is should have looked like at the top of the page with the required backslashes showing:

Weather Icon Curl:

curl -o /tmp/weather.html http://weather.yahoo.com/united-states/maryland/baltimore-2358820/; curl -o /tmp/currenttemp.png `grep "div\ class=\"forecast-icon\"\ style=\"background:url" /tmp/weather.html | awk -F"'" '{ printf $2 }'` 



You can copy and paste what I show and then replace the first url, if you don't live in Baltimore or download the "Weather icon curl.glet" above and change the url inside GeekTool preferences. 

For those who hadn't noticed, clicking on the ellipsis "…" after the command text box within preferences pops up an edit window for the command. Just be sure you have the window selected that you want to edit.
User Avatar
Russ77 1246 days ago
Sadly, another tip.

This is not meant to be a flame, but constructive criticism. This website is trying to do the community a service. I thank them.

However, the code authors and readers, in most cases, aren't aware that some of the code displayed is being mangled by this website's design. In the code display, less than signs or left angle brackets can't be used at all on this website and backslashes have to be double-backslashed to even show up as a single backslash. The designers of this website are 'apparently unaware' that they should be using some sort of 'tag' mechanism to display 'literal' 'code' 'examples' 'preformatted' so as to show us the unabridged code in the comments or elsewhere the author may want to place it on the website's webpages. I said the website designer are 'apparently unaware' because there is no prominent warning on each webpage about how inaccurate the displayed code may be.

So despite what I mentioned about copying and pasteing for accuracy, don't do it on this website, until the designers fix this webpage flaw. You can't be sure you are getting all the code unless you compare it to what is in the downloaded geeklet. You are better off just using the supplied geeklets that you can download, adapt, and implement.
User Avatar
jalvani 1115 days ago
@Russ77 Thanks for providing the link. I forgot to update this page. Fixed.
User Avatar
durgadas 1189 days ago
Day.glet link is broken, leading to 404 error.
User Avatar
jalvani 1115 days ago
Tested it, and it seems to be fixed.
User Avatar
olivierdeen 965 days ago
Nice Works great!!
User Avatar
philrei 863 days ago
interesting
User Avatar
shchaofan 708 days ago
mark,thanks~!
User Avatar
mawi12345 398 days ago
you coud simply use:

ping -q -c 10 $HOST | tail -1 | cut -d "/" -f 5

for your remote office ping script.

Log in to comment or register here.