Author Archives: kevin

About kevin

I write the posts

Bash user? Try Zsh, the more usable terminal shell

On most operating systems, the default command line shell is Bash. Bash is a perfectly good shell. However there are a number of tasks that are slow or annoyingly time-consuming in Bash, particularly relating to the shell history. It's like using your phone to complete tasks, instead of a laptop.

Zsh is a newer terminal shell with slightly different syntax than Bash. Zsh makes many smart usability decisions where Bash fails, helping you get work done faster. I thought I'd highlight some of the best examples.

ZSH skips repeat commands in history. Let's say I run our unit test suite 20 times in a row. With Bash, if I wanted to get the command I ran just before that, I'd have to hit the up arrow 21 times to get the previous line. Zsh combines all the duplicate commands into one history item, so you only have to press 'up' twice to get that old command.

Ctrl+U deletes the whole line, no matter where the cursor is. In Bash Ctrl+U will delete everything left of the cursor. I have never wanted to delete everything left of the cursor without also deleting the whole line.

Command sensitive history. In Zsh if I type git and then press 'up', Zsh will cycle through all of my latest git commands, skipping any non-git commands. This is especially useful with a few infrequent commands I run that take many command line options, such as our configuration scripts.

Shared history across tabs. With Bash, using the 'up' arrow to access previous commands only gives you access to the history of the current tab. This is like having Chrome only remember your history for one given tab, instead of sharing it across all your tabs.

Smarter tab completion out of the box. Zsh is smart about figuring out which filenames you actually want. There's a good list of tab completion examples here, the two that stand out for me are:

  • Typing

    rm foo*<tab> 
    

    will expand to

    rm foo.txt foo.txt.swp foo.o foo.c
    

    or however many files beginning with foo there are in the directory.

  • Typing

    vim zzz<tab>
    

    will match in the middle of files, for example blah-blah-blah-zzz.txt.

You should give it a try - it may be a little unfamiliar at first, but you'll save a lot of time and annoyance by completing tasks more quickly with Zsh. You can switch by typing at the Bash command prompt:

$ zsh

That will load Z Shell in the current window. You can change your shell permanently by running:

$ chsh -s $(which zsh)

Let me know what you think!

Liked what you read? I am available for hire.

Why I’m not switching my bank to Simple

I finally got my Simple invite. Simple is an online banking startup that wants to make the experience of using banks much, much better. As far as I can tell they are delivering on that experience - their site and iPhone app are a joy to use. They also focus on the whole experience - the ATM card that came in the mail was delivered in a beautiful package, and the signup process, which requires gathering a ton of private information about you, was painless.

That said, I realized shortly after signing up that I'm going to be sticking with Ally Bank for one simple reason: they refund ATM fees. I used to hate ATM's. The option I had with ATM's was either a) look up the nearest in-network ATM online, then walk three blocks, all the while wondering why I are doing this to save a measly $3; or b) go to the liquor store ATM and hate myself for spending money to get at my money.

ATM fee refunds turned an experience I hated into something I can brag about ("It doesn't matter, I get the money back at the end of the month"). I get about $120 in ATM refunds every year, as well as the time and stress savings trying to find an in-network ATM saved, easily worth two or three percentage points of interest. I don't know how it makes business sense for Ally to pay for my ATM fees, but it's their killer feature.

I appreciate what Simple is doing and wish them the best. If you are still saddled with a card from a bank with physical branches, switching to Simple is one of the best things you could do. However at the moment Ally's ATM fee refunds (a better ATM user experience) over Simple's awesome website and iPhone app (a better web experience).

Liked what you read? I am available for hire.

Why we’ll never shut down our API

Recently there have been several articles by startups who built a service around another company's API, and then got upset that the other company changed their Terms of Service, revoked their API access, or sent them a cease and desist letter. Others have rightly pointed out that Craigslist, Netflix, &c. offer API's to improve the value of their own services, and building a company around access to another's API may be foolhardy.

