62 lines
2.1 KiB
Bash
62 lines
2.1 KiB
Bash
# Global network bashrc/profile file
|
|
# Updated 2019-11-12
|
|
|
|
function venv() {
|
|
DIR="/home/$USERNAME/.venvs"
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "No command specified"
|
|
|
|
elif [ $1 = "--help" ] || [ $1 = '-h' ]; then
|
|
echo "Custom python Virtualenv manager
|
|
\"Because pipenv is too hard and everything else sucks\"
|
|
|
|
Commands:
|
|
list List available virtualenvs
|
|
show Alias of list
|
|
delete <venv> Delete a virtualenv
|
|
del Alias of delete
|
|
rm Alias of delete
|
|
load <venv> Activate a virtualenv for usage
|
|
new <venv> <python> Create a new virtualenv. If <python> is not specified,
|
|
then the system default python is used
|
|
"
|
|
elif [ $1 = "list" ] || [ $1 = "show" ] || [ $1 = "ls" ]; then
|
|
ls $DIR
|
|
elif [ $1 = "load" ]; then
|
|
. $DIR/$2/bin/activate
|
|
elif [ $1 = "new" ]; then
|
|
virtualenv $DIR/$2 --python=$3
|
|
elif [ $1 = "delete" ] || [ $1 = "del" ] || [ $1 = "rm" ]; then
|
|
rm -rf $DIR/$2
|
|
elif [ $1 = "go" ]; then
|
|
cd $DIR/$2
|
|
fi
|
|
}
|
|
|
|
function parse_git_branch() {
|
|
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
|
|
}
|
|
|
|
function up() { cd $(eval printf '../'%.0s {1..$1}); }
|
|
|
|
function pipin() { pip freeze | grep $1; }
|
|
|
|
alias bk='cd -'
|
|
alias fuck='sudo $(history -p \!\!)'
|
|
alias doc='cd ~/Documents'
|
|
alias dn='cd ~/Downloads'
|
|
alias version='uname -orp && lsb_release -a | grep Description'
|
|
alias activate='source ./bin/activate'
|
|
alias ipconfig='ip address show'
|
|
alias cls='clear'
|
|
alias mklink='ln -s'
|
|
alias ls='/usr/bin/ls -lshF --color --group-directories-first --time-style=long-iso'
|
|
alias gg='cd ~/Git'
|
|
alias gmtime='/usr/bin/date -u --iso-8601=seconds'
|
|
alias date='/usr/bin/date --iso-8601=seconds'
|
|
alias whatismyip='curl https://icanhazip.com/'
|
|
|
|
export rc=/home/$USERNAME/.bashrc
|
|
export PS1="\[\e[0;97m\]\[\e[37m\e[1m\]\u\[\e[1;94m\]@\[\e[94m\]\H\[\e[0;33m\]$(parse_git_branch) \[\e[37m\]\w\[\e[33m\] \[\e[0;97m\]$\[\e[0m\] "
|