This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import braces | |
import time | |
True, False = False, True | |
class ExamBoard(object): | |
def submit(self, work): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |