September 7, 2020

Instant Google Results in Alfred

I’ve been searching for a solution to allow me to instantly search Google from anywhere on my Mac. My goal is to access the result I want as fast as possible.

My previous solution was to use the default fallback search in Alfred. I hit Option-Space typed my search and pressed Enter. This was pretty good. It would open Safari with my query’s Google results. The page would take two seconds to load and then I’d have to figure out how to select the result I wanted.

Ideally, I’d just press 1, 2, 3, etc on my keyboard to launch the corresponding result. But the closest I could find was a vim-like browser plugin (such as Vimari) which gives all links a letter combination to type to navigate to it. Or Shortcat, which I use for navigating all macOS UI.1

This solution wasn’t fast enough for me though. I wanted a more modal experience where I hop into an ephemeral search session.

Enter googler

In my search for instantly navigating Google results, I came across googler which displays google results on the command line. You can type a number followed by Enter and it opens your default browser to that result. Getting closer.

After looking for an existing solution and turning up empty, I decided to make my own via Alfred Workflows.

I really liked googler and essentially wanted to interface with it through Alfred. So I picked up my favorite programming language, and started writing. The end result is Alfred googler. Here’s a demo:

demo gif

Check out the README for info on installation and features.

  1. There’s an alternative to Shortcat called Vimac but I still prefer Shortcat even though it’s not maintained.

September 6, 2020

Monitoring my Internet Connection with Speedtest-cli

I wanted to log my internet’s upload and download speeds over time. brew search speed turned up speedtest-cli which uses servers to measure what I was interested in.

Unfortunately it’s a one time test and if you want it to repeat, you’ll need to automate it. I chose a simple shell while loop to handle this for me1:

while; do
  speedtest-cli --json --server $(
    speedtest-cli --list |
    grep -E "CenturyLink|Sprint|Enid|OneNet|Cox|Suddenlink" |
    head -20 |
    cut -f 1 -d ')' |
    sort -R | head -1
  ) | tee -a speedtest-log.json
  sleep 600

This checks a random nearby server every 10 minutes.

The $(...) subshell is what finds a random server (speedtest-cli outputs in order of distance). The grep limits it to internet providers I’ve heard of2. tee outputs to stdout as well as a log file so I can see the results without having to tail the json log.

I run this in a tmux session dedicated to monitoring my internet (I run 2ping, mtr, and httping here as well).

The results are append to the log as one test run per line so it’s a little terse to read. I may end up writing a Sinatra app to display the results in a more human readable format.

  1. I don’t recommend running this on a laptop as you may forget about it when you tether to your phone’s data plan.

  2. Feel free to adjust this to your preference.

March 5, 2020

Configuring a Heroku Review App to use another apps database

In certain scenarios, I’ve found it useful to use our production app’s Read Replica as a source for manual testing. It’s not something I’m reaching for often but there are definitely cases where our seed data just doesn’t cut it.

Since it’s a read replica, no writes can be made to it and I don’t have to worry (too much) about harming production. You’ll want to make sure any external user operations aren’t configured to happen automatically (e.g. sending email, cropping avatars, etc).


In order to assign a different DATABASE_URL to a review app, you’ll need to destroy the postgres attachment on your review app. I knock this out by chaining some commands together:

heroku addons:destroy $(heroku addons:info heroku-postgresql -a your_review_app | grep '===' | awk '{print $2}') -a your_review_app

The sub-command here is getting the name of the add-on (e.g. postgresql-concentric-04442) and passing it to heroku addons:destroy.1


Now that we’ve gotten rid of that pesky, old database, we can set the DATABASE_URL on our review app. I also have a banger of a command for this:

heroku config:set DATABASE_URL="$(heroku config:get HEROKU_POSTGRESQL_PURPLE_URL -r production)" -a your_review_app

In order to know what to substitute in for HEROKU_POSTGRESQL_PURPLE_URL in your setup, run:2

heroku pg:info -r production | grep Followers 

Use your discretion to determine your read-replica.


That’s it. In my case, my app was rebooted and it read the DATABASE_URL without a problem. If your app tries to do writes, it will most likely throw an exception.

  1. Of course, don’t put your production app’s name in this one. 😂😱

  2. Assuming you’re using a read replica from Heroku

March 3, 2020

Resolving Brakeman Errors

After running brakeman you’ll get a report and, if there are new warnings, it will exit with a status code of 3”. Typically, I only see two types of output from Brakeman. Either a large report where there are new warnings or a short report which is saying Brakeman is out of date.

I’ll briefly explain resolving both.

Resolving New Warning(s) Detected

The long report.

Run brakeman -I to get an interactive console for ignoring warnings. It will analyze your code base and then prompt you for where to find the ignore file. I’ve always used the default location of config/brakeman.ignore, so I simply press Enter to accept the default.

Then I almost always choose option 2 to Hide previously ignored warnings”. This option is a bit confusing. It’s the same as option 1 but doesn’t show warnings you’ve already ignored.

