logo

Mac Terminal.app vs iTerm2

Every once in a while I wonder if I’m using an unnecessary 3rd party app when a built-in on macOS would be sufficient. Terminal.app is one such app - I’ve used iTerm2 for many years, but I don’t use a bunch of its features, and every time I open iTerm2 settings it feels like overkill. I was on my spouse’s Mac over the weekend helping her get some things set up and used Terminal.
One minute to read

Fish and pipestatus

Fish and $pipestatus Note: This morning I answered a Reddit post about $pipestatus, and after learning that there’s not a lot of good information out there, I thought making a blog post might be helpful for other future Fish users wanting to know more about using Fish’s $pipestatus. What’s an exit status? In Fish, like other shells, you can tell whether a command failed via its return value, sometimes called an exit code or an exit status.
6 minutes to read

Better git shell aliases

Better git shell aliases: using an external shell script 10 years ago, I read this blog post on GitHub Flow git aliases by Phil Haack. From it, I learned a few really clever tricks. Even though I never much cared for using ‘GitHub Flow’ as a git workflow, I used some of those tricks for my own git aliases. One of those being this basic pattern: [alias] foo = "!f() { echo "foobar: $@"; }; f" This lovely little mess of an alias embeds a one-line shell function tersely named “f” directly into a git command.
8 minutes to read

Finding common bigrams

Find common bigrams Bigrams are 2-letter combos. When designing a keyboard layout, it’s common to optimize for comfort and speed by analyzing bigrams. Here’s a simple shell script to do a quick-and-dirty bigram analysis. Start with a corpus Download Shai’s corpus for Colemak: cd ~/Downloads curl -fsSLo corpus.txt.xz https://colemak.com/pub/corpus/iweb-corpus-samples-cleaned.txt.xz Extract the .txt file: unxz corpus.txt.xz Split into individual words Separate that corpus into individual words, one per lined, and all lowecase letters:
One minute to read

Using awk to colorize go output

From my StackOverflow answer on the subject of colorizing Golang test run output: I like piping to a simple awk script to colorize output from other shell commands. That way, you can customize with whatever colors/patterns suit you. You want to colorize an output unique to your project? Go for it. Simply save this awk script to ./bin/colorize in your project, chmod u+x ./bin/colorize, and customize to your needs: #!/usr/bin/awk -f # colorize - add color to go test output # usage: # go test .
One minute to read

Zsh - splitting a string into an array

Zsh - splitting a string into an array Intro There are a ton of different ways to split up a string in Zsh. This post attempts to show them with examples to help you build your own. I write Zsh scripts all the time, and still reference back to this guide, so there you go. Using the split parameter expansion ${(s/x/)foo} From the Zsh docs on Parameter Expansion Flags (yeah - I know… how would anyone ever find that if they didn’t know where to look!
3 minutes to read

zstyle primer

From my StackOverflow answer on the subject of Zstyles: When it comes to learning about the Zsh zstyle, it’s hard to find a lot of good examples that describe what zstyles are used for and how to use them. The Zsh documentation notoriously obtuse. To learn about zstyle, I recommend spending some time looking at how Prezto uses it, as well as reading the docs and trying some things in an interactive Zsh session.
3 minutes to read

Modern SQL Style Guide

Modern SQL Style Guide - rev 1.0.1 A guide to writing clean, clear, and consistent SQL. select * from modern.sql_style_guide as guide where guide.attributes in ('clean', 'clear', 'consistent') and guide.look = 'beautiful' Purpose These guidelines are designed to make SQL statements easy to write, easy to read, easy to maintain, and beautiful to see. This document is to be used as a guide for anyone who would like to codify a team’s preferred SQL style.
17 minutes to read

Two years of Colemak

It’s been more than 2 years since I learned to type using Colemak , and I am still happily using it. I have nearly no interaction with QWERTY aside from my phone, the occasional shared machine where I can’t use my AutoHotKey mappings, and the meaningless default letters on all the keyboards I use but never look at. I never quite achieved my goal of 85 WPM, but I also never really properly trained for speed.
6 minutes to read

SQLite UDF in Python

From my StackOverflow answer on the subject of parsing SQLite string dates: Python makes it pretty easy to add a user-defined function to a SQLite query. Let’s demonstrate this by populating a table full of text reprensentations of dates, and then use a simple Python UDF we write here called date_parse to attempt to parse the text date into a real date. First, we need to do some basic setup. Let’s do some standard Python imports firsts.
3 minutes to read