.zshrc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. # See ~/.aliases for the various aliases seen in here
  9. source "$HOME/.aliases"
  10. newemail () {
  11. 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
  12. }
  13. yayup () {
  14. mv ~/.asdf ~/.asdf.bak
  15. yay -S --noconfirm archlinux-keyring endeavouros-keyring
  16. yay -Syu --noconfirm
  17. mv ~/.asdf.bak ~/.asdf
  18. }
  19. repo_go() {
  20. asso registries-read
  21. export PRIVATE_REPO_TOKEN="$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
  22. export CODEARTIFACT_AUTH_TOKEN="$PRIVATE_REPO_TOKEN"
  23. poetry config http-basic.codeartifact aws $PRIVATE_REPO_TOKEN
  24. aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile registries-read
  25. }
  26. ghlogin() {
  27. npm login --registry=https://npm.pkg.github.com --scope=@sureapp
  28. }
  29. poetry-install() {
  30. repo_go
  31. poetry install
  32. }
  33. sush() {
  34. if [[ $1 == "sbx" ]]
  35. then
  36. asso sure-inc
  37. aeks sure-inc
  38. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  39. fi
  40. if [[ $1 == "qa" ]]
  41. then
  42. aeks np-farmers
  43. kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
  44. fi
  45. if [[ $1 == "prod" ]]
  46. then
  47. asso sure-inc
  48. aws eks update-kubeconfig --name surepreme-production-k8s-use1 --profile sure-inc
  49. kubectl exec -it -n bastion $(kubectl get pod -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- bash
  50. fi
  51. }
  52. roc() {
  53. asso np-farmers
  54. aeks np-farmers
  55. kubectl port-forward $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) 5001:8080
  56. }
  57. portforward() {
  58. asso np-farmers
  59. aeks np-farmers
  60. kubectl port-forward $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) $1:8080
  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 --force
  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. for f in ~/.dotfiles.sure/bash/*.sh; do source $f; done
  83. for f in ~/.dotfiles.sure/direnv/*.sh; do source $f; done
  84. eval "$(atuin init zsh)"
  85. export AWS_PROFILE=sure-inc
  86. local hostname="%{$fg_bold[white]%}%m"
  87. PROMPT="${hostname} ${PROMPT}"
  88. export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"