I hereby claim:
- I am dcrosta on github.
- I am dcrosta (https://keybase.io/dcrosta) on keybase.
- I have a public key ASAQuXx8EHZPizgcpBHawcB0kva5JXCAN-74HvWotp4aJgo
To claim this, I am signing this object:
import re | |
from HTMLParser import HTMLParser | |
whitespace = re.compile('(\w+)') | |
class HTMLAbbrev(HTMLParser): | |
def __init__(self, maxlength, *args, **kwargs): | |
HTMLParser.__init__(self, *args, **kwargs) | |
self.stack = [] |
I hereby claim:
To claim this, I am signing this object:
>>> api.host_tags('my.hostname.com') | |
['role:base', 'env:prod', 'role:bidder'] | |
>>> api.host_tags('my.hostname.com') | |
['role:base', 'env:prod'] | |
>>> api.host_tags('my.hostname.com') | |
['role:base', 'env:prod', 'role:bidder'] | |
>>> api.host_tags('my.hostname.com') | |
['region:us-east-1', 'role:hdat', 'role:base', 'availability-zone:us-east-1c', 'image:ami-1624987f', 'security-group:sg-a89e60c1', 'instance-type:m1.xlarge', 'name:[redacted]', 'kernel:aki-88aa75e1', 'env:qa', 'security-group:sg-71968219'] | |
>>> api.host_tags('my.hostname.com') | |
['role:base', 'env:prod', 'role:bidder'] |
init_config: | |
instances: | |
- host: localhost | |
port: 10101 | |
name: master | |
conf: | |
- include: | |
domain: hadoop | |
bean: hadoop:name=MasterStatistics,service=Master |
init_config: | |
instances: | |
- host: localhost | |
port: 10101 | |
name: regionserver | |
conf: | |
- include: | |
domain: hadoop | |
bean: name=RegionServerStatistics,service=RegionServer |
-----> Heroku receiving push | |
-----> Python app detected | |
-----> Preparing Python interpreter (2.7.2) | |
-----> Creating Virtualenv version 1.7.2 | |
New python executable in .heroku/venv/bin/python2.7 | |
Not overwriting existing python script .heroku/venv/bin/python (you must use .heroku/venv/bin/python2.7) | |
Installing distribute..................................................................................................................................................................................................done. | |
Installing pip................done. | |
Overwriting .heroku/venv/bin/activate with new content | |
Overwriting .heroku/venv/bin/activate.fish with new content |
import sys | |
class TheModule(object): | |
def __getattr__(self, name): | |
# you can do whatever you want with `name` here | |
print (self, name) | |
sys.modules[__name__] = TheModule() |
Guess the output: | |
>>> def exec_code_object_and_return_x(codeobj, x): | |
... exec codeobj | |
... return x | |
... | |
>>> co1 = compile("""x = x + 1""", '<string>', 'exec') | |
>>> co2 = compile("""del x""", '<string>', 'exec') | |
>>> exec_code_object_and_return_x(co1, 1) | |
# What do you get here? |
from functools import wraps | |
class Equalizer(object): | |
def __init__(self, rv): | |
self._rv = rv | |
def __eq__(self, other): | |
assert self._rv == other | |
class Puny(object): |
class openFiles(object): | |
def __init__(self, *args): | |
if not all(isinstance(arg, tuple) for arg in args): | |
raise TypeError('arguments to openFiles must all be 2-tuples') | |
if not all(len(arg) in (1, 2) for arg in args): | |
raise TypeError('arguments to openFiles must all be 2-tuples') | |
self.args = args | |
def __enter__(self): | |
self.fhs = [file(*arg) for arg in self.args] |