Nick Johnstone's Blog

Sometimes I write things

Subscribe to my mailing list for updates

Death

I’ve been thinking about death a lot recently. Shortly after I turned one, my grandfather on my father’s side died while taking a boating exam, a sudden heart attack.

I recall feeling sad about that when I was much younger, but the truth is I barely knew him. I have a memory, or the memory of a memory, of my first birthday. We were in a McDonalds, and I can still see his face looking into mine.

When I was five my father had a brain aneurysm, and while the surgeons were stopping the huge flood of blood into his brain he suffered a stroke. You’re supposed to die after that happens, really.

I recall seeing my grandparents waiting for me after school that Thursday, and knowing straight away that something was wrong. I remember riding a toy car up and down their driveway for what must have been an hour, demanding to see my father.

Thankfully, my father is far too determined and stubborn to let a little thing like severe brain damage slow him down too much. You wouldn’t guess today if he didn’t tell you.

I must have been around eleven when Graham Condon, a City Councillor in Christchurch who worked alongside my mother, died in a cycling accident. I remember shaking his hand for the first time the week before, and being struck by how nice he was.

I was sixteen when in February 2011, Christchurch was struck by a devastating earthquake. I was sitting with my friends in a Subway (food, not transport) in the center of the city. We ran out into Cashel Mall to see shock-waves of force buckling the cobblestone. At the time, I was attending Unlimited Paenga Tawihi, an excellent alternative school situated right smack bang in the center of town.

I don’t remember seeing anyone die. I do remember walking past collapsed buildings, burning and shrouded in dust. I was soon reunited with my mum and my brother and we found our way home. Nobody I knew personally died, but for the city’s soul. It’s slowly growing a new one.

I had hoped that I had escaped the fear, but a minor quake in Wellington last year revealed the terror lying inside me. The fear is the worst part, and I wish I could move past it.

I’ve been downhill skateboarding for 4 years now, since I was sixteen (funny that). I’m not sure if that’s so true anymore, as I’ve only skated downhill a handful of times in the last year.

It’s the fear that gets me. The fear that my luck will run out and I’ll lose traction and hit a car. I’ve skated Brooklyn Hill in Wellington maybe thirty times and the only time I came close to falling off was when a friend tried to overtake me and failed.

I love skateboarding, and it kills me that I’m afraid of it. Everything I know tells me that it’s not about if you fall off, it’s about getting back up again. But I can’t shake the fear of death on these roads.

Just after a year of being into skating, a guy named James died skating a hill named Sugar in Auckland. It was a freak accident, he hit the back of his head while wearing a full face helmet and died instantly. The paramedics that were already on site for the race couldn’t do anything.

Most people still won’t skate that hill out of respect. A lot of people quit that day, and haven’t looked back. The number of life threatening accidents I’ve first responded to because of skateboarding is too damn high.

My grandfather is dying, slowly but surely. It fucking sucks. Pop, I know that you’ll read this and I want you to know that I love you, and I always will. I’ll call you soon, and I’ll see you at Christmas.

It pains me when I hear people say “I’m going to work for n years so then I can become a musician/write a book/live my dreams and then I’ll be happy”. If you’ve got an idea of what might make you happy, I think you need to go for it, as soon as you can.

My whole life, the universe has reminded me that I could die at any moment. That fact is now a fundamental of my world view. When I have to make hard decisions, I ask myself: Would I be okay if I died in one month and I hadn’t done this?

I hope that I will live a long life, but I assume that I won’t. Every day is precious and I spend a lot of time trying to remember that. Plan for the future, but ask yourself how you can make it happen today.

I don’t really have a simple conclusion for you, but for the fact that you are alive and that’s stupendously unlikely. Enjoy.

Go With Your Gut

All too often when I’m programming I find myself looking at a problem and feeling like I have no clue how to even begin.

In amongst the murky swamp of stress and self doubt there is a little spark of intuition. It’s small, and fragile, but all I have to do is blow on it, feed it the fuel it needs to burn. Sometimes my intuition turns out to be wrong. But more often than not that fire shows me the light.

And you know what? I can’t ever remember regretting having followed my intuition.

What haunts me is when I find that little spark and then ignore it. There’s nothing more sickening than spending hours battling with a problem only to realize I knew the answer all along, if only I had trusted myself.

Now, when I come to a fork in the road. I try not to fret and fray and become paralyzed by choice. I strike out along a path and see what happens. At least that way I’m going somewhere.

Auto Updating Git Status With Tmux and Watch

One of the great things about tmux is that you can create flexible development layouts.

You can easily display the output of a command and auto update it using watch. It has a similar end user experience as tail -f, except for commands instead of files. For example:

$ watch git status

watch will run git status every 2 seconds and display the output.

If you want color in your git status, you’ll need to configure git to display color when being run by watch.

$ git config --global color.status always $ watch --color git status

Controlling Sonic Pi From Vim (or Anywhere Else)

Last week I discovered Sonic Pi. I watched Repl Electric perform live at RubyConf AU. He gave a brief demo of Sonic Pi, a tool for progamming live music with Ruby. Instantly my eyes lit up. It was the instrument I’d always wanted.

I tried it out the next day. It has a nice interface, but I’m used to vim and living in the terminal. I googled “vim sonic pi”, but there was nothing I could see. I hunted round for a bit, but I couldn’t find a command line interface either.

It was Sam Aaron (the creator of Sonic Pi) who pointed me in the right direction, a blog post entitled Connecting Erlang to Sonic Pi. It turned out that there was an undocumented method of controlling Sonic Pi externally.

The secret:

1
2
3
require 'osc-ruby'
code = 'play 50' # or whatever you want
OSC::Client.new('localhost', 4557).send('/run-code', code)

That code sends an OSC message (Open Sound Control) to Sonic Pi, instructing it to run the given code just as if you had typed it in.

So I put together a simple command line interface to use Sonic Pi from the terminal. sonic-pi-cli. I packaged it up as a gem, and released it into the wild.

You can install it with gem install sonic-pi-cli and then run music with sonic_pi play 60 or echo 'sample :loop_amen' | sonic_pi.

I was really happy to have a working CLI for Sonic Pi. I quickly whipped up some vim binds so I could use Sonic Pi right from my editor.

1
2
noremap <leader>r :silent w !sonic_pi<CR>
noremap <leader>S :call system("sonic_pi stop")<CR>

You can add these commands to your .vimrc, and voila, Sonic Pi in your vim. I use the spacebar as my leader key, so these shortcuts feel a lot like using Sonic Pi.

Now, the really amazing part comes. Less than a day since I first released sonic-pi-cli on RubyGems, a few awesome projects have already put it to use.

Robin Newman has used it to control Sonic Pi from his phone with a Raspberry Pi and telegram.

dermusikman immediately started working on a vim plugin to bring as many features of Sonic Pi to vim as he can, sonicpi.vim.

At the moment, it contains the shortcuts from above, as well as auto completion for samples and the like, and the use of the .pi file format, with Ruby highlighting.

I’m absolutely astounded by the awesome work that has been put out so rapidly by others in the community. I really love this aspect of open source. There’s a good sense of collaboration through Github issues and gitter.

I’m looking forward to contributing more to the Sonic Pi community in future.

The Random Number Gods

When I tell people that Rogue has inspired me to write a blog post about privilege, I am generally met with a resounding bu-wha?

Rogue is a simple game. You play as an adventurer, descending the 27 floors of a dungeon, collecting gold and loot, fighting monsters and avoiding traps, with the goal of retrieving the Amulet of Yendor and returning to the surface.

Rogue had a few things that made it different from many other games. The first, and the most important, is that when your character dies, you’re dead forever. You’re presented with a tombstone and some information about your life, but there’s no respawn button.

Another crucial part of Rogue is what is known as Procedural Content Generation. In English, that means that the dungeons are new every time you play. Every character you play starts surrounded by different walls, with different risks, rewards, and horrible enemies awaiting.

The third essential part of Rogue is that it is very difficult to win. It takes hundreds of attempts, for most players, before they first reach the bottom of the dungeon, retrieve the amulet, and “ascend” to the surface. There are many ways to die in Rogue, and a typical player will experience most of them when they “ascend”.

In my mind, Rogue draws some striking parallels to real life. Your actions have serious consequences. It only takes a single mistake to cause your death. A seemingly strong character can easily get overwhelmed if you make the wrong call.

Like life, you are at the mercy of your surroundings. To succeed, you have to fight and make do with what is available to you, but it’s not always enough. There comes a moment in (almost) every game where you find your back against the wall and meet your maker.

It was thinking about life in terms of Rogue when I had an ‘aha’ moment as to how I could really phrase my feelings around privilege.

My life has been going pretty well recently. At the same time, I see people near and far facing hardship and sorrow. It makes me wonder what has led to our difference in circumstances.

I know that some people like to think that those successful in life fought harder, that hard work and perseverance can overcome any obstacle. While that might play a part, it seems impossible to deny that your start in life makes all the difference.

As an adventurer in Rogue, what you find on the first few floors of the dungeon will have a huge impact on your fate. If you’re lucky enough to find a good set of armor or the right potions on the first floor, you’ll probably breeze through the early dungeon. You will survive some situations simply because you got lucky and had what others didn’t.

In my mind, it’s the same – to have parents that teach you to read before you start school. I was lucky enough to have parents that both taught me to learn and nourished the spark of curiosity inside of me. That seemingly small gift early on has had huge impacts throughout my life. If not for that, probably, you wouldn’t be reading my blog.

I was extremely privileged to be born where and when I was, and to whom. I think it’s important to consider that not everyone is so fortunate.

Politics and Anarchy

I’ve been thinking a lot about politics recently.

For most of my life, so far, I’ve thought anarchists were delusional. A world without government? You’d have to be crazy to think that’s a good idea. In my mind, anarchists wanted to inflict chaos upon society.

It recently occurred to me that anarchists aren’t crazy, just optimistic. I feel anarchy is about the belief that humanity might be capable of living together without needing a strong system of governance. I’ve started to think anarchy might be about hope, not chaos and fear as I previously thought.

This realization came at a useful time. The election is happening soon, and I’ve been watching my friends and acquaintances discuss politics on Facebook. The most disheartening thing to me is the division between supporters of the different parties. I’ve seen people removing each other as internet friends, simply because they support a different party. To me, this speaks of an unwillingness to consider and understand why other people think the way they do.

All of my beliefs and opinions exist simply because they were what made sense to me at the time. When you drive away from people who think differently from you, you limit your view of the world. In effect, you create a feedback loop that supports your views (the technical internet term is a ‘circlejerk’).

I think it’s important that we try and break out of the echo chamber of opinions we’ve built and have some real discussions. Everyone you meet has had different experiences and will perceive things in different ways.

My advice to you is simple. Strive to see the world through the eyes of others. You might find something you like.

Failing to Forget

http://heeris.id.au/2013/this-is-why-you-shouldnt-interrupt-a-programmer/

I’ve recently discovered a useful productivity hack. I found that when I sat down to code it would take me a while to get back into the swing of things. I would have to struggle to figure out where I should start and what to do.

I’ve started writing a failing test just before I leave my work for the day. When I get back to work the next day, I simply run my tests, fix the failure as usual and I’m back into my rhythm.

It only takes a minute or two to write a failing test but it saves me 10 to 15 minutes of trying to recover my mental state. Let me know if you find this useful, or if you have any useful hacks/tips of your own.

Hills of All Sorts

You should watch this video:

Powershop

Earlier this year, I set myself a goal. By the end of 2014, I would be living in Wellington making cool things for a living. I think I’ve done it.

I started working at Powershop last week. Powershop is (as the name says) a shop for power.

I was quite fortunate in my job hunting, and ended up with four different offers from Wellington software companies to choose from.

I chose Powershop because they have a fantastic company culture, put out quality products, and treat their employees well. They also met my fixed requirement of having a ping pong table. Everyone I’ve gotten to know there, so far, has been really cool. There is a healthy diversity of backgrounds and ideas at Powershop, which I really value.

As a new developer, you join the Dev Train, a special team where you just learn and improve. New devs spend up to three months working on games and other interesting projects to hone their skills before being consigned into production code.

On Being Down

I originally posted this on Facebook, but I thought I would repost it here for posterity.

Someone recently told me something that made me think a bit. ‘It gets better’.

I’ve heard that a bit but I’d never really about how it applied to me. I thought about how the last few years have been for me.

The last year or so of high school was pretty tough in terms of my emotional stability, and I found it really difficult to talk about with other people. Sometimes I would just feel down, for up to weeks at a time. I wasn’t sure if I was just being lazy, or if this was just how things were.

It was even worse in that nothing was really wrong with my life. You feel even worse for feeling down, when you have every reason to be up.

I wanted to post this because I’ve only recently started thinking that many other people actually go through this. Someone said something to me, so I figure I might pass it on. If you are having a tough time, if you can’t shrug feeling down, it honestly gets better.

My life has been much better recently. I’ve been in a much better place emotionally, and it’s easier to feel good. I’m working towards happiness being my default state.

I know this is definitely a bit weird to post on Facebook, but I think it’s important to talk about. Hit me up if you want to chat about it (especially about controlling emotions), or comment.

Dev Academy - the End

Dev Academy is over, for my cohort at least. A fresh batch of students will be arriving to start Phase 1 in just over a week.

Getting back to normal life is weird. You’re with the same group of people, learning intensely for 10-12 hours almost every day, for 9 weeks straight. Dev Academy somehow doesn’t feel like normal life, almost doesn’t feel real, but it’s much more real than normal life in some ways. Everyone is so honest and open. It’s so supportive, and you’re surrounded by the most incredible people.

The last day of Dev Academy was really touching. We presented our final projects in the morning. Richard, Andrew, Taylor and I had created Skirmish, a multiplayer war game played on Google Maps. I can’t do justice to the presentations, so I will post the video once it’s available. I was really impressed by the level of quality of each of the final projects, especially from the technically weaker team.

After that, we took our first field trip of the course, and headed up to Central Park. We did an exercise where everyone divides into two parallel rows, facing each other. Each person is in turn blindfolded and walks between the two rows. Each person standing quietly gives the blindfoldee a piece of praise as they pass.