Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Status
Not open for further replies.
Tried that the first day....unfortunately, when I click the "classic map" link all I get is "error on page" in the status bar and if I try to copy the URL, it says it copies it, but when I try to paste it in the address bar, it's empty...really weird.

That is weird. Would you mind sharing what part of "NY State" you are trying to copy the URL for? I can try to get the various links for your geektool image and post them here.
 
I've modded my desktop with some simple shells. No external script paths, just simple shell commands.

I have an air, 10.6.6 and geektool v3 runs horrendously slow. It can take 5 minutes to properly place a window. Just clicking on it in the menu bar takes 3 seconds to pop up. Typing in the size box for example can take 30 seconds.

Anyone else having serious lag using it with v3 after adding scripts?
 
I couldn't find a RSS script that parsed the ESPN feed nicely so here is one that should work.

Code:
#!/bin/sh

URL="http://sports.espn.go.com/espn/rss/news"

curl --silent "$URL" | grep -E '(title>|description>)' | \
grep -E '(<title>|description)' | tail -n +4 | sed -e 's/<!\[CDATA\[//g' -e 's/\]\]>//g' | sed -e 's/<a.*a>/   /g' | sed -e 's/<*.title>//g' -e 's/<.*/\
/' | sed -e 's/<*.title>//g' -e 's/<.*/\
/' | sed -e '/<description>/d' | sed -e 's/<\/description>/\
/g
' | fmt -w 80
 
Parsing RSS

Looking through these posts I have seen a lot of people come up with some pretty clever hacks to parse RSS using sed, awk, grep, egrep, cut, etc etc etc.. I have written a quick little PHP that will cleanly parse valid RSS (using XML methods that were built to do this!).

You can check out the code to the script and download it from my website here http://www.daveeddy.com/tutorials-scripts/php/rss-parser/

An example of this script in use can be seen a couple posts above where I show screenshots of my desktop. Both the news section and the twitter section are using this parser.

To use this script simply call it like this:
Code:
dave@mac:~$ php rss.php http://www.daveeddy.com/feed/ 7 
Dave Eddy
>> GeekTool For Mac (revisited) (1 day ago)
>> Viridian 1.2 Released (1 week ago)
>> Introduction to Unix Tutorial (3 weeks ago)
>> RITLUG (3 weeks ago)
>> Ampache Now Playing WordPress… Now with Ajax/jQuery (1 month ago)
>> Viridian 1.1.1 Released… New features/bug fixes (1 month ago)
>> Viridian 1.1 Released! (2 months ago)
The '7' after the URL is optional argument that tells it print the 7 newest stories (5 is default).
 
That is weird. Would you mind sharing what part of "NY State" you are trying to copy the URL for? I can try to get the various links for your geektool image and post them here.

I tried Syracuse NY, Utica NY, and Rome NY...then I tried Albany NY same story. The links under the default map "full-feature map" and "weather in motion" actually turn into a "hand" pointer and get underlined when I hover over them, and they go to the proper item when clicked. When hovering over the "classic map" link gets underlined but the pointer stays an "arrow" - so it's like the link is still in the page code, but doesn't resolve to anything I guess.

For the hell of it, I just tried Boston MA and it does the same thing.....
 
I started using some of the scripts the OP originally posted in the start of this thread, date, time, day, month, iTunes and tried to get the weather. All was working except for the weather and I noticed that the Geektool and window server were using well over 1GB of RAM. I MRoogled it but couldn't find much in the way of answers. One person had said theirs was in the few MB range and that was about it.

I uninstalled the scripts and Geektool because of that. But I'd like to run them again and without it being such a RAM hog.

Can anyone help me with that?
 
Thought I'd share my Current Geektool Desktop. Still a work in progress, most specifically needing my Google Reader / NetwNewsWire Unread Feeds (see two messages).

I am using Bowtie for the player (it seems to use less resources than my Geektool Geeklet) and Mirage2 to make the Dock clear.

5354480075_2f53a77d20_b.jpg

Hello,
Can you post the command for hard drive capacity?
Thank's
 
Does anybody know how to display the capacity for internal RAID arrays?

Normally I do the following for single discs;

Code:
df -H | grep disk0s2 | awk '{print "Disc name:", $4"/"$2" ("$5" used)"}'

This works fine with all discs, except for the RAID array, which is has the identifier disk5, this doesn't return a result though. :confused:

Edit: Nevermind! Disc utility revealed that the array doesn't have the extension "s2". DOHHH! ;)
 
I tried Syracuse NY, Utica NY, and Rome NY...then I tried Albany NY same story. The links under the default map "full-feature map" and "weather in motion" actually turn into a "hand" pointer and get underlined when I hover over them, and they go to the proper item when clicked. When hovering over the "classic map" link gets underlined but the pointer stays an "arrow" - so it's like the link is still in the page code, but doesn't resolve to anything I guess.

For the hell of it, I just tried Boston MA and it does the same thing.....

If I'm reading you right, you simply can't get the Classic Map pages to appear? Not sure what's up with that, but here's some closer radar views for you:

100-mile metro: http://i.imwx.com/web/radar/us_syr_metroradar_plus_usen.jpg
600-mile: http://i.imwx.com/web/radar/us_roc_closeradar_plus_usen.jpg

Hope that helps.
 
If I'm reading you right, you simply can't get the Classic Map pages to appear? Not sure what's up with that, but here's some closer radar views for you:

100-mile metro: http://i.imwx.com/web/radar/us_syr_metroradar_plus_usen.jpg
600-mile: http://i.imwx.com/web/radar/us_roc_closeradar_plus_usen.jpg

Hope that helps.

Those helped a lot....it was interesting that the classic map link wouldn't work on Firefox on my Mac or in IE on my PC, but when I switched to Chrome on the Mac I got the JPGs that you linked to....thanks for sticking with it!
 
Hello,
Can you post the command for hard drive capacity?
Thank's

Sure, here is the script I have where I basically combined several commands to make my entire system list out. Just pick and choose.

Code:
# System Tools Script
#!/bin/sh
#Connections
myen0=`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}'`
ssid1=`airport -I | grep -e '[^[:alnum:]_]SSID[^[:alnum:]_]' | awk '{print $2}'`
chan1=`airport -I | grep -e '[^[:alnum:]_]channel[^[:alnum:]_]' | awk '{print $2}'`

if [ "myen1" != "" ]
then
    echo "AirPort     : $myen1";
    echo "SSID        : $ssid1";
    echo "Channel   : $chan1";
else
    echo "Airport  : INACTIVE"
fi


#Uptime, Ram, HDD
uptime | awk '{print "Uptime     : " $3 " " $4 " " $5 }' | sed -e 's/.$//g';
top -l 1 | awk '/PhysMem/ {print "RAM Free : " $10 " "}'
#top -l 1 | awk '/PhysMem/ {print "RAM Free: " $10 " "}' ;
#df -Hl | grep 'disk0s2' | awk '{print $4"/"$2" free ("$5" used)"}'
# top -l 2 |awk '/CPU usage/ && NR > 5 {print $1, ":", $3, $4}'
# top -l 2 |awk '/CPU usage/ && NR > 5 {print $1, ":", $5, $6}'
# top -l 2 |awk '/CPU usage/ && NR > 5 {print $1, ":", $7, $8}'

#Drives
df -H -l | awk '{print $1 " : " $4"/"$2" free ("$5" used)"}'


#Trash
du -sh ~/.Trash/ | awk '{print "Trash: " $1}'

#Computer Demographics
sw_vers | awk -F':\t' '{print $2}' | paste -d ' ' - - -;
sysctl -n hw.memsize | awk '{print $0/1073741824" GB RAM"}';
sysctl -n machdep.cpu.brand_string;
 
Weather Image

having a little trouble getting the image from weather.yahoo. could you be more specific as to where to put the commands?
 
I'm getting really frustrated with the weather scripts. I've tried several of them that I found in this thread, but almost none of them work for me. I've tried the ones using Lynx and the others using Yahoo! Weather. I was able to get one working but it was in Celsius and I couldn't figure out how to make it Fahrenheit.

Not only that, it disturbs me that the Geektool is currently using 716MB of RAM and the WindowServer is at 1.27GB RAM usage and growing. Why????? :confused:

The only scripts I have going are the Day, Date, Month, Time, Uptime and RAM free, plus a couple of unsuccessful weather ones.

Will someone please assist me in finding what I am doing wrong?
 
having a little trouble getting the image from weather.yahoo. could you be more specific as to where to put the commands?

ok. its in 2 scripts.
1st: shell (its gonna show up empty, but dont forget to put a refresh rate)
Code:
curl --silent "http://ca.weather.yahoo.com/canada/quebec/montreal-3534/" | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/weather.png\
dont forget to change the url to wherever you live.

2nd: image (another refresh rate for this one too...)
Code:
file:///tmp/weather.png
voila! :D

I'm getting really frustrated with the weather scripts. I've tried several of them that I found in this thread, but almost none of them work for me. I've tried the ones using Lynx and the others using Yahoo! Weather. I was able to get one working but it was in Celsius and I couldn't figure out how to make it Fahrenheit.

Not only that, it disturbs me that the Geektool is currently using 716MB of RAM and the WindowServer is at 1.27GB RAM usage and growing. Why????? :confused:

The only scripts I have going are the Day, Date, Month, Time, Uptime and RAM free, plus a couple of unsuccessful weather ones.

Will someone please assist me in finding what I am doing wrong?

ok. first, if youre using geektool 3, you dont need lynx. now for the weather scripts, there it is:
todays weather, shows up as "Clear, -24 C". dont forget to change your city code.
Code:
curl "http://weather.yahooapis.com/forecastrss?p=CAXX0301&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'
in fahrenheit: (i just changed the 2 c's for 2 f's)
Code:
curl "http://weather.yahooapis.com/forecastrss?p=CAXX0301&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'

forecast: (to change in *F, change the "=c" for "=f" in the url)
Code:
curl  "http://weather.yahooapis.com/forecastrss?p=CAXX0301&u=c" | 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/"

and for the RAM problem... are your refresh rates high? and/or at the same time?

edit: decided to put my new desktop... on the right, my school schedule in text (ical) and more visual (image). on the left, everything else on ical.
 

Attachments

  • 23 jan '11.jpg
    23 jan '11.jpg
    665.4 KB · Views: 343
Last edited:
ok. first, if youre using geektool 3, you dont need lynx. now for the weather scripts, there it is:
todays weather, shows up as "Clear, -24 C". dont forget to change your city code.
Code:
curl "http://weather.yahooapis.com/forecastrss?p=CAXX0301&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'
in fahrenheit: (i just changed the 2 c's for 2 f's)
Code:
curl "http://weather.yahooapis.com/forecastrss?p=CAXX0301&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'

forecast: (to change in *F, change the "=c" for "=f" in the url)
Code:
curl  "http://weather.yahooapis.com/forecastrss?p=CAXX0301&u=c" | 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/"

and for the RAM problem... are your refresh rates high? and/or at the same time?

Cool, thank you! :D

Yes I am using GeekTool 3. The code you gave works for the conditions and temperature in Fahrenheit but the forecast code isn't showing anything in C or F. <-- Nevermind... I figured it out. I accidentally removed a couple of characters.

Refresh rates are kind of the direction I was leaning in and didn't find any guidance as to what an acceptable rate would be. Now for the time I have it displaying seconds so setting the refresh rate to 1 seemed like a no-brainer. All the others are set at 60 seconds right now, and as I mentioned, I am not sure what a better rate would be.

EDIT: I attached my current desktop with the fixed weather information (THANK YOU). Still looking for guidance on the RAM usage and refresh rates.

Another question, on the uptime script, how do I get the part where it says ", 1 user" off of there? I noticed if I had two Terminal sessions open, it would say "2 users," either way, I don't want that part at all. Here is the code I am using for it:

Code:
#Uptime, Ram, HDD
uptime | awk '{print "Uptime     : " $3 " " $4 " " $5 }' | sed -e 's/.$//g';
top -l 1 | awk '/PhysMem/ {print "RAM Free : " $10 " "}'
#top -l 1 | awk '/PhysMem/ {print "RAM Free: " $10 " "}' ;
 

Attachments

  • Screen capture 1.jpg
    Screen capture 1.jpg
    295.4 KB · Views: 248
Last edited:
Refresh rates are kind of the direction I was leaning in and didn't find any guidance as to what an acceptable rate would be. Now for the time I have it displaying seconds so setting the refresh rate to 1 seemed like a no-brainer. All the others are set at 60 seconds right now, and as I mentioned, I am not sure what a better rate would be.
The problem might be that top is intentionally "staying alive" for exactly one second (as part of keeping its sample rate constant). So if you're calling it too often, that could possibly spawn multiple instances of the process.

Still looking for guidance on the RAM usage and refresh rates.

Another question, on the uptime script, how do I get the part where it says ", 1 user" off of there? I noticed if I had two Terminal sessions open, it would say "2 users," either way, I don't want that part at all. Here is the code I am using for it:

Code:
#Uptime, Ram, HDD
uptime | awk '{print "Uptime     : " $3 " " $4 " " $5 }' | sed -e 's/.$//g';
top -l 1 | awk '/PhysMem/ {print "RAM Free : " $10 " "}'
#top -l 1 | awk '/PhysMem/ {print "RAM Free: " $10 " "}' ;

Here is my own custom design for uptime:
uptime |sed 's/^.*up *//;s/, *[0-9]* user.*$/m/;
s/ day[^0-9]*/d, /;s/ \([hms]\).*m$/\1/;s/:/h, /;
s/ 0/ /;s/^/Uptime: /'

It's complex only because uptime itself isn't consistent. I.e., its output string is formatted differently for x seconds after boot, versus x minutes after boot, versus x hours after boot, etc.

As for the free RAM business, i avoid top myself and go with vm_stat instead. Although this looks longer, it actually completes 200 times quicker (simply because top is deliberately delaying itself):

vm_stat |awk '/ (free|speculative):/ {x+=$NF/256}
END {printf "RAM free: %dM\n", x}'

