Created
November 14, 2021 05:59
-
-
Save ianrandmckenzie/bb86c41d9dcd3da670db924777182812 to your computer and use it in GitHub Desktop.
My .zprofile / .zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IANRANDMCKENZIE.ZSHRC | |
# Largely derivative of my former Medium Rare Inc colleague Yosuke Hasumi's .bash_profile: | |
# https://gist.github.com/yosukehasumi/fb5c97f661ee3d4e1b41049707606fb5 | |
# Easily reload these configs | |
# ------------------------------------------------------------ | |
alias reload!='source ~/.zshrc' | |
# Setting PATH for various tools | |
# ------------------------------------------------------------ | |
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" | |
export PATH | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH" | |
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home | |
export PATH=$JAVA_HOME/bin:$PATH | |
eval "$(rbenv init -)" | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && . "$(brew --prefix)/opt/nvm/nvm.sh" # This loads nvm | |
[ -s "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" ] && . "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion | |
autoload -U add-zsh-hook | |
load-nvmrc() { | |
if [[ -f .nvmrc && -r .nvmrc ]]; then | |
nvm use | |
elif [[ $(nvm version) != $(nvm version default) ]]; then | |
echo "Reverting to nvm default version" | |
nvm use default | |
fi | |
} | |
add-zsh-hook chpwd load-nvmrc | |
load-nvmrc | |
# Files and navigation functions | |
# ------------------------------------------------------------ | |
alias cleanupDS="find . -type f -name '*.DS_Store' -ls -delete" # Recursively delete .DS_Store files | |
export EDITOR='sublime' | |
alias showFiles=' | |
defaults write com.apple.finder AppleShowAllFiles YES; | |
killall Finder /System/Library/CoreServices/Finder.app; | |
' | |
alias hideFiles=' | |
defaults write com.apple.finder AppleShowAllFiles NO; | |
killall Finder /System/Library/CoreServices/Finder.app; | |
' | |
mcd () { mkdir -p "$1" && cd "$1"; } # mcd: Makes new Dir and jumps inside | |
trash () { command mv "$@" ~/.Trash ; } # trash: Moves a file to the MacOS trash | |
alias s=sublime | |
cr () { code ~/Code/Ruby/$1; } | |
cw () { code ~/Code/WordPress/$1; } | |
alias o='open -a Finder ./' | |
# Scratching the code curiosity itch | |
# ------------------------------------------------------------ | |
alias scratch.html='code ~/Desktop/scratch.html' | |
alias scratch.css='code ~/Desktop/scratch.css' | |
alias scratch.js='code ~/Desktop/scratch.js' | |
alias scratch.rb='code ~/Desktop/scratch.rb' | |
# memHogsTop: Find memory & CPU hogs | |
# ----------------------------------------------------- | |
alias memHogs='top -l 1 -o rsize | head -20' | |
alias cpuHogs='ps wwaxr -o pid,stat,%cpu,time,command | head -10' | |
# HTTP Tools | |
# ------------------------------------------------------------------- | |
alias myip='curl http://www.myip4.com' # myip: Public facing IP Address | |
# Download a web page and show info on how long each request phase took. | |
# Basically a way for me to brag to myself about how much better at dev | |
# ops I am than the rest of my local competition. | |
httpDebug () { | |
curl $@ -o /dev/null -w " | |
dns: %{time_namelookup} | |
connect: %{time_connect} | |
pretransfer: %{time_pretransfer} | |
starttransfer: %{time_starttransfer} | |
total: %{time_total}\n | |
"; | |
} | |
# What's running on these ports? | |
# ------------------------------------------------------------ | |
alias p3000='lsof -i tcp:3000' | |
alias p6379='lsof -i tcp:6379' | |
alias p8080='lsof -i tcp:8080' | |
alias p8888='lsof -i tcp:8888' | |
# Spin up a new Roots.io site | |
# ------------------------------------------------------------ | |
# $1 = website domain name | |
rootswp_build(){ | |
echo "Building a fresh WordPress repo..." | |
mkdir $1 && cd $1 | |
git clone --depth=1 git@github.com:roots/bedrock.git site && rm -rf site/.git | |
git clone --depth=1 git@github.com:roots/trellis.git && rm -rf trellis/.git | |
git init | |
git add . | |
git commit -m "Initial commit" | |
code . | |
echo "Done. Next step: configure wordpress_sites.yml and vault.yml" | |
echo "Enter 'done' once you're finished configuring" | |
while : | |
do | |
read input_1 | |
if [ $input_1 = "done" ]; then | |
echo "Beginning provisioning with vagrant..." | |
cd trellis && vagrant up | |
echo "Provisioning complete." | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment