Skip to content

Instantly share code, notes, and snippets.

@srossross
Last active February 14, 2017 22:34
Show Gist options
  • Save srossross/8cacb00c260dd60b2aea27597ef73a16 to your computer and use it in GitHub Desktop.
Save srossross/8cacb00c260dd60b2aea27597ef73a16 to your computer and use it in GitHub Desktop.
My Environment Files
[alias]
ci = commit
co = checkout
st = status
ss = status -sb
ssb = submodule foreach 'git status -sb'
br = branch
bb = for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
bn = !git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | tail -n 10
clean-branches = !git branch -d $(git branch --merged develop | grep -v 'develop')
[color]
ui = always
# [credential]
# [core]
# editor = subl -n -w
# [push]
# default = simple
# [credential]
# helper = osxkeychain
function envtitle {
if [ -z "$CONDA_DEFAULT_ENV" ]; then
ENV_TXT="root"
else
ENV_TXT=$(basename $CONDA_DEFAULT_ENV)
fi
PWD=$(pwd)
CUR_DIR=$(basename $PWD)
echo -n -e "\033]0;[env:$ENV_TXT] $CUR_DIR \007"
}
# Thanks to this post:
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x
brew install cabextract
cd ~/Downloads
mkdir consolas
cd consolas
curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
cabextract PowerPointViewer.exe
cabextract ppviewer.cab
open CONSOLA*.TTF
function exitstatus {
EXITSTATUS="$?"
HAPPY_FACE1="•‿•)"
ANGRY_FACE1="ಠ_ಠ)"
BOLD="\[\033[1m\]"
RED="\[\033[1;31m\]"
GREEN="\[\e[32;1m\]"
BLUE="\[\e[34;1m\]"
OFF="\[\033[m\]"
PROMPT="(\u@samson ${BLUE}\W${OFF}"
if [ "${EXITSTATUS}" -eq 0 ]
then
PS1="${PROMPT} ${BOLD}${GREEN}${HAPPY_FACE1}${OFF} "
else
PS1="${PROMPT} ${BOLD}${RED}$ANGRY_FACE1${OFF} "
fi
PS2="${BOLD}>${OFF} "
}
export PROMPT_COMMAND="exitstatus; envtitle; $PROMPT_COMMAND"
pyedit (){
### Function to open python module in editor
### Usage example: pyedit this
xpyc=`python -c "import sys; stdout = sys.stdout; sys.stdout = sys.stderr; import $1; stdout.write($1.__file__)"`
if [ "$xpyc" == "" ]; then
echo "Python module $1 not found"
elif [[ $xpyc == *__init__.py* ]]; then
xpydir=`dirname $xpyc`;
echo "$EDITOR $xpydir";
$EDITOR "$xpydir";
else
echo "$EDITOR ${xpyc%.*}.py";
$EDITOR "${xpyc%.*}.py";
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment