Files
dotfiles/zsh/.zshrc

101 lines
3.4 KiB
Bash
Raw Normal View History

2024-01-11 14:15:49 -05:00
# If you come from bash you might have to change your $PATH.
export GOPATH="$HOME/.go"
export PATH=$HOME/.bin:$HOME/var/bin:/usr/local/bin:$PATH:$HOME/.go/bin
2024-01-11 14:15:49 -05:00
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
2024-01-11 14:20:39 -05:00
plugins=(git z fzf asdf direnv emacs yarn)
2024-01-11 14:15:49 -05:00
source $ZSH/oh-my-zsh.sh
# Example aliases
alias dj="poetry run python manage.py $argv"
alias sysu="systemctl --user $argv"
2024-01-11 16:48:50 -05:00
alias fsync="find . -type f -name '*.sync-conflict*'"
2024-01-23 15:31:15 -05:00
alias vi="vim $argv"
alias dus="du -sh * | sort -h"
2024-03-08 14:18:55 -05:00
alias rhea="ssh rhea.local"
2024-01-11 16:48:50 -05:00
alias pandora="ssh pandora.unbl.ink"
alias bastion="ssh bastion.unbl.ink"
2024-01-13 13:13:02 -05:00
alias pull="git pull --rebase --autostash"
2024-01-13 13:15:07 -05:00
alias push="git push"
2024-01-13 13:13:02 -05:00
alias asso="aws sso login --profile $argv"
2024-03-08 14:18:55 -05:00
alias bookpull="rsync --delete -avzichP root@rhea.local:/tank/books/ ~/.calibre/"
alias bookpush="rsync --delete -avzichP ~/.calibre/ root@rhea.local:/tank/books/"
alias chglg="git add ./changelog/ && git commit -m 'Add changelog' && git push"
2024-01-13 13:13:02 -05:00
2024-01-16 18:55:52 -05:00
newemail () {
curl -X POST --user colin@unbl.ink:$(pass personal/colin@unbl.ink | head -n 1) -d "address=$1@unbl.ink" -d "forwards_to=colin@unbl.ink" https://box.unbl.ink/admin/mail/aliases/add
}
2024-01-15 10:06:27 -05:00
yayup () {
mv ~/.asdf ~/.asdf.bak
yay -S --noconfirm archlinux-keyring endeavouros-keyring
yay -Syu --noconfirm
mv ~/.asdf.bak ~/.asdf
}
repo_go() {
asso registries-read
2024-01-13 13:13:02 -05:00
export PRIVATE_REPO_TOKEN="$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
export CODEARTIFACT_AUTH_TOKEN="$PRIVATE_REPO_TOKEN"
poetry config http-basic.codeartifact aws $PRIVATE_REPO_TOKEN
aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile registries-read
}
2024-01-15 10:06:27 -05:00
sush() {
2024-01-13 13:13:02 -05:00
if [[ $1 == "sbx" ]]
then
2024-01-15 10:06:27 -05:00
asso sure-inc
aws eks update-kubeconfig --name surepreme-sandbox-k8s-use1 --profile sure-inc
kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
2024-01-13 13:13:02 -05:00
fi
if [[ $1 == "qa" ]]
then
2024-01-15 10:06:27 -05:00
asso np-farmers
aws eks update-kubeconfig --name farmers-qa-k8s-use1 --profile np-farmers
kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
2024-01-15 10:06:27 -05:00
fi
2024-01-13 13:13:02 -05:00
2024-01-15 10:06:27 -05:00
if [[ $1 == "prod" ]]
2024-01-13 13:13:02 -05:00
then
2024-01-15 10:06:27 -05:00
asso sure-inc
aws eks update-kubeconfig --name surepreme-production-k8s-use1 --profile sure-inc
kubectl exec -it -n bastion $(kubectl get pod -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- bash
2024-01-13 13:13:02 -05:00
fi
}
2024-01-11 14:20:39 -05:00
2024-01-15 10:06:27 -05:00
alias qa="sush qa"
alias sbx="sush sbx"
alias prod="sush prod"
prep_pg_for_sure() {
psql -U sure postgres -c "CREATE USER sure SUPERUSER"
psql -U sure postgres -c "CREATE USER surepremeroot SUPERUSER"
psql -U sure postgres -c "CREATE USER rdsadmin SUPERUSER"
}
refresh_sure_db() {
echo "This will likely take about 10 minutes"
asso np-farmers
aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump
dropdb -U sure surepreme --force
2024-01-15 10:06:27 -05:00
createdb -U sure surepreme
psql -U sure surepreme -c "CREATE EXTENSION postgis"
pg_restore -d surepreme /tmp/qa_farmers_latest.pgdump
rm /tmp/qa_farmers_latest.pgdump
echo "Database `surepreme` successfully restores from QA data"
}
2024-01-11 14:20:39 -05:00
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
2024-01-13 13:13:02 -05:00
for f in ~/.dotfiles.sure/bash/*.sh; do source $f; done
for f in ~/.dotfiles.sure/direnv/*.sh; do source $f; done
2024-01-13 13:13:02 -05:00
eval "$(atuin init zsh)"
2024-03-08 14:18:55 -05:00
export AWS_PROFILE=sure-inc