For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
diff --git a/pymongo/connection.py b/pymongo/connection.py | |
index b444f50..7635c78 100644 | |
--- a/pymongo/connection.py | |
+++ b/pymongo/connection.py | |
@@ -46,6 +46,7 @@ from pymongo import (database, | |
helpers, | |
message) | |
from pymongo.cursor_manager import CursorManager | |
+from pymongo.decorators import reconnect | |
from pymongo.errors import (AutoReconnect, |
import functools | |
import pymongo | |
import logging | |
import time | |
MAX_AUTO_RECONNECT_ATTEMPTS = 5 | |
def graceful_auto_reconnect(mongo_op_func): | |
"""Gracefully handle a reconnection event.""" | |
@functools.wraps(mongo_op_func) |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
This article is now published on my website: Prefer Subshells for Context.
/* See: http://0x10c.com/doc/dcpu-16.txt */ | |
function hex(n) { | |
return '0x' + n.toString(16); | |
} | |
function disassemble (code) { | |
var PC = 0; | |
var operand = function (bits) { |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This document lays out some baseline expectations between conference speakers and conference presenters. The general goal is to maximize the value the conference provides to its attendees and community and to let speakers know what they might reasonably expect from a conference.
We believe that all speakers should reasonably expect these things, not just speakers who are known to draw large crowds, because no one is a rockstar but more people should have the chance to be one. We believe that conferences are better -- and, dare we say, more diverse -- when the people speaking are not just the people who can afford to get themselves there, either because their company paid or they foot the bill themselves. Basically, this isn't a rock show rider, it's some ideas that should help get the voices of lesser known folks heard.
These expectations should serve as a starting point for discussion between speaker and organizer. They are not a list of demands; they are a list of rea
function curry(f) { | |
return function(x) { | |
var g = f.bind(this, x); | |
if(g.length == 0) return g(); | |
if(arguments.length > 1) return curry(g).apply(this, [].slice.call(arguments, 1)); | |
return curry(g); | |
}; | |
} | |
var sum = curry(function(x, y) { |
/* a macro that defines a context variable that is stored in thread local | |
storage. It's implemented as a module that exports a `get`, `set` and | |
`set_to` function. `set_to` acts as a stack. */ | |
macro_rules! context_var (($name:ident : $t:ty) => ( | |
mod $name { | |
/* internal tls key helper */ | |
fn key(_x: @$t) {} | |
/* checks if the variable is set */ | |
pub fn is_set() -> bool { unsafe { |