Files
dotfiles/bashrc
Colin Powell 848336d3d5 Initial commit
This excempts my two emacs configurations for spacemacs and doom-emacs.

THere are still credentials in plaintext and I need to solve how to
store those in git without the credentials.
2018-12-02 12:41:17 -05:00

159 lines
5.4 KiB
Bash

#!/usr/bin/env bash
#####################
# Path to the bash it configuration
export BASH_IT="${HOME}/.bash_it"
# Lock and Load a custom theme file
# location /.bash_it/themes/
export BASH_IT_THEME='demula'
# (Advanced): Change this to the name of your remote repo if you
# cloned bash-it with a remote other than origin such as `bash-it`.
# export BASH_IT_REMOTE='bash-it'
# Your place for hosting Git repos. I use this for private repos.
export GIT_HOSTING='git@git.domain.com'
# Don't check mail when opening terminal.
unset MAILCHECK
# Change this to your console based IRC client of choice.
export IRC_CLIENT='irssi'
# Set this to false to turn off version control status checking within the prompt for all themes
export SCM_CHECK=false
# Set Xterm/screen/Tmux title with only a short hostname.
# Uncomment this (or set SHORT_HOSTNAME to something else),
# Will otherwise fall back on $HOSTNAME.
export SHORT_HOSTNAME=$(hostname -s)
# Set Xterm/screen/Tmux title with only a short username.
# Uncomment this (or set SHORT_USER to something else),
# Will otherwise fall back on $USER.
export SHORT_USER=${USER:0:8}
# Set Xterm/screen/Tmux title with shortened command and directory.
# Uncomment this to set.
#export SHORT_TERM_LINE=true
# Set vcprompt executable path for scm advance info in prompt (demula theme)
# https://github.com/djl/vcprompt
#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
# (Advanced): Uncomment this to make Bash-it reload itself automatically
# after enabling or disabling aliases, plugins, and completions.
# export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1
# Uncomment this to make Bash-it create alias reload.
# export BASH_IT_RELOAD_LEGACY=1
# Load Bash It
source "$BASH_IT"/bash_it.sh
# DONE WITH BASH_IT, setup other things
#This bashrc file requires:
#
# * direnv
# * nvm
# * rbenv
######################
command_exists () {
type "$1" &> /dev/null ;
}
if command_exists rbenv ; then
eval "$(rbenv init -)"
fi
export HUGO_BASE_DIR='~/sites/onec.me/'
export COMPOSE_API_VERSION=1.23
export TERM=screen-256color
export GTAGSLABEL=pygments
export PYENV_VERSION=3.6.6
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
# GO
export GOPATH=$HOME/.golang
export PATH="/usr/local/bin:/usr/local/sbin:$PATH:${GOPATH//://bin:}/bin:$HOME/.local/bin:$PATH"
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH="./node_modules/.bin:$PATH"
alias e='emacsclient --no-wait'
# PLAN9
export PLAN9=/usr/local/plan9 export PLAN9
export PATH=$PATH:$PLAN9/bin export PATH
# RVM
export PATH="$PATH:$HOME/.rvm/bin"
export DOCKER_HOST='unix:///var/run/docker.sock'
# Required to re-write python binary paths with pyenv
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
djsrv() { python manage.py runserver 0.0.0.0:8000; }
djcel() { celery -A summon_platform worker; }
djsh() { python manage.py shell $1; }
djshp() { python manage.py shell_plus $1; }
vr() { vault read -field=value secret/$1 | pbcopy; }
vw() { vault write secret/$1 value="$2" username="$3"; }
vrl() { vault read -field=value secret/$1 | xclip -sel clip; }
vrll() { vault read -field=value secret/$1; }
passp () { pass -c personal/$1; }
passe () { pass -c elation/$1; }
#alias checkmail="notmuch search --output=files tag:deleted | tr '\n' '\0' | xargs -0 -L 1 rm && notmuch new && mbsync -Va && notmuch new"
alias el8awslogin="eval $(aws ecr get-login --no-include-email --region us-west-1)"
# Elixir version manager
test -s "$HOME/.kiex/scripts/kiex" && source "$HOME/.kiex/scripts/kiex"
# Vault things
export VAULT_ADDR='https://vault.onec.me:8200'
alias vault-token="curl https://www.onec.me/info/vault.txt | keybase pgp decrypt -m"
alias view-sealant="curl https://www.onec.me/info/sealant.txt" # | keybase pgp decrypt -m"
gen-new-token() { keybase pgp encrypt -m "$(vault token create -policy=admins -display-name="Colin Powell" -field token)" secstate; }
alias wanip='dig +short myip.opendns.com @resolver1.opendns.com'
alias sshome='ssh $(curl -L www.onec.me/wanip)'
alias rchunk='brew services restart chunkwm'
# Maximum number of history lines in memory
export HISTSIZE=50000
# Maximum number of history lines on disk
export HISTFILESIZE=50000
# Ignore duplicate lines
export HISTCONTROL=ignoredups:erasedups:ignorespace
# When the shell exits, append to the history file
# instead of overwriting it
shopt -s histappend
# After each command, append to the history file
# and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# Elation specific
el8sh() { pushd ~/devel/elationemr/hippo && docker-compose exec hippo /bin/bash -c 'cd /opt/hippo; exec "/bin/bash"'; popd; }
el8build() { pushd ~/devel/elationemr/hippo && docker-compose exec webpack make clean && docker-compose exec webpack nvm use default && make deps; popd; }
el8start() { pushd ~/devel/elationemr/hippo && docker-compose up -d; popd; }
el8stop() { pushd ~/devel/elationemr/hippo && docker-compose down; popd; }
el8logs() { pushd ~/devel/elationemr/hippo && docker-compose logs --tail 20 -f hippo; popd; }
el8clogs() { pushd ~/devel/elationemr/hippo && docker-compose logs --tail 20 -f celery; popd; }
alias evpn="sudo openvpn --config ~/Nextcloud/elation.ovpn"
alias pvpn="sudo openvpn --config ~/Nextcloud/protonvpn.ovpn"