Skip to content

Instantly share code, notes, and snippets.

@emaxerrno
Created September 16, 2013 03:39
Show Gist options
  • Select an option

  • Save emaxerrno/6576488 to your computer and use it in GitHub Desktop.

Select an option

Save emaxerrno/6576488 to your computer and use it in GitHub Desktop.
worklog
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
#bash completion -- pkg_add -r bash-completion
if [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
fi
#git completion
if [ -f /usr/local/share/git-core/contrib/completion/git-completion.bash ]; then
. /usr/local/share/git-core/contrib/completion/git-completion.bash
fi
#git completion -- home brew
if [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
. /usr/local/etc/bash_completion.d/git-completion.bash
fi
#git prompt on mac osx
if [ -f /usr/local/etc/bash_completion.d/git-prompt.sh ]; then
. /usr/local/etc/bash_completion.d/git-prompt.sh
fi
#mac osx git completion
if [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
fi
export CLICOLOR=yes
export LSCOLORS=ExFxCxDxBxegedabagacad
alias ls='ls -GCF'
alias ll='ls -alFo'
alias la='ls -A'
alias l='ls -CF'
alias j=jobs
alias lx='ll -BX' # sort by extension
alias lz='ll -rS' # sort by size
alias lt='ll -rt' # sort by date
alias tree='tree -aCsv'
alias date="date +%a%t%b%t%D%l:%M:%S%p"
alias df='df -h'
alias du='du -h'
# make all these commands safer
alias cp="cp -vi"
alias mv="mv -vi"
alias rm="rm -v"
alias rmdir="rmdir -v"
alias mkdir='mkdir -p -v'
alias nano='nano -w'
alias ping='ping -c 5'
alias ..='cd .. && ls -l'
cdAndPrint() {
cd $1 && ls ./
}
alias ,,='cdAndPrint'
alias df='df -h'
alias du='du -c -h'
# modified commands
alias diff='colordiff' # requires colordiff package
alias grep='grep --color=auto'
#to recycle tmux sessions
alias tmux='tmux attach'
# new commands
alias da='date "+%A, %B %d, %Y [%T]"'
alias du1='du -sch'
alias hist='history | grep $1' # requires an argument
export GOPATH=$HOME/workspace/gopath
#export GOMAXPROCS=4
#set emacs as default editor
export EDITOR=emacs
alias emacs='emacs -nw'
set -o emacs
# gives me an emacs editor everytime I invoke a man. Good for
# searching -- Perhaps replace with uemacs instead of emacs
emacs_man() {
#option 1: uncomment when you have server-start on
#/usr/bin/emacsclient -t -e "(woman \"$1\")"
#option 2: for most tasks this is fine
# -q no init file
# -nw no window
# -eval is the result of the elisp command woman
# -Q quick no splash etc
emacs -nw -q -Q --eval "(woman \"$1\")"
}
#source-highlight
#TODO(agallego) -- guard this by platform dependent stuff
export LESSOPEN="| /usr/local/bin/src-hilite-lesspipe.sh %s"
export LESS=' -R '
#PS1 modification
GRAY_COLOR='\[\e[m\n\e[1;30m\]'
BOLD_BLUE_COLOR='\[\e[1;34m\]'
LIGHT_GRAY_COLOR='\[\e[0;37m\]'
WHITE_COLOR='\[\e[1;37m\]'
GREEN_COLOR='\[\e[0;92m\]'
GIT_WHERE='$(__git_remotes)$(__git_ps1)'
PS1="$GRAY_COLOR[$BOLD_BLUE_COLOR\u@\H$LIGHT_GRAY_COLOR] $WHITE_COLOR\w $GREEN_COLOR$GIT_WHERE$LIGHT_GRAY_COLOR\n$ "
PS2='> '
PS4='+ '
# UTF-8 support
export LANG=en_US.UTF-8
export LESSCHARSET=utf-8
#must have
TERM=xterm-256color
function prompt-irblack {
local WHITE="\[\033[1;37m\]"
local BLACK="\[\033[0;30m\]"
local BLUE="\[\033[0;34m\]"
local LIGHT_BLUE="\[\033[1;34m\]"
local CYAN="\[\033[0;36m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREEN2="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local MAGENTA="\[\033[1;35m\]"
local LIGHT_GRAY2="\[\033[0;37m\]"
local DARK_GRAY="\[\033[1;30m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}\
$LIGHT_GRAY2[$DARK_GRAY\u$LIGHT_GRAY2]\
$LIGHT_GRAY2[$LIGHT_BLUE\h$LIGHT_GRAY2:$BLUE\w$LIGHT_GRAY2]$RED\$(git_branch)\$(hg_branch)$LIGHT_GRAY2\
$LIGHT_GRAY\n\$ "
PS2='> '
PS4='+ '
}
function prompt-solarized {
local WHITE="\[\033[1;37m\]"
local BLACK="\[\033[0;30m\]"
local BLUE="\[\033[0;34m\]"
local LIGHT_BLUE="\[\033[1;34m\]"
local CYAN="\[\033[0;36m\]"
local RED="\[\033[1;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREEN2="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[1;37m\]"
local MAGENTA="\[\033[1;35m\]"
local LIGHT_GRAY2="\[\033[1;36m\]"
local DARK_GRAY="\[\033[1;30m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}\
$WHITE[$GREEN\u$WHITE]\
$LIGHT_GRAY2[$LIGHT_BLUE\h$LIGHT_GRAY2:$BLUE\w$LIGHT_GRAY2]$RED\$(git_branch)$LIGHT_GRAY2\
$WHITE\n\$ "
PS2='> '
PS4='+ '
export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:"
export LS_COLORS="di=34:ln=1;35:so=32:pi=33:ex=1;31:bd=34:cd=34:su=0;41:sg=0;46:tw=0;42:ow=0;43:fi=1;37:"
}
export GOPATH=~/workspace/gopath:~/workspace/proxy
export GOROOT=/usr/local/Cellar/go/1.1.1
export PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
export PATH=$PATH:/usr/local/go/bin:~/workspace/gopath/bin
# needed for godef
#export REVERSE_PROXY_MUXER="/Users/agallego/workspace/proxy/misc/proxy.conf"
# needs to be last thing. /usr/local/bin needs to be first thing
export PATH=/usr/local/bin:$PATH:~/bin:/usr/local/share/npm/bin
function workLog {
dirs=$(ls $HOME/workspace)
for d in $dirs
do
d=$HOME/workspace/$d
if [[ -d $d/.git ]]; then
cd $d
gituser=`git config user.name`
echo "Project: $(pwd):$gituser"
# git --no-pager log --author='$gituser' --oneline --decorate
git --no-pager log --all --graph --since=8.days --oneline --decorate --author=$gituser --numstat
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment