R, Procrastination, Kittens, and Dune

I’m currently in that strange liminality of the dissertation stage of grad school, which means I spend a lot of hours in a little closet in the library cursing quietly. The work is going well—I have little basis to complain—but occasionally I hit some snag with a program I’m writing. For me these headaches seems to happen more frequently in R, leading to events like the following:

I do this frequently enough to have created a bash alias:

But I got to thinking yesterday that a more fruitful approach than advising a hiatus would be a temporary distraction. I decided to write an R function that would show a picture of a puppy and an inspirational quote. Sadly I could not find free APIs that served puppy pictures or inspirational quotes. I settled for cats and quotes from the Dune novels. Now if I feel frustrated, I can call plot.kitty() and get something like these:

You can see the function (which was written sloppily in the span of about 20 minutes) at this GitHub Gist.

/bin/true

I like coming across the odd history of Unix commands that I use on a daily basis. Here’s one I didn’t know: the true utility, which just exits without error and is often used in infinite loops, was originally just an empty shell script. By definition, it never contained any errors, and quite simply performed its duty. I found out about it from this post:

Read Quote of Ron Spencer’s answer to What is the shortest and most effective code ever written? on Quora

A longer discussion of its history (and the bizarre addition of copyright statements) can be found here.