I hereby claim:
- I am cshoe on github.
- I am cshoe (https://keybase.io/cshoe) on keybase.
- I have a public key whose fingerprint is 2DB5 0FC0 C3FF F9EF D3A9 76A2 1E0B 7699 6E4C 5D94
To claim this, I am signing this object:
# -*- coding: utf-8 -*- | |
from __future__ import (absolute_import, division, print_function, | |
unicode_literals) | |
from datadog import statsd | |
def main(): | |
"""docstring for main""" |
import functools | |
import threading | |
from tornado import gen, httpserver, ioloop, stack_context, web | |
class ThreadRequestContext(object): | |
""" | |
A context manager that saves some per-thread state globally. | |
Intended for use with Tornado's StackContext. |
import time | |
from contextlib import contextmanager | |
@contextmanager | |
def timed(metric, tags=None): | |
start = time.time() | |
try: | |
yield tags | |
finally: | |
print tags |
I hereby claim:
To claim this, I am signing this object:
# As mentioned, this is a bit verbose but I like the separation of concerns. | |
# Basically, you have two functions -- one that does meaningful work and | |
# another that just serves as the "glue" to connect the Django signal | |
# infrastructure to your function. | |
from django.dispatch import receiver | |
@receiver | |
def glue_funtion(sender, **kwargs): | |
""" |
I hereby claim:
To claim this, I am signing this object:
import sys | |
from xml.etree import ElementTree | |
from jinja2 import Template | |
template_string = """{\\rtf1\\ansi\\ansicpg1252\cocoartf1265\cocoasubrtf190 | |
{\\fonttbl\\f0\fswiss\\fcharset0 ArialMT;\\f1\\froman\\fcharset0 Times-Roman;} | |
{\colortbl;\\red255\green255\\blue255;} |
FROM ubuntu:12.04 | |
MAINTAINER Chris Schomaker <[email protected]> | |
# add salt repository | |
RUN sudo apt-get update | |
RUN sudo apt-get install -y python-software-properties | |
RUN sudo add-apt-repository -y ppa:saltstack/salt | |
RUN sudo apt-get update |
from readability import ReaderClient | |
rdb_client = ReaderClient('my_reader_token', 'my_reader_secret', 'user_key', 'user_secret') | |
bookmarks_response = rdb_client.get_bookmarks(favorite=True) | |
print bookmarks_response.content | |
>>> {'bookmarks': [{'user_id': 1039419, 'read_percent': u'0.00', u'tags': [], u'date_updated': u'2013-05-31 08:22:57', u'favorite': True, u'archive': False, u'date_archived': None, u'date_opened': None, u'article': … } |
# -*- coding: utf-8 -*- | |
import json | |
import urllib | |
import requests | |
CONTENT = """ | |
<html lang="en" dir="ltr" class="client-js"><head> | |
<title>Cryptography - Wikipedia, the free encyclopedia</title> |