Notes on life and tech by Abraham Neben

# Generate an animated gif of the specified static images.

import imageio
import sys

if len(sys.argv) < 4:
    print('Usage: gif output.gif [frame duration in ms] [image1] [image2] ...')

output_fname = sys.argv[1]
duration = int(sys.argv[2])
fnames = sys.argv[3:]

images = []
for fname in fnames:
imageio.mimsave(output_fname, images, duration=duration/1000)


Posted by Abraham

I love running because I can do it almost anywhere and any time, but after several years of running with poor form, I have mostly switched to lower impact exercises like swimming and biking. I still run once or twice a week, making an effort to use good form. I'm hoping that with good form, good shoes, and good surfaces, I'll be able to run for decades to come!

Poor running form I never ran track and field or had any formal coaching on how to run or jog. Naively, I thought you just did it. So for years my form looked like this. Notice that my rear leg is not fully extended, my front leg is raised up quite high off the ground. My physical therapist explained to me that I was bouncing up and down a lot, which is both inefficient and hard on the knees and ankles. Poor running form

Good running form He explained that by fully extending my rear leg and keeping my front leg closer to the ground, the impact is a lot lower on my body. I have also mostly switched from toe-striking to heal-striking because I find it forces me to use this better form. If I toe-strike then I have a tendency to bounce up and down too much. That said, my physical therapist claims there is nothing inherently bad about either toe-striking or heel-striking, it's strictly a personal preference. Good running form

Physical therapy I highly recommend consulting with a physical therapist if you are dealing with any muscle or joint issues. I like to think of physical therapists as personal trainers with a formal education! They can help with stretching, strengthening, and avoiding bad exercises! Connecticut has a direct access law that lets you see a physical therapist without a referral from a doctor, which reduces the hurdles getting help. For an acute injury, it's probably best to see a doctor first, but I've really benefited from physical therapy for chronic muscle, joint, and tendon issues.

Good running shoes In my previous life, I bought a new pair of sneakers every year and wore them everywhere for everything. By the end of the year they were full of holes, had no tread, and had very little support. I've learned that a quality pair of sneakers is an investment just like physical therapy. I have been wearing Altra running shoes for the past few months, and they provide excellent support. Altra is known for their “foot-shaped” design, which has a wide toe-box to reduce pressure around your toes. I find this reduces the nerve sensitivity I occasionally experience in my left foot. Altra running shoes


Posted by Abraham

I came across a superb cover of Bare Necessities from the Jungle Book by a pair of up-and-coming musicians: Carson McKee and Josh Turner (>500k subs between them). The attention to detail in this throwaway cover for the inter webs is impressive! If there was ever a pair of new musicians to support on Patreon, these are them (Carson, Josh)


Posted by Abraham


Sublime Text is an elegant, fast, and lightweight text editor for macOS, and it is my preferred choice for Python/C++ editing. Seriously, VS Code and PyCharm are so much slower that I wonder if people who use them like waiting around for files to open or for project searches to finish.

  • Cmd-P – Quick open file by name (I have remapped this to Cmd-T)
  • Ctrl-G – Go to line number (I have remapped this to Option-G)
  • Opt-D – Insert python debugger (This is a custom shortcut)

rg is far and away the fastest way to search through a large repo of source code from the terminal.

Magnet is the Mac equivalent of Window’s only useful innovation over the past decode: Snap Assist. For any given project, I probably have a 4 windows open (Slack, iTerm2, a jupyter notebook, and Sublime Text). Magnet gives you keyboard shortcuts and sticky screen edges to move any give windows to any half or quarter of the screen.

  • Ctrl-Opt-Left (Ctrl-Opt-Right) – Move window and resize to fill left (right) half of screen.
  • Ctrl-Opt-U – Move window and resize to fill top left half of screen. I use U, I, J, and K to move windows to the top left, top right, bottom left, and bottom right quarters of the screen. But these shortcuts are easy to customize.

CopyPath is a Mac utility that lives in the menu bar and lens you copy the full path of any selected file(s). It's indispensable for anyone that uses both the terminal and the Finder. zsh is a bash alternative which has several nice features: A shared command history between all terminal windows, a built in git aware prompt, and a default pretty color scheme

General mac text editing shortcuts

Ctrl-A (Ctrl-E) – Move cursor to the beginning (end) of the current line Opt-left (Opt-Right) – Move cursor one word back (forward) Shift-Opt-Left (Shift-Option-Right) – Select previous (next) word Opt-Backspace – Delete previous word


Posted by Abraham

Here's a snippet from a fascinating interview with Democrat data scientist David Shor in New York Magazine.

Mitt Romney and Donald Trump agreed on basically every issue, as did Barack Obama and Hillary Clinton. And yet, a bunch of people changed their votes. And the reason that happened was because the salience of various issues changed. Both sides talked a lot more about immigration, and because of that, correlation between preferences on immigration and which candidate people voted for went up. In 2012, both sides talked about health care. In 2016, they didn''t. And so the correlation between views on health care and which candidate people voted for went down.

One interesting tidbit Shor alludes to is an analysis by political scientist David Broockman (see writeup in Vox) showing that moderate voters do not actually have moderate views on invididual issues. What we call moderate voters are really voters with many ideologically inconsistent views.

For Ahler and Broockman, this solves a puzzle. They note that many states have implemented election reforms to wrest the process away from partisans and empower average voters to elect the moderate politicians they really want. These reforms include open primary elections, nonpartisan redistricting, and public funding of elections. But “the bulk of studies on these reforms finds little evidence that they improve moderate candidates' fortunes.”> The answer, Ahler and Brookman realize, is simple: these voters don't want moderate candidates because these voters aren't actually moderates.


Posted by Abraham

If you type full git commands all the time, you're making life unnecessarily hard for yourself. Add these aliases to your shell config file, eg .bashrc or .zshrc. I'm a longtime user of zshell.

    alias cherry="git cherry-pick"
    alias ga="git add"
    alias gb="git branch --sort=-committerdate"
    alias gca="git commit --amend"
    alias gch="git checkout"
    alias gcm="git commit -m"
    alias gcnm="git commit -n -m"
    alias gd="git diff"
    alias gl="git log"
    alias gr="git reset"
    alias gs="git status"


Posted by Abraham

For most of my life I felt like the odd man out. I was shyer, more anxious, and less social than any of my friends. To some extent things have changed over the past few years as I've dealt with social anxiety and learned to better accept myself. But I still find that I'm the quiet one in virtually all of my friendships. I always took this for granted, thinking that I must really be in the 99th percentile of shyness. But when my boyfriend and I had dinner with a few of his college friends last week, I started reassessing.

One of his friends was quiet. Very quiet. It's rare that I meet someone shyer than myself. But then I started thinking back to a few weeks prior. I had brunch with an ex and his new boyfriend: also very shy. In fact, Myers/Briggs reports that the population is split virtually half and half between introverts and extroverts. So where were all these shy folks all my life when I was feeling like a social outcast?

The answer is in the Friendship Paradox: your friends are likely to have more friends than you do. This is a selection bias effect. No matter how shy or introverted you are, your friends are likely to be extroverts because those are the people most likely to be seeking friends. So where are all the introverts? They've been here all along hiding in an extrovert's world. I'm an introvert, and I generally still find extroverts easier to make conversation with. They ask more questions and are better at keeping the conversation going.

I saw Susan Cain's TED Talk a while back, but I never really groked it until now. Even introverts have a bias against introverts. We're quiet and it's time to shout it from the rooftops.


Posted by Abraham

Jony Ive, at the Genius Bar, with a spec of dust?

Apple shipped a super slim new keyboard on the ultra-portable 2015 MacBook, and later introduced it across their laptop line. The redesigned physical mechanism underneath each key allowed for a thinner design and improved key stability while typing. Another triumph for the tech world's best designers and engineers.

Except not.

The butterfly keyboard had reliability problems from the beginning, prompting Apple to set up a dedicated replacement policy. The new mechanism was uniquely sensitive to dust, failing to recognize certain keystrokes at times, or generating double keystrokes at others (eg, see Casey Johnston's eviscerating review and Joanna Stern's column written verbatim on a malfunctioning keyboard). Without publicly admitting failure, Apple repeatedly refined the mechanism in hopes of solving the issues (see iFixit's writeups from 2019 and 2020).

I never had reliability problems with my 2017 MacBook Pro keyboard, but the ultra-low travel, ultra-stable typing mechanism constantly aggravated my wrists. “Key stability” means that only vertical force will cause the key to depress. For instance, if you apply force at an angle 30 deg away from normal, then you are forced to type ~15% harder than you would have to type on the non-butterfly keyboard (ie, F cos θ). “Stable keyboard” sounds like a nice phrase, but the poor ergonomics are inescapable.

This is lesson that Apple has yet to learn. Even now after sunsetting the butterfly mechanism, the replacement remains heavily influenced by it. Yes, the key travel is increased, but the keys remain as rigidly stable as the butterfly's. I typed on the new keyboard in person at the New Haven Apple Store when it was introduced on the new 16 inch MacBook Pro last still takes too much force to type.

The only good solution for serious typists is to use an external keyboard. I have become a devotee of split ergonomic keyboards like the Microsoft Sculpt or the Logitech Ergo. Either that or dig out your beautiful first-generation MacBook Pro with the to-die-for silver keyboard ...


Posted by Abraham

I switched to Roland Kauffmann''s excellent Programmer dvorak keyboard layout over a decade ago and haven''t looked back since. It has all the advantages of the dvorak keyboard (e.g., 70% of words can be typed without moving fingers off the home row), with some nice improvements for programmers (e.g., parentheses and brackets are placed symmetrically on the top row, and symbols are primary over numbers). Switching to Programmer dvorak has reduced my wrist and finger strain at work, especially paired with a nice ergonomic keyboard like this one.
In this post, I''ll discuss some of the issues I''ve run into with Programmer dvorak and how to address them.

The keys don''t match the keycaps. Sure, you could buy a physical dvorak keyboard or put dvorak stickers on your keycaps, but why train yourself to look at the keys while you''re typing? I created a wallpaper image with the programmer Dvorak layout overlayed on the Andromeda galaxy. So all I had to do was use my Show Desktop hot corner to consult the layout.

Thumb typing. The keyboard layout of the iphone/ipad keyboard cannot be changed to Dvorak. Several years ago, Apple allowed developers to created 3rd party keyboards, and there are a few dvorak ones but they are all disappointing: ugly, slow, and unpleasant to use. All I want is to apply a new layout to the Apple keyboard. For this reason, I thumb-type in qwerty.

Using a bluetooth keyboard with an iPad. Strangely, while Apple doesn''t let you change the layout of the on-screen keyboard to any Dvorak, they do allow you to use the (vanilla) Dvorak layout for Bluetooth keyboards. Unfortunately, there''s no way to use the programmer Dvorak layout.

Computerized standardized testing. The GRE exam is given on computer and requires a typed essay, and just like the SAT, longer essays typically receive higher scores. To prepare for this, I switched 100% back to qwerty for a month prior to the exam to make sure I could type as long an essay as possible.


Posted by Abraham

It's easy to stay in shape living in a city. As an undergrad at UChicago, I walked around the campus everyday, and took public transit downtown on the weekends and then walked some more. In Boston, I biked almost everywhere year round (1). From my apartment to Harvard to MIT to Back Bay to the MFA to Whole Foods and back home. Then I slept.

After graduating I took a job in Connecticut and got a car. A car spoils you. Getting groceries is easier. Getting to work is easier. You don't have to walk when it's cold...or hot...or rainy...or basically ever. Not being in the habit of working out, I started to get back pain after about a year of this.

I started PT and learned that my hamstrings, hip flexors, and lower back were tight. And my legs and abs were weak. So I started doing stretches before and after work and taking 20min walks mid afternoon. After 2-3 months, my back was feeling a lot less tense. After that experience I'm a believer in PT.

But I want to do more than just treat back pain: I want to have energy and be strong and be able to eat whatever I want. It's hard to stay in shape as a working adult. You have to plan when to work out and when to eat. When it it okay to be drenched with post workout sweat at work and when isn't it. I prefer outdoor activities because there is build in leverage to go some distance (you can't bike 4 miles out and call it quits in the next town!), but what if it's cold or hot or wet?

For the past few months, my workouts have been

  • Swimming at the YMCA. I love swimming, and it's low impact and it's hard to overdo it. It's takes a big chunk of time though: I get heartburn unless I wait 2-3 hours after I eat, and of course it takes twice as long as running because I have to drive there, change, and shower before and after.
  • Biking up East rock park. This is usually a fun workout, but not when its 85 degrees outside.
  • Running. Fun when it's cool. Unpleasant when it's hot. I make sure to drink water 20 minutes before working out instead of during the run in order to minimize GERD symptoms.
  • Kayaking. Good upper body exercise, and it's definitely cooler on the lake than on land. But same complaints as swimming: lots of overhead.
  • YouTube ab workouts by MadFit (standing workout, lying down workout)


Posted by Abraham