The zen terminal

Tools are believed to be a major factor in the evolution of humankind. If we didn’t have tools, like wheels, shovels, computers or the internet we just would not be very productive. One of the tools that has shaped the digital revolution is the command-line interface (CLI), also known as the terminal or console.

What makes a CLI so effective is the brilliantly simple way it allows you to control a computer using text based commands. There is no graphics or buttons or mouse. Just you, the keyboard, and the machine. It’s quick. I can’t even begin to describe how much more efficient I am on linux than say windows for common tasks. Want to backup your cat gifs?

cp /images/cats/*.gif /gifs/cats/

The thing about your terminal is that it’s personal. It’s intimate. You know it like the back of your hand. Where your files are is in your head, neatly arranged to your personal preferences. You can change the colors of the text and background to form a sort of new age coat of arms. Here’s mine:

terminal, tmux, powerline, zsh, cURL, jq, htop

I understand that it might look scary, but it’s pretty simple once you get your head around it. There are some good guides and once you dive in it’s actually pretty fun. Right now is an exciting time in CLI, even after 40+ years there is still much innovation to be had in the shell space. You will likely start with Bash, move onto Zsh, or maybe even try out Fish like me.

Here are some terms layman’s terms (please correct me if I’m wrong or have any suggestions)

shell = “The interface that accepts your input and runs software for you”
prompt = “What you see in your shell when it’s waiting for your input”
script = “File with code that consists of commands to be ran by your shell or programming language”
dotfiles = “Collection of invisible configuration files residing in your home folder”
linux = “A class of operating systems that use the linux kernel”
*nix = “A class of operating systems consisting of unix and linux”
root = “The most powerful user, has total access to everything and everyone”

Oh ya, this was meant to just be about how I got rid of messages whenever I open up a shell, hence “Zen” and all, so here’s how I make Ubuntu, Fish, and SSH keep quiet.

#!/usr/bin/env fish

# Ubuntu Message of The Day
if test -f /etc/update-motd.d/*
        chmod -x /etc/update-motd.d/*
end

# Fish Shell Greeting
set line1 "# Don't Show Fish Greeting"
set line2 "set --erase fish_greeting"
echo -e "\n\n$line1\n$line2" >> ~/.config/fish/config.fish
. ~/.config/fish/config.fish

# SSH Last Login
set line1 "# Don't Show Last Login"
set line2 "PrintLastLog no"
echo -e "\n\n$line1\n$line2" >> /etc/ssh/sshd_config
service ssh restart

 

You can go much much much deeper into the rabbit hole, for instance the code to having some fun with fortunes and frogs in my prompt is hosted on GitHub. Here’s what I see when I ssh into my server:

Fish shell prompt

Enable tmux scrolling in iTerm2

When using iTerm2 the one option I could not live without is unlimited scrollback and support for mouse / trackpad scrolling for tmux. Here is how to enable unlimited scrollback and support for tmux in iTerm2 preferences:

Enable unlimited scrollback for tmux

Bonus Protip: You may also with to enable mouse support by adding this to the ~/.tmux.conf file in your home directory (create one if you don’t have it already):

# tmux config file ~/.tmux.conf
set-window-option -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on

Remove www from URL with nginx

So I’ve recently been wearing my sysadmin hat, having installed and configured nginx a coworker showed me that if you added www as a subdomain the website was gone. Not good, so I did some googling and found a few examples on how to ensure users are redirected to the appropriate subdomain (or lack thereof). It’s as simple as adding this new server block to your nginx config file (If your using ubuntu it is most likely in /etc/nginx/sites-enabled), and change domain.com with your actual domain.

server {
server_name www.domain.com;
return 301 $scheme://domain.com$request_uri;
}

Then you should be able to simply restart nginx, again if your using ubuntu this command will probably work:

sudo service nginx restart

Do people love your startup?

Been doing surveys and stuff, lately with just one question fueling one metric, the Net Promoter Score.

How likely are you to recommend [company or product] to your friends and colleagues?

NPS Score Visualization

Basically you ask this simple question with a 1-10 rating scale for the answer then you group the results into the following buckets:

Promoters rated 9 or 10: These people love you
Passives rated 7 or 8: They sit on the fence
Detractors rated 6 or lower: Get to know these people

Segmentation is what makes it really cool. For instance you can track the NPS for:

Users by the month they joined (a cohort which you should apply to all your metrics)
Users who came from different acquisition channels (people from 4chan are mean!)
Users who have done a specific activity (good way to find your “aha moment”)

Data Visualization

Lately I’ve been spending my time defining key metrics for our SaaS startup Mashape. One of the things we wanted to do was get quick visual feedback of our data. There are a lot of great charting and graphing tools and services, but I ended up falling in love with one javascript library in particular. Rickshaw is built on top of D3.js and comes with all the bells and whistles that you see in enterprise level dashboards. If you have data and want to make it look pretty I highly recommend it.

Here are some screenshots I can share with you:

42x more requests in one year

42x more requests in one year

Data visualization is fun when you have great data!

Data visualization is fun when you have great data!

Teaching better with technology.

I grew up in an era of video games. When I was just a little guy I remember playing my favorite Ninja Turtle, Michelangelo, on our NES. Even my Grandma got bit by the gamebug, her favorite was the plainly named golf, which we sometimes played together.

The games back then were not great; to put it plainly, the graphics and UX sucked. Serisouly, I don’t know why ROMS exist except for nostalgia (I will admit I have the original Mortal Kombat for Super Nintendo on my jailbroken iPhone) But we played them and we loved them. We spent hours grinding away at the controller.

Whats this got to do with education? These games weren’t easy, but we learned how to beat them.

The game received criticism for its difficult gameplay, being noted by many fans and critics as being one of the more frustrating NES games made.
Teenage Mutant Ninja Turtles Wikipedia

No matter what the objective was, rather climbing through sewers or getting a double bogey we were able to grok the missions and challenges at hand. We adapted to new controls and approaches, learning new ways to do things at a pace I doubt has ever happened before. The brain cells were stimulated and storing a lot of info. Then we went to school for eight hours. Had a quiz or something. Recess was cool. I remember being at school thinking about the level I was stuck on. Or what was for lunch. Or the cute girl next to me. But I don’t remember ever thinking about homework.

I’m a programmer by trade, and people assume I’m good at Math. I laugh and say no, I write code to do it for me. For instance this is super common: 60*60*24*365*1000 (it’s a year in milliseconds)

So how can we make school, and education in general, more exciting? Well we could use games, which we are already doing. My favorite “educational” game was The Oregon Trail. I put education in quotes because the only thing you really learn is the importance of wagon supplies and bullets if your traveling cross continentally in the 19th century. But I think games are actually a small facet to the solution of a much bigger problem. What most of the world’s education systems are doing right now is killing any creativity and feeding students useless information. What day some dude traveled somewhere. How to do advanced geometry. Some classes– some teachers are an exception. Art, English, Languages, those kind of classes actually are interesting and engaging most of the time. It’s the standardization and delivery that I find backwards. When my little brother starts school I want him to enjoy it and learn as much as possible. It was amazing how quickly he learned to read words like New Game, Start, and Loading playing on my mom’s iPhone as a toddler.

Our entire education system, like the oregon trail, is stuck in the 19th century. We approach teaching our young like running a factory. The kids are the products.

We treat our young ones like a canvas on which to print a predetermined image of what we deem important. What we ought to be doing is the exact opposite, teach them that the world is their canvas and allow them to choose their own course. Why is the most important thing in our schools what grade your in and what grades you got. We shouldn’t even have grades. Now, that’s a big statement that a lot of people would find ridiculous. This is going to require a shift in the entire paradigm of education. I’m not as eloquent as some in conveying ideas, so I highly suggest you click that link.

I also don’t have many answers. I know things are broken, and might be able to apply a piece of tape here or there, but I don’t have the skills, knowledge, or time to offer a complete fix. But we could probably do it together.

growth-hacker-venn-diagram

Remember the eight-second rule. Consumers have eight seconds worth of patience while waiting for your pages to load. This is especially true for home pages. It’s like the restaurant business mantra: Don’t keep them waiting, or they’ll leave and never return.

Remove all .git files, recursively.

If your using composer or another package management system, it’s great isn’t it? But it comes with a lot of junk in the form of hidden .git repos that keep a record of every change the project has committed. You don’t want to send all that over the wire every time you deploy to staging or production. This is especially important if your using your own internal packages making it ready for anyone to come steal, accessing the full source code of your project.

Either way this shell command will remove them. I put it in a chef cookbook, you can use it however you want.

find . | grep .git | xargs rm -rf

Source: http://davidwalsh.name/delete-svn#comment-23147

Startup Name Generator Webapp

Giving Advice

One of the biggest mistakes I think people make in business is witholding information for fear of “rocking the boat” or disturbing the status quo. Luckily I’ve had family and friends commit their insight no matter if it would be well received or not. In that spirit here is some advice I have for some well known web apps.

Google:

  • Fix (IE. Monetize) your 404 page. WTF is wrong with you, I just made you millions.

Twitter:

  • Make it so when you tag someone the casing doesn’t convert to lowercase. That’s annoying.
  • Wish I could copy and paste the username from the header of the direct message modal window.

HackPad:

  • Why can’t I change the name of the url manually, using the top line is a bad idea for a few reasons.
  • Add optional markdown support for those of us who want it, I can’t be the only one.
  • Let me add notes to specific people from within the pad which sends them an email, like so:


# @email@example.com check this out blah blah blah
 
Normal hackpad area something important etc...
 
/* @email@example.com @other@example.com
etc...
*/

Your welcome.

Update #1

Hackpad hit me up on twitter right away!

Update #2

Twitter fixed the issue, now fixing the capitalization of usernames wont waste precious seconds of my time. I’m not saying it’s cus of this post, but I did follow and tweet a bunch of the engineers.

Update #3

Google? Google? Google? Hire me and I’ll spend more time on google plus.

Super Useful PHP Helper Function

If you use PHP, especially when dealing with an API, you might want to see everything inside a variable. Normally you’d use print_r(); but that would normally return a big long line of unreadable text. Since PHP included formatting as whitespace if you wrapped the output in a <pre> tag you get a nicely indented view that is much more readable.

Here’s how you can do it super easy style, just add this function to your project:

function pretty_print($arg) {
  echo '<pre>';
  print_r($arg);
  echo '</pre>';
}

Then you can do something like:

$var = $_SERVER;
pretty_print($var);

desk.com api is awesome

Shut up and take my money!

Analytics.js

The hassle-free way to integrate analytics into any web application. Works with google analytics and KISSmetrics, amongst others.

Silicon Valley startups spend our brightest intellectual resources on photo sharing and social-whatever, while industries that affect the quality of living for millions are left with bureaucrats.
Jeff Lindsay

The most important thing is to build a prototype and get to market, not writing a plan, making a forecast, or creating a PPT pitch. Always be prototyping.
Guy Kawasaki Reddit AMA

Couldn’t be more proud…

Screen shot 2012-12-04 at 12.15.32 AM

Online Payment Systems

My comparison of online payment credit card processor based on my experience with PayPal, Authorize.net, Google Checkout and Stripe. Here’s the punchline: Stripe kicks ass

12345...6