colori(s|z)ed ls output on macos

As is often the case, the nix defaults for ls are spartan. I finally got around to wrestling my ls color settings into submission. On macos/zsh, gdircolors gave inconsistent results, so I set the LS_COLORS environment var directly.

Snips:

install gls

brew install coreutils

.zshrc

if [[ "$(uname)" = "Darwin" ]]; then # macos uses a different 'ls'
  export CLICOLOR=1
  source "$XDG_CONFIG_HOME/zsh/.dir_colors"
  alias l="gls -ahF --group-directories-first --color=always"
else
  alias l="ls -ah --color --group-directories-first"
fi

~/.config/zsh/.dir_colors

# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
export LS_COLORS='rs=0:di=00;34:ln=00;37:mh=00:pi=40;33:so=00;35:do=00;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=00;33:*.tar=01;31:*.tgz=01;31:'

The full goodies:

IoT device setup: easy until it’s not

Internet-connected devices are increasingly supplied without a USB tethering option. While I presume this cuts down on manufacturing complexity and improves form factor, the wifi setup user experience is often terrible.

I recently acquired a FitBit Aria scale which has the completely undocumented quirk of only being able to connect to 802.11b wifi. My router defaults to n. I had to dig through the router settings and enable dual-band. There is absolutely no way a muggle would ever figure this out.

To compound the issue, their activation API was suffering a bug that returned a cryptic JSON error when using a Mac or iOS Safari to register the scales. I have no Wintel, so I finally got it working using iOS Chrome.

Googling revealed loads of posts by angry consumers who had returned the product as defective. I wonder how much this poor design choice cost FitBit’s bottom line? Omitting a USB setup option might have seemed clever but it backfired badly – perhaps it would have been fine if their wifi onboarding experience wasn’t so flawed.

And after enabling dual-band support on my router my Kindle Paperwhite would no longer connect to the wifi network. I had to manually enable WPS discovery mode on the router to pair it again. Oy!