A while ago, I wrote down a list of clever life rules in my day-to-day notebook. One of them was "don't poll". To say a bit more about it, don't spent time waiting for things to finish and checking them constantly.

A more concrete example: I find myself running terminal commands that take ~5 minutes, and then wasting ~5 minutes watching them. This is pretty stupid. So what I have started doing instead is run something like

$ some_long_command
[ ... scroll scroll scroll ... ]
[ ... waiting for it to finish ... ]
[ ... give up ... ]
terminal-notifier -message "some_long_command done"
[ ... go do something else ... ]

Then, later I see a notification: notification for finally done

Another one: If I set up a long running command and know when it should finish, I can also fire off something like

at 1:05 << EOF
terminal-notifier -message "hit 1:05 ETA for XXX being done"
EOF

which will fire off a message at 1:05 to remind me to check in on it.

In fact, this is such a useful pattern that I wrote a small script around it:

#!/bin/sh
# remindat time message
TIME=$1
shift
MESSAGE=$*
at ${TIME} <<EOF
terminal-notifier -message "${MESSAGE}"
EOF

so now I can just run

remindat 1:05 hit 1:05 ETA for XXX being done

(Note: For the at command to work, I had to run:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist

after adding my username to /var/at/at.allow.)

Finally, iterm2 includes triggers that can run a command when it observes text matching a text. iterm2 notification screen This is great!