Skip to content

Instantly share code, notes, and snippets.

View ashwoods's full-sized avatar

Ashley Camba ashwoods

View GitHub Profile
server {
listen *:80 default;
server_name _;
location / {
client_max_body_size 1G;
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@ashwoods
ashwoods / install-teamcity.md
Last active March 8, 2024 23:10 — forked from sandcastle/install-teamcity.md
Install TeamCity 10.0.2 on Debian/Ubuntu with Nginx

Install

Follow the steps below to install Team City 10.0.2 on Debian/Ubuntu with Nginx as the proxy for port 80.

Requirements:

  • curl
  • configure utf-8 locale of your choice (recommended)

Install Team City:

@ashwoods
ashwoods / cache.conf
Last active August 31, 2016 17:53
Example nginx configuration with SSL, uwsgi, Cache
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;

Keybase proof

I hereby claim:

  • I am ashwoods on github.
  • I am ashwoods (https://keybase.io/ashwoods) on keybase.
  • I have a public key whose fingerprint is E4F4 E15C BB1E 0062 1F90 9F24 DE62 ADE2 A6C6 A243

To claim this, I am signing this object:

sudo apt-get install ruby-dev
sudo gem install rdoc
sudo gem install guard
sudo gem install guard-livereload

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
##teamcity[testFailed message='Error' error='true' name='test_entry_code_award_counter' details='Traceback (most recent call last):|n File "/vagrant/submitz/apps/entries/tests.py", line 36, in test_entry_code_award_counter|n self.assertEqual(|'%s-%04d|' % (entry.category.code, i), entry.code)|n File "/vagrant/submitz/apps/entries/models.py", line 190, in code|n position = self.award_position|n File "/vagrant/submitz/apps/entries/models.py", line 212, in award_position|n row_number = raw[0|].row_number - 1|n File "/home/vagrant/.virtualenvs/submitz/local/lib/python2.7/site-packages/django/db/models/query.py", line 1617, in __getitem__|n return list(self)[k|]|n File "/home/vagrant/.virtualenvs/submitz/local/lib/python2.7/site-packages/django/db/models/query.py", line 1600, in __iter__|n instance = model_cls(**model_init_kwargs)|n File "/vagrant/submitz/apps/entries/models.py", line 85, in __init__|n self._status = self.status|n File "/home/vagrant/.virtualenvs/submitz/local/lib/python2.
##teamcity[testFailed message='Error' error='true' name='test_entry_code_award_counter' details='Traceback (most recent call last):|n File "/vagrant/submitz/apps/entries/tests.py", line 36, in test_entry_code_award_counter|n self.assertEqual(|'%s-%04d|' % (entry.category.code, i), entry.code)|n File "/vagrant/submitz/apps/entries/models.py", line 190, in code|n position = self.award_position|n File "/vagrant/submitz/apps/entries/models.py", line 212, in award_position|n row_number = raw[0|].row_number - 1|n File "/home/vagrant/.virtualenvs/submitz/local/lib/python2.7/site-packages/django/db/models/query.py", line 1617, in __getitem__|n return list(self)[k|]|n File "/home/vagrant/.virtualenvs/submitz/local/lib/python2.7/site-packages/django/db/models/query.py", line 1600, in __iter__|n instance = model_cls(**model_init_kwargs)|n File "/vagrant/submitz/apps/entries/models.py", line 85, in __init__|n self._status = self.status|n File "/home/vagrant/.virtualenvs/submitz/local/lib/python2.
@ashwoods
ashwoods / gist:6973308
Last active April 26, 2018 12:33
entry creation in transaction.
INSERT INTO "entries_entry" ("created",
"modified",
"award_id",
"category_id",
"user_id",
"status",
"status_changed",
"position",
"price",
"title")
@ashwoods
ashwoods / gist:6883938
Created October 8, 2013 12:29
tirolissimo export
for entry in award_entries:
try:
extra_data = entry.entrydata_set.get(slug='step1')
kunde = extra_data.answer.get('kunde')
agentur = extra_data.answer.get('agentur')
except:
kunde = None
agentur = None
entry_row = [