.zshrc 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # If you come from bash you might have to change your $PATH.
  2. export PATH=$HOME/.bin:/usr/local/bin:$PATH
  3. export ZSH="$HOME/.oh-my-zsh"
  4. ZSH_THEME="robbyrussell"
  5. plugins=(git z fzf asdf direnv emacs yarn)
  6. source $ZSH/oh-my-zsh.sh
  7. # Example aliases
  8. alias dj="poetry run python manage.py $argv"
  9. alias sysu="systemctl --user $argv"
  10. alias fsync="find . -type f -name '*.sync-conflict*'"
  11. alias atlas="ssh atlas.local"
  12. alias pandora="ssh pandora.unbl.ink"
  13. alias bastion="ssh bastion.unbl.ink"
  14. alias pull="git pull --rebase --autostash"
  15. alias push="git push"
  16. alias asso="aws sso login --profile $argv"
  17. yayup () {
  18. mv ~/.asdf ~/.asdf.bak
  19. yay -S --noconfirm archlinux-keyring endeavouros-keyring
  20. yay -Syu --noconfirm
  21. mv ~/.asdf.bak ~/.asdf
  22. }
  23. repo_go() {
  24. asso registries-read
  25. export PRIVATE_REPO_TOKEN="$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
  26. export CODEARTIFACT_AUTH_TOKEN="$PRIVATE_REPO_TOKEN"
  27. poetry config http-basic.codeartifact aws $PRIVATE_REPO_TOKEN
  28. aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile registries-read
  29. }
  30. sush() {
  31. if [[ $1 == "sbx" ]]
  32. then
  33. asso sure-inc
  34. aws eks update-kubeconfig --name surepreme-sandbox-main-cluster --profile sure-inc
  35. fi
  36. if [[ $1 == "qa" ]]
  37. then
  38. asso np-farmers
  39. aws eks update-kubeconfig --name farmers-qa-main-cluster --profile np-farmers
  40. fi
  41. if [[ $1 == "prod" ]]
  42. then
  43. asso sure-inc
  44. echo "from platform_core.apps.core_protections.models import *" | pbcopy
  45. aws eks update-kubeconfig --name surepreme-production-main-cluster --profile sure-inc
  46. kubectl exec -it -n bastion $(kubectl get po -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- python manage.py shell
  47. fi
  48. if (( $2 ));
  49. then
  50. if [[ $2 = "-p" ]]
  51. then
  52. echo "Import command is on your clipboard"
  53. echo "from platform_core.apps.core_protections.models import *" | pbcopy
  54. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash -c "python manage.py shell"
  55. else
  56. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  57. fi
  58. else
  59. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  60. fi
  61. }
  62. alias qa="sush qa"
  63. alias sbx="sush sbx"
  64. alias prod="sush prod"
  65. prep_pg_for_sure() {
  66. psql -U sure postgres -c "CREATE USER sure SUPERUSER"
  67. psql -U sure postgres -c "CREATE USER surepremeroot SUPERUSER"
  68. psql -U sure postgres -c "CREATE USER rdsadmin SUPERUSER"
  69. }
  70. refresh_sure_db() {
  71. echo "This will likely take about 10 minutes"
  72. asso np-farmers
  73. aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump
  74. dropdb -U sure surepreme
  75. createdb -U sure surepreme
  76. psql -U sure surepreme -c "CREATE EXTENSION postgis"
  77. pg_restore -d surepreme /tmp/qa_farmers_latest.pgdump
  78. rm /tmp/qa_farmers_latest.pgdump
  79. echo "Database `surepreme` successfully restores from QA data"
  80. }
  81. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
  82. eval "$(atuin init zsh)"