Offensive Thinking
Internet Thoughtcrime
New snippets on github: alarm and bitify
Posted: 2010-03-21
I’ve added two more scripts to my github snippets repository that you may find useful. I use them quite frequently.
bitify
I know, I’m all creative with names, aren’t I ;)? This little script, basically a one-liner, uses bit.ly to shorten a URL on the command line. Because, you know, I hate leaving the command line. Web interfaces are for WIMPs. Together with twidge, it enables me to use twitter and identi.ca from the shell.
alarm
I searched for a good solution to the following problem for quite some time: I am notoriously forgetful. So, besides my trusty remind, I was in search for a simple command line tool to pop up a message at a certain time. Sounds easy, doesn’t it? Well, the problem is the “command line” part. Sure, you can just use the “at” command, but I wanted a popup box, not a message in a terminal I may already have forgotten about.
Fortunately, remind implements something called “daemon mode”. It allows you to run a remind instance in the background, triggering arbitrary commands at a certain time. Perfect. All I needed was a simple script to allow me to conveniently add reminders to the file watched by remind. That’s how alarm was born.
Alarm messages take either an absolute or a relative time and a message. Examples:
alarm ‘12:00 Prepare dinner’
alarm ‘30m Dinner is ready’
I start the remind daemon in my xmonad.hs file as follows:
remind -z ‘-k zenity —info —text=“%s” &’ ~/.alarm_reminders
This pops up a nice message box with zenity when an alarm is due.