Skip to content

Instantly share code, notes, and snippets.

@timwright12
Created April 20, 2021 19:54
Show Gist options
  • Save timwright12/469716e97c3fafab6688972247cf1771 to your computer and use it in GitHub Desktop.
Save timwright12/469716e97c3fafab6688972247cf1771 to your computer and use it in GitHub Desktop.
# PATH updates
export NVM_DIR=~/.nvm
export PATH="/usr/local/opt/ruby/bin:$PATH"
source $(brew --prefix nvm)/nvm.sh
# Terminal Alias
NEWLINE=$'\n'
ME=$'tim'
PROMPT="${NEWLINE}%B%F{white}%1~%f%b${NEWLINE}[%m][${ME}] -> "
# Homework Tests
alias check-es5='npx es-check es5 index.js'
# Command alias
alias edithosts='sudo vi /private/etc/hosts'
alias editbash='code ~/.zshrc'
alias phpserver='php -S localhost:8000'
alias pythonserver='python -m SimpleHTTPServer 8888'
alias npm-remove-packages='rm -rf node_modules/'
alias npm-reset-packages='rm -rf node_modules/ && yarn'
alias socksup='ssh socks -D 2001 -N &'
alias sockson='bash ~/Sites/va-gov/devops/utilities/va.sh socks on'
alias socksoff='bash ~/Sites/va-gov/devops/utilities/va.sh socks off'
alias socksadd='ssh-add -K ~/.ssh/id_rsa'
# Directory shortcuts
alias home='cd ~'
alias sites='cd ~/Sites'
alias desktop='cd ~/Desktop'
alias sandbox='cd ~/Sites/sandbox'
## Project alias
alias va='cd ~/Sites/va-gov/vets-website/ && git branch'
alias va-build-prod='NODE_ENV=production ./script/build.sh --buildtype vagovprod'
alias va-build-staging='NODE_ENV=production ./script/build.sh --buildtype vagovstaging'
alias va-build-dev='NODE_ENV=production ./script/build.sh --buildtype vagovdev'
alias va-reset='rm -rf node_modules/ && rm -rf .cache/ && rm -rf build/ && yarn && yarn build'
alias content-build='cd ~/Sites/va-gov/content-build/ && git branch'
alias devops='cd ~/Sites/va-gov/devops/ && git branch'
# Docker
alias dockerup='docker-compose up -d'
alias dockerdown='docker-compose down'
alias dockerstop='docker stop $(docker ps -a -q)'
alias dockerdelete='docker rm $(docker ps -a -q)'
alias dockerkill='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)'
# Composer
alias composer-install='composer install --ignore-platform-reqs'
alias composer-update='composer update --ignore-platform-reqs'
alias composer-dump='composer dump-autoload --ignore-platform-reqs'
# Adhoc website locally
# Commands:
# - adhoc go
# - adhoc build
# - adhoc serve
adhoc() {
if [[ "${1}" == "go" ]]
then
cd ~/Sites/adhoc/www.adhoc.team && git branch
elif [[ "${1}" == "build" ]]
then
bundle install && bundle exec jekyll build
elif [[ "${1}" == "serve" ]]
then
bundle exec jekyll serve
fi
}
server() {
python -m SimpleHTTPServer $1
}
# Usage: link /path/to/original /path/to/symlink
symlink() {
ln -s $1 $2
}
# Usage: remove path/to/dir
remove() {
rm -rf $1
}
## File diff
fs-diff() {
diff -ur $1 $2 | delta
}
# Directory diff
# Usage: src/site ../vets-website/src/site
fs-dir-diff() {
diff -rq $1 $2
}
# Usage: git-show-conflicts
git-show-conflicts() {
git diff --name-only --diff-filter=U
}
# USAGE: git-archive feature/branch-name
git-archive() {
git checkout $1
git tag archive/$1
git push origin archive/$1
git checkout master
git branch -D $1
git push origin :$1
}
# USAGE: git-upstream-set {{repo url}}
git-upstream-set() {
git remote add upstream $1
git fetch upstream
}
# USAGE: git-pull-fork 54 feature/whatever
git-pull-fork() {
git fetch origin pull/$1/head:$2
}
# From vets-website
# Usage: get-patch 8394a595db5ceb3c50a69c82b005377aa3fef82e
get-patch(){
git format-patch -1 $1
}
# From content-build
# Usage: apply-patch 0001-Pw-16192-fix-15045.patch include src/site/components/up_to_top_button.html
apply-patch() {
if [ "$2" ]
then
git am --signoff --$2 $3 < ../vets-website/$1
else
git am --signoff < ../vets-website/$1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment