Skip to content

Instantly share code, notes, and snippets.

#include <Arduino.h>
#include <SPI.h>
#define P_MOSI 11
#define P_MISO 12
#define P_SCK 13
#define P_RESET 8
#define P_ERR 9
local string = require "string"
local fmt = string.format
local socket = require "socket"
local udp = socket.udp()
local lua_send = {}
local MLEN = 4096
#include <stdio.h>
#include <stdlib.h>
typedef struct ListNode {
struct ListNode *next;
void *ptr;
} ListNode;
void
list_node_init(ListNode *ln, ListNode *next, void *with)
;; https://github.com/clojure/clojure-contrib/blob/master/modules/dataflow/src/main/clojure/clojure/contrib/dataflow.clj
;; todo
;; link dataflows
;; no collection toplevel streams
;; names that start with *
;; toposort finds cycles
;; syntax-extensions
(load "util.scm")
;; dispatcher is a work in progress haha
(define-syntax dispatcher
(lambda (x)
(syntax-case x (else)
((d name (case1 do1 ...) ... )
(with-syntax ( (args (datum->syntax #'d 'args)) )
#'(define (name m . args)
(case m
(case1 do1 ...) ...
(else (error (symbol->string 'name) "bad operation" m)))))))))
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#define nl() printf("\n")
#define fl_mark() printf("s/exp /mantissa\n");
#define is_finite(_fl) ((_fl & 0x7F800000) != 0x7F800000)
#define is_normalized(_fl) is_finite(~(_fl))
void
// these are equivalent
digitalWriteFast(13, HIGH);
delay(1);
digitalWriteFast(13, LOW);
delay(100);
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// util {{{
typedef int bool;
const bool true = (2 == 2);
const bool false = (2 != 2);
@yurapyon
yurapyon / wav_load.c
Last active November 29, 2023 11:51
simple wav file loader in C. loads 8bit and 16bit PCM and 32bit float wav files, converts to simple "sound" struct
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef struct {
float **audio;
int chan_ct;
int sample_ct;
int sample_rate;
} sound;
@yurapyon
yurapyon / tic_tac_toe.lua
Created July 9, 2016 22:46
tic tac toe with computer player
local string = require"string"
local fmt = string.format
-- ==&== BOARD ==&==
local function new_board()
return {{" "," "," "},
{" "," "," "},
{" "," "," "}}
end