Skip to content

Instantly share code, notes, and snippets.

Avatar

aaeilm yurapyon

View GitHub Profile
View gist:4b5915822763284fa6321dd8018b3bfd
#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
View luasend.lua
local string = require "string"
local fmt = string.format
local socket = require "socket"
local udp = socket.udp()
local lua_send = {}
local MLEN = 4096
View topologic_sort.c
#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)
View dataflow.scm
;; 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")
View streams.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)))))))))
View janky_float_printer.c
#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
View gist:4b3f1765385c2eab6e5f6cfe7795dd03
// these are equivalent
digitalWriteFast(13, HIGH);
delay(1);
digitalWriteFast(13, LOW);
delay(100);
//
View lisp_parser.c
#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 Apr 11, 2021
simple wav file loader in C. loads 8bit and 16bit PCM and 32bit float wav files, converts to simple "sound" struct
View wav_load.c
#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 Jul 9, 2016
tic tac toe with computer player
View tic_tac_toe.lua
local string = require"string"
local fmt = string.format
-- ==&== BOARD ==&==
local function new_board()
return {{" "," "," "},
{" "," "," "},
{" "," "," "}}
end