Skip to content

Instantly share code, notes, and snippets.

View amstocker's full-sized avatar

Andrew Stocker amstocker

View GitHub Profile
import wave
import numpy as np
import matplotlib.pyplot as plt
class LowPassFilter:
def __init__(self, init=0.0, decay=0.9):
self.b = 1 - decay
self.y = init
import wave
from math import sqrt, sin, pi
import numpy as np
import matplotlib.pyplot as plt
# Y(n) = (1-a) * 0.5 * (x(n) + x(n-1)) + a*y(n-1)
#class LowPassFilter:
# def __init__(self, b=0.99, n=1024):
import numpy as np
import wave
from random import randint
sample_rate = 48000
samples_per_cycle = 256
for z in range(8):
import numpy as np
import wave
sample_rate = 48000
samples_per_cycle = 256
for z in range(8):
filename = "{}.wav".format(z + 1)
with wave.open(filename, mode="wb") as wav_file:
import numpy as np
import wave
from fractions import Fraction
version = 3
sample_rate = 44100
samples_per_cycle = 512
amplitude_threshold = 1e-5
#include <USBHost_t36.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlaySdWav playSdWav1; //xy=272,942
with open("day14_input.txt") as f:
data = f.read().split('\n')
# Part 1
memory = [0] * 100000
for line in data:
if line[0:4] == "mask":
mask = line[7:]
mask0 = int(''.join(map(lambda c: '0' if c == 'X' else c, mask)), 2)
from random import randrange
N = 5
has_santa = set()
is_santa = set()
pairs = set()
while len(has_santa) < N:
from random import randrange
N = 5
has_santa = set()
is_santa = set()
pairs = set()
while len(has_santa) < N: