From 10160f63c0c2674186cc0a706ef8a4c162f7b17d Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Sun, 14 Mar 2021 11:35:35 -0400 Subject: [PATCH] random updates/organization --- Brewfile | 56 +++++++++------- macos/macos.sh | 15 +++-- vscode/settings.json | 1 - zsh/.zshrc | 6 +- zsh/aliases.zsh | 100 +--------------------------- zsh/macos.zsh | 98 +++++++++++++++++++++++++++ zsh/path.zsh | 18 +++-- zsh/plugins/zsh-syntax-highlighting | 2 +- zsh/rosetta.zsh | 10 +++ 9 files changed, 169 insertions(+), 137 deletions(-) create mode 100644 zsh/macos.zsh create mode 100644 zsh/rosetta.zsh diff --git a/Brewfile b/Brewfile index 74a4d3a..97ceecf 100644 --- a/Brewfile +++ b/Brewfile @@ -2,30 +2,26 @@ # Taps # ############################### -tap "AdoptOpenJDK/openjdk" +tap "adoptopenjdk/openjdk" tap "aws/tap" tap "cloudflare/cloudflare" tap "dart-lang/dart" -# tap "exolnet/deprecated" tap "facebook/fb" tap "github/bootstrap" tap "github/gh" -tap "goreleaser/tap" tap "heroku/brew" -tap "hhvm/hhvm" tap "homebrew/bundle" tap "homebrew/cask" tap "homebrew/cask-versions" tap "homebrew/core" tap "homebrew/services" tap "homebrew/test-bot" -# tap "jakejarvis/brew", "git@github.com:jakejarvis/homebrew-brew.git" -tap "mongodb/brew" tap "sass/sass" tap "teamookla/speedtest" tap "thoughtbot/formulae" tap "twilio/brew" # tap "wpengine/wpe-cli" +tap "wpscanteam/tap" ############################### # Binaries # @@ -98,12 +94,12 @@ brew "node" brew "nvm" # Mostly ordinary binaries -brew "amazon-ecs-cli" -brew "aws/tap/aws-sam-cli" brew "aws-shell" brew "awscli" brew "angular-cli" brew "asciinema" +brew "autoconf" +brew "automake" brew "azure-cli" brew "caddy" brew "carthage" @@ -115,18 +111,15 @@ brew "dart-lang/dart/dart" brew "doctl" brew "elixir" brew "erlang" -# brew "facebook/fb/fbsimctl", args: ["HEAD"] brew "geoip" brew "go" -brew "goreleaser/tap/goreleaser" -brew "govendor" brew "guetzli" brew "heroku/brew/heroku" brew "heroku/brew/heroku-node" -# brew "hhvm" brew "htop" brew "httpie" brew "httrack" +brew "hugo", args: ["HEAD"] brew "hydra" brew "iproute2mac" brew "jq" @@ -137,10 +130,7 @@ brew "mas" brew "mcrypt" brew "mhash" brew "mkcert" -# brew "mongodb" -brew "mongodb/brew/mongodb-community" brew "mosh" -# brew "mysql" brew "mariadb" brew "mysql-client" brew "ncurses" @@ -150,14 +140,18 @@ brew "openvpn" brew "optipng" brew "packer" brew "php" +brew "pkg-config" brew "pngcheck" brew "pngcrush" brew "postgresql" +brew "python@3.8" +brew "python@3.9" brew "python" -# brew "python@2" brew "pyenv" +brew "qemu" brew "ruby" brew "ruby-build" +brew "rust" brew "rbenv" brew "rclone" brew "s3fs" @@ -191,9 +185,10 @@ brew "zopfli" brew "ant" brew "maven" brew "gradle" -cask "android-sdk" +# cask "android-sdk" # cask "android-ndk" cask "android-platform-tools" +# cask "android-studio" # Pentesting tools brew "aircrack-ng" @@ -209,6 +204,8 @@ brew "hashpump" brew "hydra" brew "john" brew "knock" +brew "massdns" +brew "mitmproxy" brew "netpbm" brew "nmap" brew "pdfcrack" @@ -223,6 +220,7 @@ brew "bettercap" brew "hashcat" brew "nikto" brew "tcpdump" +# brew "wpscanteam/tap/wpscan" # not yet compatible with M1 ############################### # macOS Apps via Cask # @@ -239,6 +237,7 @@ cask "carbon-copy-cloner" cask "cleanmymac" cask "coconutbattery" cask "daisydisk" +cask "dropbox" cask "duet" cask "etrecheckpro" cask "filebot" @@ -267,8 +266,7 @@ cask "tunnelblick" # Development/Work cask "adobe-creative-cloud" -cask "AdoptOpenJDK/openjdk/adoptopenjdk" -cask "AdoptOpenJDK/openjdk/adoptopenjdk-jre" +cask "adoptopenjdk/openjdk/adoptopenjdk" cask "chromedriver" cask "eclipse-java" cask "github" @@ -293,10 +291,10 @@ cask "xquartz" # Virtual Machines (& Docker) cask "docker" -cask "virtualbox" -cask "virtualbox-extension-pack" -cask "vagrant" -cask "vmware-fusion" +# cask "virtualbox" +# cask "virtualbox-extension-pack" +# cask "vagrant" +# cask "vmware-fusion" # Media cask "beamer" @@ -345,22 +343,32 @@ cask "wireshark" # Apple mas "Apple Configurator 2", id: 1037126344 mas "Compressor", id: 424390742 +mas "Developer", id: 640199958 mas "Final Cut Pro", id: 424389933 mas "GarageBand", id: 682658836 mas "iMovie", id: 408981434 mas "Keynote", id: 409183694 -mas "Logic Pro X", id: 634148309 +mas "Logic Pro", id: 634148309 mas "MainStage 3", id: 634159523 mas "Motion", id: 434290957 mas "Numbers", id: 409203825 mas "Pages", id: 409201541 +mas "Playgrounds", id: 1496833156 +mas "Transporter", id: 1450874784 +mas "Xcode", id: 497799835 # Third Party mas "Amphetamine", id: 937984704 +mas "Deliveries", id: 290986013 mas "Disk Speed Test", id: 425264550 +mas "Kindle", id: 405399194 +mas "Magnet", id: 441258766 mas "Microsoft Remote Desktop", id: 1295203466 +mas "Microsoft To Do", id: 1274495053 mas "Outline", id: 1356178125 mas "Shazam", id: 897118787 +mas "Silicon Info", id: 1542271266 mas "TweetDeck", id: 485812721 mas "Twitter", id: 409789998 +mas "VMware Remote Console", id: 1230249825 mas "WireGuard", id: 1451685025 diff --git a/macos/macos.sh b/macos/macos.sh index 0b8c490..d4465c9 100755 --- a/macos/macos.sh +++ b/macos/macos.sh @@ -8,6 +8,9 @@ fi # Make sure macOS is fully up to date before doing anything sudo softwareupdate --install --all +# Install Rosetta 2 +sudo softwareupdate --install-rosetta --agree-to-license + # Install Xcode Command Line Tools sudo xcode-select --install # Accept Xcode license @@ -20,10 +23,6 @@ if test ! "$(which brew)"; then /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" fi -# Fix some installation errors -# sudo chown -R "$(whoami)" /usr/local/share/man/man8 -# chmod u+w /usr/local/share/man/man8 - # Disable analytics # https://docs.brew.sh/Analytics brew analytics off @@ -31,7 +30,13 @@ brew analytics off # Update Homebrew recipes brew update -# Install all apps from the Brewfile +# Install more current ZSH and set as default shell +# https://stackoverflow.com/a/44549662/1438024 +brew install zsh +sudo sh -c "echo $(brew --prefix zsh)/bin/zsh >> /etc/shells" +chsh -s "$(brew --prefix zsh)/bin/zsh" + +# Install all apps from the Brewfile, ignore errors brew tap homebrew/bundle brew bundle || true diff --git a/vscode/settings.json b/vscode/settings.json index 749dbf9..f8a2f09 100644 --- a/vscode/settings.json +++ b/vscode/settings.json @@ -21,7 +21,6 @@ "git.enableCommitSigning": true, "git.showPushSuccessNotification": true, "workbench.iconTheme": "material-icon-theme", - "liveshare.featureSet": "insiders", "editor.renderWhitespace": "none", "editor.suggestSelection": "first", "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", diff --git a/zsh/.zshrc b/zsh/.zshrc index e52e5aa..094283a 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -21,12 +21,16 @@ SAVEHIST=10000 ZSH_CUSTOM=$DOTFILES/zsh ZSH_THEME="agnoster" DEFAULT_USER=jake -DISABLE_UPDATE_PROMPT=true # Oh My ZSH plugins plugins=( colorize osx + history + vscode + gitignore + gnu-utils + zsh_reload zsh-syntax-highlighting zsh-autosuggestions ) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 7fe203c..0b79590 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -13,103 +13,9 @@ alias ...="cd ../.." alias ....="cd ../../.." alias ~="cd ~" -# -# Remap macOS core utils to GNU -# -alias sed="gsed" -alias grep="ggrep" -alias find="gfind" -alias make="gmake" -alias tar="gtar" -alias which="gwhich" -alias awk="gawk" - -# macOS has no `md5sum`, so use `md5` as a fallback -command -v md5sum > /dev/null || alias md5sum="md5" - -# My own creation! See: https://github.com/jakejarvis/simpip -alias ipv4="curl -4 simpip.com --max-time 1 --proto-default https --silent" -alias ipv6="curl -6 simpip.com --max-time 1 --proto-default https --silent" -alias ip="ipv4; ipv6" -alias iploc="ipconfig getifaddr en0" -alias ips="ip; ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" - -alias dns-clear="networksetup -setdnsservers Wi-Fi" -alias dns-check="networksetup -getdnsservers Wi-Fi" -alias dns-set="networksetup -setdnsservers Wi-Fi " -alias dns-set-cloudflare="dns-set 1.1.1.1 1.0.0.1" -alias dns-set-google="dns-set 8.8.8.8 8.8.4.4" -alias flush="sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache" - alias hosts="sudo $EDITOR /etc/hosts" -alias speed="wget -O /dev/null http://cachefly.cachefly.net/100mb.test" alias digg="dig @1.1.1.1 +nocmd any +multiline +noall +answer" - -# Update: brew, npm, gem, app store, macos -update() { - NC="\033[0m" - YELLOW="\033[0;33m" - - sudo -v - - echo -e "${YELLOW}Updating Homebrew formulae and casks...${NC}" - brew update - # git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" fetch --unshallow - brew upgrade - brew upgrade --cask --greedy - brew cleanup - - echo -e "${YELLOW}Updating NPM/Yarn packages...${NC}" - npm install npm@latest --global - npm update --global - yarn global upgrade - - echo -e "${YELLOW}Updating Ruby gems...${NC}" - gem update --system - gem update - # gem upgrade --user-install - gem cleanup - - # https://stackoverflow.com/a/3452888 - echo -e "${YELLOW}Updating pip packages...${NC}" - pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U - - echo -e "${YELLOW}Updating Composer packages...${NC}" - composer global update - - echo -e "${YELLOW}Updating Oh-My-ZSH...${NC}" - omz update - - # echo -e "${YELLOW}Updating MAS apps...${NC}" - # mas upgrade - - echo -e "${YELLOW}Updating macOS system...${NC}" - sudo softwareupdate -ia --include-config-data -} - -alias rehide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" -alias unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" -alias forcetrash="sudo rm -rf ~/.Trash /Volumes/*/.Trashes" -alias unq="sudo xattr -rd com.apple.quarantine" -alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" - -alias gpu="system_profiler SPDisplaysDataType" -alias cpu="sysctl -n machdep.cpu.brand_string" -alias screenfetch="neofetch" - -alias ripfinder="sudo killall Finder" -alias ripdock="sudo killall Dock" -alias ripmenu="sudo killall SystemUIServer NotificationCenter" - -# open current directory in Finder -alias finder="open -a Finder ./" - -# uncomment to use VS Code insiders build -# alias code="code-insiders" -alias vs="code ./" - -alias firefox="/Applications/Firefox.app/Contents/MacOS/firefox-bin" -alias ff="firefox" +# alias speed="wget -O /dev/null http://cachefly.cachefly.net/100mb.test" # # Git @@ -188,15 +94,13 @@ make_hugo() { && HUGO_BUILD_TAGS=extended mage -v install ) } +alias hugo_brew="brew upgrade hugo --fetch-HEAD --build-from-source" # run `hugo config` first to make sure we're in a Hugo directory: alias hugo_clean="hugo config 1>/dev/null && rm -rf public/ resources/ build/" alias sshalt="ssh -p 2222" alias moshalt="mosh --ssh=\"ssh -p 2222\"" -alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" -alias watchos="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app" - alias pubkey="more ~/.ssh/id_ed25519.pub | pbcopy | echo '=> Public key copied to clipboard.'" alias pubkey_rsa="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to clipboard.'" diff --git a/zsh/macos.zsh b/zsh/macos.zsh new file mode 100644 index 0000000..cd2dae1 --- /dev/null +++ b/zsh/macos.zsh @@ -0,0 +1,98 @@ +# Rosetta hacks for M1 Macs +alias intel="arch -x86_64 /bin/zsh" +alias arm="arch -arm64 /opt/homebrew/bin/zsh" + +# Remap macOS core utils to GNU +alias grep="ggrep" +alias which="gwhich" +alias awk="gawk" +#alias sed="gsed" +#alias find="gfind" +#alias make="gmake" +#alias tar="gtar" + +# macOS has no `md5sum`, so use `md5` as a fallback +command -v md5sum > /dev/null || alias md5sum="md5" + +# My own creation! See: https://github.com/jakejarvis/simpip +alias ipv4="curl -4 simpip.com --max-time 1 --proto-default https --silent" +alias ipv6="curl -6 simpip.com --max-time 1 --proto-default https --silent" +alias ip="ipv4; ipv6" +alias iploc="ipconfig getifaddr en0" +alias ips="ip; ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" + +alias dns-clear="networksetup -setdnsservers Wi-Fi" +alias dns-check="networksetup -getdnsservers Wi-Fi" +alias dns-set="networksetup -setdnsservers Wi-Fi " +alias dns-set-cloudflare="dns-set 1.1.1.1 1.0.0.1" +alias dns-set-google="dns-set 8.8.8.8 8.8.4.4" +alias flush="sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache" + +# Update: brew, npm, gem, app store, macos +update() { + NC="\033[0m" + YELLOW="\033[0;33m" + + echo -e "${YELLOW}Updating Homebrew formulae and casks...${NC}" + brew update + # git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" fetch --unshallow + brew upgrade + brew upgrade --cask --greedy + brew cleanup + + echo -e "${YELLOW}Updating NPM/Yarn packages...${NC}" + npm install npm@latest --global + npm update --global + yarn global upgrade + + echo -e "${YELLOW}Updating Ruby gems...${NC}" + gem update --system + gem update + # gem upgrade --user-install + gem cleanup + + # https://stackoverflow.com/a/3452888 + echo -e "${YELLOW}Updating pip packages...${NC}" + pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U + + echo -e "${YELLOW}Updating Composer packages...${NC}" + composer global update + + echo -e "${YELLOW}Updating Oh-My-ZSH...${NC}" + omz update + + echo -e "${YELLOW}Updating MAS apps...${NC}" + mas upgrade + + echo -e "${YELLOW}Check for macOS system updates...${NC}" + softwareupdate --list +} + +alias rehide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" +alias unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" +alias forcetrash="sudo rm -rf ~/.Trash /Volumes/*/.Trashes" +alias unq="sudo xattr -rd com.apple.quarantine" +alias verify_sign="codesign --verify --deep --verbose" +alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" + +alias gpu="system_profiler SPDisplaysDataType" +alias cpu="sysctl -n machdep.cpu.brand_string" +alias screenfetch="neofetch" + +alias ripfinder="sudo killall Finder" +alias ripdock="sudo killall Dock" +alias ripmenu="sudo killall SystemUIServer NotificationCenter" + +# open current directory in Finder +alias finder="open -a Finder ./" + +# uncomment to use VS Code insiders build +# alias code="code-insiders" +alias vs="code ./" + +# Xcode simulators +alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" +alias watchos="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app" + +alias firefox="/Applications/Firefox.app/Contents/MacOS/firefox-bin" +alias ff="firefox" diff --git a/zsh/path.zsh b/zsh/path.zsh index 5c2fbc7..b66c23f 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -17,9 +17,18 @@ export PATH="$GOPATH/bin:$PATH" # Ruby export RUBY_HOME="/opt/homebrew/opt/ruby/bin" -export GEM_PATH="$HOME/.gem/ruby/3.0.0" +export GEM_PATH="/opt/homebrew/lib/ruby/gems/3.0.0/bin" export PATH="$RUBY_HOME:$PATH" -export PATH="$GEM_PATH/bin:$PATH" +export PATH="$GEM_PATH:$PATH" + +# rbenv +export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml)" +if command -v rbenv 1>/dev/null 2>&1; then + eval "$(rbenv init -)" +fi + +# Python +export PATH="$HOME/Library/Python/3.9/bin:$PATH" # openjdk export PATH="/opt/homebrew/opt/openjdk/bin:$PATH" @@ -53,11 +62,6 @@ if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" fi -# rbenv -if command -v rbenv 1>/dev/null 2>&1; then - eval "$(rbenv init -)" -fi - # ----- Third-party additions below: ----- # Google Cloud SDK diff --git a/zsh/plugins/zsh-syntax-highlighting b/zsh/plugins/zsh-syntax-highlighting index 5eb4948..e851724 160000 --- a/zsh/plugins/zsh-syntax-highlighting +++ b/zsh/plugins/zsh-syntax-highlighting @@ -1 +1 @@ -Subproject commit 5eb494852ebb99cf5c2c2bffee6b74e6f1bf38d0 +Subproject commit e8517244f7d2ae4f9d979faf94608d6e4a74a73e diff --git a/zsh/rosetta.zsh b/zsh/rosetta.zsh new file mode 100644 index 0000000..86c4629 --- /dev/null +++ b/zsh/rosetta.zsh @@ -0,0 +1,10 @@ +# Set iTerm color scheme to Intel blue when session running via Rosetta2 +# https://cutecoder.org/software/detecting-apple-silicon-shell-script/ +if [[ "$(uname -m)" == "x86_64" && "$(sysctl -in sysctl.proc_translated)" == "1" ]]; then + ARCH_BG="003862" # Intel-ish blue +else + ARCH_BG="0B0B0B" # boring black +fi + +# https://iterm2.com/documentation-escape-codes.html +echo -ne "\033]1337;SetColors=bg=${ARCH_BG}\007"