This file contains hidden or 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
<!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)"> |
This file contains hidden or 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 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:'] |
This file contains hidden or 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
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"type": "object", | |
"properties": { | |
"cool": { | |
"enum": [ | |
"a", | |
"b" | |
] | |
}, |
This file contains hidden or 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 logging | |
import os | |
from logging.handlers import DatagramHandler | |
HOST_KEY = "STATSD_HOST" | |
PORT_KEY = "STATSD_PORT" | |
logger = logging.getLogger("test") |
This file contains hidden or 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
#!/bin/bash | |
mysqldump -d \ | |
--skip-add-drop-table \ | |
--skip-add-locks \ | |
--skip-disable-keys \ | |
--skip-set-charset $@ \ | |
| grep -v SET | head -n -2 | tail -n +7 |
This file contains hidden or 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
class AttrDict(dict): | |
def __init__(self, *args, **kwargs): | |
super(AttrDict, self).__init__(*args, **kwargs) | |
self.__dict__ = self | |
class Choices(dict): | |
pass |
This file contains hidden or 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
#!/bin/bash | |
args="--merged" | |
echo "delete some merged branches:" | |
{ git branch $args | grep -E -v "master|stable|prod|\*" | cut -c 3- | while read -r branchname; do | |
read -r -u 3 -p "Delete $branchname (y/n)? " answer | |
case ${answer:0:1} in | |
y|Y ) | |
git branch -d "$branchname" | |
;; |
This file contains hidden or 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 | |
""" | |
A local 'statsd' server for dev purposes | |
""" | |
from __future__ import print_function | |
import socket | |
import sys | |
def main(port): |
This file contains hidden or 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
#!/bin/bash | |
echo 'cleaning old kernels. fuck you, ubuntu.' | |
df -h /boot | |
echo 'all versions' | |
dpkg --list | grep -P "linux-image" | |
echo 'maybe delete' | |
dpkg --list | grep -P "linux-image-\d" | tr -s " " | cut -d " " -f 2 | sort | head -n -1 |
This file contains hidden or 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 time import sleep | |
class retriable(object): | |
""" | |
A retrying decorator with backoff. | |
Use it like so: | |
@retriable(tries=60, initial_backoff=60, backoff_multiplier=1) |
OlderNewer