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

With all the stories of police racism and brutality in the news, I''ve been thinking about the first time I was pulled over by a cop. Looking back, I did all the wrong things, and I shudder to think what would have happened if I had been black.

It was almost midnight and I was driving back from Wendy''s. There''s no traffic. Suddenly I see police lights behind me. There''s no shoulder to pull onto, so I take the next right and pull over on a side street. I can feel a panic attack coming on, but I force myself to breathe. I don''t think I''ve done anything wrong.

“License and registration?” I flip through my folder and find the registration.

“That''s actually two weeks out of date.”

“Oh really? I''m sure I paid it, I must have forgotten to save the new document.”

“I pulled you over because you have a headlight out, I think it''s your right headlight.”

He walks to the front of my car to check. Without thinking, I open my door and step outside to follow him.

“Wow, you''re right.”

I walk back to my car and wait for him to run the plates. Returning to my car, he is all smiles. “Everything checks out. Just a warning about the headlight. By the way, we have the same birthday, you''re just 2 years younger. And in the future, you shouldn''t get out of your car when you''re pulled over. Personally I didn''t feel threatened, but next time wait inside. Have a good night!”

I didn''t think much about it at the time, but looking back, this encounter had white privilege scrawled all over it. He gave me the benefit of the doubt and was professional, but friendly. I''m a 6 foot tall fidgety male; how much darker would my skin have to be for him to feel threatened? Especially with my jumping out of the car to follow him.

I'm glad he didn't feel threatened, but the Harvard Law Review writes that “Officers learn to treat every individual they interact with as an armed threat and every situation as a deadly force encounter in the making” and “Even acting friendly, officers may be told, can make them a target.” [1]

I want to empathize. Black Americans are more likely to commit violent crimes [2] and have violent encounters with police. So why shouldn't officers be more alert than with white suspects? Yes, higher crime rates are probably caused by higher poverty rates [3], but doesn't it still makes sense for officers to prioritize their own safety? The answer is this is the wrong mindset because it becomes self fulfilling. Police are more likely to aggravate black suspects, which encourages more aggressive reactions, creating a violent spiral (eg [4]). It's time to #breakthespiral.

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

Mythbusters was one of my favorite series growing up, and it was definitely one of my early inspirations to study experimental physics. But over the course of the show, Adam Savage and Jamie Hyneman did plenty of experiments that were basically unnecessary had they done a two line physics calculation. Yes, it was fun to see the guys make a football field-sized sheet of paper, and use a hydraulic press to fold it, could just do the math instead. Standard printer paper is \( t=0.1\text{mm}\) thick, and \( d=25\text{cm}\) long. It gets twice as thick and half as long each time you fold it, so after \( N \) folds it is \( 2^Nt \) thick and \( d/2^N \) long. Roughly speaking, you can fold paper in half until it is as thick as it is long, i.e., \( 2^Nt = d/2^N \), which implies \( N = \frac{1}{2}\log_2 d/t\approx 5.6 \). So maybe if you really force it: 6 times. Because this result depends only logarithmically on the length and thickness, it is fairly insensitive to their values. For example, if the sheet of paper is as large as a football field, \( d=100\text{m} \), 400 times bigger than standard printer paper, then \( N=9.9 \). So experiments are great, but sometimes a spherical cow is all you need.

Posted by Abraham