Skip to content

Instantly share code, notes, and snippets.

View Aeva's full-sized avatar

Aeva Aeva

View GitHub Profile
@Aeva
Aeva / keyboard_matrix.cpp
Created July 3, 2017 21:36
simple keyboard matrix
// Pinout assumes Arduino Micro
int verticals[] = { 6, 5, 4, 3, 2 };
int horizontals[] = { 12, 11, 10, 9, 8 };
// State tracker for keyboard events
bool state[5][5];
// Define which pin sets are used for what when scanning.
#define drains verticals
#define inputs horizontals
@Aeva
Aeva / smol-layouts.org
Created June 24, 2017 17:47
keyboard layout mood board
@Aeva
Aeva / drains.scm
Created May 29, 2017 17:49
A type inference system based on the Constraint Solver from SICP
(use-modules (srfi srfi-1))
(load "patterns.scm")
(define all-drains '())
(define (register-drain! drain)
(set! all-drains (cons drain all-drains))
drain)
(define (solved?)
(every (lambda (drain) (not (null? (drain 'type)))) all-drains))
@Aeva
Aeva / patterns.scm
Created May 29, 2017 17:49
a simple partial type solving mechanism
(use-modules (srfi srfi-1))
(define (limit matcher list)
(define matched '())
(for-each
(lambda (item) (if (matcher item) (set! matched (cons item matched))))
list)
matched)
(use-modules (srfi srfi-1))
;; "record-types" will end up looking something like this:
;;
;; ((camera (matrix #:mat4))
;; (model (position #:vec3)
;; (matrix #:mat4)
;; (clip-space (* (camera matrix) (model matrix) (model position)))))
(define record-types '())
(use-modules (srfi srfi-1))
(define (camera-layout)
'((matrix #:mat4)))
(define (camera property)
(find (lambda (record) (eq? (car record) property)) (camera-layout)))
(define (model-layout)
'((position #:vec3 #:vertex)
@Aeva
Aeva / shader_conlanging.org
Last active March 31, 2017 16:53
scheme shader dsl mockup

This is a mockup for a scheme shader DSL. The main idea here is to conceptualize shaders as being a dependency resolution problem instead of a mess of procedural code. So instead, we define some named data structures. These structures can name other structures as “dependencies”. Data members follow the form of a name, an optional value, and zero or more tags to specify type. Type is optional, but if the struct is under-specified, evaluating it will throw an error.

The variant macro can be used to provide polymorphism (maybe the macro should just be “polymorph”).

Lastly, the vertex and fragment shader macros can take any number of structs as dependencies, but in this case, they only need “model”. The rest will be pulled in automatically.

This lets us do a number of things:

  1. C structs and helper APIs can be easily generated automatically from the struct and variant macros.
@Aeva
Aeva / web_audio_api_experiment.js
Created January 18, 2017 06:46
Web Audio API Experiment
function LerpNode(ctx) {
"strict";
var node = {
"lhs" : ctx.createGain(),
"rhs" : ctx.createGain(),
"__alpha" : 0.5,
};
node.alpha = Object.create(AudioParam.prototype, {
@Aeva
Aeva / browser_architecture_draft.org
Last active November 20, 2016 06:54
High-Level Notes on a Fancy Browser Architecture

pitch

A web browser that provides reasonably privacy from common tracking employed by for-profit corporations.

A big inspiration is this blog post: https://theperplexingpariah.co.uk/my-firefox.html

Having used things like request block and self destructing cookies in firefox, I have some ideas for some simple changes to how the browser works that would aleviate a lot of the usability problems that those

@Aeva
Aeva / generated_picking_pass_renderer.js
Created September 30, 2016 03:58
Generated Picking Pass Renderer
var camera = this.graph.camera || null;
var graph = this.graph;
var prog = this.prog;
if (graph.__last_framestart < please.time.__framestart) {
// note, this.__last_framestart can be null, but
// null<positive_number will evaluate to true anyway.
graph.tick();
}
if (camera) {
graph.camera.update_camera();