Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
Last active January 15, 2021 12:51
Show Gist options
  • Save pcolazurdo/9a3e1ca7d1998ab9ce1bad8275c98b1e to your computer and use it in GitHub Desktop.
Save pcolazurdo/9a3e1ca7d1998ab9ce1bad8275c98b1e to your computer and use it in GitHub Desktop.
Shell Utils
# Set default blocksize for ls, df, du
# from this: http://hints.macworld.com/comment.php?mode=view&cid=24491
# ------------------------------------------------------------
export BLOCKSIZE=1k
# some utils
trash () { command mv "$@" ~/.Trash ; }
alias lr='ls -R 2>/dev/null| grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'' | less'
zipf () { zip -r "$1".zip "$1" ; } # zipf: To create a ZIP archive of a folder
qfind () { command find . -name "$@" 2>/dev/null ; }
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
# https://stackoverflow.com/a/43458830
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
# create commands to override pip restriction.
# use `gpip` or `gpip3` to force installation of
# a package in the global python environment
gpip(){
PIP_REQUIRE_VIRTUALENV="" pip "$@"
}
gpip3(){
PIP_REQUIRE_VIRTUALENV="" pip3 "$@"
}
# Configuration for virtualenv
export WORKON_HOME=$HOME/.virtualenvs
#export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
# s3cat util to 'cat' a file into stdout from S3
s3cat () {
aws s3 --quiet cp ${1} /dev/stdout
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment