- Random character
- Using AppleScript (by Flip)
- Using shell
- Using Perl* (by Brandon)
- Twitter feeds
- Friends timeline
- Search query
- Calendar
- Simple Calendar
Random character¶
Get a random character to be used with a fancy/dingbats font as ornament
Using AppleScript (by Flip)¶
-- Save as script and call from GeekTool with "osascript path_to_the_script" set ls to "abcdefgh" -- characters to use (find them in TextEdit using the font you want then copy/paste) set n to count items of ls set theSeed to do shell script "head -n 1 /dev/random" set x to random number from 1 to n with seed theSeed return (item x of ls)
Using shell¶
echo "\x@echo \"obase=16;$((25*$RANDOM/32767+97))\"|bc@"
Ok... mmm... This one may require some explanation :-)
This one returns a lowercase letter from a to z.
97 refers to the first ascii code you want (see man ascii)
25 is last ascii code - first ascii code (that is last ascii code - 97)
Using Perl* (by Brandon)¶
perl -e '@a=qw(a b c d e);print $a[rand($#a)]'
Twitter feeds¶
Friends timeline¶
curl --basic --user user:password http://twitter.com/statuses/friends_timeline.rss 2> /dev/null | grep title | sed 's/.*<title>//;s/<\/title>//' | perl -MHTML::Entities -ne 'binmode(STDOUT, ":utf8");print decode_entities($_)'
Search query¶
curl --basic http://search.twitter.com/search.atom?q=geektool 2> /dev/null | grep title | sed 's/.*<title>//;s/<\/title>//' | perl -MHTML::Entities -ne 'binmode(STDOUT, ":utf8");print decode_entities($_)'
Calendar¶
Simple Calendar¶
Change the LANG to suit your locale (get it in terminal by typing "echo $LANG")export LANG=fr_FR;cal | sed "s/ $(date +%e) / $(echo '\033[40m\033[1;31m')$(date +%e)$(echo '\033[0m') /"Alternatively, you can mark the current day this way (by Chris Ferrara) :
export LANG=fr_FR;cal | sed "s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed 's/./#/g') /"