clean up bash config

main
Buddy Sandidge 6 years ago
parent 1074406b66
commit aabb888752

@ -1,50 +1,32 @@
#!/usr/bin/env bash #!/usr/bin/env bash
pods_dir='~/podcasts' music_dir='~/music'
desktop_dir='~/desktop'
docs_dir='~/documents'
# Aliases for OS X # Aliases for OS X
if [[ `uname` == 'Darwin' ]]; then if [[ $(uname) == Darwin ]]; then
alias ls='ls -G'
alias grep='grep --color'
alias fgrep='fgrep --color'
alias egrep='egrep --color'
music_dir='~/Music' music_dir='~/Music'
desktop_dir='~/Desktop' desktop_dir='~/Desktop'
docs_dir='~/Documents' 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 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 grep='grep --color=auto' alias ls='ls --color=auto'
alias fgrep='fgrep --color=auto' alias dir='dir --color=auto'
alias egrep='egrep --color=auto' alias vdir='vdir --color=auto'
fi alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias dash-v1='cd ~/code/insight-platform && ~/src/grails-1.2.2/bin/grails run-app -https -Xms800m -Xmx1000m -XX:PermSize=200m' # Move around to common locations
alias desktop="cd $desktop_dir"
# Fix vagrant up errors on Mavericks alias podcasts="cd ~/podcasts"
# http://davidwalsh.name/fixing-vagrant-errors alias code='cd ~/code/ '
alias fix-vagrant='sudo /Library/StartupItems/VirtualBox/VirtualBox restart' alias music="cd $music_dir"
alias documents="cd $docs_dir"
alias docker-env='eval $(docker-machine env default)' unset -v music_dir
unset -v desktop_dir
unset -v docs_dir
# Some common aliases # Some common aliases
alias ll='ls -alF' 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 ' 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 # 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 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 #!/usr/bin/env bash
# append to the history file, don't overwrite it
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Disable capslock # Disable capslock
if [[ -x `which setxkbmap` ]]; then if [[ -x $(which setxkbmap) ]]; then
if [[ `uname` == 'Linux' ]]; then if [[ $(uname) == Linux ]]; then
setxkbmap -option ctrl:nocaps setxkbmap -option ctrl:nocaps
fi fi
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 # don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace # ... or force ignoredups and ignorespace
export HISTCONTROL=ignoredups:erasedups:ignorespace export HISTCONTROL=ignoredups:erasedups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# Use empty string for unlimited history # Use empty string for unlimited history
export HISTSIZE= export HISTSIZE=
export HISTFILESIZE= export HISTFILESIZE=
export HISTTIMEFORMAT='%y-%m-%d %T λ ' 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
# make less more friendly for non-text input files, see lesspipe(1) # make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
if [ "$TERM" == "xterm" ]; then # enable color support of ls and also add handy aliases
export TERM=xterm-256color if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi fi
if [[ $(uname) == 'Darwin' ]]; then if [ "$TERM" == xterm ]; then
export BS_OS='osx' export TERM=xterm-256color
elif [[ $(uname) == 'Linux' ]]; then
export BS_OS='linux'
fi fi
export EDITOR='vim'
[[ -f ~/.nvm/nvm.sh ]] && source ~/.nvm/nvm.sh [[ -f ~/.nvm/nvm.sh ]] && source ~/.nvm/nvm.sh
[[ -r $NVM_DIR/bash_completion ]] && source $NVM_DIR/bash_completion [[ -r $NVM_DIR/bash_completion ]] && source $NVM_DIR/bash_completion

@ -1,19 +1,14 @@
#!/usr/bin/env bash #!/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 { function min-jpg {
tmpfile=`mktemp` tmpfile=$(mktemp)
ogfile="$1" ogfile="$1"
jpegtran -optimize -perfect -outfile $tmpfile $ogfile jpegtran -optimize -perfect -outfile $tmpfile $ogfile
mv $tmpfile $ogfile mv $tmpfile $ogfile
} }
function min-png { function min-png {
tmpfile=`mktemp` tmpfile=$(mktemp)
ogfile="$1" ogfile="$1"
pngcrush -rem alla -reduce -brute $ogfile $tmpfile pngcrush -rem alla -reduce -brute $ogfile $tmpfile
mv $tmpfile $ogfile mv $tmpfile $ogfile
@ -34,32 +29,29 @@ function parse_git_branch {
} }
function get-create-date { function get-create-date {
date=`date -r "$1" +"%F"` date -r "$1" +"%F"
echo $date
} }
function add-date-prefix { function add-date-prefix {
DIR=`dirname "$1"` DIR=$(dirname "$1")
FILE=`basename "$1"` FILE=$(basename "$1")
DATE=`date -r "$1" +"%F"` DATE=$(date -r "$1" +"%F")
mv "$1" "$DIR/$DATE_$FILE" mv "$1" "$DIR/$DATE_$FILE"
} }
function get-bitrate { function get-bitrate {
echo `exiftool -AudioBitrate "$1" | awk '{print $4}'`": $1" exiftool -AudioBitrate "$1" | awk '{print $4}'
} }
function _hostname-color { function _hostname-color {
case `whoami` in case "$(whoami)" in
'bsandidge') echo $blue;; william) echo $blue;;
'buddy') echo $blue;; buddy) echo $blue;;
'root') echo $bred;; root) echo $bred;;
*) echo $purple;; *) echo $purple;;
esac esac
} }
function _hostname-show { function _hostname-show {
hostname -s | tr '[A-Z]' '[a-z]' hostname -s | tr '[A-Z]' '[a-z]'
} }

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
function _add-path { function add-path {
dir="$1" dir="$1"
if [[ $PATH =~ "$dir" ]]; then if [[ $PATH =~ "$dir" ]]; then
return return
@ -10,19 +10,21 @@ function _add-path {
fi fi
} }
_add-path ~/.cargo/bin add-path ~/.cargo/bin
_add-path ~/go/bin add-path ~/go/bin
_add-path /var/lib/gems/1.8/bin add-path /var/lib/gems/1.8/bin
_add-path /Library/Frameworks/Python.framework/Versions/2.7/bin add-path /Library/Frameworks/Python.framework/Versions/2.7/bin
_add-path ~/Library/Python/2.7/bin add-path ~/Library/Python/2.7/bin
_add-path ~/.rvm/bin add-path ~/.rvm/bin
_add-path ~/opt/bin add-path ~/opt/bin
_add-path /usr/local/mysql/bin add-path /usr/local/mysql/bin
_add-path /opt/vertica/bin add-path /opt/vertica/bin
_add-path /opt/local/bin add-path /opt/local/bin
_add-path /opt/local/sbin add-path /opt/local/sbin
_add-path ~/bin add-path ~/bin
_add-path /usr/local/go/bin add-path /usr/local/go/bin
_add-path ~/.bin add-path ~/.bin
_add-path ~/opt/depot_tools add-path ~/opt/depot_tools
_add-path ~/.yarn/bin add-path ~/.yarn/bin
unset -f _add-path

@ -1,53 +1,21 @@
# If not running interactively, don't do anything # If not running interactively, don't do anything
[ -z "$PS1" ] && return [ -z "$PS1" ] && return
if [ -f ~/.bash/environment ]; then function source-file {
source ~/.bash/environment file="$1"
fi if [[ -f "$file" ]]; then
. "$file"
if [ -f ~/.bash/path ]; then fi
source ~/.bash/path }
fi
source-file /etc/bash_completion
if [ -f ~/.bash/colors ]; then source-file ~/.bash/colors
source ~/.bash/colors source-file ~/.bash/aliases
fi source-file ~/.bash/functions
source-file ~/.bash/git-flow-completion
if [ -f ~/.bash/functions ]; then source-file ~/.bash/path
source ~/.bash/functions source-file ~/.bash/environment
fi source-file ~/.bash/prompt
source-file ~/opt/bash/env
if [ -f ~/.bash/aliases ]; then
source ~/.bash/aliases unset -f source-file
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

Loading…
Cancel
Save