Skip to content

Instantly share code, notes, and snippets.

@rouge8
rouge8 / .gitignore
Last active August 29, 2015 13:57
Makefile path weirdness
node_modules
@rouge8
rouge8 / benchmark.sh
Last active August 29, 2015 14:01
pypy performance regression with fastavro https://bugs.pypy.org/issue1770
#!/bin/bash
set -eu
VENV_DIR=/tmp/fastavro-venv
function cleanup() {
rm -rf "$VENV_DIR"
}
function benchmark() {

Keybase proof

I hereby claim:

  • I am rouge8 on github.
  • I am rouge8 (https://keybase.io/rouge8) on keybase.
  • I have a public key whose fingerprint is 8615 0BD5 3032 4028 AAD0 86A1 D112 A173 40AD 85F8

To claim this, I am signing this object:

@rouge8
rouge8 / check-deps
Last active August 29, 2015 14:13
Check that a requirements.txt file is fully satisfied (including its dependencies) by the current environment. Useful for verifying installs done with `pip install --no-deps`
#!/usr/bin/env python
from argparse import ArgumentParser
import pkg_resources
def main():
parser = ArgumentParser('Check that a requirements.txt file is satisifed '
'by the current environment.')
parser.add_argument('filename')
import pytest
@pytest.mark.parametrize('val', [
b'\xac\x10\x02G',
b'\xfe\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xad\xbe\xef',
b'\x7f\x00\x00\x01',
])
def test_fail(val):
assert False
@rouge8
rouge8 / README.md
Last active December 9, 2015 22:48
Circles

Just some random circles.

Click to make them disappear! Or add more!

@rouge8
rouge8 / index.html
Last active December 12, 2015 00:39
<!DOCTYPE html>
<html lang="en">
<head>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/bootstrap.min.js"></script>
<style type="text/css">
.row-fluid > .sidebar {
width: 280px;
position: absolute !important;
@rouge8
rouge8 / filters.py
Last active December 14, 2015 23:39
active links
from django import template
register = template.Library()
@register.filter
def startswith(value, arg):
"""Usage, {% if value|starts_with:"arg" %}"""
return value.startswith(arg)
@rouge8
rouge8 / README.md
Last active December 16, 2015 10:49
vim formula that uses homebrew python
  1. Install Python

    brew install python --framework
    
  2. Link /usr/local/lib/python2.7/config

    ln -s /usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/Current/lib/python2.7/config /usr/local/lib/python2.7/config
    
@rouge8
rouge8 / fields.py
Created April 25, 2013 21:23
Django REST Framework DictField
from ast import literal_eval
class DictField(serializers.WritableField):
type_name = 'DictField'
def from_native(self, value):
if isinstance(value, basestring):
try:
value = literal_eval(value)
except SyntaxError: