Skip to content

Instantly share code, notes, and snippets.

@halferty
Created February 10, 2020 23:36
Show Gist options
  • Save halferty/01386f319f776be69777a3dd5c48bba7 to your computer and use it in GitHub Desktop.
Save halferty/01386f319f776be69777a3dd5c48bba7 to your computer and use it in GitHub Desktop.
export CLICOLOR=1
source ~/.secretkeys
export PATH="$PATH:$HOME/ruby/bin"
PS1='[[\u@'$(hostname)' \w]] »'
alias docollectstatic="managepy collectstatic"
alias dolint="docker-compose run --rm web ./scripts/lint"
alias doeslint="docker-compose run --rm web ./scripts/eslint"
alias dotest="docollectstatic && managepy test"
alias doutest="managepy collectstatic && docker-compose run --rm web ./scripts/jest_unit_test"
alias doitest="docker-compose run --rm web ./scripts/integration_test"
alias gau="git update-index --assume-unchanged"
alias gnau="git update-index --no-assume-unchanged"
alias glau="git ls-files -v | grep ^[a-z]"
alias rst-rst-branch="rrst_branch"
alias rst-branch="rst_branch"
function gitpushplus()
{
branchname="$(git symbolic-ref --short -q HEAD)"
git push origin "+$branchname"
}
function rst_branch()
{
if [ $# -eq 1 ]; then
git clean -f -d
git rebase --abort
git branch -D tempbranch &> /dev/null
find . -name "post-checkout" | xargs rm -rf
git checkout -b tempbranch
git fetch origin
git branch -D $1
git checkout -b $1 --track origin/$1
git branch -D tempbranch
git reset --hard HEAD
fi
}
function replay()
{
# Get current dir name
projectname=${PWD##*/}
# Build alt name
projectname2="_$projectname"
# Create it if not exists
if [ ! -d "../$projectname2" ]; then
cp -r ./ "../$projectname2"
fi
# Get a temp dir
# mytmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`
# # Copy current directory there
# cp -r ./ $mytmpdir/
# branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
# rst-branch master
# git checkout $branch
# git reset --hard HEAD
}
alias managepy="docker-compose run --rm web ./manage.py"
resetdb() {
echo "yes" | managepy flush &> /dev/null; managepy makemigrations; managepy migrate; managepy init_db
}
stopall() {
for i in $(docker ps | cut -f 1 -d' ' | tail -n+2); do docker kill "$i"; done
docker ps
}
deleteall() {
docker container prune -f
docker volume prune -f
}
resetall() {
rm -rf ./assets/bundles/*
stopall
docker-compose down
deleteall
resetdb
docker-compose build
docker-compose up
}
runwww() {
docker-compose run --rm app yarn install
docker-compose up
}
passwordgenerator() {
ruby -e 'puts ([("0".."9").to_a.sample]+[("a".."z").to_a.sample]+[("A".."Z").to_a.sample]+["!@#$%^&*".split(//).sample]+(("0".."9").to_a+("a".."z").to_a+("A".."Z").to_a+"!@#$%^&*".split(//)).sample(12)).shuffle.join'
}
alias base64decode=b64d
b64d() {
echo `echo $1 | base64 --decode`
}
function stopprocess() {
if [ $# -ne 0 ]; then
kill -9 `ps auxww | grep "$@" | grep -v grep | tr -s ' ' | cut -d' ' -f 2`
fi
}
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment