Even though it’s an essential part of creating an online presence, I could never come up with a proper username that would work across different services. Today I decided that I would find one, no matter what. It should be easy to write, easy to remember, easy to understand in a spoken conversation and, in a less measurable dimension, it should sound good.

The first step was finding a systematic way to check whether a username was available in different services. There are several websites that do exactly that, I’ve used checkusernames.com, which is easier to scan quickly since everthing fits in less than two pages (you can get it to fit in one page with some simple CSS manipulation in the dev tools), and Namech_k, which checks some different services, like Facebook, and also domains.

After experimenting with variations of my name and then some crazy things for a few hours (horselovingmartian was a serious option at one point), I determined that it would be a joke with the word “functional”. Problem is, “functional” is a 10 letter word, and Twitter has an annoying limit of 15 characters for usernames, leaving me with only 5 characters to work with. Some of the best ones didn’t fit, and some others were taken. I almost flipped the table when I came up with barelyfunctional only to find out it had 1 extra character.

Damn.

I yielded: I’m not that good at inventing names (specially in a language that’s not my native one), so to overcome this obstacle I would need to use my other skills. I would find a list of words, programmatically apply some constraints, and choose from the options in the resulting list.

Some time ago I released a small game for a Ludum Dare called I AM GONNA SMACK YOU WITH MY WORDS! (pretty fun, you should check it out!) for which I needed a dictionary to validate the user entries. After some digging, I’ve found out: every default UNIX-like installation has a list of words, usually at /usr/share/dict/words or /usr/dict/words:

$ cat /usr/share/dict/words | less

That’s awesome, let’s use that! But how many words does it contain?

$ cat /usr/share/dict/words | wc -l
99171

Wow, ok, that’s a lot. Let’s do some filtering, including only the words that contain between 1 and 5 characters:

$ cat /usr/share/dict/words | grep "^\w\{1,5\}$" | wc -l
10311

Still not very helpful. I figured that a lot of words were proper nouns, so we could remove the ones starting with a capital letter:

$ cat /usr/share/dict/words | grep "^[a-z]\w\{1,4\}$" | wc -l
7583

Hmm, still a lot of work. I really like adjectives that end with ly, like barely, so I gave it a shot:

$ cat /usr/share/dict/words | grep "^[a-z]\w\{1,2\}ly$" | wc -l
72

Aha! That’s more manageable. Now you can read it with less or save it to a file and read it in your favourite editor:

$ cat /usr/share/dict/words | grep "^[a-z]\w\{1,2\}ly$" > awesome_adjectives.txt

This is a common pattern for handling huge inputs, you start massaging it, figuring out patterns and excluding them, until you have a dataset which has a workable size.

Just for curiosity, here’s a little Ruby script to accomplish the same:

# I'm using each_line so we don't load everyhing into memory at the same time
awesome_adjectives = File.open('/usr/share/dict/words', 'r')
                       .each_line
                       .select { |line| line =~ /^[a-z].*ly$/ }

That’s it! Keep experimenting!

Get help on Codementor

Comments