At this point, brakeman will iterate over each new warning prompting you to ignore the warning. This is a critical point in your role here. You need to make sure the warning should be ignored or fixed. If this is a positive warning, you need to Ctrl-C right now and go fix the code rather than ignoring the vulnerability. If it is a false-positive, you can ignore it here via i or n. I recommend n because it prompts for a note as to why this warning is a false-positive.

After you have resolved all warnings, it will (optionally) prompt you to remove fingerprints (outdated warnings). You need to input y or yes here for it to actually remove the fingerprints.

Finally, you’ll want to save changes via 1 and, due to amnesia or disorder, Brakeman will again ask you where the ignore file is. I again just press Enter because I use the default location. (I have no idea why the input and output would be in different locations.)

You can run brakeman again and it should report No warnings found”. You’re all ready to check the ignore file into source control and push it up to your CI.

Brakeman’s Out of Date

The short report.

This only appears if you’re running brakeman --enusre-latest (which I highly recommend).

To fix, simply run bundle update brakeman. This will update your Gemfile.lock which is all you should need to change.

If you are locking brakeman in your Gemfile (which I don’t recommend), you should check Brakeman’s CHANGES to make sure the new changes don’t break whatever you’re guarding against with the version locking.

January 28, 2020

Audio Gear

If you would like to have great, clean sounding audio in your meetings, podcasts, or videos. Purchase the microphone and audio interface that I recommend and use below.


I use the Audio-Technica AT875R shotgun microphone.

I place it 3-5 inches from my mouth using a boom arm attached to my desk. Since I type on that desk, I use a shock mount.

Since this is a shotgun mic, it works great from a distance. I can position the mic about 6-8 inches from my mouth to get it out of a video head shot which I use for meetings (I have enough room for a lower third with this shot; about a 35mm focal length). But, for best sound, place it only a fist-full away.

Audio Interface

Since most microphones in this category do not have USB, you will need an interface to connect it to your computer.

I recommend the Behringer UMC204HD audio interface. I have the 404HD which has four inputs instead of two. I have yet to use more than two inputs though.

Many podcasters like the Focusrite Scarlett interfaces but these cannot be muted by apps like Shush (see below) and therefore I cannot recommend them.

Boom Arm

The microphone I recommend doesn’t come with a stand. In my setup, I have a Rode PSA1 Boom arm. It’s fine but if it ever breaks I’ll probably purchase a Blue Compass purely for asthetics. Neewer makes a cheap boom arm but I haven’t tried it.

Shock Mount

Since I’m typing/bumping the desk I sit at, I got a shock mount which works great with my microphone.

XLR Cable

None of the aforementioned products come with an XLR cable. If you’re using a boom arm you will probably need 6-15ft of XLR cable. I went with a 10ft cable from Planet Waves. I had a little cable to spare.

Shush - Digital Cough Drop

When you’re in a meeting or apart of a live event, you’ll eventually need to cough or sneeze or the dog starts barking or something else will happen, and you will want to mute your microphone quickly. For this case, I highly recommend the $5 app Shush from Mizage.

In Push-to-Silence mode, I have a single hot key that I can hold to mute myself. Great for using as a digital cough drop. Double-press my hot key and it switches modes. Now, in Push-to-Talk mode, I can hold my hot key to talk to my guests (great when I’m in a large group and I don’t need to talk a lot). Double-press it again and I’m back to Push-to-Silence mode.

I do recommend turning off the sounds Shush makes which means you have to rely on the status bar icon to know if you’re muted.

Monitoring Headphones

You’ll want some closed backed headphones if you are going to be recording audio for others to listen to. You’ll want closed backed headphones so that audio doesn’t leak into your microphone. I’ve heard good things about the Sony MDR7506. I personally use the Shure SE215 as they are in-ear monitors which aren’t so obnoxious on camera.

Too expensive for you?

Another option to all of the above is a USB microphone and some wired earbuds. The Audio-Technica ATR2100x-USB is a hand-held mic that comes with a stand. It has a standard headphone jack for audio monitoring and will work as an audio output so you can hear yourself and your computer’s audio in your headphones. It also has an XLR port so if you wanted to slowly upgraded into a boom arm, usb interface, and so on, you could do so without having to buy a new microphone. I haven’t used it personally.

(This could be a good mobile solution as well.)

Find yourself saying I have too much money” or I want more options”?

Check out Marco Arment’s Podcasting Microphones Mega-Review. He uses a $250 microphone with a $880 USB Interface and $1300 headphones with a $850 headphone amp.

While he does have pricey tastes, don’t let that steer you away from his mega-review. He reviews almost two dozens mics, ranging from $10-900, with multiple sound recordings from each. If you want to research this rather than take my opinion, look no further. And if you do, check out Podcastage’s YouTube Channel.

November 18, 2019

Hand and Wrist Exercises for Computer Users

I’ve been having problems with minor pain in my hands, wrists, and up through my arm. I’ve been giving these exercise a go.