Skip to content

Instantly share code, notes, and snippets.

View all.pytb
$ nosetests
ERROR: test_assert_true (test_stuff.TestFail)
Traceback (most recent call last):
File "/home/vagrant/", line 17, in test_assert_true
raise Exception
View foo.js
function FooObj(){
this.location = ""
this.setLocation= function (location){
this.location = location;
var foo = new FooObj();
View foo.pytb
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class PatchArg(object):
... def __init__(self, target, attribute, new):
... = target,
... self.attribute = attribute,
... = new
>>> PatchArg("foo", "bar", "blat")
import matplotlib.pyplot as plt
import numpy as np
input = open("stage2-input.bin", "rb").read()
bin = map(int, list(''.join(map(lambda s: s[2:], map(bin, map(ord, list(input)))))))
results = np.correlate(bin, bin, mode='full')
results = results[results.size/2:]
View gist:80b634a5513b7237519d
OfflineIMAP 6.5.4
Licensed under the GNU GPL v2+ (v2 or any later version)
Remote repository 'personal-remote': type 'IMAP'
Host: localhost Port: 1143 SSL: False
Establishing connection to localhost:1143
Server welcome string: * OK [CAPABILITY IMAP4REV1 AUTH=LOGIN IDLE MOVE] IMAP4rev1 DavMail 4.4.0-2198 server ready
Server capabilities: ('IMAP4REV1', 'AUTH=LOGIN', 'IDLE', 'MOVE')
folderfilter= lambda folder: folder == 'INBOX'
View ferengi-plan.txt
# The blog post that started it all:
# Current known FCC address ranges:
# Confirm/locate FCC IP ranges with this:
# In your nginx.conf:
location / {
from functools import wraps
class MyDecorator(object):
would normally be my_decorator because it's a function, and functions use underscore delimited lower-case.
Used CamelCase to demo that it's really a class.
def __init__(multiplier):
self.multiplier = multiplier
View gist:941fcced20c53ba063bd
Received: by with SMTP id 2csp295902obv;
Fri, 4 Jul 2014 09:16:25 -0700 (PDT)
X-Received: by with SMTP id q90mr19172514qgd.43.1404490584775;
Fri, 04 Jul 2014 09:16:24 -0700 (PDT)
Return-Path: <>
Received: from ([])
by with ESMTP id p66si34755143yhd.99.2014.
for <>;
>>> from django.conf import settings
>>> from django.template import Context, Template
>>> settings.DATETIME_FORMAT
'D j m Y H:i (e)'
>>> Template('{{deadline|date:"DATETIME_FORMAT"}}').render(Context({"deadline":}))
u'July 24, 2014, 11:45 a.m.'
from collections import defaultdict as DefaultDict
class DefaultClass(object):
def __init__(self, *args, **kwargs):
self.__dict__ = DefaultDict(*args, **kwargs)