1
mirror of https://github.com/jakejarvis/dotfiles.git synced 2026-01-12 16:32:54 -05:00

Look mom, I finally have a *real* dotfiles repo like the cool kids! 😎

This commit is contained in:
2019-09-07 21:26:10 -04:00
parent f763a1b3cd
commit 2c71836ba6
31 changed files with 1818 additions and 509 deletions

41
zsh/.zshrc Normal file
View File

@@ -0,0 +1,41 @@
# Path to your dotfiles (aka the cloned Git repo).
export DOTFILES=$HOME/.dotfiles/zsh
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Default to nano 'cause I'm a wimp.
export VISUAL="nano"
export EDITOR="nano"
# Adjust history for speed.
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
# Oh My ZSH settings:
ZSH_CUSTOM=$DOTFILES
ZSH_THEME="agnoster"
plugins=(
git
# colored-man-pages
colorize
pip
python
brew
osx
zsh-syntax-highlighting
zsh-autosuggestions
)
# Load everything!
source $ZSH/oh-my-zsh.sh
# Fix slow paste problem w/ zsh-syntax-highlighting plugin.
# https://github.com/zsh-users/zsh-syntax-highlighting/issues/295
zstyle ':bracketed-paste-magic' active-widgets '.self-*'
# Other miscellaneous settings:
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSECURE_REDIRECT=1
export HOMEBREW_CASK_OPTS=--require-sha

71
zsh/aliases.zsh Normal file
View File

@@ -0,0 +1,71 @@
# Enable aliases to be sudo'ed
alias sudo="sudo "
alias ll="ls -lah"
alias la="ls -a"
alias l="ls -lh"
alias cd..="cd .."
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias ~="cd ~"
#alias ip="dig +short myip.opendns.com A @resolver1.opendns.com"
#alias ipv4="dig +short myip.opendns.com A @resolver1.opendns.com"
#alias ipv6="dig +short -6 myip.opendns.com AAAA @resolver1.ipv6-sandbox.opendns.com"
alias ip="ipv4"
alias ipv4="curl -4 icanhazip.com"
alias ipv6="curl -6 icanhazip.com"
alias iplocal="ipconfig getifaddr en0"
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 serve="echo 'Starting server at http://127.0.0.1:8000/ ...'; python3 -m http.server"
alias hosts="sudo $EDITOR /etc/hosts"
alias speed="wget -O /dev/null http://cachefly.cachefly.net/100mb.test"
alias digg="dig @8.8.8.8 +nocmd any +multiline +noall +answer"
alias unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias rehide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
alias forcetrash="sudo rm -rf ~/.Trash /Volumes/*/.Trashes"
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
alias displays="system_profiler SPDisplaysDataType"
alias cpu="sysctl -n machdep.cpu.brand_string"
alias screenfetch="neofetch"
alias ripfinder="killall Finder"
alias ripdock="killall Dock"
alias ripmenu="killall SystemUIServer NotificationCenter"
alias update="brew update; brew upgrade; brew cleanup; nvm install node --latest-npm --reinstall-packages-from=node; npm install npm -g; npm update -g; gem update --system; gem update; gem cleanup; sudo gem update --system; sudo gem update; sudo gem cleanup; sudo softwareupdate -ia --include-config-data;"
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"
alias gundo="git reset --soft HEAD~1"
alias gc="git add . && git commit -m "
alias gs="git status -sb"
alias gd="git diff"
alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app"
alias watchos="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app"
alias dc="docker-compose"
alias sshalt="ssh -p 2222"
alias moshalt="mosh --ssh=\"ssh -p 2222\""
alias finder="open ./"
alias unq="sudo xattr -rd com.apple.quarantine"
alias weather="curl -4 http://wttr.in/Boston"

72
zsh/functions.zsh Normal file
View File

@@ -0,0 +1,72 @@
# Make new directory and change into it (this seems like a no-brainer)
mkcd() {
mkdir -p -- "$1" &&
cd -P -- "$1"
}
# Start an HTTP server from a directory, optionally specifying the port
serve() {
local port="${1:-8000}"
sleep 1 && open "http://localhost:${port}/" &
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesnt break anything for binary files)
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
}
# Start a bash shell inside of a running Docker container
docker-bash() {
docker exec -ti $1 /bin/bash
}
# Extract a compressed archive without worrying which tool to use
extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Find the real location of a short URL
unshort() {
curl -sIL $1 | sed -n 's/Location: *//p'
}
# Create a git.io short URL
gitio() {
if [ -z "${1}" ] || [ -z "${2}" ]; then
echo "Usage: \`gitio slug url\`"
return 1
fi
curl -i https://git.io/ -F "url=${2}" -F "code=${1}"
}
# List files in an S3 buckett
s3ls() {
aws s3 ls s3://$1
}
# Push a local SSH public key to another machine
# https://github.com/rtomayko/dotfiles/blob/rtomayko/.bashrc
push_ssh_cert() {
local _host
test -f ~/.ssh/id_rsa.pub || ssh-keygen -t rsa
for _host in "$@";
do
echo $_host
ssh $_host 'cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
done
}

30
zsh/path.zsh Normal file
View File

@@ -0,0 +1,30 @@
# Default junk
export PATH="$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
# Go
export GOPATH="$HOME/golang"
export GOROOT="/usr/local/opt/go/libexec"
export PATH="$PATH:$GOPATH/bin"
export PATH="$PATH:$GOROOT/bin"
# ruby
export PATH="/usr/local/opt/ruby/bin:$PATH"
# metasploit
export PATH=:"/opt/metasploit-framework/bin:$PATH"
# curl
export PATH="/usr/local/opt/curl/bin:$PATH"
# ----- Third-party additions below: -----
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/jake/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/jake/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/jake/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/jake/google-cloud-sdk/completion.zsh.inc'; fi
# added by travis gem
[ -f /Users/jake/.travis/travis.sh ] && source /Users/jake/.travis/travis.sh