Skip to content

Instantly share code, notes, and snippets.

View lgw4's full-sized avatar

Chip Warden lgw4

View GitHub Profile
@lgw4
lgw4 / enable-terminal-touch-id.sh
Last active May 17, 2022 21:23
Enable Touch ID on macOS terminal applications
#!/usr/bin/env sh
PAM_SUDO_FILE="/private/etc/pam.d/sudo"
PAM_TID="auth sufficient pam_tid.so"
if [ "$(uname)" != "Darwin" ]; then
echo "[ERROR]: Not on macOS. Exiting..."
exit 1
fi
@lgw4
lgw4 / Atom One (Light).itermcolors
Last active April 7, 2023 19:56
Atom One (Light) theme for iTerm2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
@lgw4
lgw4 / docker_default_platform.sh
Created September 5, 2021 18:16
Environment variable for defaulting to linux/amd64 on Docker Desktop on Apple silicon
export DOCKER_DEFAULT_PLATFORM=linux/amd64
@lgw4
lgw4 / setenv.HOMEBREW_ROOT.plist
Last active July 1, 2021 14:54
Set environment variable for GUI applications on macOS with launchctl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>setenv.BAR</string>
<key>ProgramArguments</key>
<array>
<string>/bin/launchctl</string>
<string>setenv</string>
@lgw4
lgw4 / build_python_3.7.x_apple_silicon.sh
Last active April 12, 2021 01:11
Build Python 3.7.x on Apple Silicon with pyenv
# URL source from Homebrew's Python 3.7 formula: https://github.com/Homebrew/homebrew-core/blob/e3e51fa975fd2c83352bf7b382b3d50525bd546a/Formula/python%403.7.rb#L84
curl -sSL https://raw.githubusercontent.com/Homebrew/formula-patches/05a27807/python/3.7.9.patch 2>&1 | pyenv install --patch 3.7.10
@lgw4
lgw4 / build_python_3.8.x_apple_silicon.sh
Last active April 12, 2021 01:10
Build Python 3.8.x on Apple Silicon with pyenv
# URL source from Homebrew's Python 3.8 formula: https://github.com/Homebrew/homebrew-core/blob/e3e51fa975fd2c83352bf7b382b3d50525bd546a/Formula/python%403.8.rb#L82
curl -sSL https://raw.githubusercontent.com/Homebrew/formula-patches/cef51fde/python/3.8.7.patch 2>&1 | pyenv install --patch 3.8.9
@lgw4
lgw4 / restart_macos_touch_bar.sh
Created August 16, 2020 01:25
Restart the macOS Touch Bar
sudo pkill TouchBarServer && sudo killall ControlStrip
@lgw4
lgw4 / disable_app_quarantine.sh
Created February 9, 2020 02:40
Bypass macOS quarantine for a given application
sudo xattr -rd com.apple.quarantine "${APPLICATION_PATH}"
@lgw4
lgw4 / flush-dns.sh
Last active May 20, 2022 15:31
flush-dns: clear cached DNS on macOS
#!/usr/bin/env sh
sudo /usr/bin/dscacheutil -flushcache && sudo /usr/bin/killall -HUP mDNSResponder
@lgw4
lgw4 / more_space_resolution_mbp_2016.scpt
Created May 29, 2019 22:56
More Space Resolution (MacBook Pro 15" 2016+)
-- More Space resolution (1920x1200)
-- MacBook Pro 15" Retina 2016+ with Touch Bar, Mojave version
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
click radio button "Display" of tab group 1
click radio button "Scaled" of radio group 1 of tab group 1
click radio button 5 of radio group 1 of group 2 of tab group 1