Created
August 8, 2014 04:26
-
-
Save ahoward/946869aa73516efb2745 to your computer and use it in GitHub Desktop.
This file contains 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
#alias rb='rbenv' | |
# path setup | |
# | |
# paths=`cat ~/.paths.sh` | |
# PATH=`ruby -e' PATH=ENV["PATH"].split(/:/); \ | |
# ARGV.reverse.each{|path| PATH.delete(path); PATH.unshift(path)};\ | |
# PATH.map!{|path| File.expand_path(path)};\ | |
# PATH.uniq!; print(PATH.join(":")) ' '~/bin' "$paths" "$PATH" 2>/dev/null` | |
# export PATH | |
# unset paths | |
# path manipulation support | |
# | |
path_append () { path_remove $1; export PATH="$PATH:$1"; } | |
path_prepend () { path_remove $1; export PATH="$1:$PATH"; } | |
path_remove () { export PATH=`echo -n $PATH | awk -v RS=: -v ORS=: '$0 != "'$1'"' | sed 's/:$//'`; } | |
for path in `tail -r ~/.paths.sh`; do path_prepend $path; done | |
unset path | |
path_prepend "~/bin" | |
# rbenv | |
# | |
eval "$(rbenv init -)" | |
#eval "$(rbenv init -)" | |
# setup ulimit | |
# | |
ulimit -S -c 1000000 > /dev/null 2>&1 | |
# setup umask | |
# | |
umask 002 | |
# ssl cert | |
# | |
export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt | |
# setup locale | |
# | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
# env settings | |
# | |
export HISTSIZE=8192 | |
export PAGER="less" | |
export EDITOR="vim" | |
# source inputrc | |
# | |
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then | |
export INPUTRC=/etc/inputrc | |
fi | |
# various bash settings | |
# | |
set savehist | |
set filec | |
set nobeep | |
set history=8192 | |
set autolist | |
unset autologout | |
# shell aliases | |
# | |
test -f ~/.aliases.sh && . ~/.aliases.sh | |
# shell functions | |
# | |
test -f ~/.functions.sh && . ~/.functions.sh | |
# setup display | |
# | |
if [[ -z $DISPLAY && -z $SSH_CONNECTION ]]; then | |
disp_no=($( ps -xww | grep -F X11.app | awk '{print $NF}' | grep -e ":[0-9]" )) | |
if [[ -n $disp_no ]];then | |
export DISPLAY=${disp_no}.0 | |
else | |
export DISPLAY=:0.0 | |
fi | |
fi | |
# ssh complete | |
# | |
SSH_COMPLETE=($( | |
ruby -e' puts ARGF.readlines.map{|line| line[%r/[^\s]+/].split(/,/)} ' < ~/.ssh/known_hosts | |
)) | |
complete -o default -W "${SSH_COMPLETE[*]}" ssh | |
complete -o default -W "${SSH_COMPLETE[*]}" scp | |
#BUCKET_COMPLETE=($( | |
#bucket list | |
#)) | |
#complete -o default -W "`bucket list | sed ''`" bucket | |
#export RSYNC_RSH=tti | |
# setup aws environment | |
# | |
export ACCESS_KEY_ID=`ruby -r yaml -e'print YAML.load(IO.read(ARGV.shift))["access_key_id"]' ~/.aws.yml` | |
export AMAZON_ACCESS_KEY_ID=$ACCESS_KEY_ID | |
export SECRET_ACCESS_KEY=`ruby -r yaml -e'print YAML.load(IO.read(ARGV.shift))["secret_access_key"]' ~/.aws.yml` | |
export AMAZON_SECRET_ACCESS_KEY=$SECRET_ACCESS_KEY | |
export CA_FILE=`ruby -r yaml -e'print YAML.load(IO.read(ARGV.shift))["ca_file"]' ~/.aws.yml` | |
export AMAZON_CA_FILE=$CA_FILE | |
# | |
# git command completion | |
# | |
if [ -f "$HOME/.git-completion.bash" ]; then | |
. "$HOME/.git-completion.bash" | |
fi | |
# | |
# gisty setup | |
# | |
export GISTY_DIR="$HOME/git/gists" | |
export GISTY_ACCESS_TOKEN=e99bae8891c57213e4bc3e59d296071a9cac3bc3 | |
export GISTY_SSL_VERIFY="NONE" | |
# | |
# see - http://railsdog.com/blog/2009/03/custom-bash-prompt-for-git-branches/ | |
# | |
source ~/.git_completion.sh | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
# setup prompt | |
# | |
export TERM_BLACK="\[\e[30;1m\]" | |
export TERM_RED="\[\e[31;1m\]" | |
export TERM_GREEN="\[\e[32;1m\]" | |
export TERM_YELLOW="\[\e[33;1m\]" | |
export TERM_BLUE="\[\e[34;1m\]" | |
export TERM_MAGENTA="\[\e[35;1m\]" | |
export TERM_CYAN="\[\e[36;1m\]" | |
export TERM_WHITE="\[\e[37;1m\]" | |
export TERM_RESET="\[\e[0m\]" | |
host=`hostname|awk -F. '{print $1}'` | |
export PS1="${TERM_CYAN}${host}${TERM_RESET}${TERM_WHITE}:${TERM_RESET}${TERM_GREEN}\w${TERM_RESET} $ " | |
unset host | |
## set hardstatus if running under a screen (see ~/bin/ns) | |
# | |
if [ ! -z "$Screen" ]; then | |
echo -ne "\033]0;"$Screen"\007" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment