Skip to content

Instantly share code, notes, and snippets.

View jacobb's full-sized avatar

Jacob Burch-Hill jacobb

View GitHub Profile
# internal publish endpoint (keep it private / protected)
location /publish {
set $push_channel_id $arg_id; #/?id=239aff3 or somesuch
push_publisher;
push_store_messages on; # enable message queueing
push_message_timeout 2h; # expire buffered messages after 2 hours
push_max_message_buffer_length 10; # store 10 messages
push_min_message_recipients 0; # minimum recipients before purge
}
@jacobb
jacobb / memcache.py
Created June 20, 2010 22:10 — forked from noahsilas/gist:446050
memcache_normal.py
"Memcached cache backend"
import time
from django.conf import settings
from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
from django.utils.encoding import smart_unicode, smart_str
class CacheClass(BaseCache):
def __init__(self, server, params):
@jacobb
jacobb / gist:749396
Created December 21, 2010 02:26
settings used to test pylibmc support in django
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3'
},
'other': {
'ENGINE': 'django.db.backends.sqlite3',
'TEST_NAME': 'other_db'
}
}
@jacobb
jacobb / private.xml
Created January 16, 2012 21:37
KeyRemap private.xml example
<?xml version="1.0"?>
<root>
<list>
<item>
<name>Swap Space and Tab</name>
<identifier>private.swap_space_and_tab</identifier>
<autogen>--KeyToKey-- KeyCode::SPACE, KeyCode::TAB</autogen>
<autogen>--KeyToKey-- KeyCode::TAB, KeyCode::SPACE</autogen>
</item>
<item>
# ~/.pypirc
find_links = http://localhost/pypi/
@jacobb
jacobb / photo.py
Created June 17, 2012 00:37 — forked from mvattuone/photo.py
Photo Upload - MV
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.conf import settings
from django.shortcuts import render
import json
import md5
/*
SublimeLinter default settings
*/
{
/*
Sets the mode in which SublimeLinter runs:
true - Linting occurs in the background as you type (the default).
false - Linting only occurs when you initiate it.
"load-save" - Linting occurs only when a file is loaded and saved.
<?xml version="1.0"?>
<root>
<list>
<item>
<name>Swap Space and Tab</name>
<identifier>private.swap_space_and_tab</identifier>
<autogen>--KeyToKey-- KeyCode::SPACE, KeyCode::TAB</autogen>
<autogen>--KeyToKey-- KeyCode::TAB, KeyCode::SPACE</autogen>
</item>
<item>
@jacobb
jacobb / nap.txt
Created August 4, 2012 08:41
Nap Example
This is a sample nap gist!
class Choice(object):
def __init__(self, *args):
self._data = tuple([
(value, value) if isinstance(value, str) else value
for value in args
])
self._data_dict = dict(self._data)