Last active
August 25, 2017 04:06
-
-
Save dhoeric/260d9d8193bdd0c8b6e1 to your computer and use it in GitHub Desktop.
A snippet for auto-load/unload virtualenv by calling `workon` on a directory. This can be added on .profile/.bashrc/.zshrc, etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Call virtualenvwrapper's "workon" if .venv exists. This is modified from-- | |
# http://justinlilly.com/python/virtualenv_wrapper_helper.html | |
# and https://gist.github.com/cjerdonek/7583644 | |
has_virtualenv() { | |
if [ -e .venv ]; then | |
ENV_NAME=`cat .venv` | |
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME" | |
elif [ $CD_VIRTUAL_ENV ]; then | |
deactivate && unset CD_VIRTUAL_ENV | |
fi | |
} | |
venv_cd () { | |
cd "$@" && has_virtualenv | |
} | |
has_virtualenv | |
alias cd="venv_cd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alias | |
alias rm="rm -i" | |
alias cp="cp -i" | |
alias mv="mv -i" | |
# add z into path | |
. `brew --prefix`/etc/profile.d/z.sh | |
# app shortcut | |
tn () { /usr/local/bin/terminal-notifier -message "$@" -sound "glass" } | |
ip2geo () { /usr/bin/curl ipinfo.io/$@ } | |
# iterm2 integration | |
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" | |
source /usr/local/dev-env/ansible/mac_profile | |
# ntfy | |
export PATH="$PATH:~/.bin" | |
eval "$(ntfy shell-integration)" | |
export AUTO_NTFY_DONE_IGNORE="vim ssh vimdiff" | |
# tools specific env | |
for f in ~/.env/*; do source $f; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment