This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| sudo apt-get -y install language-pack-es-base | |
| sudo apt-get -y install postgresql-9.1 libpq-dev postgresql-9.1-postgis gdal-bin | |
| sudo apt-get -y install git python-pip python-dev | |
| sudo apt-get -y install libxml2-dev libxslt1-dev | |
| sudo -u postgres psql -c "CREATE ROLE dev LOGIN PASSWORD 'dev' SUPERUSER VALID UNTIL 'infinity';" | |
| sudo -u postgres createdb template_postgis | |
| sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql | |
| sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @register.assignment_tag | |
| def query(qs, **kwargs): | |
| """ template tag which allows queryset filtering. | |
| Usage: | |
| {% load query from operations %} | |
| {% query operations description="some things" as records %} | |
| {% for r in records %} | |
| ... | |
| {% endfor %} | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ git commit ... (1) | |
| $ git reset --soft "HEAD^" (2) | |
| $ edit (3) | |
| $ git add .... (4) | |
| $ git commit -c ORIG_HEAD (5) | |
| 1) This is what you want to undo | |
| 2) This is most often done when you remembered what you just committed is incomplete, or you misspelled your commit message, or both. Leaves working tree as it was before "reset". (The quotes are required if you use zsh) | |
| 3) Make corrections to working tree files. | |
| 4) Stage changes for commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def luhn_checksum(card_number): | |
| def digits_of(n): | |
| return [int(d) for d in str(n)] | |
| digits = digits_of(card_number) | |
| odd_digits = digits[-1::-2] | |
| even_digits = digits[-2::-2] | |
| checksum = 0 | |
| checksum += sum(odd_digits) | |
| for d in even_digits: | |
| checksum += sum(digits_of(d*2)) |
NewerOlder