clean up bash config
This commit is contained in:
parent
1074406b66
commit
aabb888752
69
bash/aliases
69
bash/aliases
@ -1,50 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pods_dir='~/podcasts'
|
||||
music_dir='~/music'
|
||||
desktop_dir='~/desktop'
|
||||
docs_dir='~/documents'
|
||||
# Aliases for OS X
|
||||
if [[ `uname` == 'Darwin' ]]; then
|
||||
alias ls='ls -G'
|
||||
alias grep='grep --color'
|
||||
alias fgrep='fgrep --color'
|
||||
alias egrep='egrep --color'
|
||||
|
||||
if [[ $(uname) == Darwin ]]; then
|
||||
music_dir='~/Music'
|
||||
desktop_dir='~/Desktop'
|
||||
docs_dir='~/Documents'
|
||||
else
|
||||
music_dir='~/music'
|
||||
desktop_dir='~/desktop'
|
||||
docs_dir='~/documents'
|
||||
|
||||
# linux only alias
|
||||
alias push-to-player="rsync -recursive --verbose --times --modify-window=1 --delete $pods_dir/ `mount -l | awk '/podcasts/ {print $3}'`/podcast/"
|
||||
fi
|
||||
if [[ `uname` == 'FreeBSD' ]]; then
|
||||
alias ls='ls -G'
|
||||
fi
|
||||
if [[ `uname` == 'FreeBSD' ]]; then
|
||||
alias ls='ls -G'
|
||||
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 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'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
# Move around to common locations
|
||||
alias desktop="cd $desktop_dir"
|
||||
alias podcasts="cd ~/podcasts"
|
||||
alias code='cd ~/code/ '
|
||||
alias music="cd $music_dir"
|
||||
alias documents="cd $docs_dir"
|
||||
|
||||
alias dash-v1='cd ~/code/insight-platform && ~/src/grails-1.2.2/bin/grails run-app -https -Xms800m -Xmx1000m -XX:PermSize=200m'
|
||||
|
||||
# Fix vagrant up errors on Mavericks
|
||||
# http://davidwalsh.name/fixing-vagrant-errors
|
||||
alias fix-vagrant='sudo /Library/StartupItems/VirtualBox/VirtualBox restart'
|
||||
|
||||
alias docker-env='eval $(docker-machine env default)'
|
||||
unset -v music_dir
|
||||
unset -v desktop_dir
|
||||
unset -v docs_dir
|
||||
|
||||
# Some common aliases
|
||||
alias ll='ls -alF'
|
||||
@ -74,16 +56,3 @@ alias numfiles='find . -maxdepth 1 -type f | wc -l'
|
||||
alias deepgrep='find . -type f -not -name "*.swp" -not -name "*.pyc" | sed "s/$/\"/g" | sed "s/^/\"/g" | xargs grep --color '
|
||||
# Show list of git branches
|
||||
alias git-br='for k in `git branch|perl -pe s/^..//`; do echo -e ` git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r'
|
||||
|
||||
alias sync-pods="rsync --archive --verbose --compress --delete nas:~/podcasts/ $pods_dir"
|
||||
|
||||
# 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 &"
|
||||
|
||||
|
||||
@ -1,43 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Disable capslock
|
||||
if [[ -x `which setxkbmap` ]]; then
|
||||
if [[ `uname` == 'Linux' ]]; then
|
||||
setxkbmap -option ctrl:nocaps
|
||||
fi
|
||||
fi
|
||||
|
||||
# don't put duplicate lines in the history. See bash(1) for more options
|
||||
# ... or force ignoredups and ignorespace
|
||||
export HISTCONTROL=ignoredups:erasedups:ignorespace
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# Use empty string for unlimited history
|
||||
export HISTSIZE=
|
||||
export HISTFILESIZE=
|
||||
export HISTTIMEFORMAT='%y-%m-%d %T λ '
|
||||
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# Disable capslock
|
||||
if [[ -x $(which setxkbmap) ]]; then
|
||||
if [[ $(uname) == Linux ]]; then
|
||||
setxkbmap -option ctrl:nocaps
|
||||
fi
|
||||
fi
|
||||
|
||||
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
|
||||
export EDITOR='vim'
|
||||
|
||||
# don't put duplicate lines in the history. See bash(1) for more options
|
||||
# ... or force ignoredups and ignorespace
|
||||
export HISTCONTROL=ignoredups:erasedups:ignorespace
|
||||
# Use empty string for unlimited history
|
||||
export HISTSIZE=
|
||||
export HISTFILESIZE=
|
||||
export HISTTIMEFORMAT='%y-%m-%d %T λ '
|
||||
|
||||
# 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
|
||||
# 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)"
|
||||
fi
|
||||
|
||||
if [ "$TERM" == xterm ]; then
|
||||
export TERM=xterm-256color
|
||||
fi
|
||||
|
||||
if [[ $(uname) == 'Darwin' ]]; then
|
||||
export BS_OS='osx'
|
||||
elif [[ $(uname) == 'Linux' ]]; then
|
||||
export BS_OS='linux'
|
||||
fi
|
||||
|
||||
export EDITOR='vim'
|
||||
|
||||
[[ -f ~/.nvm/nvm.sh ]] && source ~/.nvm/nvm.sh
|
||||
[[ -r $NVM_DIR/bash_completion ]] && source $NVM_DIR/bash_completion
|
||||
|
||||
@ -1,19 +1,14 @@
|
||||
#!/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`
|
||||
tmpfile=$(mktemp)
|
||||
ogfile="$1"
|
||||
jpegtran -optimize -perfect -outfile $tmpfile $ogfile
|
||||
mv $tmpfile $ogfile
|
||||
}
|
||||
|
||||
function min-png {
|
||||
tmpfile=`mktemp`
|
||||
tmpfile=$(mktemp)
|
||||
ogfile="$1"
|
||||
pngcrush -rem alla -reduce -brute $ogfile $tmpfile
|
||||
mv $tmpfile $ogfile
|
||||
@ -34,32 +29,29 @@ function parse_git_branch {
|
||||
}
|
||||
|
||||
function get-create-date {
|
||||
date=`date -r "$1" +"%F"`
|
||||
echo $date
|
||||
date -r "$1" +"%F"
|
||||
}
|
||||
|
||||
function add-date-prefix {
|
||||
DIR=`dirname "$1"`
|
||||
FILE=`basename "$1"`
|
||||
DATE=`date -r "$1" +"%F"`
|
||||
|
||||
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"
|
||||
exiftool -AudioBitrate "$1" | awk '{print $4}'
|
||||
}
|
||||
|
||||
function _hostname-color {
|
||||
case `whoami` in
|
||||
'bsandidge') echo $blue;;
|
||||
'buddy') echo $blue;;
|
||||
'root') echo $bred;;
|
||||
*) echo $purple;;
|
||||
case "$(whoami)" in
|
||||
william) echo $blue;;
|
||||
buddy) echo $blue;;
|
||||
root) echo $bred;;
|
||||
*) echo $purple;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _hostname-show {
|
||||
hostname -s | tr '[A-Z]' '[a-z]'
|
||||
}
|
||||
|
||||
|
||||
36
bash/path
36
bash/path
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function _add-path {
|
||||
function add-path {
|
||||
dir="$1"
|
||||
if [[ $PATH =~ "$dir" ]]; then
|
||||
return
|
||||
@ -10,19 +10,21 @@ function _add-path {
|
||||
fi
|
||||
}
|
||||
|
||||
_add-path ~/.cargo/bin
|
||||
_add-path ~/go/bin
|
||||
_add-path /var/lib/gems/1.8/bin
|
||||
_add-path /Library/Frameworks/Python.framework/Versions/2.7/bin
|
||||
_add-path ~/Library/Python/2.7/bin
|
||||
_add-path ~/.rvm/bin
|
||||
_add-path ~/opt/bin
|
||||
_add-path /usr/local/mysql/bin
|
||||
_add-path /opt/vertica/bin
|
||||
_add-path /opt/local/bin
|
||||
_add-path /opt/local/sbin
|
||||
_add-path ~/bin
|
||||
_add-path /usr/local/go/bin
|
||||
_add-path ~/.bin
|
||||
_add-path ~/opt/depot_tools
|
||||
_add-path ~/.yarn/bin
|
||||
add-path ~/.cargo/bin
|
||||
add-path ~/go/bin
|
||||
add-path /var/lib/gems/1.8/bin
|
||||
add-path /Library/Frameworks/Python.framework/Versions/2.7/bin
|
||||
add-path ~/Library/Python/2.7/bin
|
||||
add-path ~/.rvm/bin
|
||||
add-path ~/opt/bin
|
||||
add-path /usr/local/mysql/bin
|
||||
add-path /opt/vertica/bin
|
||||
add-path /opt/local/bin
|
||||
add-path /opt/local/sbin
|
||||
add-path ~/bin
|
||||
add-path /usr/local/go/bin
|
||||
add-path ~/.bin
|
||||
add-path ~/opt/depot_tools
|
||||
add-path ~/.yarn/bin
|
||||
|
||||
unset -f _add-path
|
||||
|
||||
64
bashrc
64
bashrc
@ -1,53 +1,21 @@
|
||||
# If not running interactively, don't do anything
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
if [ -f ~/.bash/environment ]; then
|
||||
source ~/.bash/environment
|
||||
fi
|
||||
function source-file {
|
||||
file="$1"
|
||||
if [[ -f "$file" ]]; then
|
||||
. "$file"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f ~/.bash/path ]; then
|
||||
source ~/.bash/path
|
||||
fi
|
||||
source-file /etc/bash_completion
|
||||
source-file ~/.bash/colors
|
||||
source-file ~/.bash/aliases
|
||||
source-file ~/.bash/functions
|
||||
source-file ~/.bash/git-flow-completion
|
||||
source-file ~/.bash/path
|
||||
source-file ~/.bash/environment
|
||||
source-file ~/.bash/prompt
|
||||
source-file ~/opt/bash/env
|
||||
|
||||
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 ~/opt/bash/env ]; then
|
||||
source ~/opt/bash/env
|
||||
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
|
||||
|
||||
if [ -f /etc/bashrc ]; then
|
||||
source /etc/bashrc
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/prompt ]; then
|
||||
source ~/.bash/prompt
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/direnv-hook ]; then
|
||||
source ~/.bash/direnv-hook
|
||||
fi
|
||||
unset -f source-file
|
||||
|
||||
Loading…
Reference in New Issue
Block a user