Skip to content

Instantly share code, notes, and snippets.

@joncombe
Last active November 18, 2022 07:30
Show Gist options
  • Save joncombe/94b099d545a18cb970f8 to your computer and use it in GitHub Desktop.
Save joncombe/94b099d545a18cb970f8 to your computer and use it in GitHub Desktop.
Personal .bash_aliases file
# get latest .bash_aliases file (you will need to logout and log back in to use it)
updateba() {
cd ~
rm .bash_aliases
wget https://gist.githubusercontent.com/joncombe/94b099d545a18cb970f8/raw/.bash_aliases --no-cache
}
# ng serve with host and default port
alias ngs='ng serve --host 0.0.0.0 --port 8001'
alias ngsp='ng serve --host 0.0.0.0 --disable-host-check --live-reload-client http://0.0.0.0:8001 --port 8001 --proxy-config proxy.conf.json'
# launch django runserver
alias dj='python manage.py runserver 0.0.0.0:8000'
alias dj01='python manage.py runserver 0.0.0.0:8001'
alias dj81='python manage.py runserver 0.0.0.0:8081'
# django management
alias pms='python manage.py shell'
alias pmdb='python manage.py dbshell'
alias pmmm='python manage.py makemigrations'
alias pmm='python manage.py migrate'
alias damm='django-admin makemessages'
alias dacm='django-admin compilemessages'
alias cel='celery -A www worker -l info'
# mkdocs
alias mks='mkdocs serve'
alias mkb='mkdocs build'
# virtualenv / venv start / stop
alias vv='python3 -m venv env'
alias src='source ../env/bin/activate'
alias de='deactivate'
alias pf='pip freeze | grep -v "pkg-resources"'
alias pfr='(pip freeze | grep -v "pkg-resources") > requirements.txt'
alias pir='pip install -r requirements.txt'
# recursively remove all .pyc files
alias delpyc='find . -type f -name "*.pyc" -exec rm -f {} \;'
# kill an unresponsive django dev server
kdj() {
kill `ps -ef | grep manage.py | grep -v grep | awk '{print $2}'`
}
# jump to the /var/www directory
alias vw='cd /var/www'
# empty memcached
emc() {
echo 'flush_all' | nc localhost 11211
}
# set www-data perms permission on the current folder
perms() {
sudo chown -R www-data:www-data .
sudo chmod -R g+rw .
}
# git
alias gita='git add .'
alias gits='git status'
alias gitc='git commit'
alias gitd='git diff'
alias gitps='git push'
alias gitpl='git pull'
alias gitpa='for i in $(find . -name ".git" -type d); do ( echo; echo $i; cd $i/..; git pull; ); done'
alias gitsa='for i in $(find . -name ".git" -type d); do ( echo; echo $i; cd $i/..; git status; ); done'
# docker
alias dcu='docker compose up'
alias dcd='docker compose down'
alias drma='docker stop $(docker ps -aq) && docker rm $(docker ps -aq)'
# crate
alias crateapi='source env/bin/activate && FLASK_LOGGING=DEBUG FLASK_HOST=0.0.0.0 FLASK_PORT=8080 cloud-api'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment