This file contains hidden or 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 functools import wraps | |
from inspect import signature | |
def curry(func): | |
if not callable(func): | |
raise TypeError('argumment must be callable') | |
sig = signature(func) |
This file contains hidden or 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 re | |
class Color: | |
""" | |
colors defined as escape sequences for fancy output. | |
easy to use but dont work on all terminals | |
https://en.wikipedia.org/wiki/ANSI_escape_code | |
""" | |
@classmethod |
This file contains hidden or 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 random import randint, shuffle, choice, random | |
from collections import defaultdict | |
from math import log10 | |
import time | |
import re | |
import os | |
SEQ_LENGTH = 10 | |
POPULATION = 100 | |
REPETITION_PENALITY = 0.9 |
This file contains hidden or 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
''' | |
Created by Jeacom | |
This is a experimental utility module for constructing and concatenating regular expressions | |
such that we can reuse them to build more complex regexes out of simpler ones. all hidden behind | |
a readable python interface so we don't have to read things like this: | |
(?:(?:(?:struct|enum)[ \t]+)?\b[a-zA-Z][a-zA-Z\d]*[ \t]+(\b[a-zA-Z][a-zA-Z\d]*)) | |
instead we read things like this: |
This file contains hidden or 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
def sqrt(num): | |
root = num | |
for i in range(100000): | |
root *= (num / (root * root) + 1) / 2 | |
return root |
This file contains hidden or 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
''' | |
Created by Jeacom | |
This is a utility module for drawing lines in the 3D viewport on Blender 2.8 | |
using the GPU Api | |
The idea is to get rid of messy draw functions and data that is hard to keep track. | |
This class works directly like a callable draw handler and keeps track of all the geometry data. | |
''' |
This file contains hidden or 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
c = [a * sum([b for b in range(10) if (b + 1) % 2]) for a in range(10)] | |
print(c) |
This file contains hidden or 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
#infinite for loop | |
b = [1,2] | |
for i in range(len("loops")): | |
for a in b: | |
b.append(a) | |
print (a) | |
c = [1,2] * 5 | |
#never reaches# |