Skip to content

Instantly share code, notes, and snippets.

View lgw4's full-sized avatar

Chip Warden lgw4

View GitHub Profile
@lgw4
lgw4 / reset_launchpad.sh
Created September 30, 2015 00:42
Reset OS X Launchpad
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock
@lgw4
lgw4 / ssh-add-keys.sh
Last active March 31, 2019 18:42
Add SSH Keys to macOS Keychain
#!/usr/bin/env bash
# Add DSA keys
for dsa in ${HOME}/.ssh/*_dsa; do
/usr/bin/ssh-add -K "${dsa}"
done
# Add RSA keys
for rsa in ${HOME}/.ssh/*_rsa; do
/usr/bin/ssh-add -K "${rsa}"
@lgw4
lgw4 / url.txt
Created March 31, 2017 18:29
Restart macOS WiFi network script
https://www.codementor.io/noxowe/no-wifi-signal-macbook-the-script-that-saved-my-sanity-du10808m3
@lgw4
lgw4 / disable_safari_autoplay.sh
Created August 9, 2017 00:54
Disable video autoplay in Safari on macOS Sierra
defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
@lgw4
lgw4 / careers.py
Last active April 5, 2018 11:33
An example of Python's collections.namedtuple
from collections import namedtuple
import random
RAND = random.SystemRandom()
Career = namedtuple(
"Career",
[
@lgw4
lgw4 / create_sparsebundle.sh
Created July 27, 2018 23:24
macOS: Create encrypted APFS sparsebundle
hdiutil create "${VOLUME_NAME}.sparsebundle" -size "${SIZE}"G -fs APFS -type SPARSEBUNDLE -encryption AES-256 -volname "${VOLUME_NAME}"
@lgw4
lgw4 / install_zlib_headers_macos.sh
Created March 26, 2019 23:59
Install zlib headers on macOS after Xcode upgrade
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
@lgw4
lgw4 / rotate_resolution_mbp_2016.scpt
Created May 29, 2019 22:53
Rotate Resolution... (MacBook Pro 15" 2016+)
-- Rotate Resolution... (between 1680x1050 and 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
tell radio group 1 of group 2 of tab group 1
@lgw4
lgw4 / default_resolution_mbp_2016.scpt
Created May 29, 2019 22:55
Default Resolution (MacBook Pro 15" 2016+)
-- Default resolution (1680x1050)
-- 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 4 of radio group 1 of group 2 of tab group 1
@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