Last active
June 19, 2018 00:20
-
-
Save torosgo/2ae880c3ab0b8caa0c5920cfca26e605 to your computer and use it in GitHub Desktop.
torosgo bashrc
This file contains hidden or 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
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting | |
source ~/.rvm/scripts/rvm | |
DROPBOXPATH="$HOME/Dropbox" | |
EC2TOOLSPATH="$DROPBOXPATH/trs/bin/ec2-api-tools" | |
# set PATH so it includes user's private bin if it exists | |
if [ -d "$HOME/bin" ] ; then | |
PATH="$HOME/bin:$PATH" | |
fi | |
if [ -d "$DROPBOXPATH/bin" ] ; then | |
PATH="$DROPBOXPATH/bin:$PATH" | |
fi | |
if [ -d "$EC2TOOLSPATH/bin" ] ; then | |
PATH="$EC2TOOLSPATH/bin:$PATH" | |
fi | |
if [ -d "$HOME/.aws" ] ; then | |
if [ -f "$HOME/.aws/accesskeys" ]; then | |
. "$HOME/.aws/accesskeys" | |
fi | |
fi | |
if [ -d "$HOME/bin/sbt/bin" ] ; then | |
PATH="$HOME/bin/sbt/bin:$PATH" | |
fi | |
alias g='/usr/bin/git' | |
alias d='/usr/bin/docker' | |
alias k='/usr/bin/kubectl' | |
alias tgitlog='/usr/bin/git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit' | |
alias tprofile='. ~/.profile' | |
keychain ~/.ssh/id_rsa ~/.ssh/id_rsa_bitbucket ~/.vagrant.d/insecure_private_key | |
. "$HOME/.keychain/$HOSTNAME-sh" | |
genpasswd() { | |
local l=$1 | |
[ "$l" == "" ] && l=16 | |
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs | |
} | |
#_byobu_sourced=1 . /usr/bin/byobu-launch | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
[[ -s "$HOME/.nvm/nvm.sh" ]] && . "$HOME/.nvm/nvm.sh" # This loads nvm | |
# Override the Git command | |
git() { | |
cmd=$1 | |
shift | |
extra="" | |
quoted_args="" | |
whitespace="[[:space:]]" | |
for i in "$@" | |
do | |
quoted_args="$quoted_args \"$i\"" | |
done | |
cmdToRun="`which git` "$cmd" $quoted_args" | |
cmdToRun=`echo $cmdToRun | sed -e 's/^ *//' -e 's/ *$//'` | |
bash -c "$cmdToRun" | |
if [ $? -eq 0 ]; then | |
# Commit stats | |
if [ "$cmd" == "commit" ]; then | |
commit_hash=`git rev-parse HEAD` | |
repo_url=`git config --get remote.origin.url` | |
commit_date=`git log -1 --format=%cd` | |
commit_data="\"{ \"date\": \"$commit_date\", \"url\": \"$repo_url\", \"hash\": \"$commit_hash\" }\"" | |
git-stats --record "$commit_data" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment