Skip to content

Instantly share code, notes, and snippets.

View jeffmylife's full-sized avatar
🌊
back to learning

Jeffrey Lemoine jeffmylife

🌊
back to learning
View GitHub Profile
@jeffmylife
jeffmylife / memorySequence.py
Created March 30, 2020 20:35
List with the ability to forget values. Kind of like a real-time sliding window.
class memorySequence(list):
def __init__(self, lst, size=10):
super().__init__(lst)
self._desired_size = size
def append(self, item):
if len(self) + 1 > self._desired_size:
del self[0]
return super().append(item)
return super().append(item)
@jeffmylife
jeffmylife / colorized_voronoi.py
Last active June 25, 2019 18:46 — forked from pv/colorized_voronoi.py
Colorized Voronoi diagram with Scipy, in 2D, including infinite regions
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Voronoi
def voronoi_finite_polygons_2d(vor, radius=None):
"""
Reconstruct infinite voronoi regions in a 2D diagram to finite
regions.
Parameters