Skip to content

Instantly share code, notes, and snippets.

@textarcana
Forked from anonymous/.profile
Created January 7, 2013 21:31
Show Gist options
  • Save textarcana/4478636 to your computer and use it in GitHub Desktop.
Save textarcana/4478636 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jan 7, 2013.
    59 changes: 59 additions & 0 deletions .profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    # Noah Sussman's CentOS .profile

    if [ "$SSH_TTY" ]; then
    # If this is a remote session, then start screen
    if [ "$TERM" != "screen" ]; then
    screen -xRRU
    if [ "$?" = "0" ]; then
    reset
    exit
    fi
    fi
    fi

    export PATH=$PATH
    export NODE_PATH=/usr/lib/node_modules/

    RESET="\[\017\]"
    NORMAL="\[\033[0m\]"
    RED="\[\033[31;1m\]"
    YELLOW="\[\033[33;1m\]"
    GREEN="\[\033[32;1m\]"
    WHITE="\[\033[37;1m\]"
    SMILEY="${GREEN}:)${NORMAL}"
    FROWNY="${RED}:(${NORMAL}"
    EMOTE="if [ \$? = 0 ]; then echo \"${SMILEY}\"; else echo \"${FROWNY}\"; fi"
    GIT_DIRTY="[[ \$(git status 2> /dev/null | tail -n1) != \"nothing to commit (working directory clean)\" ]] && echo \"${YELLOW}\" || echo \"${GREEN}\""

    function parse_git_hash {
    hash=$(git log --format="%h" -n1 2> /dev/null) || return
    echo $hash
    }

    function parse_git_branch {
    ref=$(git-symbolic-ref HEAD 2> /dev/null) || return
    echo ${ref#refs/heads/}
    }

    function seconds_since_epoch {
    echo `date +%s`
    }

    export PS1="${RESET}\n\`${EMOTE}\` \
    \u@\h \
    \`${GIT_DIRTY}\`\$(parse_git_branch) \$(parse_git_hash)${NORMAL} \
    \w \
    \n\t \D{%b %d %Y %z} \
    \$(seconds_since_epoch) \
    \`${GIT_DIRTY}\`\n\$ ${NORMAL}"

    export EDITOR=emacs
    export SVN_EDITOR=emacs
    export GIT_EDITOR=emacs
    export HISTCONTROL=ignoreboth
    export HISTSIZE=10000
    export HISTIGNORE="ls:exit:cd ..:cd -:cd ~:ls:pwd:fg:cls:svn st:git r:git rpull:git st:git info"
    export RUBYOPT=rubygems

    alias reload="source ~/.profile"
    alias cls="clear"