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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""A native python implementation of the par2 file format. | |
This is only intended to be able to read packets in par2, not execute | |
repair, verify, or create new par2 files.""" | |
import struct |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Simple gevent POC to check how to get ZMQ sockets working with | |
subprocesses spawned by a simple process.""" | |
# this code doesn't seem to work properly; it has a | |
# tendency to hang at various parts of the req/rep process | |
# all of this stuff works flawlessly if you change: |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Simple eventlet POC to check how to get ZMQ sockets working with | |
subprocesses spawned by a simple process.""" | |
import os | |
import eventlet | |
import multiprocessing |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Which json is the best json.""" | |
import json | |
import simplejson as sjson | |
import ujson | |
import cjson | |
import bson |
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
#!/bin/bash | |
# capture an area on OSX and run quickup on the produced file | |
CAPPATH="$HOME/tmp-capture.png" | |
if [ -n `which screencapture` ]; then | |
screencapture -i $CAPPATH | |
# esc exits screencapture without writing, don't try to upload in this case |
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
#!/usr/bin/env python | |
from lxml.html.clean import Cleaner | |
from lxml.html import defs | |
class AttrWhitelistCleaner(Cleaner): | |
"""An HTML Cleaner that can use an attribute whitelist. Defaults to using | |
the attributes that are whitelisted by default with ``safe_attrs_only`` | |
turned on.""" | |
def __init__(self, **kw): |
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
#!/bin/bash | |
PORT="8000" | |
usage() { | |
cat << EOF | |
usage: $0 host [port] | |
EOF | |
} |
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
// Selectable implements a simple interface which allows to get the inner text | |
// of some element as well as run a CSS select on it and get a list of nodes | |
type Selectable interface { | |
CssSelect(selector string) []Node | |
Text() string | |
} | |
// A node wrapper, in order to provide a similar interface in the future | |
// possibly without gokogiri | |
type Node struct { |
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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"github.com/moovweb/gokogiri" | |
"github.com/moovweb/gokogiri/css" | |
"github.com/moovweb/gokogiri/html" | |
"github.com/moovweb/gokogiri/xml" | |
"github.com/moovweb/gokogiri/xpath" |
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
const ( | |
white = iota + 89 | |
black | |
red | |
green | |
yellow | |
blue | |
purple | |
) |