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.
Finally!! Cheers mate!

Here is my script for the DOW, works fine.

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'

Output is:
DOW: 10,388.90 +22.75 (0.22%)

Just modify the URL and the label at the end for other stocks, and you're good to go.
 
Interesting - I copied and pasted this verbatim right into geektools ver. 3 running on a MacPro. It works w/o chmod. See attached screenshot.

OK, you're right, that works too... :)

Well, in fact there are 2 ways to run a script:

1. Put a "#!/path/to/interpreter" line at the top of the script (also known as the shebang line) and run the script itself on the command line with "./script" or something like "~/bin/script". Everything after the #! line will then be processed by the interpreter. But then you have to make the script executable with chmod +x

2. Or: run the interpreter on the command line and feed it the script file as an argument. For example: "/usr/bin/ruby calscript.rb" or even "ruby calscript.rb" if /usr/bin is in your PATH environment variable. Then there's no need to make the script executable. And you could also leave out the "#!/usr/bin/ruby" line, because that won't be used (the interpreter is already running, so the #! line is just comment).

In your screenshot I can see you are using scenario 2, and that works perfectly. I mostly use scenario 1, because I'm too lazy to type things like "ruby scriptname" all the time :)
 
Just remember - continuously pinging Google for stock data will trigger their servers to block your IP. So watch your refresh rate settings in the GeekTools scripts.

Always good to keep that in mind. I have my stock refreshes set at 1 hour, and weather refreshes set for 1 hour too.
 
spent way too long doing this

screenshot20091205at225s.jpg
 
I know what you mean. The first couple of nights fiddling with GeekTool was fun, but it kept me awake far too long and away from other stuff I should have been doing instead.

What are those icons? I really like them.

xpack, pretty extensive if you wanna go all out, i just use them for those 3
 
dontpanic,

I am going to hijack this thread
just for a moment.

I have been a Mac user for the
past three years but never thought
about changing my icons.

Using that pack you recommended
in the post above, what is the easiest
method for changing icons in Mac?
 
candybar, if you're doing a lot and want to change system icons

if you're just doing a single folder/drive, which is how i did it, you can right click ---> get info on the icon you want to use, and then click the icon in that pane, and copy it, then go to the icon you want to replace, get info again, click the icon and paste

maybe paste the icon you're replacing onto a new folder and save it somewhere in case you want to change it back
 
Upgrade

Upgraded to geektool 3 and now a couple of shells do not work.
Code:
[COLOR="Red"]Memory[/COLOR]
top -l 1 | awk '/PhysMem/ {print "Memory Used: " $8}'
top -l 1 | awk '/PhysMem/ {print "Memory Inactive:  " $6+$10"M"}'
and
Code:
[COLOR="Red"]IPAddresses[/COLOR]
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 en1 | 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"
Any help would be appreciated. These worked in previous version of Geektool.
 
Upgraded to geektool 3 and now a couple of shells do not work.
Code:
[COLOR="Red"]Memory[/COLOR]
top -l 1 | awk '/PhysMem/ {print "Memory Used: " $8}'
top -l 1 | awk '/PhysMem/ {print "Memory Inactive:  " $6+$10"M"}'
and
Code:
[COLOR="Red"]IPAddresses[/COLOR]
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 en1 | 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"
Any help would be appreciated. These worked in previous version of Geektool.
I plugged all those scripts into my MacPro OS 10.6.2 w/ geektools ver. 3.0RC5 Build 116.

Works great.
 
I plugged all those scripts into my MacPro OS 10.6.2 w/ geektools ver. 3.0RC5 Build 116.

Works great.

I thought they would too, but I paste the code in the geeklet and it just displays nothing. Then I think they are working as I have the same Geektool.
Upddate: Tried it and it worked now. Quirk.
 


can someone tell me give me the script to the forecast he has?

I cannot seem to find a CPU usage script that works either, any help? I like the one he has on here up in the right corner.
im still pretty new to this so no hate ppl :D. thanks
 
can someone tell me give me the script to the forecast he has?
Search that that person made and ye' shall find that it is a Yahoo Widget and not a geektool script.

I cannot seem to find a CPU usage script that works either, any help? I like the one he has on here up in the right corner.
im still pretty new to this so no hate ppl :D. thanks
Detailed that a few posts back. Reformat it to make it one line if you like.
https://forums.macrumors.com/posts/8911211/
 
I still can not get a simple clock script to work ):

Can anyone help me please?

Using terminal run the command: date

Your output will be something like:
Sun Dec 6 23:05:31 EST 2009

The awk space-delimited values for the above output are:

$1 --> Sun
$2 --> Dec
$3 --> 6
$4 --> 23:05:31
$5 --> EST
$6 --> 2009

In geektools run this shell script:

Code:
date | awk '{print $2," ",$3}';
And get this output:
Dec 6

Modify and format to your needs.

Here is another variant (to show the power of the sub command):

Code:
date |  awk '{
sub("Jan","JANUARY",$2);
sub("Feb","FEBRUARY",$2);
sub("Mar","MARCH",$2);
sub("Apr","APRIL",$2);
sub("May","MAY",$2);
sub("Jun","JUNE",$2);
sub("Jul","JULY",$2);
sub("Aug","AUGUST",$2);
sub("Sep","SEPTEMBER",$2);
sub("Oct","OCTOBER",$2);
sub("Nov","NOVEMBER",$2);
sub("Dec","DECEMBER",$2);
print $2" "$3", "$6}';
This will get you:
DECEMBER 6, 2009


EDIT: Ahh- you wanted clock, not date.....sorry.
 
Clock - use one of the following:

Code:
date +"%I:%M"%p
Gives--> 11:46PM

Code:
date +%l:%M
Gives--> 11:46

Code:
date '+%H:%M:%S'
Gives--> 23:46:55

Code:
date '+%H:%M'
Gives--> 23:46
 
Using terminal run the command: date

Your output will be something like:
Sun Dec 6 23:05:31 EST 2009

The awk space-delimited values for the above output are:

$1 --> Sun
$2 --> Dec
$3 --> 6
$4 --> 23:05:31
$5 --> EST
$6 --> 2009

In geektools run this shell script:

Code:
date | awk '{print $2," ",$3}';
And get this output:
Dec 6

Modify and format to your needs.


It might be easier to use the 'date' command itself, there are many formats to display the date and/or time any way you want.

For example:
Code:
date "+%b %e"
# Gives: Dec  7

date "+%A %d %B %T"   
# Monday 07 December 06:55:56  

date +%v   
# 7-Dec-2009 (Quotation marks are only needed when there are spaces in the format)

The complete list of formats can be found in the strftime manual:
Code:
man strftime

...<blah blah>...

     %A    is replaced by national representation of the full weekday name.
     %a    is replaced by national representation of the abbreviated weekday name.
     %B    is replaced by national representation of the full month name.
     %b    is replaced by national representation of the abbreviated month name.
     %C    is replaced by (year / 100) as decimal number; single digits are preceded by a zero.
     %c    is replaced by national representation of time and date.
     %D    is equivalent to ``%m/%d/%y''.
     %d    is replaced by the day of the month as a decimal number (01-31).

...<about the rest of the alphabet>...
 
Wow Thank you so much Ive been trying to get the Image since last night. OMG. All for trying to make my desktop look cool. Your script worked for me! <3 :D

I created a 'shell' that gets the weather picture:

curl --silent "http://weather.yahoo.com/spain/valencia/elx-759880/" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /var/tmp/weather_test.pngxargs curl --silent -o /var/tmp/weather.png

An then an 'image' that displays the weather picture on the desktop

file://localhost/var/tmp/weather.png

You will need to change the URL (http://weather.yahoo.com/spain/valencia/elx-759880/) so that it gets weather in your location.
 
Help with script

I´m really new to this.. :)

Is there anyone that like to help me to extract METAR´s and TAF´s from these to sites. I´ve tried to figure out how to do it my self but.. well, I don´t have a clue!

METAR and TAF and of course select just the ones o need..

Thanks alot guys!

/Barvid
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.