Skip to content

Instantly share code, notes, and snippets.

@sjas
Last active March 25, 2019 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjas/d1411bf45a337c0288558b5424b80bb7 to your computer and use it in GitHub Desktop.
Save sjas/d1411bf45a337c0288558b5424b80bb7 to your computer and use it in GitHub Desktop.
###################################################################################################################
# 0x00 - basics
###################################################################################################################
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
export PROMPT_COMMAND=echo
export PS0='\n'
export PS1='$( i=$?; if [ $i -eq 0 ]; then echo \\\[\e[32\;1m\\\]$i; else echo \\\[\e[31\;1m\\\]$i; fi )\[\e[0m\] \u@\h \[\e[33;1m\]\t\[\e[0m\] \w$(if git status 2>/dev/null | grep -q "nothing to commit"; then echo \\\[\e[32m\\\]; else if git status 2>/dev/null | grep -qi -e "^Changes not staged for commit" -e "^Untracked files:"; then echo \\\[\e[31m\\\]; else if git status 2>/dev/null | grep -q "to be committed"; then echo \\\[\e[36m\\\]; else echo \\\[\e[35\;1m\\\]; fi; fi; fi)$(__git_ps1)\[\e[0m\] \[\e[37;1m\]\$\[\e[m\]\[\e[36;1m\]$SHLVL \[\e[m\]\[\e[37;1m\]h\[\e[m\]\[\e[36;1m\]\! \[\e[m\]\[\e[37;1m\]c\[\e[m\]\[\e[36;1m\]\# \n\[\e[m\]'
alias eb='vim ~/.bashrc; . ~/.bashrc; echo [+] .bashrc reloaded'
alias reb=". ~/.bashrc; echo [+] .bashrc reloaded"
export EDITOR="vim"
export VISUAL="vim"
export PAGER="less"
export LESS=' -R '
export LANGUAGE="en_US:en"
shopt -s checkwinsize
shopt -s dotglob
LS_OPT1='-h --color --time-style=long-iso'
LS_OPT2='-is'
#LS_OPT2=''
#files
alias ls="ls $LS_OPT1"
alias l="ls $LS_OPT1 -l $LS_OPT2"
alias ll="ls $LS_OPT1 -l $LS_OPT2 -A"
alias lt="ls $LS_OPT1 -l $LS_OPT2 -Atr"
alias lS="ls $LS_OPT1 -l $LS_OPT2 -ASr"
alias lr="find | sort | cut -c 3-" ## so no additional package is needed
#directories
alias d="ls $LS_OPT1 -l -F | grep ^d"
alias dl="ls $LS_OPT1 -l -AF | grep ^d"
alias ..="cd .."
alias mkcd="pushd $(mktemp -d)"
alias o="popd"
alias p="pushd"
alias v="vim"
alias cf='tail -n +1 * | grep --color -e $ -e ^==.\*'
###################################################################################################################
# 0x01 - kubernetes
###################################################################################################################
alias d=docker
complete -F _docker d
alias mk=minikube
source <(kubectl completion bash)
alias k=kubectl
complete -F __start_kubectl k
alias kg="for i in \$(kubectl api-resources | awk 'NR>1{print \$1}'); do echo; echo \$'\e[33;1m'\$i\$'\e[0m'; kubectl get \$i; done"
alias kgy="for i in \$(kubectl api-resources | awk 'NR>1{print \$1}'); do echo; echo \$'\e[33;1m'\$i\$'\e[0m'; kubectl get \$i -o yaml; done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment