Notes

Atom Feed

ARM Support

November 29, 2021

I recently got a new 2021 Apple Macbook Pro 14” with the M1 Pro processor (quite a nice upgrade from my previous 2014 Macbook Pro). While the fact that the new ports on the 2021 Macbook Pro are great, the biggest hangup was switching from an AMD64 to an ARM64 CPU. For my development workflow, this meant switching to ARM64 versions of developer tools or switching to entirely different tools altogether. Following is an abridged list of dev tools that I use and what I switched to on ARM64.

AMD64 tool New tool
Python Works great
Node Works great
Go Works great
Desktop apps (Chrome, iTerm, Slack, etc) No issues found
Factorio Works great
Virtualbox UTM
Docker Works great
Phantomjs Chromium
Official MySQL Docker Image Semi-Official MySQL Docker Image
Hadolint No alternative so far
Syncthing Works great
MenuMeters Works great
Amphetamine Works great

So far with few minor hickups, transitioning from AMD64 to ARM64 is working pretty well. Even transitioning off Virtualbox to a different Virtual Machine (UTM/QEMU) platform seemed pretty flawless.

Permalink

Map Caps Lock to Escape for Vim

November 24, 2021

As an avid vim user (better than emacs!), I’m having to escape out of different modes pretty often. Hitting the escape button on most keyboards adds a lot of friction being pretty far away from home row on a keyboard (not to mention simply missing on some versions of Macbooks). I’ve therefore remapped caps lock to escape to make it much easier to work with Vim.

For a mac, this is pretty easy and is built directly into MacOS. Within System Preferences -> Keyboard, you can edit Modifier Keys and remap Caps Lock to Escape.

Modifier Keys

Update 2021-11-25 from the @hrs:

DID YOU KNOW that it’s also possible to bind caps lock to both escape (when pressed individually) AND control (when chording)? I’ve been doing that forever and it’s quite nice. The free MacOS tool for that is Karabiner

Permalink

Download and Convert Youtube Playlists to MP3 Files

July 15, 2021

These are two scripts to download a youtube playlist of videos, and convert the videos into MP3 files.

youtube-dl supports converting files automatically but requires ffmpeg to be installed on the machine and visible in $PATH. convert.sh instead uses a ffmpeg docker container.

download.sh

#!/bin/bash

# Download a youtube playlist

set -euo pipefail
IFS=$'\n\t'

url="$1"

wget https://yt-dl.org/downloads/2021.06.06/youtube-dl-2021.06.06.tar.gz
tar xvf youtube-dl*

screen python3 youtube-dl/youtube-dl "$url"

convert.sh

#!/bin/bash

# This script converts an mp4 into an mp3
# It works by running ffmpeg in a docker container

set -euo pipefail
IFS=$'\n'

convert () {
    input="$1"
    output="$input.mp3"

    docker run -v "$(pwd):$(pwd)" -w "$(pwd)" jrottenberg/ffmpeg:3.4-scratch \
        -stats \
        -i "./$input" -vn \
        -acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 \
        "./$output"
}

if [ -z "${1-}" ]; then
    for f in $(find . -type f -name "*.mp4"); do
        convert "$f"
    done
else
    convert "$1"
fi

Permalink

Nobody Ever Got Fired for Copying FAANG

June 27, 2021

There’s a famous saying “Nobody ever got fired for buying IBM”. This once referred to IBM being a huge ubiquitous company that was a safe choice for being a technology vendor. Nowadays, though IBM is still a pretty large company (#42 on the Fortune 500), it’s outshined by newer larger tech companies like Facebook (#34), Apple (#3), Amazon (#2), Netflix (#115), and Google (#9). These FAANG companies share similar culture and technology and are frequently copied by other companies on things like interview process, internal tools, UX design, and compensation. I therefore propose that the 2020 version of this saying is “Nobody ever got fired for copying FAANG.”

Permalink

Removing Token Authentication From Jupyter/iPython Notebooks

May 31, 2021

Jupyter (formerly iPython) notebooks by default require an authentication token to access. This is because the notebooks allow users to run arbitrary code so the token prevents access by non-authorized users. However, with a properly secured environment (running within a local network or not binding to a public network interface), there’s little need to set an authentication token. While the Jupyter documentation recommends using a password instead, it still doesn’t get around the fact that the default notebook configuration uses unencrypted http connections which allow any party to intercept or modify requests, making both tokens and passwords trivial to bypass. Therefore, to fully get rid of authentication on a Jupyter notebook:

  1. Make sure your notebook is not accessible to the wider internet.
  2. Run jupyter notebook --generate-config
  3. Uncomment the line c.NotebookApp.token = '' and make sure the value is set to an empty string
  4. Restart your notebook server

Permalink

Debian and Ubuntu Releases

February 13, 2021

Setting Up FastAI Fastbook on a Fresh Ubuntu Instance

January 31, 2021

Tip for Developer Tools Startups

January 30, 2021

A Better Go Defer

October 20, 2020

Covid-19 Economy Predictions

October 13, 2020

Basic Docker Monitoring

July 4, 2020

Switching From Go Dep to Go Mod

May 30, 2020

Upgrading LibMySQLClient in Python MySQLDB/MySQLClient

May 25, 2020

Developing Django in Production

May 15, 2020

Quote

March 5, 2020

Sendmail Wrapper for Mailgun

March 1, 2020

Python Release Support Timeline

December 26, 2019

Use the Default Flake8 Ignores

December 14, 2019

Making Pip Require a Virtualenv

December 5, 2019

Engineering Toolbox

November 30, 2019

Node Timezones

November 1, 2019

Sampling Samples

August 21, 2019

Rotating a NxN Matrix in One Line of Python

July 27, 2019

iTerm2 Search History

July 19, 2019

Nginx Auth With IP Whitelists

June 29, 2019

Bash Strict Mode

May 11, 2019

Optimizing Asus Routers for Serving Websites With Cloudflare

May 5, 2019

Browserify, Mochify, Nyc, Envify, and Dotenv

April 1, 2019

Scraping Images From Tumblr

February 24, 2019

There Are Too Many NPM Packages

February 10, 2019

Programmers Writing Legal Documents

January 31, 2019

Solidity Review

November 17, 2018

Likwid

November 9, 2018

My First Server's IP

November 9, 2018

Installing Netdata

September 23, 2018

Interrobang Versus Shebang

July 10, 2018

Bad Interview Questions

July 8, 2018

Showing Users in Different Databases

July 7, 2018

Some MIT (Undergraduate) Admissions Interview Advice

July 4, 2018

Optimize the Develop-Test-Debug Cycle

April 22, 2018

Example of Python Subprocess

March 23, 2018

Spotted in Taiwan

January 20, 2018

Fixing "Fatal Error: Python.h: No Such File or Directory"

December 16, 2017

Cassandra Primary Keys

December 11, 2017

MyPy Review

November 2, 2017

Griping About Time Zones

October 26, 2017

Bundling Python Packages With PyInstaller and Requests

September 23, 2017

Go Receiver Pointers vs. Values

September 4, 2017

Fixing statsonice.com Latency

September 1, 2017

Showing Schemas in Different Databases

August 26, 2017

Straight Lines

June 2, 2017

Emerson on Intellect

May 29, 2017

Core Metric for Developer Productivity

May 21, 2017

How to Capture a Camera Image With Python

May 7, 2017

Python Has a Ridiculous Number of Inotify Implementations

May 2, 2017

Projects: Gentle-Alerts

April 27, 2017

Creating a New PyPI Release

April 24, 2017

Eva Air USB Ports

April 24, 2017

Projects: Git-Browse

March 18, 2017

Cassandra Compaction Strategies

March 5, 2017

Code Is Like Tissue Paper

January 25, 2017

Seen in a Bathroom Stall at MIT

January 24, 2017

Underused Python Package: Webbrowser

January 21, 2017

Pax ?

January 5, 2017

Golang Review

January 2, 2017

Wadler's Law

December 15, 2016

Tunnel V2

December 8, 2016

MultiPens

December 5, 2016

SSH Tunnel

September 18, 2016

That Time I Was a Whitehat Hacker

September 18, 2016

Comparison of Country and Company GDPs

September 8, 2016

Sketching Science

September 8, 2016

Tech Hiring Misperceptions at Different Companies

July 22, 2016

Calculating Rails Database Connections

June 26, 2016

DevOps Reactions

June 12, 2016

Tuning Postgres

June 9, 2016

Fibonaccoli

June 4, 2016