Merge branch 'master' into superstack

pull/212/head
Jason Benterou 2013-06-02 21:56:38 -07:00
commit ec4dc7b303
12 changed files with 326 additions and 22 deletions

View File

@ -13,7 +13,7 @@ alias _="sudo"
if [ $(uname) = "Linux" ]
then
alias ls="ls --color=always"
alias ls="ls --color=auto"
fi
which gshuf &> /dev/null
if [ $? -eq 1 ]
@ -40,7 +40,7 @@ alias piano='pianobar'
alias ..='cd ..' # Go up one directory
alias ...='cd ../..' # Go up two directories
alias ....='cd ../../..' # Go up two directories
alias ....='cd ../../..' # Go up three directories
alias -- -='cd -' # Go back
# Shell History

View File

@ -11,6 +11,8 @@ alias gst='git status'
alias gs='git status'
alias gss='git status -s'
alias gl='git pull'
alias gpr='git pull --rebase'
alias gpp='git pull && git push'
alias gup='git fetch && git rebase'
alias gp='git push'
alias gpo='git push origin'
@ -27,7 +29,12 @@ alias gexport='git archive --format zip --output'
alias gdel='git branch -D'
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master'
alias gll='git log --graph --pretty=oneline --abbrev-commit'
alias gg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias ggs="gg --stat"
alias gsl="git shortlog -sn"
alias gw="git whatchanged"
if [ -z "$EDITOR" ]; then
case $OSTYPE in
linux*)
alias gd='git diff | vim -R -'
@ -35,7 +42,10 @@ case $OSTYPE in
darwin*)
alias gd='git diff | mate'
;;
darwin*)
*)
alias gd='git diff'
;;
esac
else
alias gd="git diff | $EDITOR"
fi

View File

@ -0,0 +1,49 @@
cite 'about-alias'
about-alias 'jitsu task abbreviations'
# jitsu
alias j='jitsu'
alias jl='jitsu login'
alias jo='jitsu logout'
# deploy and update
alias jd='jitsu apps deploy'
alias ju='jitsu apps update'
# new and start, restart, stop
alias jn='jitsu apps create'
alias js='jitsu apps start'
alias jr='jitsu apps restart'
alias jx='jitsu apps stop'
# logs
alias jll='jitsu logs'
alias jlog='jitsu logs'
alias jlogs='jitsu logs'
# env
alias je='jitsu env'
alias jel='jitsu env list'
alias jes='jitsu env set'
alias jeg='jitsu env get'
alias jed='jitsu env delete'
alias jec='jitsu env clear'
alias jesv='jitsu env save'
alias jeld='jitsu env load'
# configuration
alias jc='jitsu conf'
alias jcl='jitsu config list'
alias jcs='jitsu config set'
alias jcg='jitsu config get'
alias jcd='jitsu config delete'
# list and install, view
alias jls='jitsu list'
alias jin='jitsu install'
alias jv='jitsu apps view'
# Database, Snapshots and Tokens
alias jdb='jitsu databases'
alias jss='jitsu snapshots'
alias jto='jitsu tokens'

View File

@ -23,3 +23,12 @@ fi
# Requires growlnotify, which can be found in the Growl DMG under "Extras"
alias grnot='growlnotify -s -t Terminal -m "Done"'
# Get rid of those pesky .DS_Store files recursively
alias dsclean='find . -type f -name .DS_Store -print0 | xargs -0 rm'
# Track who is listening to your iTunes music
alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689'
# Flush your dns cache
alias flush='dscacheutil -flushcache'

View File

@ -0,0 +1,135 @@
#!/usr/bin/env bash
_bash-it-comp-enable-disable()
{
local enable_disable_args="alias plugin completion"
COMPREPLY=( $(compgen -W "${enable_disable_args}" -- ${cur}) )
}
_bash-it-comp-list-available-not-enabled()
{
subdirectory="$1"
local available_things=$(for f in `ls -1 $BASH_IT/$subdirectory/available/*.bash`;
do
if [ ! -e $BASH_IT/$subdirectory/enabled/$(basename $f) ]
then
basename $f | cut -d'.' -f1
fi
done)
COMPREPLY=( $(compgen -W "all ${available_things}" -- ${cur}) )
}
_bash-it-comp-list-enabled()
{
subdirectory="$1"
local enabled_things=$(for f in `ls -1 $BASH_IT/$subdirectory/enabled/*.bash`;
do
basename $f | cut -d'.' -f1
done)
COMPREPLY=( $(compgen -W "all ${enabled_things}" -- ${cur}) )
}
_bash-it-comp-list-available()
{
subdirectory="$1"
local enabled_things=$(for f in `ls -1 $BASH_IT/$subdirectory/available/*.bash`;
do
basename $f | cut -d'.' -f1
done)
COMPREPLY=( $(compgen -W "${enabled_things}" -- ${cur}) )
}
_bash-it-comp()
{
local cur prev opts prevprev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="help show enable disable"
case "${prev}" in
show)
local show_args="plugins aliases completions"
COMPREPLY=( $(compgen -W "${show_args}" -- ${cur}) )
return 0
;;
help)
local help_args="plugins aliases"
COMPREPLY=( $(compgen -W "${help_args}" -- ${cur}) )
return 0
;;
enable)
_bash-it-comp-enable-disable
return 0
;;
disable)
_bash-it-comp-enable-disable
return 0
;;
aliases)
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
case "${prevprev}" in
help)
_bash-it-comp-list-available aliases
return 0
;;
esac
;;
alias)
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
case "${prevprev}" in
enable)
_bash-it-comp-list-available-not-enabled aliases
return 0
;;
disable)
_bash-it-comp-list-enabled aliases
return 0
;;
esac
;;
plugin)
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
case "${prevprev}" in
enable)
_bash-it-comp-list-available-not-enabled plugins
return 0
;;
disable)
_bash-it-comp-list-enabled plugins
return 0
;;
esac
;;
completion)
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
case "${prevprev}" in
enable)
_bash-it-comp-list-available-not-enabled completion
return 0
;;
disable)
_bash-it-comp-list-enabled completion
return 0
;;
esac
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _bash-it-comp bash-it

View File

@ -0,0 +1,72 @@
# #########################################################################
# This bash script adds tab-completion feature to django-admin.py and
# manage.py.
#
# Testing it out without installing
# =================================
#
# To test out the completion without "installing" this, just run this file
# directly, like so:
#
# . ~/path/to/django_bash_completion
#
# Note: There's a dot ('.') at the beginning of that command.
#
# After you do that, tab completion will immediately be made available in your
# current Bash shell. But it won't be available next time you log in.
#
# Installing
# ==========
#
# To install this, point to this file from your .bash_profile, like so:
#
# . ~/path/to/django_bash_completion
#
# Do the same in your .bashrc if .bashrc doesn't invoke .bash_profile.
#
# Settings will take effect the next time you log in.
#
# Uninstalling
# ============
#
# To uninstall, just remove the line from your .bash_profile and .bashrc.
_django_completion()
{
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
DJANGO_AUTO_COMPLETE=1 $1 ) )
}
complete -F _django_completion -o default django-admin.py manage.py django-admin
_python_django_completion()
{
if [[ ${COMP_CWORD} -ge 2 ]]; then
PYTHON_EXE=$( basename -- ${COMP_WORDS[0]} )
echo $PYTHON_EXE | egrep "python([2-9]\.[0-9])?" >/dev/null 2>&1
if [[ $? == 0 ]]; then
PYTHON_SCRIPT=$( basename -- ${COMP_WORDS[1]} )
echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1
if [[ $? == 0 ]]; then
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \
COMP_CWORD=$(( COMP_CWORD-1 )) \
DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} ) )
fi
fi
fi
}
# Support for multiple interpreters.
unset pythons
if command -v whereis &>/dev/null; then
python_interpreters=$(whereis python | cut -d " " -f 2-)
for python in $python_interpreters; do
pythons="${pythons} $(basename -- $python)"
done
pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ")
else
pythons=python
fi
complete -F _python_django_completion -o default $pythons

View File

@ -0,0 +1,11 @@
# pip bash completion start
_pip_completion()
{
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
PIP_AUTO_COMPLETE=1 $1 ) )
}
complete -o default -F _pip_completion pip
# pip bash completion end

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
BASH_IT="$HOME/.bash_it"
cp $HOME/.bash_profile $HOME/.bash_profile.bak
test -w $HOME/.bash_profile &&
cp $HOME/.bash_profile $HOME/.bash_profile.bak &&
echo "Your original .bash_profile has been backed up to .bash_profile.bak"
cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/.bash_profile

View File

@ -277,6 +277,8 @@ _enable-thing ()
return
fi
mkdir -p $BASH_IT/$subdirectory/enabled
ln -s $BASH_IT/$subdirectory/available/$plugin $BASH_IT/$subdirectory/enabled/$plugin
fi

View File

@ -0,0 +1,9 @@
cite about-plugin
about-plugin 'Node.js helper functions'
export PATH=./node_modules/.bin:$PATH
# Make sure the global npm prefix is on the path
[[ `which npm` ]] && export PATH=$(npm config get prefix)/bin:$PATH

View File

@ -11,7 +11,7 @@ function mkvenv {
group 'virtualenv'
cwd=`basename \`pwd\``
mkvirtualenv --no-site-packages --distribute $cwd
mkvirtualenv --distribute $cwd
}
@ -19,7 +19,7 @@ function mkvbranch {
about 'create a new virtualenv for the current branch'
group 'virtualenv'
mkvirtualenv --no-site-packages --distribute "$(basename `pwd`)@$(git_prompt_info)"
mkvirtualenv --distribute "$(basename `pwd`)@$(git_prompt_info)"
}
function wovbranch {
@ -28,3 +28,10 @@ function wovbranch {
workon "$(basename `pwd`)@$(git_prompt_info)"
}
function wovenv {
about 'works on the virtualenv for this directory'
group 'virtualenv'
workon "$(basename `pwd`)"
}

View File

@ -108,8 +108,8 @@ function hg_prompt_vars {
fi
SCM_PREFIX=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
SCM_SUFFIX=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}
SCM_BRANCH=$(hg summary 2> /dev/null | grep branch | awk '{print $2}')
SCM_CHANGE=$(hg summary 2> /dev/null | grep parent | awk '{print $2}')
SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}')
SCM_CHANGE=$(hg summary 2> /dev/null | grep parent: | awk '{print $2}')
}
function rvm_version_prompt {
@ -137,8 +137,8 @@ function ruby_version_prompt {
}
function virtualenv_prompt {
if which virtualenv &> /dev/null; then
virtualenv=$([ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`") || return
if [[ -n "$VIRTUAL_ENV" ]]; then
virtualenv=`basename "$VIRTUAL_ENV"`
echo -e "$VIRTUALENV_THEME_PROMPT_PREFIX$virtualenv$VIRTUALENV_THEME_PROMPT_SUFFIX"
fi
}