Skip to content

Instantly share code, notes, and snippets.

@daniel-j
daniel-j / visualizer.ino
Last active March 12, 2021 21:45
Ardunio FFT audio visualizer, using a python script running on host | https://www.youtube.com/watch?v=k5hBVO-IvFo
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 3
#define LEDS 16
#define PACKET_SZ ( (LEDS * 3) + 3 )
@daniel-j
daniel-j / closure.nim
Last active August 10, 2025 17:43
Nim closure wrapping C with generics
# does not leak with --mm:arc :)
# nim c -d:release -d:useMalloc --debugger:native --mm:arc --threads:off closure && valgrind --leak-check=full ./closure
{.emit: """
typedef void(* c_callback) (int param, void *arg);
struct cState {
int param;