Skip to content

Instantly share code, notes, and snippets.

@vinioliveira
Created April 8, 2011 00:59

Revisions

  1. vinioliveira revised this gist Sep 22, 2011. 1 changed file with 0 additions and 15 deletions.
    15 changes: 0 additions & 15 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -127,18 +127,3 @@ export PS1='\w `~/.rvm/bin/rvm-prompt i v g` `git branch 2> /dev/null | grep -e
    #This line enable bash autocomplete for git
    source ~/.git-completion.git

    tab()
    {
    osascript -e "
    tell application \"iTerm\"
    tell the first terminal
    set currentSession to current session
    launch session \"Default Session\"
    tell the last session
    write text \"cd $(pwd)\"
    write text \"$*\"
    end tell
    select currentSession
    end tell
    end tell"
    }
  2. vinioliveira revised this gist Sep 22, 2011. No changes.
  3. vinioliveira revised this gist Sep 22, 2011. 1 changed file with 17 additions and 1 deletion.
    18 changes: 17 additions & 1 deletion .bashrc
    Original file line number Diff line number Diff line change
    @@ -125,4 +125,20 @@ export OOO_FORCE_DESKTOP=gnome
    export PS1='\w `~/.rvm/bin/rvm-prompt i v g` `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\n\[\033[37m\]$\[\033[00m\] '

    #This line enable bash autocomplete for git
    source /etc/bash_completion.d/git
    source ~/.git-completion.git

    tab()
    {
    osascript -e "
    tell application \"iTerm\"
    tell the first terminal
    set currentSession to current session
    launch session \"Default Session\"
    tell the last session
    write text \"cd $(pwd)\"
    write text \"$*\"
    end tell
    select currentSession
    end tell
    end tell"
    }
  4. vinioliveira revised this gist May 11, 2011. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -123,3 +123,6 @@ export OOO_FORCE_DESKTOP=gnome

    #Custom PS1 to show which version and branch you're using at moment.
    export PS1='\w `~/.rvm/bin/rvm-prompt i v g` `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\n\[\033[37m\]$\[\033[00m\] '

    #This line enable bash autocomplete for git
    source /etc/bash_completion.d/git
  5. vinioliveira revised this gist Apr 11, 2011. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion .bashrc
    Original file line number Diff line number Diff line change
    @@ -112,9 +112,14 @@ alias ..='cd ..'
    alias ...='cd ../..'
    alias ....='cd ../../..'
    alias .....='cd ../../../..'

    # Custom dir folder explorer for ubuntu.
    alias ll='ls -l'

    export OOO_FORCE_DESKTOP=gnome
    export OOO_FORCE_DESKTOP=gnome

    # RVM Initialize system bash to make works RVM when starts bash.
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

    #Custom PS1 to show which version and branch you're using at moment.
    export PS1='\w `~/.rvm/bin/rvm-prompt i v g` `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\n\[\033[37m\]$\[\033[00m\] '
  6. vinioliveira created this gist Apr 8, 2011.
    120 changes: 120 additions & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,120 @@
    # ~/.bashrc: executed by bash(1) for non-login shells.
    # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
    # for examples

    # If not running interactively, don't do anything
    [ -z "$PS1" ] && return

    # don't put duplicate lines in the history. See bash(1) for more options
    export HISTCONTROL=ignoredups

    # set variable identifying the chroot you work in (used in the prompt below)
    if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
    fi

    # set a fancy prompt (non-color, unless we know we "want" color)
    case "$TERM" in
    xterm-color)
    PS1='[${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\h\[\033[00m\]] \[\033[01;34m\]\w\[\033[00m\]\$ '
    ;;
    *)
    PS1='$ '
    ;;
    esac
    #change the title
    case "$TERM" in
    xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
    #PROMPT_COMMAND='echo -ne "${PWD}\007"'
    ;;
    *)
    ;;
    esac

    # enable color support of ls and also add handy aliases
    if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    fi

    # enable programmable completion features (you don't need to enable
    # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
    # sources /etc/bash.bashrc).
    if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
    fi

    extract () {
    if [ -f $1 ] ; then
    case $1 in
    *.tar.bz2) tar xjf $1 ;;
    *.tar.gz) tar xzf $1 ;;
    *.bz2) bunzip2 $1 ;;
    *.rar) rar x $1 ;;
    *.gz) gunzip $1 ;;
    *.tar) tar xf $1 ;;
    *.tbz2) tar xjf $1 ;;
    *.tgz) tar xzf $1 ;;
    *.zip) unzip $1 ;;
    *.Z) uncompress $1 ;;
    *.7z) 7z x $1 ;;
    *) echo "'$1' cannot be extracted via extract()" ;;
    esac
    else
    echo "'$1' is not a valid file"
    fi
    }

    #netinfo - shows network information for your system
    netinfo ()
    {
    echo "--------------- Network Information ---------------"
    /sbin/ifconfig | awk /'inet addr/ {print $2}'
    /sbin/ifconfig | awk /'Bcast/ {print $3}'
    /sbin/ifconfig | awk /'inet addr/ {print $4}'
    /sbin/ifconfig | awk /'HWaddr/ {print $4,$5}'
    myip=`lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' `
    echo "${myip}"
    echo "---------------------------------------------------"
    }

    #dirsize - finds directory sizes and lists them for the current directory
    dirsize ()
    {
    du -shx * .[a-zA-Z0-9_]* 2> /dev/null | \
    egrep '^ *[0-9.]*[MG]' | sort -n > /tmp/list
    egrep '^ *[0-9.]*M' /tmp/list
    egrep '^ *[0-9.]*G' /tmp/list
    rm -rf /tmp/list
    }

    #copy and go to dir
    cpg (){
    if [ -d "$2" ];then
    cp $1 $2 && cd $2
    else
    cp $1 $2
    fi
    }

    #move and go to dir
    mvg (){
    if [ -d "$2" ];then
    mv $1 $2 && cd $2
    else
    mv $1 $2
    fi
    }

    # Directory navigation aliases
    alias ..='cd ..'
    alias ...='cd ../..'
    alias ....='cd ../../..'
    alias .....='cd ../../../..'
    alias ll='ls -l'

    export OOO_FORCE_DESKTOP=gnome
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

    export PS1='\w `~/.rvm/bin/rvm-prompt i v g` `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\n\[\033[37m\]$\[\033[00m\] '