This post originated from an RSS feed registered with Ruby Buzz
by James Britt.
Original Post: A Simple Hack for Getting Things Done
Feed Title: James Britt: Ruby Development
Feed URL: http://feeds.feedburner.com/JamesBritt-Home
Feed Description: James Britt: Playing with better toys
I'm not remarkably organized, but I'm much better than I was a year or so ago. independent contracting and consulting, plus being being part of a start-up, provides remarkable motivation to up the org skills.
I had been using Outlook as my calender application for some time, and while it does not use a nice, open, easily hacked text-file format, I liked (or got used to) the behavior, the UI, and assorted little details. Plus, I found it fairly easy to write some Ruby helper apps to manipulable entries.
However, since getting a new laptop, I've been trying to make peace with Sunbird. While it uses an open file format, I've yet to write anything as handy as my Outlook apps.
I tend not to keep too many applications running all the time, prefer to conserve CPU for actual development effort. I run Thunderbird every so often, but close it down after half an hour. With a calender app, though, I need to have up in order to have alarms pop up, so I use task scheduler to run to ten minutes before each hour. But to ad a new alarm means launching the app if it is not already running, and all sorts of clicking and typing.
Mostly this is tolerable, especially if I expect to be altering the task reminder and resetting the alarm. Often, though, I simply want something to pop up and tell it is time to do this or that (such as watch something in Book TV).
Despite being on WinXP, I spend much time suing the cmd shell, so I concocted a Ruby script that would write a little note, then use the at command to schedule the note to pop up at a given time. Now can easily (again) type remainders to myself at the command line, making it less likely I will forget to do something.
# File hey.rb
#
# First, simple help:
def help
puts "Need to pass a time and a message:"
puts " d:\> hey 13:30 This is my message"
puts " or some minutes and a message:"
puts " d:\> hey 15 This is my message"
puts "But if you leave out a time then it defaults to 60 minutes into the future"
exit
end
help unless ARGV.size > 1
# Grab what is probably the time data
t = ARGV.shift
# But munge stuff if doesn't meet some criteria
if t =~ /\d/
unless t =~ /:/
t = Time.new + ( t.to_i * 60)
t = "#{t.hour}:#{t.min}"
end
else
ARGV.unshift "#{t}"
t = Time.new + (60*60)
t = "#{t.hour}:#{t.min}"
I make no claims that this is the best way to do this sort of thing, but it was easy and it works.
BTW, one thing that was not obvious to me was the need to use the /INTERACTIVE switch. It seems that without that switch the commands will execute, but you never see anything, which is first puzzling, then useless.