.zshrc 3.2 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. eval "$(aws configure export-credentials --profile np-farmers --format env)"
  8. source $ZSH/oh-my-zsh.sh
  9. # See ~/.aliases for the various aliases seen in here
  10. source "$HOME/.aliases"
  11. newemail () {
  12. 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
  13. }
  14. yayup () {
  15. mv ~/.asdf ~/.asdf.bak
  16. yay -S --noconfirm archlinux-keyring endeavouros-keyring
  17. yay -Syu --noconfirm
  18. mv ~/.asdf.bak ~/.asdf
  19. }
  20. repo_go() {
  21. asso registries-read
  22. export PRIVATE_REPO_TOKEN="$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
  23. export CODEARTIFACT_AUTH_TOKEN="$PRIVATE_REPO_TOKEN"
  24. poetry config http-basic.codeartifact aws $PRIVATE_REPO_TOKEN
  25. aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile registries-read
  26. }
  27. ghlogin() {
  28. npm login --registry=https://npm.pkg.github.com --scope=@sureapp
  29. }
  30. poetry-install() {
  31. repo_go
  32. poetry install
  33. }
  34. sush() {
  35. if [[ $1 == "sbx" ]]
  36. then
  37. asso sure-inc
  38. aws eks update-kubeconfig --name surepreme-sandbox-k8s-use1 --profile $argv
  39. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  40. fi
  41. if [[ $1 == "qa" ]]
  42. then
  43. qaeks np-farmers
  44. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  45. fi
  46. if [[ $1 == "prod" ]]
  47. then
  48. asso sure-inc
  49. aws eks update-kubeconfig --name surepreme-production-k8s-use1 --profile sure-inc
  50. kubectl exec -it -n bastion $(kubectl get pod -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- bash
  51. fi
  52. }
  53. portforward() {
  54. asso np-farmers
  55. qaeks np-farmers
  56. kubectl port-forward $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) $1:8080
  57. }
  58. alias qa="sush qa"
  59. alias sbx="sush sbx"
  60. alias prod="sush prod"
  61. prep_pg_for_sure() {
  62. psql -U sure postgres -c "CREATE USER sure SUPERUSER"
  63. psql -U sure postgres -c "CREATE USER surepremeroot SUPERUSER"
  64. psql -U sure postgres -c "CREATE USER rdsadmin SUPERUSER"
  65. }
  66. refresh_sure_db() {
  67. echo "This will likely take about 10 minutes"
  68. #asso np-farmers
  69. #aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump
  70. dropdb -U sure surepreme --force
  71. createdb -U sure surepreme
  72. psql -U sure surepreme -c "CREATE EXTENSION postgis"
  73. pg_restore -d surepreme /tmp/qa_farmers_latest.pgdump
  74. #rm /tmp/qa_farmers_latest.pgdump
  75. echo "Database `surepreme` successfully restores from QA data"
  76. }
  77. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
  78. for f in ~/.dotfiles.sure/bash/*.sh; do source $f; done
  79. for f in ~/.dotfiles.sure/direnv/*.sh; do source $f; done
  80. eval "$(atuin init zsh)"
  81. export AWS_PROFILE=sure-inc
  82. local hostname="%{$fg_bold[white]%}%m"
  83. PROMPT="${hostname} ${PROMPT}"
  84. export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"