Skip to content

Instantly share code, notes, and snippets.

View charlesthomas's full-sized avatar

Charles Thomas charlesthomas

View GitHub Profile
@codemonkey2841
codemonkey2841 / auto-ve
Last active August 29, 2015 14:01
Auto workon/deactivate a python virtualenv
function has_virtualenv() {
if [[ $PWD == $PROJECT_HOME* ]]; then
PRJCT_NAME=$(echo ${PWD//$PROJECT_HOME/} | cut -f 2 -d /)
if [ -n "$PRJCT_NAME" ]; then
if [ -e $WORKON_HOME/$PRJCT_NAME ]; then
if [ -z "$VIRTUAL_ENV" ]; then
workon $PRJCT_NAME
fi
return
fi
@abakula1
abakula1 / gi()
Last active August 29, 2015 13:57
Put a github link to your latest commit into your clipboard
gi(){
local githash=$(git log --pretty=format:'%H' -n 1)
local repoUrl=$(git ls-remote --get-url | sed 's/.*@//' | sed 's/.git//')
echo https://${repoUrl}/commit/${githash} | pbcopy
}