Skip to content

Instantly share code, notes, and snippets.

@marcusshepp
Last active May 2, 2016 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusshepp/ef3166b79a3c3b6cad0c4746a09d5e1d to your computer and use it in GitHub Desktop.
Save marcusshepp/ef3166b79a3c3b6cad0c4746a09d5e1d to your computer and use it in GitHub Desktop.
mkmanagementcommand(){
# creates a new management command
# arg1: app name
mkdir $1/management;
touch $1/__init__.py;
mkdir $1/management/commands;
touch $1/management/commands/__init__.py;
touch $1/management/commands/$2.py;
}
add_ci(){
# puts you straight into a commit message
git add --all;
git commit;
}
remkvirtualenv(){
# recreates a virtualenv
# arg1: virtualenv name
deactivate;
rmvirtualenv $1;
mkvirtualenv $1;
pip install -r requirements.txt;
clear;
}
v_switch(){
echo "switching vagrant box"
cd ~/projects/$1/to-vagrant/;
vagrant halt;
cd ~/projects/$2/to-vagrant/;
vagrant up;
workon $2;
cd ..;
echo "switched";
}
load_pg(){
# name of pg
# name of project
# must have to-vagrant
python ~/projects/admin-scripts/import_pgdump.py ~/projects/tech-ops/pg_dumps/$1 ~/projects/$2/to-vagrant;
cd ~/project/$2;
workon $2;
}
new_vagrant(){
# clones to-vagrant and starts the vm
git clone git@git.techops.cmich.edu:internal/to-vagrant.git;
cd to-vagrant;
vagrant up;
}
vup(){
vagrant up;
# vagrant ssh --command "sudo apt-get upgrade && sudo apt-get update";
}
remkmigrations(){
# recreates an initial migration file
# useful for messing around with django models
echo "remaking migrations for $1..";
echo "**before**";
ls $1/migrations;
echo "**removing**";
rm -rf $1/migrations/0001*;
ls $1/migrations;
echo "**makemigrations**";
python manage.py makemigrations $1;
ls $1/migrations;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment