.zshrc 3.4 KB

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