thinlens

tech

I've used a Dell U2413 monitor for years with my MacBook Pro, and always connected to the monitor's DisplayPort input (using this cable). This is a low-DPI monitor (non-retina), but with font-smoothing in macOS I always found the clarity to be more than adequate. However, when I ordered an Anker USB hub with a separate HDMI port, I decided to connect to the monitor using an HDMI cable (this one) in order to free up another USB-C port. This worked, but it seemed to disable macOS's font smoothing, making the text appear really jagged.

Here are some close-up photos of the monitor that show the difference.

Jagged, hard to read text on monitor plugged in via HDMI. Jagged, hard to read text on Dell U2413 display plugged in via HDMI.

Smooth, easy to read text on monitor plugged in via DisplayPort. Smooth, easy to read text on on Dell U2413 display plugged in via DisplayPort.

This has been true in both Catalina and Big Sur, I don't think I tested it on earlier OS versions. I tried forcing macOS to re-enable font smoothing following this, but no change. So in lieu of buying a new monitor, I've reverted to my DisplayPort to USB-C cable.

#tech

Posted by Abraham

I'm hesitating upgrading to an M1 Mac because I hear it runs much cooler (eg see Gruber's review) and I'm worried that Diddy won't nap on my computer anymore. He absolutely loves the toasty i9 CPU on my 16in Mac Book Pro! If you are a cat, do you like the new Apple silicon Macs?

#tech

Posted by Abraham

#!/PATH/TO/PYTHON
#
# 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] ...')
    sys.exit(0)

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

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

#tech

Posted by Abraham

Apps/Utilities

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

#tech

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"

#tech

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 year...it 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 ...

#tech

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.

#tech

Posted by Abraham