Skip to content

Instantly share code, notes, and snippets.

@KitB
KitB / load.py
Last active December 21, 2015 10:49
import imp
def get_module(name):
(file, p, desc) = imp.find_module(name)
m = imp.new_module(name)
exec file in m.__dict__
return m
_n_reloads = 0
#!/usr/bin/env python
from __future__ import braces
import time
True, False = False, True
class ExamBoard(object):
def submit(self, work):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
class ListDict(list):
""" List of dicts with rapid is-element-of operation for the whole thing.
(e.g. `(k, v) in list_dict`)
class Normalizer(object):
def __init__(self, vector_length):
_minima = np.zeros(vector_length)
_maxima = np.zeros(vector_length)
def update(self, vector):
np.minimum(self._minima, vector, self._minima)
np.maximum(self._maxima, vector, self._maxima)
def normalize(self, vector):
@KitB
KitB / dencode.py
Last active November 12, 2016 16:14
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import base64
import getpass
import math
import sys
def padpad(pad, text):
if len(text) > len(pad):