Skip to content

Instantly share code, notes, and snippets.

@rowanseymour
Last active August 22, 2023 14:56
Show Gist options
  • Save rowanseymour/7668b30b3b75f54e4e415ea6c1557eea to your computer and use it in GitHub Desktop.
Save rowanseymour/7668b30b3b75f54e4e415ea6c1557eea to your computer and use it in GitHub Desktop.
# Shells in English
export LANG=en_US.UTF-8
export LC_LANG=en_US
# Customize prompt
PROMPT='%F{111}%1~%f %# '
# Add Homebrew psql and pipx to path
export PATH="/opt/homebrew/opt/libpq/bin:/Users/rowan/.local/bin:$PATH"
# Add go bin folder to path
export PATH="$PATH:$HOME/go/bin"
# I'm a simple man
export EDITOR="/usr/bin/nano"
# And I don't like typing passwords
export ANSIBLE_VAULT_PASSWORD_FILE=~/.ansible_pass
# General aliases
alias ll="ls -al"
# Git aliases
alias gs="git status"
alias ga="git add"
alias gc="git commit"
alias gk="git checkout"
alias gb="git branch"
# Shortcut function for launching rapidpro with manage.sh
rp() {
if [ $# -lt 2 ] || ! [[ $1 =~ ^(v|s|r|t)$ ]] || ! [[ $2 =~ ^(rs|t|tc|m|mm)$ ]]
then
echo "usage: rp [v|s|r|t] [rs|t|tc|m]"
echo " → v = vanilla, s = staging, r = rapidpro, t = textit"
echo " → rs = runserver, t = test, tc = test clean, m = migrate, mm = makemigrations"
return
fi
local args=""
if [ $1 = "v" ]
then
args+="-f vanilla "
elif [ $1 = "s" ]
then
args+="-f textit -d staging "
elif [ $1 = "r" ]
then
args+="-f textit -d rapidpro "
elif [ $1 = "t" ]
then
args+="-f textit -d textit "
fi
if [ $2 = "rs" ]
then
args+="runserver 0.0.0.0:8000"
elif [ $2 = "t" ]
then
args+="test --keepdb -v 2"
elif [ $2 = "tc" ]
then
args+="test -v 2"
elif [ $2 = "m" ]
then
args+="migrate"
elif [ $2 = "mm" ]
then
args+="makemigrations"
fi
cmd="./manage.sh $args ${@:3}" # run with remaining args
echo -e "\033[0;37m$cmd\033[0m"
eval "$cmd"
}
# Mailroom aliases
alias mr="go install github.com/nyaruka/mailroom/cmd/mailroom; mailroom -redis=redis://localhost:6379/15 -log-level=info"
alias cr="go install github.com/nyaruka/courier/cmd/courier; courier --db='postgres://temba@localhost/temba?sslmode=disable' -spool-dir='.' -redis=redis://localhost:6379/15 -log-level=info"
alias ix="go install github.com/nyaruka/rp-indexer/cmd/rp-indexer; rp-indexer -db='postgres://temba:temba@localhost:5432/temba?sslmode=disable'"
ssh-add --apple-load-keychain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment