Skip to content

Instantly share code, notes, and snippets.

@wulab
wulab / piano.py
Created October 1, 2022 05:41 — forked from av1d/piano.py
Simple 1 octave piano in Python with live input
import numpy as np
import simpleaudio as sa
import os, sys, termios, time, tty
# Key mapping:
# W E T I U
# A S D F G H J K
#
# Which translates to:
# C#D# F#G#A#
@wulab
wulab / lisp.lua
Created September 29, 2022 17:51 — forked from polymeris/lisp.lua
Toy Lisp interpreter in Lua / LPEG
local lpeg = require'lpeg'
local P, R, S = lpeg.P, lpeg.R, lpeg.S --patterns
local C, Ct = lpeg.C, lpeg.Ct --capture
local V = lpeg.V --variable
local parser = P {
'program', -- initial rule
program = Ct(V'sexpr' ^ 0),
wspace = S' \n\r\t' ^ 0,
atom = V'boolean' + V'integer' + V'string' + V'symbol',