Skip to content

Instantly share code, notes, and snippets.

View narfdotpl's full-sized avatar

Maciej Konieczny aka narf narfdotpl

View GitHub Profile
@narfdotpl
narfdotpl / jc.py
Created August 15, 2011 09:58
invalidate Johnny Cache
#!/usr/bin/env python
# encoding: utf-8
"""
Invalidate Johnny Cache's cache for given models outside "normal Django"
(e.g. in a management command).
"""
from johnny.cache import invalidate
from johnny.middleware import QueryCacheMiddleware
@narfdotpl
narfdotpl / gist:1180921
Created August 30, 2011 13:47
memory leak in a Django app
# source of a massive memory leak in a Django app (if obj is QuerySet):
if not obj:
return None
@narfdotpl
narfdotpl / magic.py
Created September 23, 2011 23:04
JS game engines by number of watchers
#!/usr/bin/env python
# encoding: utf-8
"""
Get list of JavaScript game engines ordered by number of watchers at GitHub.
"""
import json
from BeautifulSoup import BeautifulSoup
import requests
@narfdotpl
narfdotpl / README.md
Created October 10, 2011 19:36
PyWaw troll
@narfdotpl
narfdotpl / mini.md
Created January 6, 2012 22:06
Mini based cars
@narfdotpl
narfdotpl / gist:1835101
Created February 15, 2012 11:09
running tests with Johnny Cache on

Oh, the joys of running tests with Johnny Cache on...

ipdb> Currency.objects.all()
[]
ipdb> Currency.objects.get(symbol='EUR')
<Currency: EUR/PLN>
ipdb> Currency.objects.count()

0

@narfdotpl
narfdotpl / gist:2036612
Created March 14, 2012 13:50
node wat

EDIT: solved -_-'


Etsy's statsd. Halp.

> node stats.js

/Users/narf/sandbox/statsd/config.js:33

{ graphitePort: 2003, graphiteHost: "localhost", port: 8125 }

@narfdotpl
narfdotpl / gist:4336266
Last active December 9, 2015 22:18
CPMA vs OS X

moved to

@narfdotpl
narfdotpl / votes.py
Last active December 10, 2015 22:28 — forked from mstepniowski/results.txt
#!/usr/bin/env python
# Requirements: requests, lxml, cssselect
import requests
from lxml import html
TALKNAME = "TITLE OF MY AMAZING TALK (it's a secret!)"
COLOR = '\033[1;34m'
END = '\033[0m'
r = requests.get('http://2013.djangocon.eu/vote/')
@narfdotpl
narfdotpl / gist:5352984
Created April 10, 2013 08:49
GFM italicisation bug

foo foo

(bar) (bar)

(baz ) (baz )

( qux)