Tree history in Vim

Posted on July 31, 2015

Jump to Post

I’m sure it happened to you too.

Just remember. That horrible moment when you time-travelled using undo - to copy and paste that line you deleted twenty minutes ago but for some reason you really, really, need it now - and then you hit a key and insert a letter. And just like that, your way back is gone.

The only appropriate reaction to that is either eating your computer or turning into a hulk and going on a neighbourhood-destroying rampage.

Yea, as a matter of fact, that has happened to me. Great Vim tip, especially combined with saving work when switching away from Vim.

Windows 10 Shares Your Wi-Fi With Contacts — Krebs on Security

Posted on July 29, 2015

Jump to Post

… it does allow anyone in your Skype or Outlook or Hotmail contacts lists to waltz onto your Wi-Fi network — should they ever wander within range of it or visit your home…

Any Windows users out there might want to hold off for a few on that big upgrade.

Coming Soon – AWS Device Farm Support for iOS Apps | AWS Official Blog

Posted on July 29, 2015

Jump to Post

We launched AWS Device Farm earlier this month with support for testing apps on Android and Fire OS devices.

I am happy to give you a heads-up that you will soon be able to test your apps on Apple phones and tablets! We plan to launch support for iOS on August 4, 2015 with support for the following test automation frameworks:

This is very interesting news for the thousands of iOS and web developers out there. I wasn’t too surprised at the Android device testing, but this is something different.

Work - Transitional

Posted on July 28, 2015

Jump to Post

I could see that my 9-to–5 job wasn’t my destiny. It didn’t fulfill me or stimulate significant personal growth. It wasn’t that I was bored, but it was more like feeling out of place—I could and should do more with my talents.

I know the feeling. Right now I’ve never been happier with where I am in my career, but the feeling Kevin describes is how I felt for seven years at my previous job. I felt like I was slowly atrophying in that cubicle. Today, after making the jump to a much smaller company where I have much more responsibility, I feel like I’m doing the best work of my life. It was scary, but worth it.

What 2,000 Calories Looks Like - The New York Times

Posted on July 28, 2015

Jump to Post

Writers, nutritionists, doctors, chefs and Michelle Obama have all been promoting a hot new diet: home-cooked food.

Looking at this list makes me never want to eat out again. (via The Loop)

Link Blogging With Quicksilver

Posted on July 25, 2015

I can’t quite make up my mind on how I feel about “link blogging”. On the one hand, there’s already a lot of people out there who do it better than I can. On the other hand, sometimes I want to share something and make a few pithy comments about it. It’s out of that second feeling that this script is born.

The script started out as an Automator action, but having an Automator wrapper around a single shell script seemed like overkill.


TITLE=`osascript -e 'tell application "Safari" 
    set pageTitle to (do JavaScript "document.title" in document 1)
end tell'`

URL=`osascript -e 'tell application "Safari" 
    set pageURI to (get URL of document 1)  
end tell'`

TEXT=`osascript -e 'tell application "Safari"
set selectedText to (do JavaScript "(window.getSelection().toString())" in document 1)
end tell'`

QUOTEDTEXT=`echo -n ">"; echo -n $TEXT`

LINK=`echo -n [Jump to Post]; echo -n \($URL\)`

NAME=`echo $TITLE | sed s/\ /-/g`
POSTNAME=`date "+%Y-%m-%d"-$NAME`   

POST_DATE=`date "+%Y-%m-%d %H:%M:%S"`

echo "---" >>$POST_FQN
echo "layout: post" >> $POST_FQN
echo "title: $TITLE" >> $POST_FQN
echo "date: $POST_DATE" >> $POST_FQN
echo "---" >> $POST_FQN

echo "$LINK" >> $POST_FQN
echo "" >> $POST_FQN
echo "" >> $POST_FQN

echo $POST_FQN

/usr/bin/open $POST_FQN

That first line is pretty ugly. I don’t recall when I wrote this, but it’s been working reliably for long enough that I don’t feel the need to change it just yet. Then again, a shell script that calls AppleScript that calls JavaScript seems pretty ridiculous.

This script looks at the current web page in Safari and grabs the title, URL, and any selected text and builds a new post in the format my site builder script expects. Similar to my previous New Post script, this one opens the new file in MacVim, ready for writing.

I call the script from Quicksilver using the Run… command, and tied the command to ^⎇ ⌘ P for a hotkey.

I might start putting more links on the site. There are often things that I find might be interesting to a certain segment of the Mac community, mainly the more technical and scientific groups, that I haven’t done anything significant with. I’d like to change that.

Starting a New Post With Automator

Posted on July 23, 2015

Automator is one of my favorite tools on the Mac, and unfortunately one of the most unappreciated. I have several workflows and services that I’ve built up over the years, things that I could have turned to a third-party tool like Keyboard Maestro, Alfred, or even my beloved Quicksilver for, but I like the simplicity of using a built-in application.

My “New Post” workflow is a simple example of using Automator to mix GUI elements with a shell script. There are only two actions. The first uses the “Ask for Text” action to prompt for a post title, and the second uses the “Run Shell Script” action to run this bit of bash:

NAME=`echo $* | sed s/\ /_/g`
POSTNAME=`date "+%Y-%m-%d"-$NAME`
POST_DATE=`date "+%Y-%m-%d %H:%M:%S"`
touch $POST_FQN

echo "---" >>$POST_FQN
echo "title: $*" >> $POST_FQN
echo "date: $POST_DATE" >> $POST_FQN
echo "tags: " >> $POST_FQN
echo "---" >> $POST_FQN

/usr/bin/open $POST_FQN

The first line removes spaces from the title passed to it from the Ask for Text action and replaces them with underscores so I can use the title as the URL slug. The second line adds the creation date[1] to the file name, and the third creates a full path to the file. The fourth line simply creates an empty file with the correct naming scheme for my site generator tool.

The collection of echo statements on the next few lines add YAML frontmatter to the post, a bit of residual formatting from the sites Jekyll roots. Finally, I use the Mac’s open command to start my favorite text editor, normally MacVim, and start writing.

Using Automator can be frustrating at times, especially when there is no action for something you think there should be an action for, but for manipulating text and mixing in scripting, it’s not bad.

  1. With apologies to Matt Gemmell. I’ve not yet committed to removing the ugly cruft from my URLs.  ↩

A Runner

Posted on July 17, 2015

My workout this morning called for five miles. Run two, walk one, run the last two. I think in the Fall or Spring it would have been fairly easy, but today, in the July heat and humidity, every step felt like dragging a pair of anchors. My muscles gave out sooner, my breath ran out faster… it was a hard workout. I finished it though, because what I’ve learned is that even when it’s hard, even when you are having a tough time and not going as fast as you’d like, you always have to finish.

I never imagined myself as a runner. I certainly don’t look like one. Before I started this friends of mine would talk about running marathons and half-marathons I’d look at them in wonder and think how I’d never be able to do something like that. Now I’ve run two 5ks, one 10k, and I’m scheduled to run another 5 and another 10 in the next few weeks. I get up at five almost every morning during the week and run, and normally have another long run on Saturday. I think after a few years of this I’m finally comfortable enough to say I’ve become a runner. Today, even though I’m not ready to say I’m training for a marathon, the possibility is there, for the first time in my life.

I’m not sure this would have happened without my iPhone. Every morning I strap it on my arm, launch the Nike+ app, start a podcast in Overcast in the background, and start the day. Before I used Nike+ I used the excellent Couch to 5k app, which gently took me through getting off my lazy butt and pounding the pavement. The most important thing I took away from that app was the routine. Once I ran the 5k I didn’t want to stop, so I switched to another app and a longer goal and kept going.

Running is my time. It’s what I do for myself, it’s how I make sure that the day is started right. It’s how I can put my busy mind to rest. It’s how I can balance staring into a computer screen all day solving puzzles with my concept of who I am and who I should be. Running is hard, running hurts, running is difficult and uncomfortable, running is calming, running is meditation.

I run in the heat and humidity. I run in the rain. I run in the freezing, bitter cold of winter. I run in the dark. I run before daybreak and I watch the sunrise over a pond along my route. I run with my dog. I run alone. I run in new shoes that give me blisters on my heels. I run when it hurts. I run when the weather is crisp and cool, and I’ve got all the energy in the world, and my legs forget their burden and carry me for miles and I feel like I could run around the world.

I’m a runner.

On Computing

Posted on June 28, 2015

I often daydream about not caring about my computer, and being able to go blissfully through my life with little concern about the mix of applications, storage of data, and how I interact with the machine, but that’s just a dream. The truth is I do care. I care a lot. I care enough that I’ve developed my own personal philosophy of computer use. I use this to determine which services and applications I will most likely be happy with. It helps me, maybe it will help you too.

My computing philosophy rests on four pillars: security & privacy, long term data storage and retrieval, simplicity, and power. I value these traits in a computing platform because of the amount of information my computer stores for me, and how much I rely on it for my research and work. I’ve been lucky enough, and privileged enough, to be able to turn my obsession with technology into a career, so my livelihood depends on me knowing how these things work, why they do the things they do, and keeping up to date on current trends and happenings in the field. I care because I have to, but also because not everyone understands the effect the choices they make with the technology they use have on their future selves. I’d like to not care, but I look at computers, applications, and the things we keep and I can’t help but see how things could go wrong. I care because I am compelled to.

This brings me to the four pillars.

Security & Privacy

Maybe I’m getting old, but I believe that I shouldn’t have to give up personal information in exchange for using my computer. I should be able to protect my data as I see fit. I shouldn’t have to worry about security because my computing decisions and platform of choice ship with good, sensible defaults, and easy ways to enhance the default choice.

So, I choose to use a Mac running OS X. I encrypt the hard drive using File Vault, and turn on the firewall to “Stealth Mode”. I use Safari for my primary browser, and I don’t install Flash. I’m not storing anything particularly interesting to anyone, just things that are important to me. A scan of our marriage certificate, all of our social security cards, bank statements going back many years, our birth certificates, details about various health related issues. Things that I don’t believe are the business of anyone else.

For more detailed reasoning on why we should all use encryption, see this article by Bruce Schneier, excerpt below:

This is important. If we only use encryption when we’re working with important data, then encryption signals that data’s importance. If only dissidents use encryption in a country, that country’s authorities have an easy way of identifying them. But if everyone uses it all of the time, encryption ceases to be a signal. No one can distinguish simple chatting from deeply private conversation. The government can’t tell the dissidents from the rest of the population. Every time you use encryption, you’re protecting someone who needs to use it to stay alive.

Long Term Data Storage and Retrieval

Paper has a heck of a shelf life. If kept in reasonable conditions, a piece of paper will long outlive all of us. Unfortunately, as the volume of information you keep increases, so does the storage requirements, and if you are storing everything on paper, you are eventually going to need entire rooms filled with filing cabinets to keep your personal data library. It’s simply not a scalable solution in the digital age.

So, I store nearly everything of interest on the computer. Appliance manuals, copies of bills, academic papers, clippings from web pages, and of course, my own creative work. Since I’m storing the data on the computer, the computer needs to be configured in such a way as to enable retrieval ten, fifteen, twenty, or even fifty years from now.

To ensure the availability of my data in the future, I tend to use open formats whenever possible. I use plain text instead of Microsoft Word documents. I print complex documents to PDF. I do use some applications where I store data in a proprietary format as an intermediary step, but when the document is complete and I’m storing for future reference it is exported to either plain text or PDF. Any system that either cannot do this, or makes exporting of data to an open format complex or difficult is quickly discarded.


Even though I care about keeping my computer secure, and about making sure the things I write today will be accessible twenty years from now, doesn’t mean I want to spend hours upon hours tweaking my system. When I plug in my computer to an external display, I just want it to use that display, no mucking about. When I want to install a new application, I want that to be as straight-forward a process as possible.

I want the applications I use to behave in a consistent manner, and I want them to integrate deeply with the operating system. That way I don’t have to think about what key combination to press or how to accomplish a given task. When everything works as intended, the combination of applications all function in a similar way. I have one important exception to the simplicity rule, MacVim, but that is only because I’ve been using Vim for fifteen years and I know exactly how it works. However, in service to simplicity even this old stalwart servant may be removed from my machine soon. Plain text editors and writing tools have gotten very, very good in the past few years.


There is absolutely no need to trade power for simplicity. In a mature, well designed system the two go hand in hand. Power is a general term that could mean many things depending on the context it is used in, even when speaking specifically about computers. The power I’m talking about here is the ability to handle complex, long-running tasks. To be able to keep up with the demands of a high-stress environment and to respond correctly when needed. The ability to run multiple, high-resource applications simultaneously without issue.

In my job I never know when things might need sudden and immediate attention, and I need my computer to be there for me when that happens. That means I don’t have time to recompile X.org or muck about with my network driver or worry about closing apps because I have too many of them open to deal with the issue at hand. I need my computer to be able to handle whatever might come around gracefully and without getting in my way.

Power is similar to flexibility, and incorporates certain attributes of a flexible system, but one that is more flexible than powerful will collapse under stress. A system that allows unlimited customization will not be able to adequately prepare for unexpected shifts in the demands placed on it. It’s easy to mistake one for the other, until the Director of Infrastructure is standing over your shoulder asking why this server just crashed and why it isn’t back up and running again yet. Then the difference becomes crystal clear.


I’ve grown to use my machines in a certain manner, and expect them to behave in a certain way. I also expect that whatever system I’m using is going to respect my privacy, provide a substantial amount of security, and be powerful enough to do what I need it to do. These requirements may limit my choices, but they also provide focus and clarity on the technology I will allow into my life.


Copyright © 2007-2015 Jonathan Buys   Subscribe

ISSN: 2161-8119