November 10, 2010
Keep trying till you succeed with Bash

The following Bash snippet will repeat a command with the given delay until it succeeds.

while [ "$?" -gt "0" ] ; do
    sleep 120 # delay in seconds between retries
    # insert command to retry here
done

Unix processes return integers when they exit. These values can be read via $? in Bash. As a matter of convention, a process that completes without errors will return 0, so by checking for exit codes greater than zero we can detect errors and retry.

4:18pm  |   URL: http://tumblr.com/Zn_4by1Rb4ez
  
Filed under: bash cli 
October 24, 2010
Click on album art.
⌘-W main window.
Pretend iTunes is a minimalist music player.

  1. Click on album art.
  2. ⌘-W main window.
  3. Pretend iTunes is a minimalist music player.

October 23, 2010
Secure delete with rm on OS X

I discovered this gem in the rm man page on OS X the other day:

-P  Overwrite regular files before deleting them.  Files are
    overwritten three times, first with the byte pattern 0xff,
    then 0x00, and then 0xff again, before they are deleted.

So there you go rm -P will securely delete a file from your disk with minimum hassle (i.e. without having to through the Thrash folder). This might be one of those goodies OS X inherited from BSD. On Linux you have to use something like shred to achieve the same thing.

Addendum: santry on the HN Thread points out the same thing can done via the srm command. Several people also noted that secure delete interacts unpredictably with modern file systems. jrockway points out that full disk encryption should be used in place of secure delete for this reason.

9:02pm  |   URL: http://tumblr.com/Zn_4by1Ia1s9
  
Filed under: cli rm os x security 
August 14, 2010
"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair."

— Douglas Adams, presumably talking about how distributed systems are more reliable since fault tolerance is baked into the architecture

August 7, 2010
I keep coming back to this one.

I keep coming back to this one.

August 2, 2010
"My ability to decide how I feel about Wikileaks’ activities is totally annihilated by my ongoing realization that it cannot possibly be real. It’s a plot device in a near-future thriller novel. I mean, seriously, semi-stateless man with an unusual appearance uses an army of anonymous allies to expose governments’ secrets, and posts an insurance file in public with some kind of deadman switch in case he’s taken out by his enemies? That shit does not happen in real life. Julian Assange is a Neal Stephenson character who’s escaped in to the real world."

Tomorrowful on MetaFilter (via Simon Willison)

July 22, 2010
Co-worker: moved files
Co-worker: scourge of p4
Me: more like code, the scourge of p4
Me: p4 would be so happy if it didn't have to deal with the contents of files
Me: just the metadata
Me: who has what opened when
Me: it loves that
1:28pm  |   URL: http://tumblr.com/Zn_4byoQcDC
Filed under: perforce 
Liked posts on Tumblr: More liked posts »