Skip to content

Instantly share code, notes, and snippets.

View phkahler's full-sized avatar

Paul Kahler phkahler

  • U.S. Michigan
View GitHub Profile
@phkahler
phkahler / gist:1ddddb79fc57072c4269fdd6716bfb72
Created October 5, 2020 22:09
Slow smooth blink an LED
{ // do this every 1ms or two
static int16_t x;
static int16_t a;
int16_t y = 0x4000 - (((int32_t)x * x) >> 16);
a = (a & 0x0fff) + (((int32_t)y * y) >> 16);
LED_io_pin = a >> 12;
x += 35; // slow blink speed
}
@phkahler
phkahler / love5.py
Last active June 30, 2022 14:21
Compatibility based on 5 love language scores
''' Compatibility computed from scores of 5 love languages '''
# the web quiz uses percentages
# https://www.5lovelanguages.com/quizzes/love-language
# scores for person 1
p1 = [ 10, 9, 6, 5, 0 ]
# scores for person 2 (must be in the same order)
p2 = [ 3, 4, 9, 9, 5 ]
@phkahler
phkahler / equalizer.c
Last active July 19, 2022 19:05
Equalizer (8 band)
#include <math.h>
// A simple 8-band EQ. The filters are all first order so there is
// lot of overlap in adjacent bands. Never the less this should be
// a solid way to shape the tone of an audio signal.
// Aiming to eventually put this in OBS, which IMHO needs one.
// This is a Work In Progress.
//
// We will use a set of 7 filters to split a signal s into 8 bands
// |<----------------------------- s ----------------------------->|