Skip to content

Instantly share code, notes, and snippets.

@jayers99
Created April 17, 2019 21:48
Show Gist options
  • Save jayers99/7dc1e670a93c9c39c24b749294eb23f7 to your computer and use it in GitHub Desktop.
Save jayers99/7dc1e670a93c9c39c24b749294eb23f7 to your computer and use it in GitHub Desktop.
work bashrc
# .bashrc
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export PATH="${HOME}/scripts:${PATH}"
# my prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[00;33m\]\u@\h\[\033[0m\]:\[\033[00;34m\]\w\[\033[00;32m\]\$(parse_git_branch)\[\033[00;0m\]\n\[\033[00;33m\]> $\[\033[00;0m\] "
alias la='ls -la'
alias lt='ls -lt'
alias md='mkdir'
alias cl='clear'
alias hist='history 60'
alias hg='history | grep '
alias hcds='history | grep -i -E '\''^\s*[0-9]+\s+cd\s+'\'' | grep -iv -E '\''^\s[0-9]+\s+cd\s+\.\.'\'' | grep -iv -E '\''^\s[0-9]+\s+cd\s+\-'\'' | sort -r | awk '\''!seen[$3] {print $0} {++seen[$3]}'\'' | sort'
alias hcdcode='history | grep -i -E '\''^\s[0-9]+\s+cd\s+\~/code'\'' | sort -r | awk '\''!seen[$3] {print $0} {++seen[$3]}'\'' | sort'
alias hgits='history | grep git'
alias setaws='setproxy; export AWS_PROFILE=dev'
alias tfvargrep='grep -irn --include \*.tfvars --exclude-dir=.terraform --exclude-dir=.git '
alias tfgrep='grep -irnP --include \*.tf --exclude-dir=.terraform --exclude-dir=.git '
alias tfpgrep='grep -Pirn --include \*.tf --exclude-dir=.terraform --exclude-dir=.git '
alias tfplan='. ~/scripts/tfplan.sh'
alias rgrep='rgrep.sh'
alias terrafrom='terraform'
alias tf='. ~/scripts/tf.sh'
snipit() {
if [ -z $1 ]; then
snip_file='snippets'
else
snip_file=$1
fi
fc -ln -1 | sed '1s/^[[:space:]]*//' >> $snip_file
tail -n 1 $snip_file
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment