Skip to content

Instantly share code, notes, and snippets.

View benauthor's full-sized avatar

Evan Bender benauthor

View GitHub Profile
@benauthor
benauthor / example.py
Created October 21, 2016 14:40
statsd logger sketch
import logging
import os
from logging.handlers import DatagramHandler
HOST_KEY = "STATSD_HOST"
PORT_KEY = "STATSD_PORT"
logger = logging.getLogger("test")
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"cool": {
"enum": [
"a",
"b"
]
},
@benauthor
benauthor / reverso.py
Created August 22, 2014 04:16
Simulate a right-to-left regex with negative lookahead and backref
import re
def get_matches(regex, mystring):
return [i.group(0) for i in re.finditer(regex, mystring)]
input1 = 'A Foo, A Foo qux: Foo qux: Foo qux:'
regex1 = r'Foo.*?qux:'
print get_matches(regex1, input1)
# >>> ['Foo, Foo qux:', 'Foo qux:', 'Foo qux:']
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg);">
<scene id="scene1">
<label t="translate(0,346)">