Skip to content

Instantly share code, notes, and snippets.

View mattrobenolt's full-sized avatar
🤠
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔

Matt Robenolt mattrobenolt

🤠
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔
View GitHub Profile
@mattrobenolt
mattrobenolt / wsgi.py
Last active October 27, 2015 18:48 — forked from mallyvai/wsgi.py
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
from raven.utils.wsgi import (
get_current_url, get_headers, get_environ)
class Sentry(object):
def __init__(self, application):
self.application = application
api:
build: .
command: python manage.py runserver 0.0.0.0:80
environment:
DJANGO_SETTINGS_MODULE: local_settings_api_service
ports:
- "80:80"
volumes:
- .:/usr/src
links:
FROM disqus/nginx:python2.7-light
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# First compile numpy by itself so we never have to do this again
COPY requirements/numpy.txt requirements/numpy.txt
RUN pip install --no-cache-dir -r requirements/numpy.txt
# Install dev stuff early becaues they prob don't change
package main
import (
"fmt"
"log"
"net/http"
"net/url"
"os/exec"
"time"
@mattrobenolt
mattrobenolt / wtf.py
Last active December 21, 2015 11:59 — forked from anonymous/wtf.py
class A(object):
def hook(self, f):
def intime(*args):
print intime.atime
intime.atime += 1
return f(*args)
intime.atime = 0
return intime
>>> f = A().hook(lambda b: b + 1)
from django.db import models
class DeviceA(object):
def do_something(self, string='Hello'):
print "Device A something '%s'" % string
def do_something_else(self):
print "Device A something else"
>>> f1 = lambda i: '%s' % i
>>> f2 = lambda i: '%s'.format(i)
>>> import dis
>>> dis.dis(f1)
1 0 LOAD_CONST 1 ('%s')
3 LOAD_FAST 0 (i)
6 BINARY_MODULO
7 RETURN_VALUE
>>> dis.dis(f2)
1 0 LOAD_CONST 1 ('%s')
foo = map(lambda s: {
# lol my lambda's body is indented
s = s.upper()
print s
return s
}, ['does', 'the', 'lambda', 'implicitly', 'end', 'after', 'toplevel', 'returns?'])
location /xml {
rewrite ^/xml/(.*)$ /$1;
proxy_pass http://xml.test.com;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
var secret_key = 'abcdefghijklmnopqrstuvwxyz';
var hash = crypto.createHash('sha1');
hash.update(secret_key);
console.log(unsign_value('8a8d431c4bee603699e3fd3e9593a3264af0f57c', 'value1'));
function unsign_value(signature, value)
{
var hmac = crypto.createHmac('sha1', hash.digest());
hmac.update(value);
console.log(signature);