.zshrc 3.3 KB

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