.zshrc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. poetry-install() {
  40. repo_go
  41. poetry install
  42. }
  43. sush() {
  44. if [[ $1 == "sbx" ]]
  45. then
  46. asso sure-inc
  47. aws eks update-kubeconfig --name surepreme-sandbox-k8s-use1 --profile sure-inc
  48. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  49. fi
  50. if [[ $1 == "qa" ]]
  51. then
  52. asso np-farmers
  53. aws eks update-kubeconfig --name farmers-qa-k8s-use1 --profile np-farmers
  54. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  55. fi
  56. if [[ $1 == "prod" ]]
  57. then
  58. asso sure-inc
  59. aws eks update-kubeconfig --name surepreme-production-k8s-use1 --profile sure-inc
  60. kubectl exec -it -n bastion $(kubectl get pod -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- bash
  61. fi
  62. }
  63. alias qa="sush qa"
  64. alias sbx="sush sbx"
  65. alias prod="sush prod"
  66. prep_pg_for_sure() {
  67. psql -U sure postgres -c "CREATE USER sure SUPERUSER"
  68. psql -U sure postgres -c "CREATE USER surepremeroot SUPERUSER"
  69. psql -U sure postgres -c "CREATE USER rdsadmin SUPERUSER"
  70. }
  71. refresh_sure_db() {
  72. echo "This will likely take about 10 minutes"
  73. asso np-farmers
  74. aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump
  75. dropdb -U sure surepreme --force
  76. createdb -U sure surepreme
  77. psql -U sure surepreme -c "CREATE EXTENSION postgis"
  78. pg_restore -d surepreme /tmp/qa_farmers_latest.pgdump
  79. rm /tmp/qa_farmers_latest.pgdump
  80. echo "Database `surepreme` successfully restores from QA data"
  81. }
  82. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
  83. for f in ~/.dotfiles.sure/bash/*.sh; do source $f; done
  84. for f in ~/.dotfiles.sure/direnv/*.sh; do source $f; done
  85. eval "$(atuin init zsh)"
  86. export AWS_PROFILE=sure-inc
  87. local hostname="%{$fg_bold[white]%}%m"
  88. PROMPT="${hostname} ${PROMPT}"