.bashrc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/usr/bin/env bash
  2. #####################
  3. # Path to the bash it configuration
  4. export BASH_IT="${HOME}/.bash_it"
  5. # Lock and Load a custom theme file
  6. # location /.bash_it/themes/
  7. export BASH_IT_THEME='demula'
  8. # (Advanced): Change this to the name of your remote repo if you
  9. # cloned bash-it with a remote other than origin such as `bash-it`.
  10. # export BASH_IT_REMOTE='bash-it'
  11. # Your place for hosting Git repos. I use this for private repos.
  12. export GIT_HOSTING='git@git.domain.com'
  13. # Don't check mail when opening terminal.
  14. unset MAILCHECK
  15. # Change this to your console based IRC client of choice.
  16. export IRC_CLIENT='irssi'
  17. # Set this to false to turn off version control status checking within the prompt for all themes
  18. export SCM_CHECK=false
  19. # Set Xterm/screen/Tmux title with only a short hostname.
  20. # Uncomment this (or set SHORT_HOSTNAME to something else),
  21. # Will otherwise fall back on $HOSTNAME.
  22. export SHORT_HOSTNAME=$(hostname -s)
  23. # Set Xterm/screen/Tmux title with only a short username.
  24. # Uncomment this (or set SHORT_USER to something else),
  25. # Will otherwise fall back on $USER.
  26. export SHORT_USER=${USER:0:8}
  27. # Set Xterm/screen/Tmux title with shortened command and directory.
  28. # Uncomment this to set.
  29. #export SHORT_TERM_LINE=true
  30. # Set vcprompt executable path for scm advance info in prompt (demula theme)
  31. # https://github.com/djl/vcprompt
  32. #export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
  33. # (Advanced): Uncomment this to make Bash-it reload itself automatically
  34. # after enabling or disabling aliases, plugins, and completions.
  35. # export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1
  36. # Uncomment this to make Bash-it create alias reload.
  37. # export BASH_IT_RELOAD_LEGACY=1
  38. # Load Bash It
  39. source "$BASH_IT"/bash_it.sh
  40. # DONE WITH BASH_IT, setup other things
  41. #This bashrc file requires:
  42. #
  43. # * direnv
  44. # * nvm
  45. # * rbenv
  46. ######################
  47. command_exists () {
  48. type "$1" &> /dev/null ;
  49. }
  50. if command_exists rbenv ; then
  51. eval "$(rbenv init -)"
  52. fi
  53. export HUGO_BASE_DIR='~/sites/onec.me/'
  54. export COMPOSE_API_VERSION=1.23
  55. export TERM=screen-256color
  56. export GTAGSLABEL=pygments
  57. export PYENV_VERSION=3.6.6
  58. export PYENV_ROOT="$HOME/.pyenv"
  59. export PATH="$PYENV_ROOT/bin:$PATH"
  60. # GO
  61. export GOPATH=$HOME/.golang
  62. export PATH="/usr/local/bin:/usr/local/sbin:$PATH:${GOPATH//://bin:}/bin:$HOME/.local/bin:$PATH"
  63. # NVM
  64. export NVM_DIR="$HOME/.nvm"
  65. [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
  66. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
  67. export PATH="./node_modules/.bin:$PATH"
  68. alias e='emacsclient --no-wait'
  69. # PLAN9
  70. export PLAN9=/usr/local/plan9 export PLAN9
  71. export PATH=$PATH:$PLAN9/bin export PATH
  72. # RVM
  73. export PATH="$PATH:$HOME/.rvm/bin"
  74. export DOCKER_HOST='unix:///var/run/docker.sock'
  75. # Required to re-write python binary paths with pyenv
  76. if command -v pyenv 1>/dev/null 2>&1; then
  77. eval "$(pyenv init -)"
  78. fi
  79. djsrv() { python manage.py runserver 0.0.0.0:8000; }
  80. djcel() { celery -A summon_platform worker; }
  81. djsh() { python manage.py shell $1; }
  82. djshp() { python manage.py shell_plus $1; }
  83. vr() { vault read -field=value secret/$1 | pbcopy; }
  84. vw() { vault write secret/$1 value="$2" username="$3"; }
  85. vrl() { vault read -field=value secret/$1 | xclip -sel clip; }
  86. vrll() { vault read -field=value secret/$1; }
  87. passp () { pass -c personal/$1; }
  88. passe () { pass -c elation/$1; }
  89. #alias checkmail="notmuch search --output=files tag:deleted | tr '\n' '\0' | xargs -0 -L 1 rm && notmuch new && mbsync -Va && notmuch new"
  90. #alias el8awslogin="eval $(aws ecr get-login --no-include-email --region us-west-1)"
  91. # Elixir version manager
  92. test -s "$HOME/.kiex/scripts/kiex" && source "$HOME/.kiex/scripts/kiex"
  93. # Vault things
  94. export VAULT_ADDR='https://vault.onec.me:8200'
  95. alias vault-token="curl https://www.onec.me/info/vault.txt | keybase pgp decrypt -m"
  96. alias view-sealant="curl https://www.onec.me/info/sealant.txt" # | keybase pgp decrypt -m"
  97. gen-new-token() { keybase pgp encrypt -m "$(vault token create -policy=admins -display-name="Colin Powell" -field token)" secstate; }
  98. alias wanip='dig +short myip.opendns.com @resolver1.opendns.com'
  99. alias sshome='ssh $(curl -L www.onec.me/wanip)'
  100. alias rchunk='brew services restart chunkwm'
  101. # Maximum number of history lines in memory
  102. export HISTSIZE=50000
  103. # Maximum number of history lines on disk
  104. export HISTFILESIZE=50000
  105. # Ignore duplicate lines
  106. export HISTCONTROL=ignoredups:erasedups:ignorespace
  107. # When the shell exits, append to the history file
  108. # instead of overwriting it
  109. shopt -s histappend
  110. # After each command, append to the history file
  111. # and reread it
  112. export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
  113. # Elation specific
  114. el8sh() { pushd ~/devel/elationemr/hippo && docker-compose exec hippo /bin/bash -c 'cd /opt/hippo; exec "/bin/bash"'; popd; }
  115. el8build() { pushd ~/devel/elationemr/hippo && docker-compose exec webpack make clean && docker-compose exec webpack nvm use default && make deps; popd; }
  116. el8start() { pushd ~/devel/elationemr/hippo && docker-compose up -d; popd; }
  117. el8stop() { pushd ~/devel/elationemr/hippo && docker-compose down; popd; }
  118. el8logs() { pushd ~/devel/elationemr/hippo && docker-compose logs --tail 20 -f hippo; popd; }
  119. el8clogs() { pushd ~/devel/elationemr/hippo && docker-compose logs --tail 20 -f celery; popd; }
  120. alias evpn="sudo openvpn --config ~/Nextcloud/elation.ovpn"
  121. alias pvpn="sudo openvpn --config ~/Nextcloud/protonvpn.ovpn"
  122. [ -f ~/.fzf.bash ] && source ~/.fzf.bash