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.

bugmcw

macrumors newbie
Dec 26, 2009
26
0
This is the only forecast script I have
I don't know enough about the code to change it
But I am sure others do
I just borrow, copy and paste

Code:
curl  "http://weather.yahooapis.com/forecastrss?p=YOURCITY&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/"

Woof, Woof - Dawg
pawprint.gif

yeah thats the same code i am using... huh... i just don't know enough about what stuff means to parse out the information i actually want.
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
Gave it another try, except added a little outer glow to it.

screenshot20100112at121.png


I'm actually quite pleased with it so far.

Thanks for the link! Will give it a try with your separators.
 

MacDawg

Moderator emeritus
Mar 20, 2004
19,823
4,503
"Between the Hedges"
I had to open the image in GraphicConverter and make the background transparent, then it worked like a charm

Just duplicate the first image in GT and change the file name

Thanks!


geektool5.png


Woof, Woof - Dawg
pawprint.gif
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
After much tweaking I've finally finished it!

It started off as this...

4266768840_2e7571b859_o.png


then to this...

screenshot20100112at121.png


then this..

screenshot20100112at124y.png


and after adding some inner bevel, shadow and a touch of gloss, I think I've finally cracked it!

screenshot20100112at213.png


I'm really happy how it turned out. Think I'm going to leave it alone now and get some sleep
 

poppero

macrumors member
Jun 26, 2009
67
0
and after adding some inner bevel, shadow and a touch of gloss, I think I've finally cracked it!
wonderful!!! next step would be sharing your final lines template with us :D

P.S.: what string do you use to have "1 °C" with the ° in Celsius indication???
 

proofrock

macrumors newbie
Jan 9, 2010
2
0
Degree mark?

Poppero,

Love this script. Would adore it if someone could help me figure out how to insert a degree mark between the temp and "F".


Best,

Proofrock


sorry, I forget a space in the regular expression...

Code:
curl --silent "http://weather.yahooapis.com/forecastrss?p=YOURCITY&u=c" | grep -E '(Current Conditions:|[A-Z]<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//' [B]-e 's/[A-Z a-z]*, //'[/B] | tail -n1

this one works great!
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
wonderful!!! next step would be sharing your final lines template with us :D

P.S.: what string do you use to have "1 °C" with the ° in Celsius indication???

I'm cheating a little with the degree symbol. it's just echo o :p

I'm on my iPhone at the moment. I'll put up the lines once I'm home!

Oh and while I'm here, do you or anyone else know of a way to show just the hi-lo temperature for the day?
 

poppero

macrumors member
Jun 26, 2009
67
0
I'm cheating a little with the degree symbol. it's just echo o :p

i tried with echo even with char hex code but not provide the expected result...

UPDATE:
i found a regex for the ° symbol, this is the complete script for degrees only:
Code:
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=YOURCITY&u=c" | grep -E '(Current Conditions:|[A-Z]<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/[A-Z a-z]*, //' -e 's/\(.*\) F/\1 °F/' -e 's/\(.*\) C/\1 °C/' | tail -n1
I modified it to auto-fix both Celsius and Fahrenheit notation.
Note: you must remember to set the encoding to UTF-8!

This is my creation...

20100112-csyn2737af3dcs9bcejxg1p726.png
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
Hey guys! I've uploaded the separator I'm using. It's been extracted from the original image. I added an inner bevel which adds the slight inner shadow to give it a bit of depth and then placed a small white transparent gradient to give the numbers a bit of gloss, again for a bit more depth.

Download

It's only one separator so you need to make two geeklets for the same image file and then just resize it over the numbers.

I think it works pretty well.

4269627052_b763c27c71_o.png
 

oneijose

macrumors regular
Jun 24, 2009
120
0
Brooklyn NY
Hey guys! I've uploaded the separator I'm using. It's been extracted from the original image. I added an inner bevel which adds the slight inner shadow to give it a bit of depth and then placed a small white transparent gradient to give the numbers a bit of gloss, again for a bit more depth.

Download

It's only one separator so you need to make two geeklets for the same image file and then just resize it over the numbers.

I think it works pretty well.

4269627052_b763c27c71_o.png
:D Thanks dude.....U R THE MAN!!
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
I'm just going to write up a little guide for any beginners to Geektool who may want to have this on their desktop

Screen%20shot%202010-01-12%20at%207.38.17%20PM.png


Watch this video first, if your completely new to geektool

The First thing you'll need is the background which you can download here
Save the background image in a folder where you'll remember it is

Then to place the image onto your desktop just drag the image icon from Geektools preference pane on to your desktop
screenshot20100114at747.png


and then specify the location of the image inside the box above [set local path].
screenshot20100114at747.png

(or you could just click the button and find the image when the pop up box appears)

Now you should have the HTC background on your desktop

Background%20Screenshot.png

Place this anywhere on your desktop where you want the Geeklet to sit.

All the next commands are Shell commands.

Next thing to add would be the Hour and Minute.

Hour
Hour.png

Code:
[B][I]date +%I[/I][/B]

Minute
Minute.png

Code:
[B][I]date +%M[/I][/B]

Quick Tip: Make sure you use the center alignment on these two to make sure they stay in the middle of the white boxes

The City name is just a simple echo which just displays any text you want it to. So in this case...

City.png

Code:
[B]echo [I]YOURCITYNAME[/I][/B]

On the other side we have the day, month and date.

Day%2C%20Month%20and%20Date.png
Use this Script:
Code:
[B][I]date +'%A, %b %d'[/I][/B]

Am%3APm.png
The script for this is:
Code:
[B][I]date +%p[/I][/B]

Lay these little geeklets over your background in whichever way you want. It doesn’t have to be the way I have it here

To get the weather for your city you need to first head over to Yahoo Weather and do a search for your city. Copy and save the URL for your city as you'll need it later.
Then, whilst on the page for your city's weather, hit the RSS button and the page will change to a feed page. In the URL for this page you'll see a code that’s all in uppercase. That’s your city code. Copy and save this next to your city URL as you will need this later aswell.

To get the current weather for your location

Current Weather Conditions
Current%20weather%20Conditions.png
You'll need this script:
Code:
[B][I]curl --silent "http://weather.yahooapis.com/forecastrss?p=YOURCITYCODE&u=c" | grep -E '(Current Conditions:|[A-Z]<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//' -e 's/, [0-9]* [A-Z]//' | tail -n1[/I][/B]

Where it says YOURCITYCODE enter the uppercase code you found for your city previously.

To get the Temperature,
Temperature.png
Use this script:
Code:
[B][I]curl --silent "http://xml.weather.yahoo.com/forecastrss?p=UKXX0085&u=c" | grep -E '(Current Conditions:|[A-Z]<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/[A-Z a-z]*, //' -e 's/\(.*\) F/\1 °F/' -e 's/\(.*\) C/\1 °C/' | sed 's/ //' | tail -n1[/I][/B]

The Next day Forecast,
Next%20Day%20Forecast.png
Use this script:
Code:
[B][I]curl "http://xml.weather.yahoo.com/forecastrss?p=YOURCITYCODE&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/Hi\:\ \(.*\)\ Lo\:\ \(.*\)/\?Hi\: \1\  Lo\:\ \2/" | sed "s/\?\(.*\)/\\1/"[/I][/B]

Again use the city code in place of YOURCITYCODE within each of the above scripts

To get the image for the weather for your city,
Weather%20Image.png
Use this script:
Code:
[B][I]curl --silent "WEATHER URL FROM YAHOO/" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png\[/I][/B]

Paste the URL you saved of your city's weather in place of " WEATHER URL FROM YAHOO" The geeklet will be blank after you’ve done, but don't worry that’s normal.

To get the image to show up on your desktop use this script:
Code:
[B][I]file:///tmp/weather.png[/I][/B]

Now it's just a matter of placing everything the way you like it. Don't forget you can change the font style and sizes to whatever you prefer.

Once you've done that you just need to overlay the numbers with a set of separators to really finish it off.
Separator%20screenshot.png


You can download it from here

All you need to do with this is place it on your desktop as an image command in the same way you did with the background image. Only, for THIS image you have to do it twice using the same Separator image and place it over both the Hour and minute numbers. This gives the numbers a bit of shine and depth to really top it of.

Just wanted to say a big thank you to everyone in this thread. I couldn’t have done any of it without the scripts you clever people have so generously shared.

I hope you find this guide useful

Jai.
 

creator2456

macrumors 68000
Jul 10, 2007
1,649
2
Chicago
I hope you find this guide useful

Jai.

You can us this for the date all in one line.

date +'%A, %b. %d'

Probably want to set it to right align as well. That way when the length changes it 'pushes' to the center of the graphic and not out of the border.
 

Attachments

  • Screen shot 2010-01-12 at 4.09.53 PM.png
    Screen shot 2010-01-12 at 4.09.53 PM.png
    4.8 KB · Views: 13,588

codymac

macrumors 6502
Jun 12, 2009
449
2
In order to the get the forecast as it appears in jck1634's post, I did this:

Code:
curl --silent "http://weather.yahooapis.com/forecastrss?p=YOURCITYCODE&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/\?\(.*\)/\\1/"

replace YOURCITYCODE with your actual city code and the "f" at the end of the URL with a "c" if you prefer.
 

Attachments

  • Picture 1.png
    Picture 1.png
    109.6 KB · Views: 187

Redfish123

macrumors newbie
Sep 4, 2009
11
0
Problem With Top output

I am having an issue with the top command in geektool v3 RC5. I am running snow leopard 10.6.2. My main problem is that when I run my command:

top -n 20 -l 1 | cut -c 1-28 | tail -21

The PID for top, cut, and tail each increase by a few each time it updates. the PID for Top might be 4015 but later in the day it is like 51450. If I change the refresh time this doesn't happen so fast, but I was wondering if there was anyway to run top through geektool where it is constantly updating like running it from the terminal. If I run it in the terminal the Top PID never changes vs. creating a new instance in geektool each time it refreshes.

Is there anyway to run top without this occurring?

Any help would be greatly appreciated.
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.