diff --git a/.gitignore b/.gitignore index a57d76865c7..bbb3a495c22 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,2 @@ -atom.symlink/.apm -atom.symlink/.node-gyp -atom.symlink/.storage -atom.symlink/blob-store -atom.symlink/compile-cache/ -atom.symlink/packages -atom.symlink/storage -atom.symlink/themes - git/gitconfig.local.symlink +Brewfile.lock.json diff --git a/Brewfile b/Brewfile index 04577dafb8f..93aed700585 100644 --- a/Brewfile +++ b/Brewfile @@ -1,40 +1,40 @@ cask_args appdir: '/Applications' -tap 'caskroom/cask' tap 'homebrew/bundle' -brew 'ack' -brew 'coreutils' -brew 'go' -brew 'grc' +brew 'atuin' +brew 'cloudflared' brew 'imagemagick' -brew 'jp2a' -brew 'libcaca', args: ['with-imlib2'] -brew 'libgit2' -brew 'openssl' -brew 'node' -brew 'readline' -brew 'postgresql' +brew 'postgresql@17' +brew 'redis' brew 'ruby-build' -brew 'rbenv' -brew 'roundup' brew 'spaceman-diff' brew 'spark' -brew 'unrar' +brew 'stripe/stripe-cli/stripe' +brew 'stripe/stripe-mock/stripe-mock' brew 'wget' -brew 'youtube-dl' +brew 'yt-dlp' cask '1password' -cask 'adium' -cask 'atom' -cask 'firefox' -cask 'garmin-express' -cask 'google-chrome' -cask 'handbrake' -cask 'mapbox-studio' -cask 'seashore' -cask 'slack' +cask 'airtable' +cask 'arq' +cask 'codex' +cask 'conductor' +cask 'diffusionbee' +cask 'ghostty' +cask 'handbrake-app' +cask 'iina' +cask 'messenger' +cask 'notion-calendar' +cask 'plex' +cask 'qlvideo' +cask 'sonos' cask 'steam' cask 'transmission' -cask 'tunnelbear' +cask 'raycast' +cask 'whatsapp' +cask 'windsurf' +cask 'visual-studio-code' cask 'vlc' +cask 'zed' +cask 'zoom' diff --git a/README.md b/README.md index 978e5159b05..497d64c78ca 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,14 @@ There's a few special files in the hierarchy. - **bin/**: Anything in `bin/` will get added to your `$PATH` and be made available everywhere. -- **Brewfile**: This is a list of applications for [Homebrew Cask](http://caskroom.io) to install: things like Chrome and 1Password and Adium and stuff. Might want to edit this file before running any initial setup. - **topic/\*.zsh**: Any files ending in `.zsh` get loaded into your environment. - **topic/path.zsh**: Any file named `path.zsh` is loaded first and is expected to setup `$PATH` or similar. - **topic/completion.zsh**: Any file named `completion.zsh` is loaded last and is expected to setup autocomplete. -- **topic/\*.symlink**: Any files ending in `*.symlink` get symlinked into +- **topic/install.sh**: Any file named `install.sh` is executed when you run `script/install`. To avoid being loaded automatically, its extension is `.sh`, not `.zsh`. +- **topic/\*.symlink**: Any file ending in `*.symlink` gets symlinked into your `$HOME`. This is so you can keep all of those versioned in your dotfiles but still keep those autoloaded files in your home directory. These get symlinked in when you run `script/bootstrap`. @@ -61,7 +61,7 @@ Everything is configured and tweaked within `~/.dotfiles`. The main file you'll want to change right off the bat is `zsh/zshrc.symlink`, which sets up a few paths that'll be different on your particular machine. -`dot` is a simple script that installs some dependencies, sets sane OS X +`dot` is a simple script that installs some dependencies, sets sane macOS defaults, and so on. Tweak this script, and occasionally run `dot` from time to time to keep your environment fresh and up-to-date. You can find this script in `bin/`. @@ -70,7 +70,7 @@ this script in `bin/`. I want this to work for everyone; that means when you clone it down it should work for you even though you may not have `rbenv` installed, for example. That -said, I do use this as *my* dotfiles, so there's a good chance I may break +said, I do use this as _my_ dotfiles, so there's a good chance I may break something if I forget to make a check for a dependency. If you're brand-new to the project and run into any blockers, please diff --git a/atom.symlink/atom.coffee b/atom.symlink/atom.coffee deleted file mode 100644 index 297b7b6f0ac..00000000000 --- a/atom.symlink/atom.coffee +++ /dev/null @@ -1 +0,0 @@ -# Atom customization goes here. diff --git a/atom.symlink/config.cson b/atom.symlink/config.cson deleted file mode 100644 index 65670f49bef..00000000000 --- a/atom.symlink/config.cson +++ /dev/null @@ -1,39 +0,0 @@ -"*": - core: - disabledPackages: [ - "background-tips" - "exception-reporting" - "metrics" - ] - followSymlinks: false - hideGitIgnoredFiles: true - ignoredNames: [ - ".bundle" - ".git" - "log" - "repositories" - "tmp" - "vendor" - ] - themes: [ - "unity-ui" - "glacier-syntax" - ] - editor: - fontFamily: "Menlo" - invisibles: {} - showIndentGuide: true - softWrapAtPreferredLineLength: true - "go-plus": - goPath: "/Users/holman/Code/go" - "release-notes": - viewedVersion: "0.89.0" - "spell-check": - grammars: [ - "text.plain" - "source.gfm" - "text.git-commit" - "text.html.basic" - ] - welcome: - showOnStartup: false diff --git a/atom.symlink/init.coffee b/atom.symlink/init.coffee deleted file mode 100644 index 3b5ebc569f7..00000000000 --- a/atom.symlink/init.coffee +++ /dev/null @@ -1 +0,0 @@ -# Add any auto-loaded Atom code on init here. diff --git a/atuin/env.zsh b/atuin/env.zsh new file mode 100644 index 00000000000..4bfbc3daeb5 --- /dev/null +++ b/atuin/env.zsh @@ -0,0 +1 @@ +eval "$(atuin init zsh)" \ No newline at end of file diff --git a/bin/a b/bin/a new file mode 100755 index 00000000000..c3ddc41bf08 --- /dev/null +++ b/bin/a @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Quick shortcut to ~*-~*AI*~-*~ +# +# Load up a current $HotThing AI client with preferable settings (which is +# usually yolo-lfg style anyway; computers wouldn't do anything to us). +# +# USAGE: +# +# $ a +# # => opens the AI client. yeah, easy peasy. +claude --dangerously-skip-permissions diff --git a/bin/battery-status b/bin/battery-status new file mode 100755 index 00000000000..a0f75f0fb94 --- /dev/null +++ b/bin/battery-status @@ -0,0 +1,39 @@ +#!/bin/bash +# +# battery-status +# +# A quick little indicator for battery status on your Mac laptop, suitable for +# display in your prompt. + +if test ! "$(uname)" = "Darwin" + then + printf "" + exit 0 +fi + +battstat=$(pmset -g batt) +time_left=$(echo $battstat | + tail -1 | + cut -f2 | + awk -F"; " '{print $3}' | + cut -d' ' -f1 +) + +if [[ $(pmset -g ac) == *"No adapter attached."* ]] +then + emoji='🔋' +else + emoji='🔌' +fi + +if [[ $time_left == *"(no"* || $time_left == *"not"* ]] +then + time_left='⌛️ ' +fi + +if [[ $time_left == *"0:00"* ]] +then + time_left='⚡️ ' +fi + +printf "\033[1;92m$emoji $time_left \033[0m" diff --git a/bin/cloudapp b/bin/cloudapp deleted file mode 100755 index 1ec555ab660..00000000000 --- a/bin/cloudapp +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env ruby -# -# cloudapp -# Zach Holman / @holman -# -# Uploads a file from the command line to CloudApp, drops it into your -# clipboard (on a Mac, at least). -# -# Example: -# -# cloudapp drunk-blake.png -# -# This requires Aaron Russell's cloudapp_api gem: -# -# gem install cloudapp_api -# -# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: -# -# email -# password - -require 'rubygems' - -['json', 'cloudapp_api'].each do |gem| - begin - require gem - rescue LoadError - puts "You need to install #{gem}: gem install #{gem}" - exit!(1) - end -end - -config_file = "#{ENV['HOME']}/.cloudapp" -unless File.exist?(config_file) - puts "You need to type your email and password (one per line) into "+ - "`~/.cloudapp`" - exit!(1) -end - -email,password = File.read(config_file).split("\n") - -if ARGV[0].nil? - puts "You need to specify a file to upload." - exit!(1) -end - -urls = [] -ARGV.each do |x| - CloudApp.authenticate(email,password) - puts "Attempting to upload #{x}" - url = CloudApp::Item.create(:upload, {:file => x}).url - - # Say it for good measure. - puts "Uploaded #{x} to #{url}" - - # Get the embed link. - url = "#{url}/#{ARGV[0].split('/').last}" - urls << url -end - -# Copy it to your (Mac's) clipboard. -`echo '#{urls.join(',')}' | tr -d "\n" | pbcopy` diff --git a/bin/dns-flush b/bin/dns-flush new file mode 100755 index 00000000000..dc3f4c076b7 --- /dev/null +++ b/bin/dns-flush @@ -0,0 +1,6 @@ +#!/bin/sh +# +# I literally always forget how to flush my DNS settings on macOS (in large part +# because it changes every damn update). + +sudo killall -HUP mDNSResponder diff --git a/bin/dot b/bin/dot index 4e0313bb995..d84a178a29b 100755 --- a/bin/dot +++ b/bin/dot @@ -4,10 +4,51 @@ # # `dot` handles installation, updates, things like that. Run it periodically # to make sure you're on the latest and greatest. + +set -e + +parentDirectory="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P)" +dotfilesDirectory="$(cd "$( dirname "$parentDirectory" )" && pwd -P)" + +displayUsageAndExit() { + echo "dot -- dotfiles management" + echo "" + echo "Usage: dot [options]" + echo "" + echo "Options:" + echo " -e, --edit Open dotfiles directory for editing" + echo " -h, --help Show this help message and exit" + exit +} + +while test $# -gt 0; do + case "$1" in + "-h"|"--help") + displayUsageAndExit + ;; + "-e"|"--edit") + exec "$EDITOR" "$dotfilesDirectory" + exit + ;; + *) + echo "Invalid option: $1" + displayUsageAndExit + ;; + esac + shift +done + export ZSH=$HOME/.dotfiles -# Set OS X defaults -$ZSH/osx/set-defaults.sh +# Update dotfiles themselves +echo "› git pull" +git -C $ZSH pull + +# Set macOS defaults +$ZSH/macos/set-defaults.sh + +# Set macOS hostname +$ZSH/macos/set-hostname.sh # Install homebrew $ZSH/homebrew/install.sh 2>&1 @@ -16,6 +57,9 @@ $ZSH/homebrew/install.sh 2>&1 echo "› brew update" brew update +echo "› brew upgrade" +brew upgrade + # Install software -echo "› $ZSH/script/install" +echo "› script/install" $ZSH/script/install diff --git a/bin/e b/bin/e index f8b6c05fcb6..501ad6e372b 100755 --- a/bin/e +++ b/bin/e @@ -13,9 +13,4 @@ # $ e . # $ e /usr/local # # => opens the specified directory in your editor - -if [ "$1" = "" ] ; then - exec $EDITOR . -else - exec $EDITOR "$1" -fi +exec "$EDITOR" "${1:-.}" diff --git a/bin/ee b/bin/ee new file mode 100755 index 00000000000..d095f389c8c --- /dev/null +++ b/bin/ee @@ -0,0 +1,5 @@ +#!/bin/sh +# +# vscode requires `--wait` if you're editing interactively in a prompt. +# +EDITOR="$EDITOR --wait" $@ diff --git a/bin/git-edit-new b/bin/git-edit-new new file mode 100755 index 00000000000..cc1c244b1b1 --- /dev/null +++ b/bin/git-edit-new @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Open new, unstaged files in your $EDITOR. +# +# This is nice to have when you run a command line generator which generates a +# file or three in your working directory, and you know you want to immediately +# edit them in your editor next. Why waste time clicking around like some sort +# of plebian when you can just run another command? + +$EDITOR $(git ls-files --others --exclude-standard) diff --git a/bin/headers b/bin/headers index 9dd1f72c6e9..6a26f40d7c8 100755 --- a/bin/headers +++ b/bin/headers @@ -1,8 +1,8 @@ #!/bin/sh # -# https://github.com/rtomayko/dotfiles/blob/rtomayko/bin/headers +# https://github.com/rtomayko/dotfiles/blob/rtomayko/.local/bin/headers curl -sv "$@" 2>&1 >/dev/null | grep -v "^\*" | grep -v "^}" | - cut -c3- \ No newline at end of file + cut -c3- diff --git a/bin/movieme b/bin/movieme deleted file mode 100755 index 115a364f0fa..00000000000 --- a/bin/movieme +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# MOVIE ME as in: "MOVIE ME AN ANIMATED GIF FROM THIS MOVIE, DAMMIT" -# -# Creates an animated gif from a movie file. Uploads to CloudApp. You must also -# have `gifme` and `cloudapp` in your $PATH. -# -# $1 - the path to the movie we're converting. -# $2 - the start time of the finished product. -# This can be in seconds, or it also accepts the "hh:mm:ss[.xxx]" format. -# $3 - the duration of the video sequence. -# This can be in seconds, or it also accepts the "hh:mm:ss[.xxx]" format. -# -# Examples: -# -# movieme -# ~/Desktop/dr-strangelove.mp4 23:12 3 -# ~/Desktop/holman-backflip-on-fire.mov 3.9 1.75 - -# cleanup -rm -rf /tmp/movieme - -# create tmp dir -mkdir -p /tmp/movieme - -# split the movie into constituent frames -ffmpeg -i "$1" -f image2 -vf "scale=iw*sar:ih" -ss $2 -t $3 -r 7 /tmp/movieme/d-%05d.png - -# ANIMATE -gifme /tmp/movieme/* -d 0 diff --git a/bin/mustacheme b/bin/mustacheme deleted file mode 100755 index ad28a39f6e2..00000000000 --- a/bin/mustacheme +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# -# mustacheme -# expanded from an idea from Rick Olson (@technoweenie) -# -# Takes a .gif, splits it into constituent frames, mustaches each, restitches -# the gif, and uploads to cloudapp. -# -# This leverages the nifty service mustachify.me, which will analyze your photo, -# identify faces, and add a mustache to your image. -# -# If the .gif is a remote file, we'll download it and blow it up locally. -# -# $1 - the path of the gif -# -# Examples: -# -# mustacheme holman-jumping-off-cliff-into-butter.gif -# mustacheme http://github.com/holman/butter/blob/master/holman-butter.gif -# -# Dependencies: -# -# - ImageMagick. If you're on a Mac, run: -# brew install imagemagick -# - wget -# - cloudapp: https://github.com/holman/dotfiles/blob/master/bin/cloudapp -# - gifme: https://github.com/holman/gifme - -set -e - -# Set up mustacheme temporary working directory -output=/tmp/mustacheme -rm -rf $output -mkdir $output - -if [[ $1 == http* ]] -then - wget $1 -O /tmp/mustache-download.gif - file=/tmp/mustache-download.gif -else - file="$1" -fi - -# Blow apart the GIF -convert $1 -coalesce $output/frame_%03d.gif - -# Mustache each frame -for frame in $output/*.gif -do - url=$(cloudapp $frame | grep Uploaded | awk '{print substr($0, index($0, "http://"))}') - url="$url/$(basename $frame)" - wget "http://mustachify.me/?src=$url" -O "$frame-stache" -done - -# Ding! Fries are done. -gifme $output/*-stache -d 0 diff --git a/bin/res b/bin/res deleted file mode 100755 index 40afcfdf55e..00000000000 --- a/bin/res +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/osascript -# -# A small command line script to change screen resolutions on Mountain Lion. -# -# Primarily I switch between two resolutions on my Retina MacBook Pro: Retina, -# and the full resolution setting. This means for particular apps I use, I can -# quickly jump between seeing more pixels and less. -# -# There doesn't appear to be an easy way to do this without just using -# AppleScript to automate clicking buttons, so that's what this does. -# -# Most of this script is adapted from this helpful answer: -# -# http://apple.stackexchange.com/a/91590 -# -# Make sure "Enable access for assistive devices" is checked in the -# Accessibility section of System Properties. - -local index1, index2 - -set index1 to 3 -- 1440 x 900 (Best for Retina) -set index2 to 5 -- 1920 x 1200 (More Space) - -tell application "System Preferences" - reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays" -end tell - -local indexToUse - -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 the "Scaled" radio button - click radio button "Scaled" of radio group 1 of tab group 1 - - tell tab group 1 - tell radio group 1 of group 1 - -- Depending on what scale option/index is current selected, set the appropriate new option/index to use - if (value of radio button index1) is true then - set indexToUse to index2 - else if (value of radio button index2) is true then - set indexToUse to index1 - end if - - -- Click the radio button for the new scale option/index - click radio button indexToUse - end tell - end tell - - -- If option/index 1 is selected a warning prompt is displayed, click the OK button to dismiss the prompt - if indexToUse = 1 then - click button "OK" of sheet 1 - end if -end tell - -tell application "System Preferences" - quit -end tell diff --git a/bin/search b/bin/search index d899b4ce332..fc64731684d 100755 --- a/bin/search +++ b/bin/search @@ -1,12 +1,12 @@ #!/bin/sh # -# Quick search in a directory for a string ($1). +# Quick search in a directory for a string ($@). # set -e # use -iru to search directories ack usually ignores (like .git) if [ -x /usr/bin/ack-grep ]; then - ack-grep -i $1 + ack-grep -i "$@" else - ack -i $1 + ack -i "$@" fi diff --git a/bin/set-defaults b/bin/set-defaults index 8a8d9a2ba27..333859619a8 100755 --- a/bin/set-defaults +++ b/bin/set-defaults @@ -1,5 +1,5 @@ #!/bin/sh # -# Sets OS X defaults by running $ZSH/osx/set-defaults.sh. +# Sets macOS defaults by running $ZSH/macos/set-defaults.sh. -exec $ZSH/osx/set-defaults.sh \ No newline at end of file +exec $ZSH/macos/set-defaults.sh diff --git a/bin/subl b/bin/subl deleted file mode 120000 index 452a98979c8..00000000000 --- a/bin/subl +++ /dev/null @@ -1 +0,0 @@ -/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl \ No newline at end of file diff --git a/bin/todo b/bin/todo index 08ae557028f..8a62cbde29a 100755 --- a/bin/todo +++ b/bin/todo @@ -13,7 +13,6 @@ # at a time. Once I've finished a todo, I just delete the file. That's it. # # Millions of dollars later and `touch` wins. -set -e # Run our new web 2.0 todo list application and raise millions of VC dollars. touch ~/Desktop/"$*" diff --git a/bin/yt b/bin/yt new file mode 100755 index 00000000000..282027c79f8 --- /dev/null +++ b/bin/yt @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Downloads the embedded video on any web page straight to the desktop. +# +# youtube-dlp, which is awesome: +# https://github.com/yt-dlp/yt-dlp +# + +cd ~/Desktop && yt-dlp -S "ext" "$1" diff --git a/docker/aliases.zsh b/docker/aliases.zsh new file mode 100644 index 00000000000..17b10f6bc90 --- /dev/null +++ b/docker/aliases.zsh @@ -0,0 +1,2 @@ +alias d='docker $*' +alias d-c='docker-compose $*' diff --git a/editors/env.zsh b/editors/env.zsh new file mode 100644 index 00000000000..0fca5519166 --- /dev/null +++ b/editors/env.zsh @@ -0,0 +1 @@ +export EDITOR='zed' diff --git a/editors/windsurf.zsh b/editors/windsurf.zsh new file mode 100644 index 00000000000..4ec661acb02 --- /dev/null +++ b/editors/windsurf.zsh @@ -0,0 +1 @@ +export PATH="/Users/holman/.codeium/windsurf/bin:$PATH" \ No newline at end of file diff --git a/functions/c b/functions/c index 486a3c6394b..ac49a5a7f49 100644 --- a/functions/c +++ b/functions/c @@ -12,13 +12,5 @@ # c holm/bo # # ...to quickly jump into holman/boom, for example. -# -# This also accounts for how Go structures its projects. For example, it will -# autocomplete both on $PROJECTS, and also assume you want to autocomplete on -# your Go projects in $GOPATH/src. -if [ ! -z "$1" ] && [ -s "$GOPATH/src/github.com/$1" ]; then - cd "$GOPATH/src/github.com/$1" -else - cd "$PROJECTS/$1" -fi +cd "$PROJECTS/$1" diff --git a/functions/extract b/functions/extract index 39a6dd643d8..16640febbe0 100644 --- a/functions/extract +++ b/functions/extract @@ -2,7 +2,7 @@ # # Usage: extract # Description: extracts archived files / mounts disk images -# Note: .dmg/hdiutil is Mac OS X-specific. +# Note: .dmg/hdiutil is macOS-specific. # # credit: http://nparikh.org/notes/zshrc.txt extract () { diff --git a/git/aliases.zsh b/git/aliases.zsh index 572e7ef9676..ac8f5a9be9a 100644 --- a/git/aliases.zsh +++ b/git/aliases.zsh @@ -10,7 +10,10 @@ fi alias gl='git pull --prune' alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" alias gp='git push origin HEAD' -alias gd='git diff' + +# Remove `+` and `-` from start of diff lines; just rely upon color. +alias gd='git diff --color | sed "s/^\([^-+ ]*\)[-+ ]/\\1/" | less -r' + alias gc='git commit' alias gca='git commit -a' alias gco='git checkout' @@ -18,3 +21,4 @@ alias gcb='git copy-branch-name' alias gb='git branch' alias gs='git status -sb' # upgrade your git if -sb breaks for you. it's fun. alias gac='git add -A && git commit -m' +alias ge='git-edit-new' diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index c936c2b2cf2..29e0e804c06 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -31,3 +31,12 @@ # # Setting to git 2.0 default to suppress warning message default = simple +[credential] + helper = osxkeychain +[diff "spaceman-diff"] + command = /opt/homebrew/bin/spaceman-diff + +[init] + defaultBranch = main +[pull] + rebase = true diff --git a/go/path.zsh b/go/path.zsh deleted file mode 100644 index 71bd1c338a7..00000000000 --- a/go/path.zsh +++ /dev/null @@ -1,2 +0,0 @@ -export GOPATH=$PROJECTS/go -export PATH="$GOPATH/bin:$PATH" diff --git a/homebrew/install.sh b/homebrew/install.sh index 1921f008fbb..be72ff076eb 100755 --- a/homebrew/install.sh +++ b/homebrew/install.sh @@ -16,9 +16,12 @@ then ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" elif test "$(expr substr $(uname -s) 1 5)" = "Linux" then - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)" + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)" fi fi +# Link keg-only formulas that we want in PATH +brew list | grep 'postgresql@' | xargs -I {} brew link {} --force 2>/dev/null + exit 0 diff --git a/homebrew/path.zsh b/homebrew/path.zsh new file mode 100644 index 00000000000..ca6b69de199 --- /dev/null +++ b/homebrew/path.zsh @@ -0,0 +1 @@ +export PATH="/opt/homebrew/bin:$PATH" \ No newline at end of file diff --git a/osx/set-defaults.sh b/macos/set-defaults.sh similarity index 53% rename from osx/set-defaults.sh rename to macos/set-defaults.sh index 786ba8110fa..f2d73256450 100755 --- a/osx/set-defaults.sh +++ b/macos/set-defaults.sh @@ -1,9 +1,9 @@ -# Sets reasonable OS X defaults. +# Sets reasonable macOS defaults. # -# Or, in other words, set shit how I like in OS X. +# Or, in other words, set shit how I like in macOS. # # The original idea (and a couple settings) were grabbed from: -# https://github.com/mathiasbynens/dotfiles/blob/master/.osx +# https://github.com/mathiasbynens/dotfiles/blob/master/.macos # # Run ./set-defaults.sh and you'll be good to go. @@ -20,7 +20,7 @@ defaults write com.apple.Finder FXPreferredViewStyle Nlsv chflags nohidden ~/Library # Set a really fast key repeat. -defaults write NSGlobalDomain KeyRepeat -int 0 +defaults write NSGlobalDomain KeyRepeat -int 1 # Set the Finder prefs for showing a few different volumes on the Desktop. defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true @@ -31,11 +31,16 @@ defaults write com.apple.dock wvous-bl-corner -int 5 defaults write com.apple.dock wvous-bl-modifier -int 0 # Hide Safari's bookmark bar. -defaults write com.apple.Safari ShowFavoritesBar -bool false +defaults write com.apple.Safari.plist ShowFavoritesBar -bool false + +# Always show Safari's "URL display" tab in the lower left on mouseover. Strangely +# like, everyone and their LLMs on the internet thinks this is ShowStatusBar, but +# it's not. +defaults write com.apple.Safari ShowOverlayStatusBar -bool true # Set up Safari for development. -defaults write com.apple.Safari IncludeInternalDebugMenu -bool true -defaults write com.apple.Safari IncludeDevelopMenu -bool true -defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true -defaults write com.apple.Safari "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true -defaults write NSGlobalDomain WebKitDeveloperExtras -bool true \ No newline at end of file +defaults write com.apple.Safari.SandboxBroker ShowDevelopMenu -bool true +defaults write com.apple.Safari.plist IncludeDevelopMenu -bool true +defaults write com.apple.Safari.plist WebKitDeveloperExtrasEnabledPreferenceKey -bool true +defaults write com.apple.Safari.plist "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true +defaults write NSGlobalDomain WebKitDeveloperExtras -bool true diff --git a/macos/set-hostname.sh b/macos/set-hostname.sh new file mode 100755 index 00000000000..a8e773c9b53 --- /dev/null +++ b/macos/set-hostname.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# This corrects a shitty point of confusion with macOS where if you bounce +# between wireless and wired connections, macOS will suddenly throw up its hands +# and add a random-ass number to your hostname. Do it a couple times and you're +# in like, the thousands appended to your hostname, which makes you look like a +# chump when your machine is called "incredible-programmer-9390028", like +# you're behind 9,390,027 other better programmers before you. Sheesh. +# +# Anyway, this runs in `dot` and only asks for your permission (usually TouchID) +# if it actually needs to change your hostname for you, otherwise it's fast to +# toss into `dot` anyway. +# +# None of this really matters in the big scheme of things, but it bothered me. + +hostname=$(scutil --get LocalHostName) + +# if hostname contains a hyphen and then a number, remove the hyphen and number +normal_hostname=$(echo "$hostname" | sed 's/-[0-9]*$//') + +# if our hostname was changed by macOS, change it back +if [ "$normal_hostname" != "$hostname" ]; then + echo "Changing hostname from $hostname to $normal_hostname" + scutil --set LocalHostName "$normal_hostname" + scutil --set ComputerName "$normal_hostname" +fi diff --git a/node/install.sh b/node/install.sh deleted file mode 100755 index 1dff4f43777..00000000000 --- a/node/install.sh +++ /dev/null @@ -1,4 +0,0 @@ -if test ! $(which spoof) -then - sudo npm install spoof -g -fi diff --git a/osx/install.sh b/osx/install.sh deleted file mode 100755 index b8a11de1a9f..00000000000 --- a/osx/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -# The Brewfile handles Homebrew-based app and library installs, but there may -# still be updates and installables in the Mac App Store. There's a nifty -# command line interface to it that we can use to just install everything, so -# yeah, let's do that. - -echo "› sudo softwareupdate -i -a" -sudo softwareupdate -i -a diff --git a/ruby/irbrc.symlink b/ruby/irbrc.symlink index 6cda38429df..d8cf3001043 100644 --- a/ruby/irbrc.symlink +++ b/ruby/irbrc.symlink @@ -1,9 +1,7 @@ #!/usr/bin/ruby require 'irb/completion' -require 'irb/ext/save-history' require 'rubygems' -IRB.conf[:SAVE_HISTORY] = 1000 IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history" IRB.conf[:PROMPT_MODE] = :SIMPLE @@ -31,8 +29,16 @@ class Object end end +# Copies the result of the last operation you ran in IRB to the system +# clipboard (if you're on macOS). +def cop + last_value = IRB.CurrentContext.last_value + %x[echo '#{last_value}' | pbcopy] + "copied \`#{last_value}' to your clipboard" +end + def me - User.find_by_login(ENV['USER'].strip) + User.find_by_email(`git config --get user.email`.chomp) end def r diff --git a/ruby/rbenv.zsh b/ruby/rbenv.zsh index cb93d589d6a..8b8542f8073 100644 --- a/ruby/rbenv.zsh +++ b/ruby/rbenv.zsh @@ -1,3 +1,6 @@ +# fun: https://bugs.ruby-lang.org/issues/14009 +export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES + # init according to man page if (( $+commands[rbenv] )) then diff --git a/script/bootstrap b/script/bootstrap index 192e165ff0d..ec33297de17 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -144,7 +144,7 @@ install_dotfiles if [ "$(uname -s)" == "Darwin" ] then info "installing dependencies" - if source bin/dot > /tmp/dotfiles-dot 2>&1 + if source bin/dot | while read -r data; do info "$data"; done then success "dependencies installed" else diff --git a/script/install b/script/install index 8d516b2a1fe..826f87e8dd0 100755 --- a/script/install +++ b/script/install @@ -6,7 +6,6 @@ set -e cd "$(dirname $0)"/.. -# Run Homebrew through the Brewfile echo "› brew bundle" brew bundle diff --git a/system/_path.zsh b/system/_path.zsh index 255c2cfca66..ed7da9058f1 100644 --- a/system/_path.zsh +++ b/system/_path.zsh @@ -1,2 +1,2 @@ -export PATH="./bin:/usr/local/bin:/usr/local/sbin:$ZSH/bin:$PATH" +export PATH="./bin:$HOME/.local/bin:/usr/local/bin:/usr/local/sbin:$ZSH/bin:$PATH" export MANPATH="/usr/local/man:/usr/local/mysql/man:/usr/local/git/man:$MANPATH" diff --git a/system/env.zsh b/system/env.zsh index 9a97245a42d..e69de29bb2d 100644 --- a/system/env.zsh +++ b/system/env.zsh @@ -1 +0,0 @@ -export EDITOR='atom' diff --git a/xcode/aliases.zsh b/xcode/aliases.zsh index b9b817ec106..1c7c6c1c3a6 100644 --- a/xcode/aliases.zsh +++ b/xcode/aliases.zsh @@ -1 +1 @@ -alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" +alias ios="open -a Simulator" diff --git a/yarn/path.zsh b/yarn/path.zsh new file mode 100644 index 00000000000..7d2b91e6c3c --- /dev/null +++ b/yarn/path.zsh @@ -0,0 +1,7 @@ +# sup yarn +# https://yarnpkg.com + +if (( $+commands[yarn] )) +then + export PATH="$PATH:`yarn global bin`" +fi diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index d8fb4b3cfd3..b88e3aa5a1b 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1 +1,3 @@ alias reload!='. ~/.zshrc' + +alias cls='clear' # Good 'ol Clear Screen command diff --git a/zsh/config.zsh b/zsh/config.zsh index bdf8f9826d0..8ca7389e218 100644 --- a/zsh/config.zsh +++ b/zsh/config.zsh @@ -1,9 +1,3 @@ -if [[ -n $SSH_CONNECTION ]]; then - export PS1='%m:%3~$(git_info_for_prompt)%# ' -else - export PS1='%3~$(git_info_for_prompt)%# ' -fi - export LSCOLORS="exfxcxdxbxegedabagacad" export CLICOLOR=true @@ -37,12 +31,9 @@ setopt HIST_REDUCE_BLANKS # like: git comm-[tab] setopt complete_aliases -zle -N newtab - bindkey '^[^[[D' backward-word bindkey '^[^[[C' forward-word bindkey '^[[5D' beginning-of-line bindkey '^[[5C' end-of-line bindkey '^[[3~' delete-char -bindkey '^[^N' newtab bindkey '^?' backward-delete-char diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 2e962956b4d..d35b8c53f5c 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -33,45 +33,40 @@ git_prompt_info () { echo "${ref#refs/heads/}" } -unpushed () { - $git cherry -v @{upstream} 2>/dev/null -} - +# This assumes that you always have an origin named `origin`, and that you only +# care about one specific origin. If this is not the case, you might want to use +# `$git cherry -v @{upstream}` instead. need_push () { - if [[ $(unpushed) == "" ]] + if [ $($git rev-parse --is-inside-work-tree 2>/dev/null) ] then - echo " " - else - echo " with %{$fg_bold[magenta]%}unpushed%{$reset_color%} " + number=$($git cherry -v origin/$(git symbolic-ref --short HEAD) 2>/dev/null | wc -l | bc) + + if [[ $number == 0 ]] + then + echo " " + else + echo " with %{$fg_bold[magenta]%}$number unpushed%{$reset_color%}" + fi fi } -ruby_version() { - if (( $+commands[rbenv] )) - then - echo "$(rbenv version | awk '{print $1}')" - fi +directory_name() { + echo "%{$fg_bold[cyan]%}%1/%\/%{$reset_color%}" +} - if (( $+commands[rvm-prompt] )) +battery_status() { + if test ! "$(uname)" = "Darwin" then - echo "$(rvm-prompt | awk '{print $1}')" + exit 0 fi -} -rb_prompt() { - if ! [[ -z "$(ruby_version)" ]] + if [[ $(sysctl -n hw.model) == *"Book"* ]] then - echo "%{$fg_bold[yellow]%}$(ruby_version)%{$reset_color%} " - else - echo "" + $ZSH/bin/battery-status fi } -directory_name() { - echo "%{$fg_bold[cyan]%}%1/%\/%{$reset_color%}" -} - -export PROMPT=$'\n$(rb_prompt)in $(directory_name) $(git_dirty)$(need_push)\n› ' +export PROMPT=$'\n$(battery_status)in $(directory_name) $(git_dirty)$(need_push)\n› ' set_prompt () { export RPROMPT="%{$fg_bold[cyan]%}%{$reset_color%}" }