Created
October 28, 2021 21:43
-
-
Save alchen99/8f2e22fa5702ba656dd5bd7bf951b35a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc on Mac - requires several GNU utlities to be installed to work | |
# Silence Bash Deprecation warning | |
export BASH_SILENCE_DEPRECATION_WARNING=1 | |
# User specific aliases and functions | |
# set TERM to 256 color | |
export TERM=xterm-256color | |
# set up LS_COLORS | |
export LS_COLORS='rs=0:di=01;36:ln=01;93: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=30;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=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:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=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:*.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:' | |
# set up timezone | |
export TZ=US/Pacific | |
# don't put duplicate lines in the history. See bash(1) for more options | |
export HISTCONTROL=ignoredups | |
# ... and ignore same sucessive entries. | |
export HISTCONTROL=ignoreboth | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# set up vi | |
if [ -f /usr/bin/vim ]; then alias vi='/usr/bin/vim'; fi | |
export EDITOR=vi | |
set -o vi | |
if [ -f /usr/bin/vimdiff ]; then alias vimdiff='/usr/bin/vimdiff -O '; fi | |
# set up screen | |
if [ -f /usr/bin/screen ] | |
then | |
alias screendr='/usr/bin/screen -DR' | |
else | |
alias screendr='$HOME/opt/bin/screen -DR' | |
fi | |
# set prompt | |
export PS1='\u@\h \w > ' | |
#--------------------------- | |
# Set up version control | |
#--------------------------- | |
# set up Git Info | |
export GIT_AUTHOR_NAME="CHANGE_ME" | |
export GIT_AUTHOR_EMAIL="CHANGE_ME" | |
export GIT_COMMITTER_NAME="CHANGE_ME" | |
export GIT_COMMITTER_EMAIL="CHANGE_ME" | |
export HOMEBREW_GITHUB_API_TOKEN="CHANGE_ME" | |
# set up bash and git completion | |
export PATH=$HOME/bin:/usr/local/opt/coreutils/libexec/gnubin:$PATH:/usr/local/bin:/usr/local/sbin | |
if [[ -f $(brew --prefix)/etc/bash_completion ]]; then . $(brew --prefix)/etc/bash_completion; fi | |
# set up for Go development | |
export GOPATH="${HOME}/.go" | |
if [[ ! -d ${GOPATH} ]]; then mkdir -p "${GOPATH}"; fi | |
if [[ ! -d ${GOPATH}/src/github.com ]]; then mkdir -p "${GOPATH}/src/github.com"; fi | |
export GOROOT="$(brew --prefix golang)/libexec" | |
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin" | |
export PATH=$PATH:/usr/local/opt/go/libexec/bin | |
# set up JAVA_HOME and java | |
alias jo11='export JAVA_HOME=`/usr/libexec/java_home -v 11`; export PATH=$JAVA_HOME/bin:$PATH; java -version' | |
alias jo12='export JAVA_HOME=`/usr/libexec/java_home -v 12`; export PATH=$JAVA_HOME/bin:$PATH; java -version' | |
# set up other PATHs | |
export PATH=$HOME/opt/bin:$(brew --prefix coreutils)/libexec/gnubin:$(brew --prefix gnu-getopt)/bin:$PATH | |
export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH" | |
# to set up MANPATH see http://www.skepticism.us/2015/10/mac-os-x-man-command-ignores-manpath-which-sucks-for-homebrew-installed-commands/ | |
# For MAC ONLY | |
# Set to GNU version of some common commands | |
if [[ -f /usr/local/bin/gsed ]]; then | |
alias sed='/usr/local/bin/gsed' | |
alias awk='/usr/local/bin/gawk' | |
alias egrep='/usr/local/bin/gegrep --color=auto' | |
alias fgrep='/usr/local/bin/gfgrep --color=auto' | |
alias grep='/usr/local/bin/ggrep --color=auto' | |
fi | |
# set up aliases | |
alias portsinuse='sudo lsof -i -n -P' | |
alias ls='ls -i --color=auto' | |
alias l.='ls -id .*' | |
alias ll='ls -ilG' | |
#alias ls='ls --color=tty' | |
alias lt='ls -ilGtr' | |
alias la='ls -ialG' | |
alias diff='diff -W $(tput cols)' | |
#alias psu='ps -u $USER -H' | |
myUID=`id -u` | |
alias psu="ps -ef | egrep \"^$myUID\"" | |
alias pso='ps -o pid,user,start,cputime,comm' | |
alias psv='ps -e -o pid,user,rss,vsize,comm --sort=-vsize | more' | |
alias psm='ps -e -o pid,user,rss,vsize,comm --sort=-rss | more' | |
alias sshka='ssh -o "ServerAliveInterval 300" ' | |
alias testrlastcsv='testr last --subunit | subunit-1to2 | subunit2csv' | |
alias testrlastalm='testr last --subunit | subunit-1to2 | subunit2alm' | |
alias cdwork='cd ~/work' | |
alias ssht='ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -o "LogLevel ERROR"' | |
alias scpt='scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -o "LogLevel ERROR"' | |
alias sshspin='ssh -i ~/.ssh/CHANGE_TO_SPINNAKER_SSH_KEY ' | |
alias scpspin='scp -i ~/.ssh/CHANGE_TO_SPINNAKER_SSH_KEY ' | |
alias sshspint='ssh -i ~/.ssh/CHANGE_TO_SPINNAKER_SSH_KEY -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -o "LogLevel ERROR"' | |
alias scpspint='scp -i ~/.ssh/CHANGE_TO_SPINNAKER_SSH_KEY -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -o "LogLevel ERROR"' | |
alias sshgensec='ssh-keygen -o -a 100 -t ed25519' | |
alias sshgenrsa='ssh-keygen -t rsa -b 4096' | |
# artifactory aliases | |
alias artpush="curl -H 'X-JFrog-Art-Api: CHANGE_TO_ARTIFACTORY_API_KEY' -T " | |
alias artget="curl -H 'X-JFrog-Art-Api: CHANGE_TO_ARTIFACTORY_API_KEY' " | |
alias artctoken="curl -H 'X-JFrog-Art-Api: CHANGE_TO_ARTIFACTORY_API_KEY' -XPOST https://armory.jfrog.io/api/security/token -d 'expires_in=0' " | |
alias artrtoken="curl -H 'X-JFrog-Art-Api: CHANGE_TO_ARTIFACTORY_API_KEY' -XPOST https://armory.jfrog.io/api/security/token/revoke " | |
# osx aliases | |
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app' | |
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app' | |
# AWS aliases | |
alias awspsd='saml2aws login -a ps-dev && export AWS_PROFILE=ps-dev' | |
alias awsas='saml2aws login -a armory-staging && export AWS_PROFILE=armory-staging' | |
alias awssa='saml2aws login -a armory-sales && export AWS_PROFILE=armory-sales' | |
alias awsad='export AWS_PROFILE=alchen-dev' | |
# Azure CLI aliases | |
# region env variables | |
# docker aliases | |
dockerrmnone='docker rmi $(docker images -f "dangling=true" -q)' | |
# other stuff | |
alias play='doitlive play' | |
alias oidcdebugger='docker run -d --rm -p 3000:3000 oauth2-oidc-debugger' | |
# kubernetes | |
if [[ -f $(brew --prefix)/etc/bash_completion.d/kubectl ]]; then | |
source $(brew --prefix)/etc/bash_completion.d/kubectl | |
source <(kubectl completion bash) | |
alias k=kubectl | |
#complete -o default -F __start_kubectl ddk | |
fi | |
# source .bashrc-ext | |
if [[ -f ~/.bashrc-ext ]]; then source ~/.bashrc-ext; fi | |
#------------------------ | |
# Create a function | |
#------------------------ | |
rgrep () { | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: rgrep \"<file_name>\" \"<expression>\"" | |
echo "" | |
else | |
find . -type d -not \( -name .svn -prune \) -o -name "$1" -exec grep "$2" {} /dev/null \; | |
fi | |
} | |
rgrepi () { | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: rgrep \"<file_name>\" \"<expression>\"" | |
echo "" | |
else | |
find . -type d -not \( -name .svn -prune \) -o -name "$1" -exec grep -i "$2" {} /dev/null \; | |
fi | |
} | |
rgrepv () { | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: rgrepv \"<file_name>\" \"<expression>\"" | |
echo "" | |
else | |
find . -type d -not \( -name .svn -prune \) -o -name "$1" -exec grep -v "$2" {} /dev/null \; | |
fi | |
} | |
rgrepf () { | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: rgrepf \"<file_name>\" \"<expression>\"" | |
echo "" | |
else | |
find . -type d -not \( -name .svn -prune \) -o -name "$1" -exec grep -l "$2" {} /dev/null \; | |
fi | |
} | |
rgrepvf () { | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: rgrepvf \"<file_name>\" \"<expression>\"" | |
echo "" | |
else | |
find . -type d -not \( -name .svn -prune \) -o -name "$1" -exec grep -L "$2" {} /dev/null \; | |
fi | |
} | |
delInode () { | |
if [ $# -ne 1 ] | |
then | |
echo "Usage: delInode \"<inode_number>\"" | |
echo "" | |
else | |
find . -inum $1 -exec rm -i {} \; | |
fi | |
} | |
dockerkill () { | |
docker kill $1 | |
docker rm $1 | |
} | |
dockerkillall () { | |
docker ps -a -q | while read i | |
do | |
echo "Killing and removing docker id $i ..." | |
docker kill $i | |
docker rm $i | |
done | |
} | |
# personal variable to indicate what bash functions have been written | |
export ZFUNCTIONS='rgrep rgrepv rgrepf rgrepvf delInode dockerkill dockerkillall' | |
export ZPROFILES='ps-dev armory-dev armory-staging armory-sales' | |
# tabtab source for serverless package | |
# uninstall by removing these lines or running `tabtab uninstall serverless` | |
[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.bash ] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.bash | |
# tabtab source for sls package | |
# uninstall by removing these lines or running `tabtab uninstall sls` | |
[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.bash ] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.bash | |
# jfrog cli bash completion | |
[ -f $HOME/.jfrog/jfrog_bash_completion ] && . $HOME/.jfrog/jfrog_bash_completion | |
# starship prompts | |
if [[ -f $HOME/bin/starship ]]; then eval "$(starship init bash)"; fi | |
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment