Skip to content

Instantly share code, notes, and snippets.

View AugmentedFifth's full-sized avatar
🍎
apfelschusss

Zachary Comito AugmentedFifth

🍎
apfelschusss
View GitHub Profile
@AugmentedFifth
AugmentedFifth / instructions-0.md
Created July 15, 2018 02:56
Writing Polyphonic Music Using Basic Species Counterpoint

Writing Polyphonic Music Using Basic Species Counterpoint

This set of instructions will aid in writing two-voice polyphonic music from scratch using a simplified and modernized version of Fux's classic early-18th-century rules for species counterpoint. The only requirements are that the reader be competent enough with sheet music to read it and write it (even if slowly), and that the reader know basic musical terminology such as the names for intervals (major third, perfect fifth, etc.).

Writing species counterpoint serves as a technical exercise that helps to

@AugmentedFifth
AugmentedFifth / technical-description-0.md
Last active July 9, 2018 02:44
CPU Caches and Some Design Considerations Thereof

CPU Caches and Some Design Considerations Thereof

A "cache" is, in general, any structure that keeps the results of processes/computations for easy access later on. The idea is that any time a given result is required in the future, a quick and efficient lookup from the cache serves as a replacement for doing the whole (potentially expensive) process/computation over again, just to get the same result. A simple example of this is the memorization of times tables. Knowing that 12 times 12 is 144 virtually instantly is useful and worth the memorization effort, compared to requiring someone to recalculate every time, even for (commonly used) small

chapter 8: bytecode format

mnemonic args stack mnemonic explanation semantics
nop - - no operation Does nothing.

W H O M S ' T

Python 3

def fib(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
#![feature(inclusive_range_syntax)]
extern crate fnv;
use fnv::FnvHashMap;
use std::cmp::min;
type Item = (usize, usize, usize);
type Opt = (usize, usize);
@AugmentedFifth
AugmentedFifth / brouwer.ebnf
Last active August 26, 2017 18:18
Rough working grammar for brouwer, written in extended Backus-Naur form.
(* brouwer *)
program =
[ module declaration ], { import }, { line } ;
module declaration =
"module", identifier, [ ( "exposing" | "hiding" ), identifier, { ",", identifier }, [ "," ] ], newline ;
import =
"import", identifier, [ "as", identifier | ( "exposing" | "hiding" ), identifier, { ",", identifier }, [ "," ] ], newline ;
@AugmentedFifth
AugmentedFifth / select-music-1970-to-1999.txt
Created August 2, 2017 10:09
A little selection of music (concentrating mostly on rock) strictly from 1970 to 1999.
Format
======
Band name
Album name 1 (release year)
Genre(s)
Choice song(s) from this album
Album name 2 (release year)
Genre(s)
Choice song(s) from this album
-- | what
applyInputs :: PlayerState -> PlayerState
applyInputs ps =
foldl' (\ps' inputGroup ->
-- Calculate accelerations for this frame based on input log.
let (# v, pressed, _, t_ #) = foldl' (\(# v, pressed, t0', t_ #) inp ->
let t1 = inp^.timeStamp
down = inp^.isDown
in (# case t0' of
Just t0 -> let thisDt = t1 - t0 in
/**
* Creates a new `Rect` with the specified top-left corner, width, and height.
* These quantities can be specified in three different ways:
*
* - Four arguments, all `numbers`, specifying the x and y values of the
* top-left corner and width/height, respectively.
* - Two arguments, both `V2`s.
* - One argument, a single `Rect` to be cloned.
*
* @param {number | V2 | Rect} arg1
@AugmentedFifth
AugmentedFifth / Rect.contains.js
Created July 19, 2017 22:31
horrible. dont do this
/**
* Decides if the given rectangle contains the given point within it.
*
* The rectangle is specified by the x-value of the upper-left corner, then the
* y-value, then the width, and then the height, in that order. After that, the
* point whose containment or non-containment is to be determined is specified.
* These values can each be specified either as two separate `number`s or as a
* single `V2`, mixing and matching arbitrarily.
*
* @return {boolean}