Posts

Pipelines and your Unix toolbox

Unix commands are great for manipulating data and files. They get even better when used in shell pipelines. The following are a few of my go-tos -- I'll list the commands with an example or two. While many of the commands can be used standalone, I'll provide examples that assume the input is piped...

Posts

Go scope

Scoping in Go is built around the notion of code blocks. You can find several good explanations of how variable scoping work in Go on Google. I'd like to highlight one slightly unintuitive consequence of Go's block scoping if you're used to a language like Python, keeping in mind, this example does...

Posts

Tracking a call stack in Go with context

The use of context in Go can help you pass metadata through your program with helpful, related information about a call. Let's build an example where we set a context key, "stack", which keeps a history of the function names called over the lifetime of the context. As we pass the context object...

Posts

Go channels

Go uses goroutines to execute multiple bits of code at the same time. Channels allow for the aggregation of the results of these concurrent calls after they have finished.

Posts

Quickstart `supervisor` guide

supervisor is a UNIX utility to managing and respawning long running Python processes to ensure they are always running. Or according to its website: Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

Posts

Git aliases

Here's a quick post for managing your git shortcuts. If you use git regularly, you should have a .gitconfig file in your home directory that looks something like this:

Posts

PySpark dependencies

Recently, I have been working with the Python API for [Spark][pyspark] to use distrbuted computing techniques to perform analytics at scale. When you write Spark code in Scala or Java, you can bundle your dependencies in the jar file that you submit to Spark. However, when writing Spark code in...

Posts

Python Fabric

To help facilitate my blogging workflow, I wanted to go from written to published post quickly. My general workflow for writing a post for [this blog][MyBlog] looks like this: Create a post in _posts Write the post Run fab sync

Posts

Bash SSH host management

If you have a lot of servers to which you frequently connect, keeping track of IP addresses, pem files, and credentials can be tedious. SSH config files are great for this problem, but they don't play well with bash. I wanted to store all of my hosts' info in a config file but still have access to...

Posts

Managing bash aliases

Bash aliases are great. Whether you use them to quickly connect to servers or just soup up the standard bash commands, they are a useful tool for eliminating repetitive tasks. I'm always adding new ones to optimize my workflow which, of course, lead to me create aliases to optimize that workflow....

Posts

Elixir binary search

A few days ago, I saw a Guess my word game on the front page of Hacker News. Before spoiling the fun for myself by checking out the comments, I decided to try my hand at writing a solution in Elixir. Afterwards, I generalized the code to choose its own word from the UNIX dictionary and then "guess"...

Posts

qc: quick calculator

If you spend most of your time in the command line, you don't want to leave to do math. Qc is a script that does in-line command line math without forcing you to exit the main bash prompt as you might with a program like bc or a language interpreter.