Eventually platforms outgrow the single-source-tree model and become distributed systems. A common pattern in these distributed systems is distributed composition via event buffering. Here we motivate and describe this event buffering pattern.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""This is a demonstration of sharing file descriptors across processes. | |
It uses Tornado (need a recent post-2.0 version from github) and the | |
multiprocessing module (from python 2.6+). To run it, start one copy | |
of fdserver.py and one or more copies of testserver.py (in different | |
terminals, or backgrounded, etc). Fetch http://localhost:8000 and | |
you'll see the requests getting answered by different processes (it's | |
normal for several requests to go to the same process under light | |
load, but under heavier load it tends to even out). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.fb_access_token | |
.fbconsole.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#~/.mutt/aliases | |
alias nick Nicholas Levandoski <nick.levandoski@auglug.org> | |
alias tim Timothy Pitt <timothy.pitt@auglug.org> | |
alias steven Steven Jackson <sjackson@auglug.org> | |
alias kaleb Kaleb Hornsby <kaleb.hornsby@auglug.org> | |
alias alug-admin nick, tim, steven |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding:utf-8 -*- | |
import sys | |
import urllib2 | |
# This script uses HEAD requests (with fallback in case of 405) | |
# to follow the redirect path up to the real URL | |
# (c) 2012 Filippo Valsorda - FiloSottile | |
# Released under the GPL license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
class HeadRequest(urllib2.Request): | |
def get_method(self): | |
return "HEAD" | |
class HEADRedirectHandler(urllib2.HTTPRedirectHandler): | |
""" | |
Subclass the HTTPRedirectHandler to make it use our | |
HeadRequest also on the redirected URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import HTMLParser | |
class IDParser(HTMLParser.HTMLParser): | |
"""Modified HTMLParser that isolates a tag with the specified id""" | |
def __init__(self, id): | |
self.id = id | |
self.result = None | |
self.started = False | |
self.depth = {} | |
self.html = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
OlderNewer