Skip to content

Instantly share code, notes, and snippets.

vbabiy@app13:/etc/varnish$ curl -X PURGE -H "Host: www.smithsonianmag.com" http://127.0.0.1:6081/travel/underwater-museum-180951559/ -I
HTTP/1.1 200 Purged.
Server: Varnish
Content-Type: text/html; charset=utf-8
Content-Length: 9218
Accept-Ranges: bytes
Date: Thu, 12 Jun 2014 19:13:06 GMT
X-Varnish: 1816509156
Age: 0
Via: 1.1 varnish
@vbabiy
vbabiy / python_resources.md
Created March 27, 2014 15:28 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@vbabiy
vbabiy / 0_reuse_code.js
Created March 27, 2014 15:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Error: Syntax error, unrecognized expression: <form ng-controller="DeleteMonitorModalCtrl">
<p class="message hr">
Are you sure you want to delete this monitor? Your new monthly total will be <b>{{ total | currency }}</b>.
</p>
<div class="buttons">
<button type="submit" ng-click="success(monitor)">Yes</button>
<button type="button" ng-click="failure()">No</button>
</div>
</form>
at Function.Sizzle.error (http://localhost:8000/static/bower_components/jquery/jquery.js:4421:8)
@vbabiy
vbabiy / sys.yml
Last active December 22, 2015 17:19
nginx:
pkg:
- installed
service:
- running
- require:
- pkg: nginx
- watch:
- file: /etc/nginx/sites-enabled/{{ pillar['application']['name'] }}
ppa:
pkgrepo.managed:
- ppa: chris-lea/node.js
- require_in:
- pkg: nodejs
- pkg: npm
@vbabiy
vbabiy / node.yaml
Last active December 22, 2015 17:09
nodejs:
pkg.installed:
- pkgs:
- nodejs: '0.10.18-1chl1~precise1'
- npm
@vbabiy
vbabiy / after.py
Last active December 20, 2015 04:59
class TestHome(TestCase):
def get_home(self):
return self.client.get('/')
def test_home_template_used(self):
self.assertTemplateUsed(self.get_home(), 'home.html')
def test_home_template_contains_hello_world(self):
self.assertContains(self.client.get('/'), 'Hello World')
@vbabiy
vbabiy / became.py
Created July 24, 2013 22:48
Working extract method
class TestHome(TestCase):
def test_home_template_used(self):
res = self.get_name()
self.assertTemplateUsed(res, 'home.html')
def get_name(self):
res = self.client.get('/')
return res
def test_home_template_contains_hello_world(self):
@vbabiy
vbabiy / parsers.py
Last active March 29, 2020 22:36
CamelCaseJSONRenderer For django rest framework
from rest_framework.parsers import JSONParser
from django.conf import settings
import re
import json
first_cap_re = re.compile('(.)([A-Z][a-z]+)')
all_cap_re = re.compile('([a-z0-9])([A-Z])')
def camel_to_underscore(name):
s1 = first_cap_re.sub(r'\1_\2', name)