Today I gamified my shell.

Ok, stop laughing, I only spent 2 hours working on it.

I wanted to actually learn the aliases I’ve carefully setup. I always think up new aliases, but immediately forget them, and continue on exactly as before.

Feature spec.

I want feedback every time I should use an alias. The feedback needs to be immediate. More important than that, I don’t want to be distracted by anything flashy. The notification must be small and persistent.

I boiled down the feature set to this:

  • look at the aliases defined
  • look at the last command executed
  • provide information about what should have written

I chose to use the right hand side of my terminal prompt to display the information. The nice thing about it is that it runs every time I finish executing a command. It is persistent and updated. And the code is fast enough that it gets out of my way.

Alternatives I choose not to do.

  • Growl: too splashy and flashy for how often I execute commands.
  • Sounds: would have driven me nuts when playing music.


The notifications worked, but why do something reasonable when you have the opportunity to do something ridiculous.

I assigned points to successful habits and mistakes. As a first stab, I incremented my score every time I wrote a correctly formatted command and lost 50 points when I made a mistake.

It also keeps my high score, the last command I typed, and the last command I got wrong.


You can get the code here


Update: After a weekend.

I’ve only had it for the weekend and my high score never goes above about 50-70 points.

I have an alias for git status which is the death of me.

alias gs='git status'

I keep loosing all my points because of it.

Update: After a week

I’ve learned 5 new aliases which I now use daily. Mostly around Git. I haven’t estimated my benefits yet but my score is about to break 1000.

I’m going to add a bunch more aliases.

Update: After 1 week + 1 day.

After creating 10 new aliases, my score dropped almost 700 points in 1 hour. But I’m noticing and remembering.

Adding too many aliases at once was a mistake.

I had a feeling I type too much. But I wasn’t sure how. So like any programmer, I got a computer to figure it out for me.

What did I type? Is there a history of everything I’ve typed? Something I can mine for interesting data?

~ wc ~/.zsh_history
17185   85023  723154 /Users/paul/.zsh_history

That is a bunch of data. And once I turned off de-duplication, for this experiment, it became a bunch more.

What do I type?

What shouldn’t I type? As it turns out, the answer is ‘git’. I’ve typed ‘git’ 6642 times, which is 6642 too many. A lot more than any other command.

git 6642
cd 988
gap 524
rm 487
ruby 452
ls 427
rails 407
rake 315
gem 268
mate 262

Here is the frequency graph of how I used my commands.

583 commands appear > 1 times
217 commands appear > 2 times
110 commands appear > 5 times
78 commands appear > 10 times
58 commands appear > 20 times
32 commands appear > 50 times
23 commands appear > 100 times
11 commands appear > 250 times

There are 32 commands which I’ve typed more than 50 times, many of which could use a great alias. The other 500+ commands, not so worried about those because I don’t use them very much.

How do I do this?

Huffshell is a gem which will looks at your history and generate a command tree based on what you type. It will also make basic suggestions for improvements.

Surprises Patterns

Huffshell even shows me there are patterns in my commit messages. I think about my changes primarily in terms of adding features or code and secondarily in terms of removing.

git 5141
  commit 3734
    -m 3726
      "add 538
      "remove 259
      "can 161
      "fix 128
      "change 110
      "bump 104
      "move 102
      "make 100
      "show 84

I don’t learn or relearn unless I’m forced to. Today I’m forcing myself to relearn my control key. I’ve turned it off completely. It does nothing.

Hopefully, in a couple weeks I’ll be completely reliant on the Caps Lock key, as a replacement. I’ve had it mapped for years, but never trained myself to use it.

1. The Business

Credit card processing is one of the most frustrating parts of starting a company. To simply accept a credit card, hardware can cost anywhere from 800 dollars to 13 thousand, but the data sent is trivially small. Square, or “squirrel” at the time, gave merchants an alternative that used the phone they already had, and a low cost card reader.

1 year in, we’ve changed the payment market. We see Square in the wild all the time. We have a product which people can touch and use to make money. Solving a problem for millions with a clever hack and commodity hardware.

2. The Tech

Square’s card reader uses the actual motion of the card swipe to generate a sound, which is decoded through a microphone, and processed in real time using the phones internet connection.

1 year in, we have:

  • A cheap reader that works on a wide variety of hardware
  • A web infrastructure to log transactions securely and persistently
  • An interface that makes credit card payments simple

We’ve seen a lot of hard puzzles come and go, but the amount of data and opportunities we have with it are just starting to show. Also, more than a couple geeks give our hardware the highest compliment possible “it reminds them of Woz’s work”.

3. The Chance to Work With Jack

Jack, our CEO, is absurdly good at what he does. He is an incredibly steady leader, relentlessly revising things to create simple products, and pushing the people around him to do the same. It isn’t a fluke that both Twitter and Square are incredibly simple technologies in every aspect. I knew the opportunity to work with Jack was rare when it came up.

1 year in, Jack has not only lead the product out of the banking world, but he’s also created a flat culture of product oriented engineers. In addition to that, we’ve managed to increase our execution speed as the team has grown and given people control over more aspects of the product.

is now working

When you’re in a startup, you need to be constantly doing the most effective thing for the startup.  Your startup is small, you have limited resources, and you need to use them wisely.

There are a million things to do every day and choosing which ones to do is important.  Making good decisions move your company forward, bad ones leave you in the same place, or worse move you backwards.

Whenever you choose what you want to do each day, there are temptations to procrastinate.  In this case, I’m defining procrastination as whenever you do something you’d like to do, something you find pleasant to do instead of doing something where you can produce lot of benefit to yourself or others.  For example, playing soccer instead of studying, or watching tv instead of playing soccer, or doing nothing at all, instead of watching tv?

These examples might all be easy to recognize, but I think there are more examples of procrastination that are less easy to recognize.  Some of which I do everyday to my chagrin, and some of which I watch other people do.

Solving the big problem instead of doing the minimum viable solution: writing a new abstraction or toolset for an abstract problem (sometimes a real problem) but in the meantime leave the customer without any solution.  Procrastination by solving a fun problem instead doing the minimum thing required to help the customer.  Sometimes, making a tool is absolutely required to your startup, it might be your actual startup, sometimes it is just more fun than doing real work.

Researching new technology, new key value store, NOSQL, eventual consistency.  people love to read about them. reading about it feels like work, but unless you actually need them that day it is more like practice for possible work.  there is value in constantly learning, constantly being a better programmer, but it is investing is a distant future.  we became programers and entrepreneurs because we liked to learn, but, it is procrastination because it doesn’t often doesn’t immediately benefit your users.

Stats procrastination.  I love doing this one.  just paging through page after page of stats.  correct pattern is picking the stats that matter, and work towards them.  just building random stats, or reading a million google analytics pages, it not going to make your company strong.  especially if they don’t change very often.  it is superficial. 

Reinvention procrastination, Recreating a 3rd party library, because you want the functionality you see, but don’t like the number of spaces they use for indentation in their code base.  Do your customers know you rewrote something?

Refactor procrastination. the customer wants their life made easier, not your life made easier.  refactoring is a way of making your programming life easier, or making yourself smart (i’m using anonymous functions!).  when you need to refactor to give users a benefit (we can’t do this until we have some better caching in place).  

Productivity p0rn procrastination.  kinda like what you are reading right now. go fix the biggest problem for your customers, right now. make something they will want to email you about and say “OMG THANKS!”

30 minute post. 

That is about it.  Explaining something forces you to understand it.  Things sound 10x worse when you try and convince someone else about them.  I’ve found the same thing about writing execsums, selling, pitching, lecturing.

It is hard but worth it.  You’ll force yourself to level up, because that is the only way you will be able to do what you need to get by.

I still love forums.

A lot.

Like, i think about how much time people can spend in forums, and how devoted they get to forums, and it blows my mind.

I love it.

standard social network friend stuff first time you do anything you get a ‘badge” call newbie

  • gets you initiated to badges
  • confirms your action first time out in the night you get another 1st stop badge, encourages more activity throughout the night?

get points for combos? or just every badge thing you get? more to come.

I decided that blog posts about stuff I’ve done in the past are probably more interesting, concrete, and thought out than things in the future. Going to focus on the observations and decisions from the past and not the future. Maybe : )

i think lisp gets this crazy reputation, like you must be awesome to have touched it. so lets make everyone awesome.

step 1. get that thing!

In ruby, the LAST definition of a function is the one that executes.

def test;
puts "first";

def test;
puts "last";

test # => last

In Sinatra, the first defined route executes

get "/test" do;
puts "first";

get "/test" do;
puts "last";
GET /test # => first

Rails kinda does the same thing regarding routes (first declared executes). But because of rails’ terse-ness regarding routes I expected it. I see everything on one page for routes, and assume top executes first. With Sinatra, and ruby in general, I expected the last definition to override the first.

(Sinatra wins in terseness in every other regard vs rails and I understand why Sinatra does this, now)

Sinatra turns out to be very useful and amazingly effective at doing simple things quickly. I am enjoying it a lot.

This blog is written in Sinatra, it is like Rails but without a ton of stuff I’m used to. I’m forced to work without migrations, view helpers, form builders. The good stuff.

But every time I hear myself complaining, I hear the way people have talked about Java to me. Connection Pools, JVM, massive scaling, byte code, and other crud that has been in java forever but only recently got in to rails.

Is every successive generation of technology a re-implementation of the smallest cell of useful functionality? Is Sinatra growing towards rails, rails growing towards java, java towards oblivion.

I love programming