Skip to content

Instantly share code, notes, and snippets.

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

Matt Robenolt mattrobenolt

🤠
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔
View GitHub Profile
$fh = fopen($box->download_url('862161200'), 'r'); // Open box.net file
$tmp = tempnam(sys_get_temp_dir(), 'DOC'); // create tmp file
print_r($tmp);
echo '<br />';
$tfh = fopen($tmp, 'w');
fwrite($tfh, fread($fh, 13421772)); // write bytes from box.net file to tmp file
fseek($tfh, 0);
// Then load tmp file into ZipArchive->open() and use this function:
http://www.botskool.com/geeks/how-extract-text-docx-or-odt-files-using-php
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);
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;
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?'])
>>> 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')
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"
@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)
package main
import (
"fmt"
"log"
"net/http"
"net/url"
"os/exec"
"time"
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
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: