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.

NJRonbo

macrumors 68040
Jan 10, 2007
3,135
1,155
rkunda,

Thanks for sticking with me on this.

I am almost there.

The Weather.png is indeed in there.

The only problem I am having is when I drag
a Geektool file to the desktop. Where do I paste
the file command? All I have is a dropdown box
with LOG and pointers to my drive. Nowhere that
I can see to paste that command.
 

rKunda

macrumors 68000
Jul 14, 2008
1,604
591
Check the SS below. BTW, I typed incorrectly. For the image you're going to use the Image selection.

Screen%20shot%202009-11-16%20at%206.02.30%20AM.png
 

NJRonbo

macrumors 68040
Jan 10, 2007
3,135
1,155
rkunda,

THAT DID IT!

I now have an icon image on my desktop.

Thank You so much!!!!!!

Hope it updates itself automatically.

Next Question...


This is the Calendar Script:

cal | sed "s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed 's/./#/g') /"

How to I put a HIGHLIGHT in the calendar I have
on my desktop?

Need the code to replace that calendar code or to add to the end
of the code (However it works)

...also, does anyone have a code for CURRENT WEATHER TEMPERATURE?


Thanks again!
 

RogersDA

macrumors 6502
Aug 19, 2009
271
0
Following some existing posts on the subject of stock quotes in this thread I tried this to get Citigroup.
.
.
.
However, there is no information at all shown in the shell window.
Got the stock quotes to work using different script(s).
 

RogersDA

macrumors 6502
Aug 19, 2009
271
0
Thanks to everyone for their posts. Here is what I did - in case it helps someone else.

STOCK INFORMATION
Here the text "INDEX:.DJI" would be changed to whatever you want - get that information from Google Finance. For example, Citigroup would be NASDAQ:C, and the "DOW" at the end would be replaced with Citigroup.
Code:
curl http://www.google.com/finance?q=INDEXDJX:.DJI | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^/DOW: /g'

In my desktop example below I used a shell script to echo each stock name. I then used a a modified script from above to create the listing of stocks
Code:
echo Dow Jones: ; echo NASDAQ: ; echo Citigroup: ; echo E*Trade: ; echo Apple: ; echo Google: ; echo Proctor '&' Gamble: ; echo Terra Nitrogen: ; echo Royal Caribbean: ; echo Disney: ; echo Arlington Asset: ; echo State Street:

Code:
curl http://www.google.com/finance?q=INDEXDJX:.DJI | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=INDEXNASDAQ:.IXIC | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NASDAQ:C | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NASDAQ:ETFC | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NASDAQ:AAPL | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NASDAQ:GOOG | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NYSE:PCG | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NYSE:TNH | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NYSE:RCL | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NYSE:DIS | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NYSE:AI | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;
curl http://www.google.com/finance?q=NYSE:STT | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^//g' ;

WEATHER
Based on some feedback in this thread you should make sure your refresh rate is not too high when grabbing data from Yahoo. I use 3600 seconds (1 hour). I really do not need to have second-by-second updates to the weather. Other users reported getting errors from Yahoo if there refresh rate was too high.

Current Conditions - here XXXXX was replaced with my Zip Code.
Code:
curl "http://xml.weather.yahoo.com/forecastrss?p=XXXXX&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 Conditions - here XXXXX was replaced with my Zip Code.
Code:
curl "http://xml.weather.yahoo.com/forecastrss?p=XXXXX&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/"

Current Image Grabber - here the text REMAINING_LINK_INFORMATION was obtained by going to yahoo weather and imputing my zip code, and copying the resultant URL.
This grabs the image on the weather site and copies it to my harddrive. This shell does not, by itself, display anything on the desktop.
Code:
curl --silent "http://weather.yahoo.com/REMAINING_LINK_INFORMATION" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /var/tmp/weather10.png\

Current Image Display - This displays the image from the previous step.
Code:
file://localhost/var/tmp/weather10.png

Doppler radar image - this is specific to my region and comes from another site. It's provided as an example.
Code:
http://images.allbrittontv.com/wjla/dlarge.gif


COMPUTER INFORMATION
Uptime
Code:
uptime | awk '{sub(/[0-9]|user\,|users\,|load/, "", $6); sub(/mins,|min,/, "min", $6); sub(/user\,|users\,/, "", $5); sub(",", "min", $5); sub(":", "h ", $5); sub(/[0-9]/, "", $4); sub(/day,/, " day ", $4); sub(/days,/, " days ", $4); sub(/mins,|min,/, "min", $4); sub("hrs,", "h", $4); sub(":", "h ", $3); sub(",", "min", $3); print "Uptime: " $3$4$5$6}'

IP Address
Code:
curl --silent http://checkip.dyndns.org | awk '{print "Current IP:" $6}' | cut -f 1 -d "<"

Disk Information
Code:
df -h | grep disk0s2 | awk '{print "Programs: " $3, "of", $2, "used &", $4, "available"}' | sed 's/Gi/Gb/g';
Code:
df -h | grep disk1s2 | awk '{print "Data: " $3, "of", $2, "used &", $4, "available"}' | sed 's/Gi/Gb/g';

ITUNES
I followed the information here in this thread
https://forums.macrumors.com/posts/8731878/
Use Apple Script Editor to save each script as a .scpt file somewhere (I choose private/var/tmp). Then, create a shell to run each script - making sure you point it to the right file location.

I also use Dateline (licensed) for the date information and Bowtie with the One.Five theme for the CD information.

Click the image to see it bigger.
 

rKunda

macrumors 68000
Jul 14, 2008
1,604
591
rkunda,

THAT DID IT!

I now have an icon image on my desktop.

Thank You so much!!!!!!

Hope it updates itself automatically.

Make sure to change the refresh settings for each of the items. I think I have mine set for 30 minutes (translate to seconds.) I don't think you'd need/want a continual refresh.

As for your question about dates and highlighting, I'm not sure. See a post above for info on weather conditions.
 

NJRonbo

macrumors 68040
Jan 10, 2007
3,135
1,155
RogersDA and rkunda,

You guys are great. Excellent job. I am having
so much fun with Geektool.

Can we keep going for those just joining this thread?

Promise I won't ask too much more.

How 'bout a hard drive icon with remaining disc space.
 

Stiss

macrumors 6502a
Apr 18, 2009
885
636
England
I'm fairly new to this but I'm getting good results.

Only problem is with my Yahoo weather image.

I get the 909 error after a few days of having the weather on my desktop.

Basically I read into it and because your accessing Yahoo more often than normal they block you, so in turn I lose my weather Image.

Is there any way around this.
 

RogersDA

macrumors 6502
Aug 19, 2009
271
0
I'm fairly new to this but I'm getting good results.

Only problem is with my Yahoo weather image.

I get the 909 error after a few days of having the weather on my desktop.

Basically I read into it and because your accessing Yahoo more often than normal they block you, so in turn I lose my weather Image.

Is there any way around this.
What refresh rate did you use for the image? You could probably go about once an hour for the image and be generally current.
 

NJRonbo

macrumors 68040
Jan 10, 2007
3,135
1,155
Yikes!

I set all my Yahoo content to 4000s to cut down
on the amount of times it connects. Hope I don't
end up losing that content.
 

Stiss

macrumors 6502a
Apr 18, 2009
885
636
England
What refresh rate did you use for the image? You could probably go about once an hour for the image and be generally current.

Thanks. I've set it to 3600 now as thats one hour in seconds. Math boy can do math.

I have the image and text on different entries, would you set both to 3600? Thats what I have done.

I had it set to 5 seconds so now wonder I got the 909 ban ;O

If anyone doesn't know what I'm talking about just google yahoo 909 error and theres blogs on it and all sorts!!
 

NJRonbo

macrumors 68040
Jan 10, 2007
3,135
1,155
RogersDA,

That calendar at the bottom of your
screen is beautiful.

Can you provide the script? Also need
the current day highlighted.

As for the regular CAL command, how do
I underline or highlight today's date?
 

RogersDA

macrumors 6502
Aug 19, 2009
271
0
That calendar at the bottom of your screen is beautiful.
Thanks.

Can you provide the script? Also need the current day highlighted.
I used Dateline.

As for the regular CAL command, how do I underline or highlight today's date?
No idea - I never bothered to use geektools and iCal. Perhaps there is a posting in this thread or in one of the many archived Desktop Picture threads that someone shows how to do this, or even a Google search for some hints.
 

FREDDIE021

macrumors newbie
Nov 16, 2009
1
0
I know there is already a way to get facebook notifications. Here is my version that skips the use of automator.

$ curl "http://your url here" -A "Mozilla/4.0" | grep 'title' | egrep '(commented|your Wall)' | sed -e 's/\<title\>//' -e 's/\<\/title\>//' -e "s/\&apos\;/'/" -e 's/ //' | head -n 4

The url you must have to use this can be obtained by clicking the notifications button on the lower right hand corner of any facebook page. From there click on show all. This should send you to a new page. Click the link for "Your notifications" on the right side of the screen. Now this should send you to a new page. Copy the url and paste that into your url here. To change the number of notifications shown change the last number in the code. It is currently set to show 4.

You must replace feed:// (from the facebook url) with http:// otherwise this will not work.

That should work to show facebook notifications if not write back and I'll try my best to help troubleshoot.


I've tried this, and a few other facebook RSS feed options and cant get anything to work.

The RSS feed url I have is
Code:
http://www.facebook.com/feeds/friends_status.php?id=XXXXXXXXX&key=049e012962&format=rss20

XXXXXXXXX = Facebook id.

All I get is a blank script box. If anyone knows what I'm doing wrong or can point me in the right direction it would be much appreciated.
 

G0dl1k3

macrumors newbie
May 27, 2009
21
0
I dont get it!

I would Like to have the current weather from Haarlem (Netherlands).
This is the link from yahoo ( RSS )

http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=f

This link should be set between both " " (shown in black)

curl --silent "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=f" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png\

But It does not work ! What is wrong now?

any help!

cheers




Thanks to everyone for their posts. Here is what I did - in case it helps someone else.

STOCK QUOTES (TEXT NEEDS TO BE CHANGED FOR EACH INDEX OR STOCK)
Here the text "INDEX:.DJI" would be changed to whatever you want - get that information from Google Finance. For example, Citigroup would be NASDAQ:C, and the "DOW" at the end would be replaced with Citigroup.
HTML:
curl http://www.google.com/finance?q=INDEXDJX:.DJI | sed -n '/price-panel style/,/ Close/p' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'| sed '/^$/d' | sed -e '$!N;s/\n/ /' -e '$!N;s/\n/ /' | head -1 | sed 's/^/DOW: /g'

WEATHER (CURRENT CONDITIONS)
Here XXXXX was replaced with my Zip Code.
HTML:
curl "http://xml.weather.yahoo.com/forecastrss?p=XXXXX&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>//'

WEATHER (FORECAST CONDITIONS)
Here XXXXX was replaced with my Zip Code.
HTML:
curl "http://xml.weather.yahoo.com/forecastrss?p=XXXXX&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/"

WEATHER (CURRENT CONDITIONS IMAGE GRABBER)
Here the text REMAINING_LINK_INFORMATION was obtained by going to yahoo weather and imputing my zip code, and copying the resultant URL.
This grabs the image on the weather site and copies it to my harddrive.
HTML:
curl --silent "http://weather.yahoo.com/REMAINING_LINK_INFORMATION" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /var/tmp/weather10.png\

WEATHER (CURRENT CONDITIONS IMAGE)
This displays the image from the previous step.
HTML:
file://localhost/var/tmp/weather10.png

WEATHER (CURRENT DOPPLER RADAR IMAGE)
HTML:
http://images.allbrittontv.com/wjla/dlarge.gif

UPTIME SCRIPT
HTML:
uptime | awk '{sub(/[0-9]|user\,|users\,|load/, "", $6); sub(/mins,|min,/, "min", $6); sub(/user\,|users\,/, "", $5); sub(",", "min", $5); sub(":", "h ", $5); sub(/[0-9]/, "", $4); sub(/day,/, " day ", $4); sub(/days,/, " days ", $4); sub(/mins,|min,/, "min", $4); sub("hrs,", "h", $4); sub(":", "h ", $3); sub(",", "min", $3); print "Uptime: " $3$4$5$6}'


I also added (a) a random image grabber using geektools for an image folder on my Mac; (b) Dateline; and (c) Bowtie. Finally, for the stocks I made an echo script just for the stock names and another script just for the prices.

Click the image to see it bigger.
 

digitallife

macrumors member
Oct 25, 2009
46
0
Lisbon, Portugal
I dont get it!

I would Like to have the current weather from Haarlem (Netherlands).
This is the link from yahoo ( RSS )

http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=f

This link should be set between both " " (shown in black)

curl --silent "http://weather.yahooapis.com/forecastrss?p=NLXX0010&u=f" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png\

But It does not work ! What is wrong now?

any help!

cheers

Hi,

you are using the wrong url (or the wrong grep/sed commands).
If you actually look into that page's html (view source) there's no "forecast-icon" text there.

That command is designed to work with a page like this:
http://weather.yahoo.com/netherlands/north-holland/haarlem-729636/

:)

ps: ...which get's you a much nicer weather icon :)
 

logan59102

macrumors newbie
Sep 25, 2007
14
0
Hi,

Can somebody help me with the CPU and CPU process ?
I've been trying to use
top -l 2 | awk '/CPU usage/ && NR > 5 {print $12, $13}'
but it did not work for me.

Thanks
 

G0dl1k3

macrumors newbie
May 27, 2009
21
0
Hi,

you are using the wrong url (or the wrong grep/sed commands).
If you actually look into that page's html (view source) there's no "forecast-icon" text there.

That command is designed to work with a page like this:
http://weather.yahoo.com/netherlands/north-holland/haarlem-729636/

:)

ps: ...which get's you a much nicer weather icon :)

This is the current link I use but still no projection

curl --silent "http://weather.yahoo.com/netherlands/north-holland/haarlem-729636/" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png\
 

rKunda

macrumors 68000
Jul 14, 2008
1,604
591
This is the current link I use but still no projection

curl --silent "http://weather.yahoo.com/netherlands/north-holland/haarlem-729636/" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png\

Try this:

SHELL:
HTML:
curl --silent "http://weather.yahoo.com/netherlands/north-holland/haarlem-729636" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png\

And don't forget to do

IMAGE:
HTML:
file:///tmp/weather.png
 

G0dl1k3

macrumors newbie
May 27, 2009
21
0
Try this:

SHELL:
HTML:
curl --silent "http://weather.yahoo.com/netherlands/north-holland/haarlem-729636" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png\

And don't forget to do

IMAGE:
HTML:
file:///tmp/weather.png

The picture is showing but the shell does not..

I put this in a shell:

curl --silent "http://weather.yahoo.com/netherlands/north-holland/haarlem-729636" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png\
 

RogersDA

macrumors 6502
Aug 19, 2009
271
0
I tried your --netherlands/north-holland/haarlem-729636-- on my system and, at first, it did not work. So, I fully exited geektools and restarted it.

I created the Image using the file location file://localhost/var/tmp/weather_test.png

I then created the shell using curl --silent "http://weather.yahoo.com/netherlands/north-holland/haarlem-729636" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /var/tmp/weather_test.png\

Doing it this time the image shows up. So - you might want to try that (quitting and restarting). Good luck!
 

RogersDA

macrumors 6502
Aug 19, 2009
271
0
Now, if someone could figure out how to write a shell script to grab a random image from a public gallery on SmugMug!

I would love to have a script that was able to pull a small- or medium-sized image from one of my SmugMug galleries.
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.