Skip to content

Instantly share code, notes, and snippets.

View solidiquis's full-sized avatar
☠️

Benji Nguyen solidiquis

☠️
View GitHub Profile
type TimeSeries = list[tuple[float, float]]
def normalize_time_series(time_series: TimeSeries, T_min: float, T_max: float) -> TimeSeries:
min_time = time_series[0][0]
max_time = time_series[-1][0]
return [
(normalize_time(t, min_time, max_time, T_min, T_max), v) for (t, v) in time_series
]
@solidiquis
solidiquis / before_after_hooks_demo.rb
Last active October 14, 2022 21:44
Ruby instance method before-and-after hooks demo
# quick and dirty demo
class Foo
include(Module.new do
def self.included(including_class)
including_class.extend(StaticMethods)
including_class.prepend(Hooks)
end
module Hooks; end
@solidiquis
solidiquis / open_gl_learning.rs
Last active December 13, 2021 09:46
Why are my vertices outside of clip space?
// Highly condensed version of my code with only the relevant bits.
// Vertices are ending up outside of clip space after transforming with MVP
// matrices despite using the same numbers and glm functions as
// https://learnopengl.com/Getting-started/Coordinate-Systems
// Libs used: glium/glutin and nalgebra_glm as glm;
let cube: [Vertex; 4] = [
// Front face:
Vertex { coord: [0.5, 0.5, 0.0], rgba: [1.0, 1.0, 1.0, 1.0] },
#!/usr/bin/env python3
from prioritize import MaxHeapq
import code
class Task:
tasks = []
def __init__(self, *args, **kwargs):
#!/usr/bin/env python3
from prioritize import MaxHeapq
import code
class Task:
tasks = []
def __init__(self, *args, **kwargs):
#!/usr/bin/env python3
from prioritize import MaxHeapq
import code
class Task:
tasks = []
def __init__(self, *args, **kwargs):