.zshrc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # If you come from bash you might have to change your $PATH.
  2. export GOPATH="$HOME/.go"
  3. export PATH=$HOME/.bin:$HOME/var/bin:/usr/local/bin:$PATH:$HOME/.go/bin
  4. export ZSH="$HOME/.oh-my-zsh"
  5. ZSH_THEME="robbyrussell"
  6. plugins=(git z fzf asdf direnv emacs yarn)
  7. source $ZSH/oh-my-zsh.sh
  8. # Example aliases
  9. alias dj="poetry run python manage.py $argv"
  10. alias sysu="systemctl --user $argv"
  11. alias fsync="find . -type f -name '*.sync-conflict*'"
  12. alias vi="vim $argv"
  13. alias dus="du -sh * | sort -h"
  14. alias rhea="ssh rhea.local"
  15. alias pandora="ssh pandora.unbl.ink"
  16. alias bastion="ssh bastion.unbl.ink"
  17. alias pull="git pull --rebase --autostash"
  18. alias push="git push"
  19. alias asso="aws sso login --profile $argv"
  20. alias bookpull="rsync --delete -avzichP root@rhea.local:/tank/books/ ~/.calibre/"
  21. alias bookpush="rsync --delete -avzichP ~/.calibre/ root@rhea.local:/tank/books/"
  22. alias chglg="git add ./changelog/ && git commit -m 'Add changelog' && git push"
  23. newemail () {
  24. 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
  25. }
  26. yayup () {
  27. mv ~/.asdf ~/.asdf.bak
  28. yay -S --noconfirm archlinux-keyring endeavouros-keyring
  29. yay -Syu --noconfirm
  30. mv ~/.asdf.bak ~/.asdf
  31. }
  32. repo_go() {
  33. asso registries-read
  34. export PRIVATE_REPO_TOKEN="$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
  35. export CODEARTIFACT_AUTH_TOKEN="$PRIVATE_REPO_TOKEN"
  36. poetry config http-basic.codeartifact aws $PRIVATE_REPO_TOKEN
  37. aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile registries-read
  38. }
  39. ghlogin() {
  40. npm login --registry=https://npm.pkg.github.com --scope=@sureapp
  41. }
  42. poetry-install() {
  43. repo_go
  44. poetry install
  45. }
  46. sush() {
  47. if [[ $1 == "sbx" ]]
  48. then
  49. asso sure-inc
  50. aws eks update-kubeconfig --name surepreme-sandbox-k8s-use1 --profile sure-inc
  51. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  52. fi
  53. if [[ $1 == "qa" ]]
  54. then
  55. asso np-farmers
  56. aws eks update-kubeconfig --name farmers-qa-k8s-use1 --profile np-farmers
  57. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  58. fi
  59. if [[ $1 == "prod" ]]
  60. then
  61. asso sure-inc
  62. aws eks update-kubeconfig --name surepreme-production-k8s-use1 --profile sure-inc
  63. kubectl exec -it -n bastion $(kubectl get pod -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- bash
  64. fi
  65. }
  66. alias qa="sush qa"
  67. alias sbx="sush sbx"
  68. alias prod="sush prod"
  69. prep_pg_for_sure() {
  70. psql -U sure postgres -c "CREATE USER sure SUPERUSER"
  71. psql -U sure postgres -c "CREATE USER surepremeroot SUPERUSER"
  72. psql -U sure postgres -c "CREATE USER rdsadmin SUPERUSER"
  73. }
  74. refresh_sure_db() {
  75. echo "This will likely take about 10 minutes"
  76. asso np-farmers
  77. aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump
  78. dropdb -U sure surepreme --force
  79. createdb -U sure surepreme
  80. psql -U sure surepreme -c "CREATE EXTENSION postgis"
  81. pg_restore -d surepreme /tmp/qa_farmers_latest.pgdump
  82. rm /tmp/qa_farmers_latest.pgdump
  83. echo "Database `surepreme` successfully restores from QA data"
  84. }
  85. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
  86. for f in ~/.dotfiles.sure/bash/*.sh; do source $f; done
  87. for f in ~/.dotfiles.sure/direnv/*.sh; do source $f; done
  88. eval "$(atuin init zsh)"
  89. export AWS_PROFILE=sure-inc
  90. local hostname="%{$fg_bold[white]%}%m"
  91. PROMPT="${hostname} ${PROMPT}"