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 have a good 18 shell geeklets running, plus 3 image geeklets (and almost 10 "sleeping"). geektool's been running for 3 days straight. even when i update them all at the same time, its doesnt go gigher than 125 MB of real memory... so on my side, 20+ geeklets : 125 MB.
all depends how you use them i guess...

Interesting.

I've since restarted GeekTool. It's only been about an hour but it's now holding steady at just over 60MB real mem.

No idea what caused it to jump to over 1.4GB...
 
Interesting.

I've since restarted GeekTool. It's only been about an hour but it's now holding steady at just over 60MB real mem.

No idea what caused it to jump to over 1.4GB...

I looked at this memory used a bit more.

With Activity Monitor open, I killed GeekTool ("GT") and restarted it. I'm on my home machine now (before I was @ work w/ a different GT setup) and GT is using ~ 46MB real mem after having initially opened the GT prefs and closing it. If I then subsequently re-open the GT prefs and close them -- and repeat this a number of time (i.e. when working on geeklets) -- the amount of real mem consumed will climb. Try it: 1) open Activity Monitor, 2) open Sys prefs, 3) click GT, 4) click Show All to close the GT prefs, 5) repeat 3 and 4 a number of times and see the real mem increase.

You can also make the real mem it skyrocket by 1) opening the GT prefs, 2) click on, say, your desktop or some other app to move the focus from GT to that app, 3) click on the GT prefs window to focus it again, 4) repeat 2 and 3 a number of times.

So long story short, once a user has all his geeklets set up, its wise to restart GeekTool to release any unnecessarily consumed memory.
 
I figured I'd make a python script that does this easily, that way you don't have to worry about piping everything to sed multiple times.

Save the following code as "myepisode_feedgrabber.py" and do a chmod +x on the file to make it executable.
Code:
#!/usr/bin/env python

# MODULE IMPORTS
import xml.dom.minidom
import re

# GET THE FEED - UPDATE TO CMD LINE ARGUMENT
# BE SURE TO HAVE THE URL REDIRECT THE URL FROM THE COMMAND LINE WITH 
# THE FOLLOWING COMMAND
# curl --silent "url goes here in quotations or else it won't work" > /tmp/geektool/myepisode_feed.xml
dom = xml.dom.minidom.parse("/tmp/geektool/myepisode_feed.xml")

# LIST TO HOLD ALL THE EPISODES
episodes = []

# INLINE FUNCTIONS - DON'T FEEL LIKE CLASSING THIS UP
def getText(nodelist):
    rc = []
    for node in nodelist:
        if node.nodeType == node.TEXT_NODE:
            rc.append(node.data)
    return ''.join(rc)

def handleChannel(channel,episodes):
    items = channel.getElementsByTagName("item")
    handleToc(items,episodes)

def handleToc(items,episodes):
    for item in items:
        # GET THE TITLE TAG FROM THE CURRENT ITEM
        title = item.getElementsByTagName("title")[0]
        # GET THE TITLE DATA FROM THE TITLE TAG
        tmp = getText(title.childNodes)
        # REGULAR EXPRESSIONS TO REMOVE THE [ AND ] AND REPLACE WITH ,
        tmp = re.sub(" \]\[ ",",",tmp)
        tmp = re.sub("\[ ","",tmp)
        tmp = re.sub(" \]","",tmp)
        # APPEND A LIST OF 4 ITEMS TO THE EPISODE LIST
        episodes.append(tmp.split(","))

# HANDLE THE XML
handleChannel(dom,episodes)

# PRINT OUT THE SHOWS
for i in range(len(episodes)):
    # WHAT EACH PORTION OF THE EPISODE LIST MEANS
    #  - episode[i][0] = SHOW NAME
    #  - episode[i][1] = SHOW SEASON AND EPISODE NUMBER
    #  - episode[i][2] = EPISODE TITLE
    #  - episode[i][3] = AIR DATE
    # THE PRINT STATEMENT IS TOTALY CUSTOMIZABLE
    # PRINT OUT SHOW TITLE AND EPISODE NAME
    print episodes[i][0] + ' - "' + episodes[i][2] + '"'

In the Geektool shell, add the following code, but replace everything in quotes with your URL:
Code:
curl --silent "url goes here in quotations or else it won't work" > /tmp/geektool/myepisode_feed.xml; 
python /path/to/the/script/myepisode_feedgrabber.py

Make sure you create a folder in /tmp called geektool as this is where the redirect and python script send/look for the xml file.

Attached is a screen grab, disregard the fact that is shows "Desperate Housewives", I picked a show that I knew would be on tomorrow when I did the myepisodes demo for the Tomorrow RSS feed.

No problem!

I have run into one issue with how I use the /tmp directory. Sometimes (but not always) the /tmp/geektool directory gets deleted upon power cycle, so you may have to go re-create it.

Regular expressions are great to use for simple parsing; but it seems to me that new users to Geektool, that have no experience with the command line, get confused easily. A one off script that does exactly what you need is far easier to maintain then a ton of commands being piped to each other.

Hey, that's me!!

I was wondering if someone could help me out with this. I've put everything together as described. What I don't know is where to find the "/tmp directory" and where it says "url goes here in quotations or else it won't work" is that URL "http://myepisodes.com/frontpage.php"?

Thanks
 
so ive been going through these pages looking for a script on how to do the time in written form(ten thirty instead of 1030) but so far i havent found it. does anyone have the code? thanks :)
 
i have a good 18 shell geeklets running, plus 3 image geeklets (and almost 10 "sleeping"). geektool's been running for 3 days straight. even when i update them all at the same time, its doesnt go gigher than 125 MB of real memory... so on my side, 20+ geeklets : 125 MB.
all depends how you use them i guess...


Do you have your scripts to share? I wish there was a way to export everything and the style that people have to easily share these things. Thanks
 
So here is my screenshot of what I have. I just started using this app today. Man it is nice so far.

239686237.png


Today event and new mail works just did not have any at the time of screenshot.
 
Do you have your scripts to share? I wish there was a way to export everything and the style that people have to easily share these things. Thanks

could you be more specific? :p

here are the scripts i have:
- 2 icalBuddy, 1 reuters news feed, 1 day in history feed, 1 battery info, 1 time machine last backup, 1 trash/downloads info, 1 airport/HD info, 1 uptime, 1 in/out speed, 2 weather info, 1 weather image, 2 personal images (school schedule and me and my girlfriend), 2 itunes and 2 calendars. all the white line are empty shell scripts with white background.

thats about it! :)
 
Hey, that's me!!

I was wondering if someone could help me out with this. I've put everything together as described. What I don't know is where to find the "/tmp directory" and where it says "url goes here in quotations or else it won't work" is that URL "http://myepisodes.com/frontpage.php"?

Thanks

Going to make it simple so you don't have to create the directory in /tmp.

Update the Python code to the following:
Replace this line
Code:
dom = xml.dom.minidom.parse("/tmp/geektool/myepisode_feed.xml")
with
Code:
dom = xml.dom.minidom.parse("/tmp/myepisode_feed.xml")

Update the geeklet command to the following:
Code:
curl --silent "url goes here in quotations or else it won't work" > /tmp/myepisode_feed.xml; 
python /path/to/the/script/myepisode_feedgrabber.py

The "url goes here in quotations or else it won't work" is your myepisode RSS Feed url.
/path/to/the/script/ is where ever you saved the python file.

You need to make the script executable by opening up the Terminal, and changing the directory to the location of the Python file
Code:
# cd /path/to/the/script
# chmod +x myepisode_feedgrabber.py
 
SBMMR,
I was considering doing the same or at-least playing around with the idea. I ran across the following site the other day, but haven't had a chance to fiddle with it. Please post if it works out for you. http://tomgeerts.wordpress.com/

xtacocorex,
Thanks. I'll give this a shot, just got in.

I found BatChmod yesterday to Chmod the file, but I'll take the Terminal route that you posted.
 
could you be more specific? :p

here are the scripts i have:
- 2 icalBuddy, 1 reuters news feed, 1 day in history feed, 1 battery info, 1 time machine last backup, 1 trash/downloads info, 1 airport/HD info, 1 uptime, 1 in/out speed, 2 weather info, 1 weather image, 2 personal images (school schedule and me and my girlfriend), 2 itunes and 2 calendars. all the white line are empty shell scripts with white background.

thats about it! :)

Are you willing share your scripts or a link to where I could see them?
 
i looked at the link, and i was messing something up with it, but i couldnt get it to work, so when i looked up more infor on geeklets(only my first day using geek tool) i did end up coming across this, and it worked. http://www.macosxtips.co.uk/geeklets/system/display-time-in-words-fuzzy-clock/


SBMMR,
I was considering doing the same or at-least playing around with the idea. I ran across the following site the other day, but haven't had a chance to fiddle with it. Please post if it works out for you. http://tomgeerts.wordpress.com/

xtacocorex,
Thanks. I'll give this a shot, just got in.

I found BatChmod yesterday to Chmod the file, but I'll take the Terminal route that you posted.
 

Attachments

  • Screen shot 2011-02-11 at 5.56.32 PM.png
    Screen shot 2011-02-11 at 5.56.32 PM.png
    1 MB · Views: 439
haha, oh dear. i was being a complete muppet. i was pasting in the "Date: code" bit as well, i didnt realise they were just there for reference purposes. Thank you for your help! Is much appreciated!
One other quick think while im here.. how would i get it to say "Time:" before the time? because at the moment it just says 22:59. Thanks!


echo Time: ;
 
echo Time: ;
or just check Overwrite text: and write time... works both ways...

Are you willing share your scripts or a link to where I could see them?
well, asking me which ones you wanted would of been easier, but i guess ill put all of them here... and my only source is the last 50 or so pages of this thread...

iCal 1 (top left):
Code:
/usr/local/bin/icalBuddy -f -sd -b "" -ss "" -eep url -sed -ic "X","Y","Z","W" -tf %H:%M eventsToday+2 | sed -e "s/*/--/" | sed -e "s/!/!!/"
iCal 2: (school calendar, bottom right)
Code:
/usr/local/bin/icalBuddy -f -sd -nc -b "" -eep url,notes -ic "V" -tf %H:%M eventsToday+1 | sed -e "s/*/--/" | sed -e "s/!/!!/"
for the images, ones modified in photoshop (right) and my school schedule was made with preview (instant alpha to erase the white then annotate)
iTunes scripts: in geektool:
Code:
osascript /Users/PATH/TO/SCRIPT/iTunes.scpt
in applescript editor: this one gives the name of the song on one line, artist another line, and nothing when itunes off/pause.
Code:
on run
	set newline to ASCII character 10
	set info to ""
	tell application "System Events"
		set num to count (every process whose name is "iTunes")
	end tell
	if num > 0 then
		tell application "iTunes"
			if player state is playing then
				set who to artist of current track
				set what to name of current track
				set onwhat to album of current track
				set stars to (rating of current track) / 20 as integer
				set info to (what & "
" & who)
			end if
		end tell
	end if
	return info
end run
in ASE, itunes 2: gives random info.
Code:
set displayLogic to "enhanced alt2"

tell application "System Events"
	set powerCheck to ((application processes whose (name is equal to "iTunes")) count)
	if powerCheck = 0 then
		return "✖"
	else
		
		-- This section moved to avoid launching iTunes when the script is run.		
		tell application "iTunes"
			try
				set playerstate to (get player state)
			end try
			if playerstate = paused then
				set trackStatus to "❚❚ "
			else
				set trackStatus to "▶ "
			end if
			
			try
				set trackID to the current track
				set trackplaylist to name of current playlist
				set trackName to the name of trackID
				set artistName to the artist of trackID
				set albumName to the album of trackID
				set tracktime to the time of trackID
				set trackplaycount to the played count of trackID
				set ratetrack to the rating of trackID
				if ratetrack < 20 then
					set trackrating to "☆"
				else
					if ratetrack < 40 then
						set trackrating to "★"
					else
						if ratetrack < 60 then
							set trackrating to "2★"
						else
							if ratetrack < 80 then
								set trackrating to "3★"
							else
								if ratetrack < 100 then
									set trackrating to "4★"
								else
									set trackrating to "5★"
								end if
							end if
						end if
					end if
				end if
				--set trackdur to the duration of trackID
				--set trackdur to round {trackdur}
				--set trackskip to the skipped count of trackID
				
				
				if displayLogic = "enhanced alt2" then
					if playerstate = paused then
						if albumName = "" then
							set displaymain to trackName & " | " & artistName
						else
							set displaymain to trackName & " | " & artistName & " | " & albumName
						end if
					else
						if albumName = "" then
							set displaymain to "(" & tracktime & ") | " & trackrating & " | " & trackplaycount & "x" & " | " & trackplaylist
						else
							set displaymain to albumName & " | (" & tracktime & ") | " & trackrating & " | " & trackplaycount & "x" & " | " & trackplaylist
						end if
					end if
				else
					set displaymain to trackStatus & " " & trackName & " | " & artistName
				end if
			on error
				if playerstate = stopped then
					set trackStatus to "◼"
				end if
				
			end try
		end tell
	end if
end tell
reuters feed:
Code:
curl --silent http://feeds.reuters.com/reuters/topNews.rss > /tmp/news_feed.xml;
one day in history feed:
Code:
curl http://www.infoplease.com/rss/dayinhistory.rss | grep CDATA | sed -e 's/\(.*\[\)//' -e 's/\].*//'
trash/downloads info:
Code:
du -sh ~/.Trash/ | awk '{print "Trash: " $1}'
du -sh ~/Downloads/ | awk '{print "Dwnlds: " $1}'
airport IP + HD info:
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}'`

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

#Uptime, Ram, HDD
 df -Hl | grep 'disk0s2' | awk '{print $4"/"$2" free ("$5")"}'
# 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}'
uptime info:
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 $3$4$5$6}'
in/out speed:
Code:
#!/bin/sh
# created by chris helming.
# chris dot helming at gmail

# get the current number of bytes in and bytes out
myvar1=`netstat -ib | grep -e "en1" -m 1 | awk '{print $7}'` #  bytes in
myvar3=`netstat -ib | grep -e "en1" -m 1 | awk '{print $10}'` # bytes out

#wait one second
sleep 1

# get the number of bytes in and out one second later
myvar2=`netstat -ib | grep -e "en1" -m 1 | awk '{print $7}'` # bytes in again
myvar4=`netstat -ib | grep -e "en1" -m 1 | awk '{print $10}'` # bytes out again

# find the difference between bytes in and out during that one second
subin=$(($myvar2 - $myvar1))
subout=$(($myvar4 - $myvar3))

# convert bytes to kilobytes
kbin=`echo "scale=2; $subin/1024;" | bc`
kbout=`echo "scale=2; $subout/1024;" | bc`

# print the results
echo "In: $kbin kb/s"
echo "Out: $kbout kb/s"
the vertical calendar is actually 2 geeklets:
Code:
/Users/PATH/TO/SCRIPT/vertical_calendar_with_gap.sh
and the 2 scripts:
Code:
#!/bin/bash
calendar=`cal`
heute=`date +%e`
if [ "$heute" -lt 10 ]; then
	heute=${heute:1:1}
fi
monat=`date +%m`
jahr=`date +%Y`
for (( i=1; i<10; i++ )); do
	if [ "$i" -eq "$heute" ]; then
	echo -ne `date -j $monat'0'$i'0405'$jahr +%a`
	echo -ne "  "
	echo $i
	exit
	else
	echo " "
	fi
done
for (( i=10; i<=${calendar:(-2)}; i++ )); do
	if [ "$i" -eq "$heute" ]; then
	echo -ne `date -j $monat$i'0405'$jahr +%a`
	echo -ne " "
	echo $i
	exit
	else 
	echo " "
	fi
done
Code:
#!/bin/bash
calendar=`cal`
heute=`date +%e`
if [ "$heute" -lt 10 ]; then
	heute=${heute:1:1}
fi
monat=`date +%m`
jahr=`date +%Y`
for (( i=1; i<10; i++ )); do
	if [ "$i" -eq "$heute" ]; then
	echo "		"
	else
	echo -ne `date -j $monat'0'$i'0405'$jahr +%a`
	echo -ne "		"
	echo $i
	fi
done
for (( i=10; i<=${calendar:(-2)}; i++ )); do
	if [ "$i" -eq "$heute" ]; then
	echo "		"
	else 
	echo -ne `date -j $monat$i'0405'$jahr +%a`
	echo -ne "		"
	echo $i
	fi
done
2 days weather forecast:
Code:
curl  "http://weather.yahooapis.com/forecastrss?p=CAXX0301&u=c" | grep -e "Forecast:" -A 3 | tail -n 3 | sed -e 's/<br \/>//' -e 's/<BR \/>//' | sed "s/\(.*\)\.\ \(.*\)/\1\?\2/" | tr "?" "\n" | sed "s/High\:\ \(.*\)\ Low\:\ \(.*\)/\?H\: \1\  L\:\ \2/" | sed "s/\?\(.*\)/\\1/"
actual weather:
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>//'
weather image in 2 (one shell, one image)
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\
applescript for the "new mail" thing on my menu bar corner
Code:
tell application "System Events" to set iCalIsRunning to (name of processes) contains "Mail"
set finalText to ""
if iCalIsRunning then
	tell application id "com.apple.mail"
		set unreadCount to (get unread count of inbox)
		if unreadCount = 1 then
			set finalText to "①"
		else if unreadCount = 2 then
			set finalText to "②"
		else if unreadCount = 3 then
			set finalText to "③"
		else if unreadCount = 4 then
			set finalText to "④"
		else if unreadCount = 5 then
			set finalText to "⑤"
		else if unreadCount > 5 then
			set finalText to "∞"
		else
			set finalText to ""
		end if
	end tell
end if
almost forgot my battery info:
Code:
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf ("%.1f%%", $10/$5 * 100)}'
thats about it for the scripts i currently use. i have a few more sleeping. the fonts are either helvetica neue (itunes), delicious small caps (ical) or mentone (system info + news)

oh yeah, sorry for the long post. but its a good sum up of a lot of scripts. ask me if you have any questions.
 
Codes that contain "/tmp"

I was hoping to fix this today. It seems that any code I attempt to use that contains "/tmp" won't work on my machine. What do I need to set up, install, etc. in order to make this folder work for me? I'd rather fix it than find ways around it.

Thanks for any help.
 
Last edited:
I wish there was a way to export everything and the style that people have to easily share these things. Thanks

Like a file that spelled out the color, font, desktop dimensions, geeklet size,content, and screen position, all in one package? That would be very cool. Not only for sharing, but also quickly getting a new mac set up, or for quickly trying out various arrangements with different wallpapers.

We can export geeklets now, but some kind of Geektool "theme" editor/applier would be nice too.
 
brenm666,
Thanks for the scripts. I tried your "reuters feed:" and because I have a /tmp folder problem I changed the path to another folder. In that folder I see the "news_feed.xml" file updating and even opened it and saw the latest news, but it doesn't show on the desktop. Any clue why it's not showing up?
 
I was hoping to fix this today. It seems that any code I attempt to use that contains "/tmp" won't work on my machine. What do I need to set up, install, etc. in order to make this folder work for me? I'd rather fix it than find ways around it.

Thanks for any help.

That's odd as /tmp is a system folder. You could always change /tmp to somewhere else in my codes, it could be a random folder in your users folder.
 
Like a file that spelled out the color, font, desktop dimensions, geeklet size,content, and screen position, all in one package? That would be very cool. Not only for sharing, but also quickly getting a new mac set up, or for quickly trying out various arrangements with different wallpapers.

We can export geeklets now, but some kind of Geektool "theme" editor/applier would be nice too.

pretty sure thats what "export" does (top of the properties window). never actually thought about exporting mines... i might do a compressed folder with a bunch of them someday... maybe.

brenm666,
Thanks for the scripts. I tried your "reuters feed:" and because I have a /tmp folder problem I changed the path to another folder. In that folder I see the "news_feed.xml" file updating and even opened it and saw the latest news, but it doesn't show on the desktop. Any clue why it's not showing up?

try this on terminal, then go on your HD in finder.
Code:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
there should be a folder name "tmp". if its not, i guess i would try creating a ".tmp" folder (the dot makes it hidden), but i really dont know if this would work, since i havent tried it. to be sure, just create a random hidden folder (.geektool) and the only thing youre gonna have to do is change your geeklets scripts. (edit: decided to try just for the hell of it. here's how youre suppose to do it.)

to hide the files, same code, but with FALSE instead of TRUE

one last thing, i forgot to thank all the people writing the codes (like xtacocorex for example... :p ) the only thing i do is basically copy/paste for most of them...
 
Last edited:
heres what i did last night... same scripts than my last one, just another picture.
 

Attachments

  • Screen shot 2011-02-14 at 6.35.55 PM.jpg
    Screen shot 2011-02-14 at 6.35.55 PM.jpg
    146.1 KB · Views: 687
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.