Even though its faster, i would still dial the refresh rates down a skosh. Maybe 5 seconds for uptime and 2 seconds for RAM... unless they're both part of the same geeklet, then go with 2 seconds for the bunch.
 
The problem might be that top is intentionally "staying alive" for exactly one second (as part of keeping its sample rate constant). So if you're calling it too often, that could possibly spawn multiple instances of the process.

I'm sorry but I don't know what you mean by top.

Here is my own custom design for uptime:
uptime |sed 's/^.*up *//;s/, *[0-9]* user.*$/m/;
s/ day[^0-9]*/d, /;s/ \([hms]\).*m$/\1/;s/:/h, /;
s/ 0/ /;s/^/Uptime: /'

It's complex only because uptime itself isn't consistent. I.e., its output string is formatted differently for x seconds after boot, versus x minutes after boot, versus x hours after boot, etc.

As for the free RAM business, i avoid top myself and go with vm_stat instead. Although this looks longer, it actually completes 200 times quicker (simply because top is deliberately delaying itself):

vm_stat |awk '/ (free|speculative):/ {x+=$NF/256}
END {printf "RAM free: %dM\n", x}'

Even though its faster, i would still dial the refresh rates down a skosh. Maybe 5 seconds for uptime and 2 seconds for RAM... unless they're both part of the same geeklet, then go with 2 seconds for the bunch.

Thanks, these two scripts work nicely. How can I get the RAM script to display in GB rather than MB, say like 'RAM Free 11.43GB?'

I still don't know what to do about the excessive RAM usage. I changed all of them to refresh at different times from each other and the only one that is refreshing every second is the time with seconds script. I looked at the forum on the GeekTool website and a couple of people had similar complaints about the RAM and CPU usage too. But I saw no resolutions on the site. Additionally, I do not have any CPU usage issues, just RAM.

From the GeekTool forum:
Bug: Memory Leak
CPU/ Mem usage - high ?
 

Attachments

  • Screen capture 1.jpg
    Screen capture 1.jpg
    34.2 KB · Views: 150
  • Screen capture 2.jpg
    Screen capture 2.jpg
    37.9 KB · Views: 138
Alright, I'm starting to get the hang of this! Copy & paste are my friends here!

I think I figured out how to mitigate the RAM usage. Once I get all the scripts running, I un-tick the enable box to shut them all down which clears it all from RAM and then I tick it again. Once I do that, the RAM usage stays to a more reasonable minimum.

I've slowly been going through this thread page by page looking for interesting scripts to use and see how others have their desktops setup. I attached mine so far.

Scripts:
Day
Date
Month
Time
iCal w/iCal Buddy
Uptime
RAM Free
Weather conditions
Weather forecast
iTunes now playing

I thought I saw someone who had a script for a MacRumors display. Does anyone have that one?
 

Attachments

  • Screen capture 1.jpg
    Screen capture 1.jpg
    300.1 KB · Views: 474
I'm sorry but I don't know what you mean by top.
Well, it's right there in the code that you yourself posted:
top -l 1 | awk '/PhysMem/ {print "RAM Free : " $10 " "}'
:) [see its man page for more info]


Thanks, these two scripts work nicely. How can I get the RAM script to display in GB rather than MB, say like 'RAM Free 11.43GB?'
Change the second line to something like:
END {printf "RAM free: %.2f gig\n", x/1024}'
 
Can't get Lynx to work

Is there a way to do a weather script with only the Temp in C and F? I can't get Lynx to work so if its a script i can just type into Geektool that would be great.
 
Is there a way to do a weather script with only the Temp in C and F? I can't get Lynx to work so if its a script i can just type into Geektool that would be great.

Code:
zip=14221 

temp_f=$(curl -s "http://xml.weather.yahoo.com/forecastrss?p=$zip&u=f" | egrep -o 'temp="[^"]*"' | sed -e 's/temp="//g' -e 's/"//g')
temp_c=$(curl -s "http://xml.weather.yahoo.com/forecastrss?p=$zip&u=c" | egrep -o 'temp="[^"]*"' | sed -e 's/temp="//g' -e 's/"//g')

echo "The temp in F is $temp_f, the temp in C is $temp_c"
 
Code:
zip=14221 

temp_f=$(curl -s "http://xml.weather.yahoo.com/forecastrss?p=$zip&u=f" | egrep -o 'temp="[^"]*"' | sed -e 's/temp="//g' -e 's/"//g')
temp_c=$(curl -s "http://xml.weather.yahoo.com/forecastrss?p=$zip&u=c" | egrep -o 'temp="[^"]*"' | sed -e 's/temp="//g' -e 's/"//g')

echo "The temp in F is $temp_f, the temp in C is $temp_c"

You're awesome I've looked all over for that script thanks a lot. Is there a way to put in the Degrees symbol?
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.