.zshrc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 atlas="ssh atlas.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@atlas.local:/tank/books/ ~/.calibre/"
  21. alias bookpush="rsync --delete -avzichP ~/.calibre/ root@atlas.local:/tank/books/"
  22. newemail () {
  23. 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
  24. }
  25. yayup () {
  26. mv ~/.asdf ~/.asdf.bak
  27. yay -S --noconfirm archlinux-keyring endeavouros-keyring
  28. yay -Syu --noconfirm
  29. mv ~/.asdf.bak ~/.asdf
  30. }
  31. repo_go() {
  32. asso registries-read
  33. export PRIVATE_REPO_TOKEN="$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
  34. export CODEARTIFACT_AUTH_TOKEN="$PRIVATE_REPO_TOKEN"
  35. poetry config http-basic.codeartifact aws $PRIVATE_REPO_TOKEN
  36. aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile registries-read
  37. }
  38. sush() {
  39. if [[ $1 == "sbx" ]]
  40. then
  41. asso sure-inc
  42. aws eks update-kubeconfig --name surepreme-sandbox-main-cluster --profile sure-inc
  43. fi
  44. if [[ $1 == "qa" ]]
  45. then
  46. asso np-farmers
  47. aws eks update-kubeconfig --name farmers-qa-main-cluster --profile np-farmers
  48. fi
  49. if [[ $1 == "prod" ]]
  50. then
  51. asso sure-inc
  52. echo "from platform_core.apps.core_protections.models import *" | pbcopy
  53. aws eks update-kubeconfig --name surepreme-production-main-cluster --profile sure-inc
  54. kubectl exec -it -n bastion $(kubectl get po -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- python manage.py shell
  55. fi
  56. if (( $2 ));
  57. then
  58. if [[ $2 = "-p" ]]
  59. then
  60. echo "Import command is on your clipboard"
  61. echo "from platform_core.apps.core_protections.models import *" | pbcopy
  62. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash -c "python manage.py shell"
  63. else
  64. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  65. fi
  66. else
  67. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  68. fi
  69. }
  70. alias qa="sush qa"
  71. alias sbx="sush sbx"
  72. alias prod="sush prod"
  73. prep_pg_for_sure() {
  74. psql -U sure postgres -c "CREATE USER sure SUPERUSER"
  75. psql -U sure postgres -c "CREATE USER surepremeroot SUPERUSER"
  76. psql -U sure postgres -c "CREATE USER rdsadmin SUPERUSER"
  77. }
  78. refresh_sure_db() {
  79. echo "This will likely take about 10 minutes"
  80. asso np-farmers
  81. aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump
  82. dropdb -U sure surepreme
  83. createdb -U sure surepreme
  84. psql -U sure surepreme -c "CREATE EXTENSION postgis"
  85. pg_restore -d surepreme /tmp/qa_farmers_latest.pgdump
  86. rm /tmp/qa_farmers_latest.pgdump
  87. echo "Database `surepreme` successfully restores from QA data"
  88. }
  89. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
  90. eval "$(atuin init zsh)"