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 logging | |
from distutils import log | |
logging.basicConfig(level=logging.DEBUG) | |
log.set_verbosity(log.DEBUG) | |
from cffi import FFI |
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 math | |
import colorsys | |
from itertools import product | |
from noise import snoise2 | |
from PIL import Image | |
import numpy as np | |
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
from itertools import product | |
import random | |
from noise import snoise2 | |
from PIL import Image | |
import numpy as np | |
size = (500, 500) |
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 asyncio | |
import time | |
HOST = "localhost" | |
PORT = 8888 | |
class Client(asyncio.Protocol): | |
def __init__(self, message, loop, host, port): | |
self.message = message |
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 Message: | |
def __init__(self, command, params, trailing, prefix=None, raw_line=None): | |
self.prefix = prefix | |
self.command = command.upper() | |
self.params = params | |
self.trailing = trailing | |
self._raw_line = raw_line |
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 szip: | |
def __init__(self, *sequences): | |
self.sequences = sequences | |
def __len__(self): | |
return min(len(seq) for seq in self.sequences) | |
def __getitem__(self, index): | |
if isinstance(index, slice): | |
return szip(*(seq[index] for seq in self.sequences)) |
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 python3.5 | |
import asyncio | |
from collections import namedtuple | |
import functools | |
import random | |
Message = namedtuple('Message', 'prefix command params') | |
Prefix = namedtuple('Prefix', 'nick ident host') |
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 ast | |
import _ast | |
import importlib.util | |
import os | |
import sys | |
from types import ModuleType | |
class PluginException(Exception): |
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
# sample output of a basic midi file https://gist.github.com/knitori/35a7d3a69189f35f655d9edb99b10b66 | |
import struct | |
import io | |
def track_reader(buf): | |
while True: | |
marker = buf.read(4) | |
if marker == b'': |
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 functools | |
import time | |
def timed_cache(seconds, typed=False): | |
def _decorator(user_function): | |
cache = {} | |
sentinel = object() |
OlderNewer