Skip to content

Instantly share code, notes, and snippets.

@PaulMaynard
PaulMaynard / bonus.cpp
Created March 27, 2021 01:40
CS410 bonus problem
// my first program in C++
#include <iostream>
using namespace std;
class Converter
{
private:
Converter(){};
public:
@PaulMaynard
PaulMaynard / test.py
Created May 16, 2020 20:45
Barebones python testing framework
import sys
tests = set()
def run_tests():
succ = True
for fun in tests:
for n, a, k, e in fun._tests:
r = fun(*a, **k)
(require rackunit)
; lambda
(check-true (lambda? '(lambda (x) x)))
(check-true (lambda? '(lambda (x y z) z y x)))
(check-false (lambda? '(lambda (x 1) x)))
(check-false (lambda? '(lambda (x))))
(check-false (lambda? '3))
(check-equal? '(x) (lambda-params '(lambda (x) y)))
root
= elements:(sexp+) {return {type: 'root', elements}}
sexp
= parenexp
/ delimited
/ id
parenexp
= type:$lparen elements:exp+ rparen {return {type, elements}}
Unity Player [version: Unity 5.4.0p4_b15b5ae035b7]
KSP_x64.exe caused an Access Violation (0xc0000005)
in module KSP_x64.exe at 0033:000000c2.
Error occurred at 2016-12-06_140500.
C:\Users\Paul\Documents\ksp backups\1.2.1 - STOCK\KSP_x64.exe, run by Paul.
64% memory in use.
16367 MB physical memory [5843 MB free].
32751 MB paging file [13818 MB free].
Initialize engine version: 5.4.0p4 (b15b5ae035b7)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 9.0c [aticfx32.dll 8.17.10.1404]
Renderer: AMD Radeon HD 6700 Series
Vendor: ATI
VRAM: 1010 MB (via DXGI)
Caps: Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=1 INTZ=1 NULL=1 RESZ=1 SlowINTZ=1 ATOC=0
Begin MonoManager ReloadAssembly
Platform assembly: C:\Users\Paul\Documents\ksp backups\1.2.1 - STOCK\KSP_Data\Managed\UnityEngine.dll (this message is harmless)
class Scope {
constructor(vars, parents) {
this.vars = vars || new Map()
this.parents = parents || [Scope.global]
}
get(name) {
if(this.vars.has(name)) {
return this.vars.get(name)
} else if(this.parents.length > 0) {
for(let p of this.parents) {
@PaulMaynard
PaulMaynard / 2+2.lambda
Last active April 28, 2017 15:35
Lambda calculus parser & compiler.
(λ+2.+22)(λmnfx.mf(nfx))((λs0.s(s0))(λnfx.f(nfx))(λfx.x))
$name : Warlord Generator
$author : Paul
$description : Generates a random imperial warlord title.
$amount : 10
$button : Fracture!
$adjective
High
Grand
Ultimate
@PaulMaynard
PaulMaynard / die.js
Last active May 2, 2016 16:13
Generator and Iterator manipulation
/** Sample die roller */
function die(pattern) {
let [, sign = '+', amt = 1, sides = 6, num, mod] = die.regex.exec(pattern)
let gen
if (num) {
gen = _.fill(Number(num))
} else {
let die = _.func(() => Math.floor(Math.random() * sides) + 1)
gen = _.combine(sum, ...Array(amt).fill(die))
}