Skip to content

Instantly share code, notes, and snippets.

@torosgo
Last active June 19, 2018 00:20
Show Gist options
  • Save torosgo/2ae880c3ab0b8caa0c5920cfca26e605 to your computer and use it in GitHub Desktop.
Save torosgo/2ae880c3ab0b8caa0c5920cfca26e605 to your computer and use it in GitHub Desktop.

Revisions

  1. torosgo revised this gist Jun 19, 2018. 2 changed files with 71 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions aliases
    Original file line number Diff line number Diff line change
    @@ -1,2 +0,0 @@
    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'
    71 changes: 71 additions & 0 deletions bashrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,71 @@
    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
  2. torosgo revised this gist Jun 19, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion aliases
    Original file line number Diff line number Diff line change
    @@ -1 +1,2 @@
    alias tgitlog
    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'
  3. torosgo created this gist Jun 18, 2018.
    1 change: 1 addition & 0 deletions aliases
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    alias tgitlog