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 time | |
import pymemcache.client | |
import pymemcache.serde | |
class PoliteClient(pymemcache.client.Client): | |
"""A sublcass of :class:`~pymemcache.client.Client`, which | |
waits a configurable period before attempting to reconnect | |
after a disconnect. |
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
init_config: | |
instances: | |
- host: localhost | |
port: 10104 | |
name: master | |
conf: | |
- include: | |
domain: hadoop | |
bean: hadoop:name=MasterStatistics,service=Master |
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
>>> def foo(a, b, c): | |
... if a: | |
... return b | |
... return c | |
... | |
>>> dis.dis(foo) | |
2 0 LOAD_FAST 0 (a) | |
3 POP_JUMP_IF_FALSE 10 | |
3 6 LOAD_FAST 1 (b) |
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
Verifying I am +dcrosta on my passcard. https://onename.com/dcrosta |
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 random | |
class Foo(object): | |
def __init__(self, a, b): | |
self.a = a | |
self.b = b | |
foos = [ | |
Foo(random.randint(0, 100), random.randint(100, 1000)) | |
for _ in xrange(10000) |
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 time | |
class PageCategoryFilter(object): | |
def __init__(self, config): | |
self.mode = config["mode"] | |
self.categories = config["categories"] | |
def filter(self, bid_request): | |
if self.mode == "whitelist": |
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
# report will be something like: | |
# | |
# { test_name: 'signup button', | |
# alternatives: ['Red', 'Green'], | |
# results: [ | |
# { attempted: 248, | |
# completed: 12 | |
# }, | |
# { | |
# attempted: 226, |
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
from flask import Flask | |
app = Flask(__init__) | |
@app.route('/', methods=['GET']) | |
def getindex(): | |
return 'You did a GET' | |
@app.route('/', methods=['POST']) | |
def postindex(): | |
return 'You did a POST' |
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
>>> def adder(amt): | |
... def inner(start): | |
... return start + amt | |
... return inner | |
... | |
>>> plusone = adder(1) | |
>>> plusone(4) | |
5 |
OlderNewer