Import existing bashrc and depending bashrc files

main
Buddy Sandidge 12 years ago
parent 16c4979878
commit d72be38811

@ -0,0 +1,68 @@
#!/usr/bin/env bash
pods_dir='~/podcasts'
# Aliases for OS X
if [[ `uname` == 'Darwin' ]]; then
alias ls='ls -G'
alias grep='grep --color'
alias fgrep='fgrep --color'
alias egrep='egrep --color'
music_dir='~/Music'
desktop_dir='~/Desktop'
docs_dir='~/Documents'
fi
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
music_dir='~/music'
desktop_dir='~/desktop'
docs_dir='~/documents'
fi
# Some common aliases
alias ll='ls -alF'
alias df='df -h'
alias du='du -h'
alias curl='curl -s '
# Shorthand helpers
alias 644='chmod 644 '
alias 755='chmod 755 '
alias 600='chmod 600 '
alias 700='chmod 500 '
alias +x='chmod +x '
alias ..='cd .. '
# Some specialty aliases
alias wget-opendir='wget -r -l 0 -c -nc -np -e robots=off --random-wait --limit-rate=800000k --reject=html,htm,index'
alias youtube-dl='youtube-dl -t '
alias rsync-win='rsync --recursive --verbose --times --modify-window=1 '
alias can-upgrade='sudo apt-get update && sudo apt-get upgrade -y '
alias can-find='aptitude search '
alias can-haz='sudo apt-get install '
alias curl-headers='curl -s -v -I '
alias take='sudo chown `whoami`:`whoami` '
alias simple-http-server='python -m SimpleHTTPServer'
alias numfiles='find . -maxdepth 1 -type f | wc -l'
alias deepgrep='find . -type f | sed "s/$/\"/g" | sed "s/^/\"/g" | xargs grep --color '
# Move around to common locations
alias desktop="cd $desktop_dir"
alias podcasts="cd $pods_dir"
alias code='cd ~/code/ '
alias music="cd $music_dir"
alias documents="cd $docs_dir"
# Will add these scripts later
#alias podcasts-play-playlist="cd $pods_dir && mkpodcastplaylist ./ > pods.m3u && vlc pods.m3u 2>/dev/null &"

@ -0,0 +1,75 @@
#!/usr/bin/env bash
# Reset
color_off='\e[0m' # Text Reset
# Regular Colors
black='\e[0;30m' # Black
red='\e[0;31m' # Red
green='\e[0;32m' # Green
yellow='\e[0;33m' # Yellow
blue='\e[0;34m' # Blue
purple='\e[0;35m' # Purple
cyan='\e[0;36m' # Cyan
white='\e[0;37m' # White
# Bold
bblack='\e[1;30m' # Black
bred='\e[1;31m' # Red
bgreen='\e[1;32m' # Green
byellow='\e[1;33m' # Yellow
bblue='\e[1;34m' # Blue
bpurple='\e[1;35m' # Purple
bcyan='\e[1;36m' # Cyan
bwhite='\e[1;37m' # White
# Underline
ublack='\e[4;30m' # Black
ured='\e[4;31m' # Red
ugreen='\e[4;32m' # Green
uyellow='\e[4;33m' # Yellow
ublue='\e[4;34m' # Blue
upurple='\e[4;35m' # Purple
ucyan='\e[4;36m' # Cyan
uwhite='\e[4;37m' # White
# Background
on_black='\e[40m' # Black
on_red='\e[41m' # Red
on_green='\e[42m' # Green
on_yellow='\e[43m' # Yellow
on_blue='\e[44m' # Blue
on_purple='\e[45m' # Purple
on_cyan='\e[46m' # Cyan
on_white='\e[47m' # White
# High Intensty
iblack='\e[0;90m' # Black
ired='\e[0;91m' # Red
igreen='\e[0;92m' # Green
iyellow='\e[0;93m' # Yellow
iblue='\e[0;94m' # Blue
ipurple='\e[0;95m' # Purple
icyan='\e[0;96m' # Cyan
iwhite='\e[0;97m' # White
# Bold High Intensty
biblack='\e[1;90m' # Black
biRed='\e[1;91m' # Red
biGreen='\e[1;92m' # Green
biYellow='\e[1;93m' # Yellow
biBlue='\e[1;94m' # Blue
biPurple='\e[1;95m' # Purple
biCyan='\e[1;96m' # Cyan
biWhite='\e[1;97m' # White
# High Intensty backgrounds
on_iblack='\e[0;100m' # Black
on_ired='\e[0;101m' # Red
on_igreen='\e[0;102m' # Green
on_iyellow='\e[0;103m' # Yellow
on_iblue='\e[0;104m' # Blue
on_ipurple='\e[10;95m' # Purple
on_icyan='\e[0;106m' # Cyan
on_iwhite='\e[0;107m' # White

@ -0,0 +1,48 @@
#!/usr/bin/env bash
# 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=10000
HISTFILESIZE=20000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
if [ "$TERM" == "xterm" ]; then
export TERM=xterm-256color
fi
function _add-path {
dir="$1"
if [[ -d $dir ]]; then
PATH=$dir:$PATH
fi
}
_add-path /var/lib/gems/1.8/bin
_add-path ~/opt/bin
_add-path /opt/local/bin
_add-path /opt/local/sbin
_add-path /opt/bin
_add-path ~/bin
_add-path ~/code/cli/bin
_add-path ~/code/ci/phpunit-git-deploy/bin
export EDITOR='vim'
# python virtualenvwrapper
export WORKON_HOME="$HOME/.virtualenvs"
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
source /usr/local/bin/virtualenvwrapper.sh
fi

@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Taken from: http://www.commandlinefu.com/commands/view/4873/google-spell-checker
function spellcheck () {
typeset y=$@;curl -sd "<spellrequest><text>$y</text></spellrequest>" https://www.google.com/tbproxy/spell|sed -n '/s="[0-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}'|tee >(grep -Eq '.*'||echo -e "OK");
}
function min-jpg {
tmpfile=`mktemp`
ogfile="$1"
jpegtran -optimize -perfect -outfile $tmpfile $ogfile
mv $tmpfile $ogfile
}
function min-png {
tmpfile=`mktemp`
ogfile="$1"
pngcrush -rem alla -reduce -brute $ogfile $tmpfile
mv $tmpfile $ogfile
}
function parse_git_status {
if [[ $(git status 2> /dev/null | wc -l) -eq 0 ]]; then
return
fi
if [[ $(git status 2> /dev/null | grep "working directory clean" | wc -l) -eq 0 ]]; then
echo '∓'
fi
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function get-create-date {
date=`date -r "$1" +"%F"`
echo $date
}
function add-date-prefix {
DIR=`dirname "$1"`
FILE=`basename "$1"`
DATE=`date -r "$1" +"%F"`
mv "$1" "$DIR/$DATE_$FILE"
}
function get-bitrate {
echo `exiftool -AudioBitrate "$1" | awk '{print $4}'`": $1"
}

@ -0,0 +1,197 @@
#!bash
#
# git-flow-completion
# ===================
#
# Bash completion support for [git-flow](http://github.com/nvie/gitflow)
#
# The contained completion routines provide support for completing:
#
# * git-flow init and version
# * feature, hotfix and release branches
# * remote feature, hotfix and release branch names
#
#
# Installation
# ------------
#
# To achieve git-flow completion nirvana:
#
# 0. Install git-completion.
#
# 1. Install this file. Either:
#
# a. Place it in a `bash-completion.d` folder:
#
# * /etc/bash-completion.d
# * /usr/local/etc/bash-completion.d
# * ~/bash-completion.d
#
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in
# your .bashrc:
#
# source ~/.git-flow-completion.sh
#
# 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant
# $command case in _git:
#
# flow) _git_flow ;;
#
#
# The Fine Print
# --------------
#
# Copyright (c) 2011 [Justin Hileman](http://justinhileman.com)
#
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
_git_flow ()
{
local subcommands="init feature release hotfix help version"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi
case "$subcommand" in
init)
__git_flow_init
return
;;
feature)
__git_flow_feature
return
;;
release)
__git_flow_release
return
;;
hotfix)
__git_flow_hotfix
return
;;
*)
COMPREPLY=()
;;
esac
}
__git_flow_init ()
{
local subcommands="help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi
}
__git_flow_feature ()
{
local subcommands="list start finish publish track diff rebase checkout pull help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi
case "$subcommand" in
pull)
__gitcomp "$(__git_remotes)"
return
;;
checkout|finish|diff|rebase)
__gitcomp "$(__git_flow_list_branches 'feature')"
return
;;
publish)
__gitcomp "$(comm -23 <(__git_flow_list_branches 'feature') <(__git_flow_list_remote_branches 'feature'))"
return
;;
track)
__gitcomp "$(comm -23 <(__git_flow_list_remote_branches 'feature') <(__git_flow_list_branches 'feature'))"
return
;;
*)
COMPREPLY=()
;;
esac
}
__git_flow_release ()
{
local subcommands="list start finish track publish help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi
case "$subcommand" in
finish)
__gitcomp "$(__git_flow_list_branches 'release')"
return
;;
publish)
__gitcomp "$(comm -23 <(__git_flow_list_branches 'release') <(__git_flow_list_remote_branches 'release'))"
return
;;
track)
__gitcomp "$(comm -23 <(__git_flow_list_remote_branches 'release') <(__git_flow_list_branches 'release'))"
return
;;
*)
COMPREPLY=()
;;
esac
}
__git_flow_hotfix ()
{
local subcommands="list start finish help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi
case "$subcommand" in
finish)
__gitcomp "$(__git_flow_list_branches 'hotfix')"
return
;;
*)
COMPREPLY=()
;;
esac
}
__git_flow_prefix ()
{
case "$1" in
feature|release|hotfix)
git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/"
return
;;
esac
}
__git_flow_list_branches ()
{
local prefix="$(__git_flow_prefix $1)"
git branch 2> /dev/null | tr -d ' |*' | grep "^$prefix" | sed s,^$prefix,, | sort
}
__git_flow_list_remote_branches ()
{
local prefix="$(__git_flow_prefix $1)"
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
git branch -r 2> /dev/null | sed "s/^ *//g" | grep "^$origin/$prefix" | sed s,^$origin/$prefix,, | sort
}
# alias __git_find_on_cmdline for backwards compatibility
if [ -z "`type -t __git_find_on_cmdline`" ]; then
alias __git_find_on_cmdline=__git_find_subcommand
fi

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# display hostname
PS1="\[$blue\]«\h»"
# display separator
PS1="$PS1\[$yellow\]⚡"
# display current path
PS1="$PS1\[$green\]\w "
# display git branch
PS1="$PS1\[$bblack\]"'$(parse_git_branch)'
# display git status
PS1="$PS1\[$yellow\]"'$(parse_git_status) '
# display date
PS1="$PS1\[$black\]\D{%F %I:%M%P} "
# display date
PS1="$PS1\[$color_off\]\n⚓ "

@ -0,0 +1,38 @@
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
if [ -f ~/.bash/environment ]; then
source ~/.bash/environment
fi
if [ -f ~/.bash/colors ]; then
source ~/.bash/colors
fi
if [ -f ~/.bash/functions ]; then
source ~/.bash/functions
fi
if [ -f ~/.bash/aliases ]; then
source ~/.bash/aliases
fi
if [ -f ~/.bash/git-flow-completion ]; then
source ~/.bash/git-flow-completion
fi
if [ -f ~/.bash/prompt ]; then
source ~/.bash/prompt
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 ] && ! shopt -oq posix; then
source /etc/bash_completion
fi
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
source /opt/local/etc/profile.d/bash_completion.sh
fi
Loading…
Cancel
Save