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.
I am currently using this code in Geektool to get the weather in Spain:

Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=benijofar,spain|awk '/Temp/{printf "Benijofar : " $2, ": "; for (i=3; i<=3; i++) printf $i " " }'

This works fine and displays the following :

Benijofar : 30.7#C

Does anybody know how to show the temperature in fahrenheit as opposed to celsius?

Thanks!

Great thread by the way.....
 
I am currently using this code in Geektool to get the weather in Spain:

Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=benijofar,spainawk '/Temp/{printf "Benijofar : " $2, ": "; for (i=3; i<=3; i++) printf $i " " }'

This works fine and displays the following :

Benijofar : 30.7#C

Does anybody know how to show the temperature in fahrenheit as opposed to celsius?

Thanks!

Great thread by the way.....

Try this:
Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=benijofar,spain|awk '/Temp/{printf $2, ": "; for (i=3; i<=3; i++) printf $i " " }'
 
Try this:
Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=benijofar,spain|awk '/Temp/{printf $2, ": "; for (i=3; i<=3; i++) printf $i " " }'

Thanks for that but unfortunately it only shows the temperature in Celsius. This is what I got when I ran it : 32.2#C.

After a bit of playing around I managed to knock something up using the weather forecast from Accuweather. It probably is not the most efficient way to do it, as I have never used the commands before, but it does display the correct information and relatively quickly.

Code:
 curl -s "http://rss.accuweather.com/rss/liveweather_rss.asp?metric=0&locCode=EUR|ES|SP016|BENIJOFAR"| awk /"Currently:"/ | sed 's/<title>/ /' | sed 's.</title>. .' | sed 's/Currently:/ /'

e.g.

Sunny: 79F

The only slight problem is that it has leading spaces and I am not sure how to get rid of them.

I also managed to get the Real-Feel temperature from Accuweather but this is definitely a botch job....

Code:
 curl -s "http://www.accuweather.com/world-index-forecast.asp?partner=apple&locCode=EUR|ES|SP016|BENIJOFAR&metric=0" | awk /quicklook_current_rfval/ | sed 's.<div id="quicklook_current_rfval">.Feels Like: .' | sed 's.°F</div>.F.'
 
hey everyone im brand new here and im not very good with computers so i was wondering if someone could direct me to a good tutorial to set up geektool. i searched on this forum and i didnt see any. i wanna set it up so it looks somewhat like this guys. thanks alot!!

screen-capture-1.png
 
I've been working on this for hours and can't figure it out. Date, etc. were fairly simple, but I've had a horrible time with the weather. It took me a loooong time to figure out how to get Lynx installed.

Now, nothing happens in geektools when I enter the setup for weather or temp. Any ideas?

When putting
Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=benijofar,spain|awk '/Temp/{printf $2, ": "; for (i=3; i<=3; i++) printf $i " " }'
I get the temp output in terminal, but nothing but blank screens in geektools. Any advice? This is rather frustrating. :)
 
Thanks for that but unfortunately it only shows the temperature in Celsius. This is what I got when I ran it : 32.2#C.

Really? Because it definitely is reading as fahrenheit on my computer (it is definately not 70 degrees celsius). Attached is a pic showing the output (in black) of the script that I posted - copied directly from the post and pasted into a new shell

Maybe try the script again
 

Attachments

  • 1.png
    1.png
    54.9 KB · Views: 4,556
I've been working on this for hours and can't figure it out. Date, etc. were fairly simple, but I've had a horrible time with the weather. It took me a loooong time to figure out how to get Lynx installed.

Now, nothing happens in geektools when I enter the setup for weather or temp. Any ideas?

When putting
Code:
lynx -dump http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=benijofar,spain|awk '/Temp/{printf $2, ": "; for (i=3; i<=3; i++) printf $i " " }'
I get the temp output in terminal, but nothing but blank screens in geektools. Any advice? This is rather frustrating. :)