There's an obvious exception; you rarely hear about terms-of-service or cease-and-desist shenanigans from companies with APIs at their core. Twilio (where I work) is a good example. The amount of money we make is directly correlated to the number of API requests we receive. We have no reason to shut anyone off, because we make more money when people use our API more. Google shut off its Translate API recently, despite a large volume of legitimate use, because it interfered with search quality - spammers were using it to generate thin copies of good content. We would never turn off our API, because it's core to our business.

(One caveat: if your big plan is to use Twilio to spam people, then yeah, we're going to shut you off. We make money when people spend money with us, but we do have an Acceptable Use Policy.)

The only conceivable situation we'd shut down our API is if the company was forced to shut down. That's a risk, but we believe that risk is low and we're working every day to minimize it. So we're not going to shut off your access, unlike Linkedin or Craigslist or another company whose API is a convenience.

Liked what you read? I am available for hire.

Sentences to consider

There is a myth among neoliberal economists that labor markets have always “adjusted” sua sponte: that when laborers were displaced from farms, “higher value” factories arose to employ them; that when the factories were downsized and offshored, a more pleasant, higher-value service economy came to be; etc. That narrative is wrong, he told me. At best it is criminally incomplete. With each technological change, new social institutions had to arise to sustain dispersed purchasing power despite a reduction of numbers and bargaining power of workers in old industries. Displaced workers ultimately did find new work, but only because the new social institutions “artificially” created buyers for all the things displaced workers reinvented themselves to sell. Without this institutional innovation, Tyrone tells me, something like the Great Depression would have been the new normal.
That's from Randy Waldman at Interfluidity.

Liked what you read? I am available for hire.

What will happen to house prices in the Bay Area after the Facebook IPO?

A lot of people seem to think that house prices in the Bay Area will rise significantly after the Facebook IPO. It's fun to speculate about, but those people seem to be assuming a lot. Here are some of those assumptions I'm not so sure about:

  1. Facebook will add a significant number of new millionaires to the Bay Area.

  2. Everyone that benefits from the Facebook IPO will want to invest that money in a house, instead of into the stock market, retirement, cars, etc.

  3. Everyone that wants to invest their option cash in a house will buy shortly after they liquidate their options.

  4. Most of Facebook's new millionaires will buy houses in the Bay Area.

  5. The supply of housing for multi-millionaires is inelastic.

  6. The people buying new houses will not be vacating their old ones.

I'm not so sure that those assumptions are good ones. A San Francisco Chronicle article from 2009 said that there were 136,000 millionaires in the Bay Area in 2009, a number that has surely risen since then. Facebook has 3500+ employees, and on the high side I would guess maybe 1500 are going to earn enough money from the IPO to change their lifestyle, This would add about 1% to the Bay's total, assuming all of Facebook's newly minted millionaires live in the Bay Area.

If anything the prices of houses at the very high end (10 million plus) will rise. But it's hard to feel very sorry for people that are priced out of that market. If anything a housing shortage here may help remove or loosen some of the Bay's many restrictive housing and zoning laws.

Liked what you read? I am available for hire.

Virtualenv is an anti-pattern (for beginners)

Every time I do a user test with a beginning programmer, I remember how hard computers are, how unforgiving the tools are, and end up wanting to apologize for how annoying and strict programming is. We are making progress with teaching people how to code, but it's still really hard.

For example, if you are just getting started with Python, here's a short list of problems you might face when trying to set up Flask, which is by far the easiest Python web server to set up.

  • Learning how to cd in the terminal
  • How URL's requested by a user map to actual code
  • HTML, CSS and Javascript, because you actually want it to be pretty.
  • How to read and write things from a database
  • Installing Flask, so learning how to use pip or easy_install
  • Python telling you your file is no good because it mixes tabs and spaces.
  • How to run Flask locally

How to draw an owl: 1. Draw some circles 2. Draw the rest of the fucking owl

And that's not even counting the stuff that's so obvious to us we forget to mention it. Most quickstart guides also fail to help people make incremental progress.

Game designers are great at teaching new, hard things. They have to be, or no one will play their games. You will notice that games don't start with you battling Ganon in an epic death match; they start with you learning how to use the character and perform actions like make a kick, or open a door. Through a series of incremental successes you become an expert in the game and can tackle more and more complex tasks.

It bugs me to see so many Python tutorials mention virtualenv as a requirement to get started. (virtualenv is a tool for sandboxing your Python apps, so each Python project on your computer is using its own set of packages). The biggest advantage of virtualenv is that you can have different versions of the same Python package (like Flask or requests) that are required by different projects, whereas if you install them system-wide you can't.

However, recommending virtualenv just adds another thing you have to do before you can see pretty lights on the screen, and represents another possible opportunity for people to lose interest, and start doing something else instead of learning how to get a web server set up.

It also introduces a significant opportunity for confusion; the "It was working yesterday, why isn't it working now?" problem. You need to remember to source your virtualenv file in every Terminal shell where you're running Python, or your terminal will tell you it can't find the library you literally just installed. Needless to say this is confusing, the Terminal won't tell you how to solve the problem, and Googling for the answer isn't likely to give you the solution you need, because it's such a generic error message.

I've never seen beginners run into the problem of needing conflicting versions of a Python package for two different projects. I was comfortable dumping everything into site-packages for over two years of Python development; only when I started working at Twilio did I need to start installing virtualenvs for every project.

As a community, I believe we should stop recommending that beginners install virtualenv. The faster we can get beginners to a Holy Shit, I Wrote Code That Made Something Happen moment, the better, and virtualenv is a big block for getting to that point. Instead I'd recommend installing pip using the one line curl program in the second paragraph here. virtualenv is something that's more appropriate to learn about and use once you have a few Python projects under your belt.

Liked what you read? I am available for hire.

#1 on HN for Six Hours: Postmortem

On Saturday my post on how not to ask questions at a conference was the number one post on the site for a solid six hours, between four and ten PM. Here are some raw stats from the last day.

  • Since the post was submitted, I've gotten 31,787 pageviews to my site; 14,478 in the nine hours between post submission and midnight, and another 15k on Sunday. One post can bring in amazing amounts of traffic, and justify all of the effort you've put into creating quality blog content.

  • In just the last two days I've gotten 50% as much traffic as I did in the whole previous year.

Google Analytics Traffic
Can you tell which days I made the frontpage of Hacker News?

  • Of those pageviews, 30,807 were for the article itself. 414 people visited my homepage (1 in 72 people) and 253 people visited my about page (1 in every 130).

  • 8,142 visits (roughly 27%) came from mobile devices. I am really glad I added a mobile/responsive view for smaller screens earlier this year, as this makes the content much more consumable on a small screen.

  • 69% of mobile visits (18% of the total) came from an iOS device.

  • Roughly 10,000 clicks came from Hacker News and 8,700 came from the Programming subreddit, where my post is still on the frontpage a day and a half later. If your post is doing well on HN, it probably makes sense to submit it to Proggit as well, as there's a large contingent of people that use Proggit exclusively.

  • 1,479 people have clicked on the aggregate Bit.ly link and 97 people have Tweeted the post (roughly 1 in 300).

  • I added 18 Twitter followers (about 1 in every 1800 visitors), bumping my total to 418. I added one new Bitbucket follower and zero new newsletter subscribers.

  • 23 people left comments on the post (about 1 in every 1300). 156 people left comments on Hacker News, off about 10k clicks, and ~160 people left comments on Reddit, off of 9k clicks.

I've posted my "conversion rate" in all cases because I don't feel like it's amazingly high. This is probably the nature of this sort of traffic though; there to read an article and learn something and then move on to the next thing. I suppose if I can reach the frontpage a few times in short succession, people may start to recognize my name and there would be a snowball effect, in terms of the number of people signing up to follow me or posting comments.

I don't have the tools in place at the moment to be able to test my "conversion rates" and see whether they can be improved. All in all though, the low rates at which people are clicking through to other material on my site suggests that I should put any information you'd like readers to know about yourself on the post view page, or in the footer of the post itself.

Liked what you read? I am available for hire.

“The best recommendations have a lot of verbs”

Via Tyler Cowen, an author from the Wall Street Journal interviewed the head of admissions at the Harvard Business School. The whole article is good, but this particular line stood out:

The best recommendations have a lot of verbs. They say, "She did this," versus adjectives that simply describe you.

I remember in 5th grade that we had to write Show Not Tell stories. The idea was to get out of the habit of writing "Kyle is in 3rd grade and he is really kind" - style stories and instead writing "When Joey's mom couldn't pick him up, Kyle walked him all the way home, even though it was two miles in the wrong direction."

I don't know why later teachers dropped the Show Not Tell agenda from the curriculum, but apparently people still write in this style. Maybe recommenders are lazy and it's easier to write "Shannon is a hard worker" than it is to come up with a concrete example. Maybe the recommender doesn't know the student very well, which is discussed in the article, and a problem.

The other possibility is that the person being recommended hasn't done anything interesting. It's easy to tell, because if you have done things, people tend to mention them when they're introducing you to someone, like "This is Jeff. Jeff wrote the entire billing system." You can also tell because the bullet points on your resume will have really bland verbs in them that don't really say anything, like "Developed marketing skills" or "Monitored social analytics tools for Company X".

One day you are going to have to wake up and decide to be Someone that Does Things. The World of Doing can be scary at first because there are lots of things that need to be done and no one is there to tell you how to do them.

So: what verbs to people use to describe you? Which of the versions below would you rather someone used to describe you?

  • "He's really good at finding tips and tricks to save time."

  • "He built a replacement for the school's calendar system and got 550 people to sign up."


  • "She is a really fierce competitor."
  • "She won the regional finals for her team by making free throws and getting a key steal in the final minutes."


  • "She's a hard worker."
  • "She rewrote the website to make it 100% faster, which boosted signups by 50%."


  • "His code is always reliable."
  • "While he was in charge, the API was down for a total of three minutes in two years."

Related: See Be Specific at Less Wrong.

Liked what you read? I am available for hire.

How not to ask questions at a conference

I went to Pycon last month (my first conference ever!) The conference was totally awesome and I met a lot of cool people. But I was also pretty appalled at the question asking at the end of each talk. Here's some stuff you should keep in mind before you ask a question at a conference.

  • Ask questions that you believe would be relevant to at least a third of the people in the room. Otherwise, avoid the temptation to show off your specialized knowledge to the room and just ask the speaker afterwards. Most of them are approachable on Twitter, email, or just in the hallways.

  • Ask only one question. If you have more than one question, pick the best and ask the other one in private later. Or ask your first question and then go to the back of the line. Other people have questions to ask as well and may not get to ask one.

  • Avoid buzzword bingo. It feels like lots of people walk up to the microphone just so the room can hear them mention some buzzword that indicates they know something about the topic. If I am running a Scrum team should I use Soak testing? How does Node.js influence the development of the PyPy project? If you wouldn't ask the question without a room full of people present, then don't ask.

  • Ask a question, don't make a comment. Talk time is for the speaker to be the expert, not you. Write up your comment as a blog post and post it for everyone to read later.

  • Be brief. After a talk, time is precious and many people may have questions for the speaker, so don't ramble about how nice it is to finally see the speaker in person, or how enlightening the talk is, even if those things are true. It's a matter of courtesy to everyone else in the room.

There is an easy solution to bad questions that no one has bothered to implement yet. Have people submit questions anonymously and have the speaker or a moderator choose which ones to answer, or have the room vote using a tool like Google Moderator. This will solve the problem of the question asker-bragger asking a trivial question.

The other solution is to charge money to ask a question, which could go to whatever cause you want. If enough people in the room have the same question they can contribute to the fee to ask the question and have it asked.

Update: There's some good discussion on Hacker News. "If the question you're asking makes you look smart, there's a good chance you're being a douchebag."

Also my friend Alan Shreve wants to know if it's appropriate to push back if the speaker dodges your question.

Liked what you read? I am available for hire.

How to use EC2 as a web proxy

If KRON Channel 4 or KICU gave me the ability to stream A's games, I'd gladly pay for it, but they don't, and we're not going to pay for cable just to get baseball.

MLB.tv is great and they allow you to stream games, but they have blackout restrictions where you can't stream the game if it's also being shown on cable locally.

Fortunately, there's a workaround. Because MLB.tv filters based on IP address, you can get around the restriction by sending your Internet traffic through a proxy computer, with an IP address that isn't blocked (this is how, for example, people in China get on the internet). Most proxies are slow though and become unwatchable if you try to stream a high-bandwidth video. If only you could use a high-bandwidth proxy and not share it with anyone else...

Fortunately Amazon provides servers in the cloud that let you do exactly this. People usually use them for running web servers, but you can use them for this purpose just as easily.

  1. Go to aws.amazon.com and login using your Amazon credentials. They will ask you for your credit card and to verify your phone number. As long as you stay inside the Free Tier (roughly 30-40 games a month) you will not be charged.

  2. Click on EC2. Click "Create Instance," then use the Quick Launch wizard. Create an Ubuntu instance (one of the "Free Tier eligible" ones) and make sure you download the credentials, as you need them to log in and they won't be available later.

  3. On the next page click on "Edit Details," then on "Security Settings." You need to create a new Security Group, that will allow computers from your apartment to connect to your new computer in the cloud. Find your apartment's IP address by visiting http://jsonip.com. Then fill out the details like this:

    EC2 Security Group Settings

    Substitute in your own IP address. If you have a cool ISP like Sonic, you can get a static IP address, which makes this much easier. Otherwise your IP address may change from day-to-day, and you'll have to update this setting, or provide a broader range of valid IP addresses in the form.

  4. You need one other piece of information which is the hostname for your EC2 instance. It will look something like this: ec2-12-34-56-789.compute-1.amazonaws.com.

  5. Now the fun parts! Open up the Terminal and type in:

    ssh -i $HOME/.ssh/mlb.pem ubuntu@ec2-12-34-56-789.compute-1.amazonaws.com -D 2001
    

    where $HOME/.ssh/mlb.pem is the route to the .pem file you downloaded earlier, and the hostname is the hostname you got above. Go ahead and leave this connection open. You need to leave this open while you're trying to watch some baseball.

    (This won't work for PC users. If you're on a PC you have to configure PuTTY to use SSH, which is an unusable mess that I'm glad I don't have to deal with anymore).

  6. Now open Firefox Preferences, click "Advanced", click "Settings", then type in these settings:

    Firefox proxy settings

    To check that they were applied correctly, visit jsonip.com in your Firefox browser. It should be a different IP than your apartment! Browse away!

Some notes:

  • The next time you set this up, all you have to do is run the SSH command in your terminal, and set up Firefox to use the proxy. It won't hurt your computer to kill either at any time, but the stream will stop working.

  • This uses the free tier of Amazon Web Services; if you go over your limits then Amazon will charge you. You can check your usage in the "Account Activity" portal on aws.amazon.com.

  • I've only done this for one game, and the usage I checked was about 0.4 GB, which means with 15 GB in/out per month, you should be able to stream about 30 games, assuming no other usage. The connection between MLB and Amazon is really good; the connection between Amazon and your apartment may not be, depending on your connection speed.

  • It may be better to configure these settings in your router so everyone can connect. I'm not sure how to do that, however.

  • Again, I wish this weren't a problem but MLB blacks out games on their streaming service, so there's no way to stream games that are on cable. I have no problem paying for a stream, as we are in fact paying for MLB.tv. I'll take this post down once someone figures out how I can pay to stream games in my local market, without resorting to hacks like this.

Liked what you read? I am available for hire.