Git Cheat Sheet

For a while now, I’ve had a gradually-expanding note with various git commands that I’ve been using as a cheat sheet for git tasks that I do not do often, but regularly enough to write them down.

I figure putting them here will not only make them (slightly) easier to get to every time, but may also help other folks out.

So here they are! Keep in mind that this is just a quick (and intentionally incomplete) cheat sheet – if you are learning git for the first time, you’re better off looking elsewhere (this is a good place to start).

read more

Getting Started With Flycheck + Pylint in emacs

This post was originally published on Admiral Ackbar’s Code Emporium .

Emacs is my favorite editor, and python is my favorite scripting language. Sometimes, though, silly syntax errors in python don’t get caught until runtime, which is a really inefficient way of finding them.

This post is a guide in getting started with pylint inside emacs. Pylint does finds syntax and other issues, so you can spot and fix them as soon as you make them. It can also be used to enforce style guides, notably pep8. With the Flycheck emacs extension, pylint’s output will be shown right inside your emacs buffers.

emacs with pylint
emacs with pylint

read more

On the Importance of Programming

This essay was originally published in The Stag Hunt Special Issue on Human Education .

I recently represented the company I work for at a career fair in New York City. The ranks of job-seekers were large and diverse in terms of background, age, and experience. Among the job-seekers, however, one group stood out: people in their late 20s to mid-30s who were looking to start a new career as programmers, having recently made up their minds to dramatically change paths. Here were former investment bankers applying for an entry-level programming position. By itself this is not particularly surprising: many people realize that the careers they enter right out of college are not quite what they expected and decide to switch tracks. Given increasing demand for programming and computer science-related jobs, it is natural that many turn to explore this field.

This group of people, however, had something much more intriguing in common. When asked about their first ventures into programming, many people used phrases such as “I never knew it was so easy…” or “it really surprised me that…”. Here were bright, curious people, most of whom had done reasonably well in their past lives, accidentally catching glimpses of how some very simple programs work and being taken completely off-guard by it. These people were so intrigued by the world of programming that they could not help but dive deeper into the rabbit hole. A common path was an intensive program taken over the course of a few weeks (General Assembly was a popular option) and then a full plunge into the world of entry-level job hunting.

This leads to a very important question: why had these people never been exposed to something with so much utility and transformative potential throughout the many years they had spent in the education system?

read more

Why You Should Use Class Enums in C++

This post was originally published on Admiral Ackbar’s Code Emporium .

This is a brief post about what class enums are in C++, and why you should use them.

The Problem: Enums Pollute Global Scope

Here’s a conflict you might get when using enums:

enum computer_state { ON = 0 , OFF, STANDBY };
enum disco_ball     { OFF = 0, ON };

int state = ON; //CONFLICT - this won't compile

read more

How to Have Multiple Versions of C++ OpenCV Side by Side

This post was originally published on Admiral Ackbar’s Code Emporium .

This tutorial will show you how you can have different versions of the same library side by side such that it’s easy to change which version your code uses.

For example, I work a lot with OpenCV, the computer vision library. I like to be able to try out different features in the trunk version of the library, but prefer to use a stable release in production settings. It’s actually pretty easy to have both versions on your computer, and select which one you’d like to use at compile time.

The following assumes you’re on a Linux machine. I’ll use OpenCV as an example, but the concept applies to any library.

read more