I've just tried the script and it works fine (giving the same output as in my post above - it is the same location as chas0001). Try changing the colour (to something totally different to your wallpaper) and size of the output - the default output is small & black and can thus be lost in dark colored wallpapers.
 
Hmm no luck. I made a hot pink widget that worked for the time. Duplicated it and changed the command to the lynx code and got a blank screen.

Thanks for the replies, though!
 
Really? Because it definitely is reading as fahrenheit on my computer (it is definately not 70 degrees celsius). Attached is a pic showing the output (in black) of the script that I posted - copied directly from the post and pasted into a new shell

Maybe try the script again

Not sure why we get different results. Perhaps its due to the location of our IP address that WUndergound reads. In europe we are supposed to use celsius but I prefer fahrenheit. Bloody European Union.

Thanks for looking into it.
 

Attachments

  • Picture 1.png
    Picture 1.png
    25 KB · Views: 240
newb with perl scipts

A buddy asked for a quick timemachine script and I thought it'd be handy for the geektools crowd. Here you go.

save it as timemachine.rb, +x permissions, then configure in geektools as necessary. Can probably get it down to hours if you need it that badly.

#!/usr/bin/env ruby
require 'date'

date =`head /var/db/.TimeMachine.Results.plist | grep date| awk -F'<|>|T|:|Z' {'print $3'}`.chomp.split("-")
gap = (Date.new(Time.now.year,Time.now.month,Time.now.day) - Date.new(date[0].to_i,date[1].to_i,date[2].to_i) )
if gap > 14
puts "you gotta backup. its been #{gap.to_i} days"

else
puts "na, you're cool. its only been #{gap.to_i} days"

end

Thanks so much for sharing this script with us. I am sorry to say I am a newb with the world of the terminal and perl scripts... can someone explain in more detail the:

"save it as timemachine.rb, +x permissions, then configure in geektools as necessary. Can probably get it down to hours if you need it that badly. "

im looking for an output of the time elapsed since last timemachine backup that would minimally read something close to: "backup: 3 days 2 hrs"
Thanks!!
 
My GeekTool Setup (Dual Displays)

Hey guys,

So I've been playing around with GeekTool for a while now, just for fun. It's a wonderful program, and amazingly versatile. One thing I love about it is that it has given me lots of practice using terminal. The only problems I have run into are miscellaneous GeekTool crashes, which are a real pain in the ass. One minute, I'll be typing in a new uptime script, and the next minute, every script that I have has been replaced with the "cal" command, making me start from scratch. It seems to me that nothing can be done about this, except for starting over. Many of the scripts that I have were taken from the net, though they are from different websites. To make it simple, I will include a list of the commands that I used, as well as the icons, widgets, docks, wallpapers, and bowtie themes.

Lets begin. Please know that I am starting with my left display, working my way from the top down, left to right. Please also know that I am putting the scripts in [BRACKETS] in order to avoid any confusion on where the scripts end and begin. Please remove them when pasting into GeekTool:

1. WidescapeWeather-- a Yahoo! widget.

2. Many of my actual scripts do not have labels included. Instead I added them seperatley by typing [echo "Label Goes Here!"]

3. Uptime-- [uptime | awk '{print "" $3 " " $4 " " $5 " " }']

4. Trash Size-- [du -sh ~/.Trash/ | awk '{print $1}']

5. Day (#)-- [date +%d]

6. Day (of the Week)-- [date +%A]

7. Month-- [date +%B]

8. Year-- [date +%Y]

9. Time (H+M)-- [date "+%I %M"]

10. I wanted the colon a different color, so I typed [echo :]. If the color/formatting is not important to you, it would be easier to type [date "+%I:%M"]

11. Seconds-- [date "+%S"]

12. AM/PM- [date "+%p"]

13. Calendar-- [cal]

14. Network Interfaces/External IP:

[myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`

if [ "$myen0" != "" ]
then
echo "$myen0"
else
echo "Inactive"
fi

myen1=`ifconfig en2 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`

if [ "$myen1" != "" ]
then
echo "$myen1"
else
echo "Inactive"
fi

wip=`curl --silent http://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`
echo "$wip"]

15. Current Network-- [system_profiler SPAirPortDataType | grep -e "Current Wireless Network:" | awk '{print "" $4 " " $5 " " $6 " " $7 " " $8}']

16. To Do-- cat [/path/to/your/todo.txt] (This is most effective when used with the todotxt script available here.)

17. Adium-- with modified versions of the HUD color theme, combined with the 65% Transparency list layout. Message style is called "minimal_mod," and I use the black vs. grey setting within that. I also use the iChat status icons.

18. iTunes-- I use a program called Bowtie to manage itunes track info on the desktop. Within Bowtie, I use a version of the minimal_mod theme, which I customized myself to be darker. If you want a copy, email me. My email is [liystalander@mac.com].

19. My drive icons are called "Wooden Slick Drives." The Dock icons are from the "Kobhens" pack. Finally, my overall system icons are from a set called "Rave-Up System."

20. The green indicators next to the drives come from a GeekTool script. [diskutil info /dev/disk0]. Change the disk# to whatever it is for the drive you want to monitor. Also, be sure to hide the output and use default icons within the shell settings in GeekTool.

21. The dock is called Bezel. Find out how to change it here.

Picture-1.png Picture-1(2).jpg
 
Your setup looks amazing. My Mac is out for repair so I've been experimenting on my wife's computer. Can't wait to get some of this set up.
 
Done
----
#!/usr/bin/env ruby
# require 'date'
public
def to_seconds; self; end
def to_minutes; self/60.0; end
def to_hours; self/(60*60.0); end
def to_days; self/(60*60*24.0); end
def to_weeks; self/(60*60*24*7.0); end

def days; self * 60 * 60 * 24.0; end

date =`head /var/db/.TimeMachine.Results.plist | grep date| awk -F'<|>|T|:|Z' {'print $3 "-" $4'}`.chomp.split("-")

gap = (Time.local(Time.now.year,Time.now.month,Time.now.day,Time.now.hour) - Time.local(date[0].to_i,date[1].to_i,date[2].to_i,date[3].to_i) )
days = gap.to_days.to_i
hours = (gap - days.days).to_hours

if days > 14
puts "you gotta backup. its been #{days} days and #{hours} hours"

else
puts "na, you're cool. its only been #{days} days and #{hours} hours"

end

Ok, for the geektoollogically challenged - What do we do with this? :)

I saved it as timemachine.rb in my Scripts folder, but how do I get the output to display?
 
You people are getting lynx to work and we need to know how.

I downloaded it, copied the lynx.command to applications...double clicked the install script and it didn't work.

I also noticed when I type lynx in my terminal window it doesn't work.

Let's get some directions here!
 
You people are getting lynx to work and we need to know how.

I downloaded it, copied the lynx.command to applications...double clicked the install script and it didn't work.

I also noticed when I type lynx in my terminal window it doesn't work.

Let's get some directions here!


Please, search back in this thread a little, there are plenty directions on installing lynx.
 
i would love the TO DO Script. Thanks

icalbuddy is available here: http://hasseg.org/icalBuddy/

Once you've gotten it installed, enter this into geektool:

/usr/local/bin/icalBuddy -nc uncompletedTasks | sed -e "s/*/--/" | sed -e "s/!/!!/"

You can play around with the strings to get the output from different calendars or different display modes. It's pretty versatile. You can take a look at the various strings by going into terminal (once it's installed) and typing $ icalbuddy -h

Enjoy!
 
I can't find the download link :) for either.

EDIT:::I found a download link with all his scripts, which is the title of the fan speed one and for it, do I just have to link to it from Geektool (file.) For the iTunes meter, what is the title of it as well and once again do I just link from Geektool?

the title of the script is fans.sh. Make a new folder at /Users/<your computer's name>/geektool and stick it in there. Make fans.sh executable (in terminal type 'chmod +x /path/to/script'). You will find another file in the package called smc.custom. Stick it in the geektool folder you just created. Now go to geektool and under shell type the path to the fans.sh script and you should be good to go.

For the itunes meter, it's called position.scpt. Stick it in the same geektool folder and then in geektool under shell type osascript /users/<your computer's name>/geektool/position.scpt. You can edit the script in script editor to change the output symbol (it can be > or - or l or whatever you want) and the output length (mine is set at 40 characters).

EDIT:::Oh, and I created the little box around the meter using the echo command in geektool.
 
Very cool Setup!!

Any chance of getting to see the final script you used for the weather? or tips on making it work?

First of all, you need to have up-to-date perl libraries. You can google that to find out how. Second, what you see comprises many different scripts, each one gives a specific output, e.g., one for sunrise, one for wind speed, one for tomorrow's high, etc. What's important and what was getting a lot of people confused is that you need the entire path/to/script in geektool under shell before you put your desired modifier. So, for example, if I wanted to display the time of sunset, I would put 'Users/<my computer's name>/bin/yweather-dir/yweather.pl -ss', where ss is the command for that output.

Let me know if you have any more questions.
 
the title of the script is fans.sh. Make a new folder at /Users/<your computer's name>/geektool and stick it in there. Make fans.sh executable (in terminal type 'chmod +x /path/to/script'). You will find another file in the package called smc.custom. Stick it in the geektool folder you just created. Now go to geektool and under shell type the path to the fans.sh script and you should be good to go.

For the itunes meter, it's called position.scpt. Stick it in the same geektool folder and then in geektool under shell type osascript /users/<your computer's name>/geektool/position.scpt. You can edit the script in script editor to change the output symbol (it can be > or - or l or whatever you want) and the output length (mine is set at 40 characters).

EDIT:::Oh, and I created the little box around the meter using the echo command in geektool.

When you say, stick it in folder, it can be somewhere like /Users/Bean/Desktop/Random/Geektool/position.scpt?
What do you mean <your computers name>, just the path to the script right? Because, I can't get either to work...
 
When you say, stick it in folder, it can be somewhere like /Users/Bean/Desktop/Random/Geektool/position.scpt?
What do you mean <your computers name>, just the path to the script right? Because, I can't get either to work...

Remember to make all files executable, including smc.custom. (chmod +x path/to/script in terminal).

I suppose you can stick them anywhere, though I found it useful to make a new folder in my home directory called geektool, partially because some of the scripts in that package have strings in them that refer to this directory (though neither of the ones you are trying to get to work.).

Yes, I meant the path to the script. Remember to put "osascript path/to/script" when you are trying to get apple scripts to work in geektool.

There's a lot of stuff to help you on the site you downloaded them from. Refer to the comments, as well as the readme documentation that came in the package.
 
Remember to make all files executable, including smc.custom. (chmod +x path/to/script in terminal).

I suppose you can stick them anywhere, though I found it useful to make a new folder in my home directory called geektool, partially because some of the scripts in that package have strings in them that refer to this directory (though neither of the ones you are trying to get to work.).

Yes, I meant the path to the script. Remember to put "osascript path/to/script" when you are trying to get apple scripts to work in geektool.

There's a lot of stuff to help you on the site you downloaded them from. Refer to the comments, as well as the readme documentation that came in the package.

I got the iTunes meter to work no problem, but the fan speeds just won't work. I stored both fan.sh and smc.custom in the same folder, made them both executable and then in Geektool (Shell) osascript /path/to/script/fans.sh and it just won't work. Nothing appears. When I click on the raw file of fans.sh it opens a very short document in text edit. Is this correct?
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.