Skip to content

Instantly share code, notes, and snippets.

@immanuelpotter
Last active October 16, 2019 09:50
Show Gist options
  • Save immanuelpotter/32caf9476e012082fe949bcd8f74736c to your computer and use it in GitHub Desktop.
Save immanuelpotter/32caf9476e012082fe949bcd8f74736c to your computer and use it in GitHub Desktop.
bashrc
# .bashrc
# Colorized Prompt
BLACK="\[\033[0;30m\]"
BLUE="\[\033[0;34m\]"
GREEN="\[\033[0;32m\]"
CYAN="\[\033[0;36m\]"
RED="\[\033[0;31m\]"
PURPLE="\[\033[0;35m\]"
BROWN="\[\033[0;33m\]"
LGRAY="\[\033[0;37m\]"
DGRAY="\[\033[1;30m\]"
LBLUE="\[\033[1;34m\]"
LGREEN="\[\033[1;32m\]"
LCYAN="\[\033[1;36m\]"
LRED="\[\033[1;31m\]"
LPURPLE="\[\033[1;35m\]"
YELLOW="\[\033[1;33m\]"
WHITE="\[\033[1;37m\]"
ORANGE="\[\033[01;38;5;208m\]"
NOCOLOR="\[\033[0m\]"
LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:';
export LS_COLORS
# Prompt
export PS1="${RED}\u@${ORANGE}\h:${PURPLE}\w${DGRAY}\$(parse_git_branch) \$(parse_hg_branch) ▶ ${NOCOLOR}"
echo "
SSSSSSSSSSS
________ ssssssssssssss ________
\_______\ / / \ \ / ______/
\ \ / / | | \ \ / /
\ \ / / / \ \ / /
\ \ ( ( / ) ) / /
\ \______ \ \ \____/ / / ________ / /
\__________\ \ / /____________/
" | lolcat
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
# Terminal Colors
# Bash History Options
export HISTSIZE=1000000
export HISTCONTROL='ignoreboth'
export HISTIGNORE='&:ls:[bf]g:exit'
export HISTTIMEFORMAT='%b %d %H:%M:%S: '
export REGION="eu-west-1"
shopt -s histappend
set cmdhist
export EDITOR=vim
#bind "set completion-ignore-case on"
shopt -s cdspell
shopt -s checkwinsize
if [ -x /usr/bin/dircolors ]; then
test -r $HOME/.dircolors && eval "$(dircolors -b $HOME/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
alias l='ls -alh'
alias tf='terraform'
alias lt='ls -alrth'
alias h='history |grep'
alias b='cat ~/.bashrc |grep'
alias adg='aws describe-groups'
alias vpn="sudo openvpn --config /etc/openvpn/client/${1}"
alias k="kubectl"
alias gbranch='git rev-parse --abbrev-ref HEAD'
alias svim='sudo vim'
alias rmswap='rm ~/.vim/tmp/swap/*'
alias adil='aws describe-instances'
alias adi='adi-ctl'
alias adia='adia-ctl'
# proper ctags innit
export MANPATH=$HOME/bin/ctags-root/share/man:$MANPATH
parse_git_branch(){
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
parse_hg_branch(){
hg summary 2>/dev/null | awk '$1 == "branch:"{print "["$2"]"}'
}
function adi-ctl {
adil $@ |awk -F "|" '{ print $2 " " $6 " " $9 " " $12 " " $13; }'
}
function adia-ctl {
adil $@ --region eu-west-2 |awk -F "|" '{ print $2 " " $6 " " $9 " " $12 " " $13; }'
}
function adie-ctl {
adil $@ --region eu-west-2 |awk -F "|" '{ print $2 " " $6 " " $9 " " $12 " " $13; }'
}
function gclone {
git clone ssh://git@github.com/$1
}
pretty(){
sed 's/\\n/\n/g;s/\\t/\t/g'
}
# Weather :)
function weather {
curl -s wttr.in/$1
}
findfile(){
cd $(dirname $(find / -name "$1" -type f 2>/dev/null))
}
finddir(){
cd $(dirname $(find / -name "$1" -type d 2>/dev/null))
}
linerip() {
[[ -z "$1" || -z "$2" || -z "$3" ]] && echo "Usage: linerip [start line number] [end line number] [filename]" || sed -n "$1","$2"'p;'"$(($2+1))"'q' "$3"
}
escape_me(){
sed 's/\"/\\\"/g' "$1"
}
nukehost(){
sed -i -e ${1}d ~/.ssh/known_hosts
}
context_switcher(){
k config use-context "$1"
}
amkube(){
context_switcher "eks"
}
gokube(){
context_switcher "gke"
}
azkube(){
context_switcher "aks"
}
ovim(){
/usr/local/bin/vim
}
[[ -s "$HOME/.bashrc.`uname`" ]] && source "$HOME/.bashrc.`uname`"
[[ -s "$HOME/.bashrc.netflix" ]] && source "$HOME/.bashrc.netflix"
[[ -s "$HOME/.bashrc.local" ]] && source "$HOME/.bashrc.local"
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/home/$(whoami)/google-cloud-sdk/path.bash.inc' ]; then source '/home/$(whoami)/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/home/$(whoami)/google-cloud-sdk/completion.bash.inc' ]; then source '/home/$(whoami)/google-cloud-sdk/completion.bash.inc'; fi
# go config, vault, jx
export PATH="$PATH:/opt/mssql-tools/bin"
export PATH=/home/$(whoami)/google-cloud-sdk/bin:/home/$(whoami)/google-cloud-sdk/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/mssql-tools/bin:/home/$(whoami)/.local/bin:/home/$(whoami)/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/usr/local/go/bin:/usr/local/go/bin
export GOPATH=/home/$(whoami)/go
export GOROOT=/usr/local/go
export PATH=/home/$(whoami)/google-cloud-sdk/bin:/home/$(whoami)/google-cloud-sdk/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/mssql-tools/bin:/home/potteri/.local/bin:/home/$(whoami)/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/usr/local/go/bin:/usr/local/go/bin:/home/$(whoami)/go/bin:/home/$(whoami)/go/bin
complete -C /home/$(whoami)/go/bin/vault vault
export PATH=$PATH:~/.jx/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment