reset git history

This commit is contained in:
Noah Masur
2020-06-03 08:31:58 -06:00
commit a368fda34d
37 changed files with 8031 additions and 0 deletions

94
scripts/bootstrap Executable file
View File

@ -0,0 +1,94 @@
#!/bin/sh
DOTS=$(dirname "$0")/..
cd "$DOTS" || (echo "Directory not found: $DOTS"; exit 1)
DOTS="$PWD"
check_for_zsh() {
if ! (echo "$SHELL" | grep zsh > /dev/null)
then
echo "Switch to using zsh before continuing"
echo ""
echo "MacOS Instructions:"
echo "System Preferences > Users & Groups > Unlock"
echo "Right-click on user, Advanced Options..."
echo "Login shell: /bin/zsh"
exit 1
fi
echo "zsh ✓"
}
check_for_ohmyzsh() {
if [ ! -d ~/.oh-my-zsh ]
then
echo "oh-my-zsh ✕"
echo ""
echo "Install oh-my-zsh before continuing"
echo "You can run the script: install_ohmyzsh"
echo ""
exit 1
fi
echo "oh-my-zsh ✓"
}
install_xcode() {
if [ "$(uname)" = "Darwin" ]
then
if ! (xcode-select --version > /dev/null 2>&1)
then
xcode-select --install
fi
echo "xcode ✓"
fi
}
install_homebrew() {
if ! (which /usr/local/bin/brew > /dev/null)
then
printf "homebrew ✕\n\n"
printf "\ninstalling homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo ""
fi
echo "homebrew ✓"
}
install_brews() {
brewfile=$DOTS/homebrew/Brewfile
if ! (/usr/local/bin/brew bundle check --file "$brewfile" > /dev/null)
then
/usr/local/bin/brew bundle --file "$brewfile"
fi
echo "brews installed ✓"
}
install_spacemacs() {
emacsdir=~/.emacs.d
if ! (git -C "$emacsdir" pull > /dev/null 2>&1)
then
git clone https://github.com/syl20bnr/spacemacs "$emacsdir"
fi
echo "spacemacs ✓"
}
printf "\nbootstrapping...\n\n"
check_for_zsh
check_for_ohmyzsh
install_xcode
install_homebrew
install_brews
install_spacemacs
("$DOTS/scripts/setup_symlinks")
echo ""
echo "consider running other scripts:"
echo " - configure_macos"
echo " - setup_keybase"
echo " - install_python"
echo " - install_rust"
echo ""

103
scripts/configure_macos Executable file
View File

@ -0,0 +1,103 @@
#!/bin/sh
echo "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# echo "Enable subpixel font rendering on non-Apple LCDs"
# defaults write NSGlobalDomain AppleFontSmoothing -int 2
# echo "Automatically show and hide the dock"
# defaults write com.apple.dock autohide -bool true
echo "Make Dock icons of hidden applications translucent"
defaults write com.apple.dock showhidden -bool true
# echo "Show all filename extensions in Finder"
# defaults write NSGlobalDomain AppleShowAllExtensions -bool true
echo "Use current directory as default search scope in Finder"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
echo "Expand save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
echo "Expand print panel by default"
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
echo "Disable the \"Are you sure you want to open this application?\" dialog"
defaults write com.apple.LaunchServices LSQuarantine -bool false
echo "Enable highlight hover effect for the grid view of a stack (Dock)"
defaults write com.apple.dock mouse-over-hilte-stack -bool true
echo "Enable spring loading for all Dock items"
defaults write enable-spring-load-actions-on-all-items -bool true
echo "Disable press-and-hold for keys in favor of key repeat"
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
defaults write -g ApplePressAndHoldEnabled -bool false
echo "Set a blazingly fast keyboard repeat rate"
defaults write NSGlobalDomain KeyRepeat -int 2
echo "Set a shorter Delay until key repeat"
defaults write NSGlobalDomain InitialKeyRepeat -int 12
echo "Disable disk image verification"
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
echo "Avoid creating .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
echo "Disable the warning when changing a file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# echo "Enable snap-to-grid for desktop icons"
# /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
echo "Disable the warning before emptying the Trash"
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# echo "Enable tap to click (Trackpad)"
# defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
echo "Enable Safaris debug menu"
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
echo "Make Safaris search banners default to Contains instead of Starts With"
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
echo "Add a context menu item for showing the Web Inspector in web views"
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# echo "Only use UTF-8 in Terminal.app"
# defaults write com.apple.terminal StringEncodings -array 4
# echo "Make ⌘ + F focus the search input in iTunes"
# defaults write com.apple.iTunes NSUserKeyEquivalents -dict-add "Target Search Field" "@F"
# Noah Prefs
echo "Enable dock magnification"
defaults write com.apple.dock magnification -bool true
echo "Set dock size"
defaults write com.apple.dock largesize -int 48
defaults write com.apple.dock tilesize -int 44
# echo "Allow apps from anywhere"
# sudo spctl --master-disable
# ---
echo "Reset Launchpad"
# [ -e ~/Library/Application\ Support/Dock/*.db ] && rm ~/Library/Application\ Support/Dock/*.db
rm ~/Library/Application\ Support/Dock/*.db
echo "Show the ~/Library folder"
chflags nohidden ~/Library
# Clean up
echo "Kill affected applications"
for app in Safari Finder Dock Mail SystemUIServer; do killall "$app" >/dev/null 2>&1; done

14
scripts/install_ohmyzsh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
install_ohmyzsh() {
if [ ! -d ~/.oh-my-zsh ]
then
printf "\ninstalling oh my zsh...\nremember to restart terminal afterwards\n\n"
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo ""
fi
echo "installed ✓"
}
install_ohmyzsh

53
scripts/install_python Executable file
View File

@ -0,0 +1,53 @@
#!/bin/sh
PYTHON_VERSION=3.8.2
DOTS=$(dirname "$0")/..
cd "$DOTS" || (echo "Directory not found: $DOTS"; exit 1)
DOTS="$PWD"
check_for_pyenv() {
if ! (which pyenv > /dev/null)
then
echo ""
echo "pyenv not found"
if ! (/usr/local/bin/brew list | grep pyenv > /dev/null)
then
echo "pyenv not installed, run: bootstrap"
echo ""
else
echo "pyenv is installed, run: setup_symlinks (and restart)"
echo ""
fi
exit 1
fi
echo "pyenv ✓"
}
setup_python() {
/usr/local/bin/pyenv install $PYTHON_VERSION --skip-existing
/usr/local/bin/pyenv global $PYTHON_VERSION
echo "python $PYTHON_VERSION ✓"
}
setup_python_envs() {
for dir in "$DOTS"/python/*/
do
dir=${dir%*/}
envname=$(basename "$dir")
if ! (/usr/local/bin/pyenv versions | grep -w "$envname" > /dev/null)
then
/usr/local/bin/pyenv virtualenv "$PYTHON_VERSION" "$envname" > /dev/null
fi
# shellcheck source=/dev/null
. "$HOME/.pyenv/versions/$envname/bin/activate"
pip install --upgrade pip > /dev/null
pip install -r "$dir/requirements.txt" > /dev/null
deactivate
echo " - venv: $envname ✓"
done
}
check_for_pyenv
setup_python
setup_python_envs

39
scripts/install_rust Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
install_rust() {
if ! (which ~/.cargo/bin/rustup > /dev/null)
then
echo "installing rustup"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
fi
echo "rustup ✓"
}
update_rust() {
~/.cargo/bin/rustup update > /dev/null 2>&1
rust_version=$(~/.cargo/bin/rustc --version | awk '{print $2}')
echo "latest rust: $rust_version ✓"
}
download_rust_analyzer() {
if ! (which rust-analyzer > /dev/null)
then
echo "downloading rust analyzer"
rust_analyzer_bin=/usr/local/bin/rust-analyzer
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-mac -o $rust_analyzer_bin
chmod +x $rust_analyzer_bin
fi
echo "rust-analyzer ✓"
}
cargo_tools() {
cargo install toml-cli
cargo install jql
}
install_rust
update_rust
download_rust_analyzer

42
scripts/setup_keybase Executable file
View File

@ -0,0 +1,42 @@
#!/bin/sh
setup_keybase() {
KEYBASE_USER=$(keybase whoami || (echo "Please login to keybase first"; exit 1))
keybase fs sync enable "/keybase/private/$KEYBASE_USER"
echo "keybase ✓"
}
setup_keybase_ssh() {
SSH_DIR="/Volumes/Keybase/private/$KEYBASE_USER/ssh"
if [ -d "$SSH_DIR" ]
then
rm -rf ~/.ssh
ln -s "$SSH_DIR" ~/.ssh
echo " - keybase: ssh ✓"
else
echo "Directory not found: $SSH_DIR"
echo "Please check your keybase files"
exit 1
fi
}
setup_keybase_aws() {
AWS_DIR="/Volumes/Keybase/private/$KEYBASE_USER/aws"
if [ -d "$AWS_DIR" ]
then
rm -rf ~/.aws
ln -s "$AWS_DIR" ~/.aws
echo " - keybase: aws ✓"
else
echo "Directory not found: $AWS_DIR"
echo "Please check your keybase files"
exit 1
fi
}
setup_keybase
setup_keybase_ssh
setup_keybase_aws

26
scripts/setup_symlinks Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
DOTS=$(dirname "$0")/..
cd "$DOTS" || (echo "Directory not found: $DOTS"; exit 1)
DOTS="$PWD"
setup_symlinks() {
for source in $(find "$DOTS" -iname "*.symlink")
do
dest="$HOME/.`basename \"${source%.*}\"`"
rm -rf "$dest"
ln -s "$source" "$dest"
done
# Spacemacs
rm -rf "$HOME/.spacemacs.d"
ln -s "$DOTS/spacemacs.d" "$HOME/.spacemacs.d"
# Vim
rm -rf "$HOME/.vim"
ln -s "$DOTS/vim" "$HOME/.vim"
echo "symlinks ✓"
}
setup_symlinks