- ipython / django-extensions
- model_mommy
- Learn a single text-editor well
- learning a few extra commands in Sublime-text has made a huge difference
| run-postgresql: | |
| service.running: | |
| - enable: true | |
| - name: postgresql-93 | |
| - require: | |
| - pkg: postgresql93 | |
| # I keep getting this error -> |
| ### previous SLS | |
| install-python-2.7.10-from-tarball: | |
| cmd.run: | |
| - names: | |
| - cd /usr/src | |
| - wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz | |
| - tar xzf Python-2.7.10.tgz | |
| - cd Python-2.7.10 | |
| - ./configure | |
| - make altinstall |
| def charge(self, account): | |
| """ | |
| Charge account for the monthly amount. This is triggered by | |
| a monthly cron job. | |
| """ | |
| self.check_balance(account) | |
| amount = settings.MONTHLY_CHARGE | |
| return self.create(account=account, amount=amount) |
Got this error when changing a ManyToMany 'through' table name
(django19)[~/Documents/bsrs/bsrs-django/bigsky]$ ./manage.py migrate
Operations to perform:
Apply all migrations: accounting, category, flatpages, contenttypes, admin, sites, person, ticket, auth, work_request, dtd, third_party, work_order, location, contact, generic, setting, translation, sessions, utils
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
def func(x, y, *args, **kwargs):
"""Summary
Parameters:
x (int) : first parameter
y: second parameter
with longer description
Raises:/Users/alelevier/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/pdb.sublime-snippet
<snippet>
| drop database ci_copy; | |
| create database ci_copy with template ci; | |
| \q | |
| drop database ci; | |
| create database ci with template ci_copy; | |
| \q | |
| drop database persistent_copy; | |
| create database persistent_copy with template persistent; |
| import requests | |
| import json | |
| url = "https://tidesandcurrents.noaa.gov/api/datagetter?begin_date=20170816&end_date=20170816&station=9410230&datum=MLLW&product=predictions&units=english&time_zone=lst&format=json" | |
| r = requests.get(url, headers=headers) | |
| content = r.content.decode('utf8') | |
| if 'wrong' not in content.lower(): | |
| try: | |
| data = json.loads(content) | |
| except Exception: |
| backupdb () { | |
| if [ $# -eq 0 ] | |
| then | |
| echo "db_name not specified" | |
| else | |
| db_name=$1 | |
| db_name_copy=${db_name}_copy | |
| psql -c "DROP DATABASE $db_name_copy;" | |
| psql -c "CREATE DATABASE $db_name_copy WITH TEMPLATE $db_name;" | |
| fi |