Skip to content

Instantly share code, notes, and snippets.

Mike Krieger mikeyk

  • Instagram
  • San Francisco, CA
Block or report user

Report or block mikeyk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mikeyk / reconnect.diff
Created Jun 30, 2011
Automatically retry on AutoReconnect exception in pymongo
View reconnect.diff
diff --git a/pymongo/ b/pymongo/
index b444f50..7635c78 100644
--- a/pymongo/
+++ b/pymongo/
@@ -46,6 +46,7 @@ from pymongo import (database,
from pymongo.cursor_manager import CursorManager
+from pymongo.decorators import reconnect
from pymongo.errors import (AutoReconnect,
View gist:1030141
==> Downloading
File already downloaded in /Users/mkrieger/Library/Caches/Homebrew
/usr/bin/tar xf /Users/mkrieger/Library/Caches/Homebrew/geos-3.3.0.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/geos/3.3.0 --disable-debug --disable-dependency-tracking
./configure --prefix=/usr/local/Cellar/geos/3.3.0 --disable-debug --disable-dependency-tracking
configure: WARNING: unrecognized options: --disable-debug
checking build system type... i386-apple-darwin11.0.0
checking host system type... i386-apple-darwin11.0.0
checking target system type... i386-apple-darwin11.0.0
View gist:918102
set nocompatible
set autoindent
set si
set smartindent
set esckeys
" set highlight=8r,db,es,hs,mb,Mr,nu,rs,sr,tb,vr,ws
set magic
mikeyk /
Created Apr 8, 2011
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
View gist:883615
/home/ubuntu/src/redis/redis/ in _execute_command
return self.parse_response(command_name, **options) ...
▼ Local vars
Variable Value
u'<redis.client.Redis object at 0xabbb02c>'
View Warn you if you left NSZombieEnabled on
// placed in my applicationDidFinishLaunchingWithOptions
if(getenv("NSZombieEnabled") || getenv("NSAutoreleaseFreedObjectCheckEnabled"))
NSLog(@"NSZombieEnabled/NSAutoreleaseFreedObjectCheckEnabled enabled!");
View Grab all Device IDs from Apple Provisioning Portal
// first use the jQuerify plugin here:
$jq("tbody tr", $("#fs-0")).each(function(index, el){
var nameTD = $jq("", el);
var nameSpan = $jq("span", nameTD);
var name = nameSpan.attr("title") ? nameSpan.attr("title") : nameSpan.text();
var deviceID = $jq("", el).attr("title");
console.log(name + '\t' + deviceID);
View gist:324606
function Post(){};
Post.prototype = {test : function(){console.log("hello there")}};
p = new Post();
/* but I prefer to do two things differently: define my member functions in the 'class' function, and have objects inherit from objects: */
function Post() {
this.test = function(){ console.log("hello there") }
View gist:247097
/* for query: nearby?lat=37.756988&lon=-122.394458&boxheight=0.001449&boxwidth=0.001449&days=60&apiv=1 */
{"discarded": 0, "num_results": 51, "result_set": [{"category": "Vehicle Theft", "description": "Stolen automobile", "timestamp": 1250335800.0, "lon": -122.394072983, "incident": "090831906", "lat": 37.7576318072}, {"category": "Assault", "description": "Battery", "timestamp": 1249933500.0, "lon": -122.395208449, "incident": "090813346", "lat": 37.7565874457}, {"category": "Assault", "description": "Battery", "timestamp": 1248226200.0, "lon": -122.395383155, "incident": "090742983", "lat": 37.7568374893}, {"category": "Drug\/narcotic", "description": "Possession of base\/rock cocaine for sale", "timestamp": 1252990860.0, "lon": -122.395636483, "incident": "090949060", "lat": 37.7567322847}, {"category": "Assault", "description": "Battery", "timestamp": 1250029800.0, "lon": -122.395685391, "incident": "090817940", "lat": 37.7570410309}, {"category": "Robbery", "description": "Robbery, armed with a knife",
You can’t perform that action at this time.