Skip to content

Instantly share code, notes, and snippets.

View brimonk's full-sized avatar
🖥️
Programming like it's 1971

Brian Chrzanowski brimonk

🖥️
Programming like it's 1971
View GitHub Profile
@brimonk
brimonk / integral.c
Created July 14, 2018 20:57
Integral Experiment in C
/*
* Brian Chrzanowski
* Fri Jul 13, 2018 13:42
*
* perform integrals over any function that returns and takes a double
* compile : cc integral.c -lm
*/
#include <stdio.h>
#include <math.h>
@brimonk
brimonk / fizzbuzz_machine.c
Created May 7, 2019 03:51
Doing Fizz Buzz with a State Machine
/*
* Brian Chrzanowski
* Mon May 06, 2019 23:41
*
* This was a meme. A friend of mine thought about how you could do fizz-buzz
* as a 15(ish) state machine.
*
* I think my thing is closer to a circular linked list with function pointers,
* but that's whatever.
*/
@brimonk
brimonk / fizzbuzz_machine_hardcoded.c
Created May 7, 2019 04:05
Fizz Buzz on State Machine with States Hardcoded
/*
* Brian Chrzanowski
* Mon May 06, 2019 23:41
*
* This was a meme. A friend of mine thought about how you could do fizz-buzz
* as a 15(ish) state machine.
*
* I think my thing is closer to a circular linked list with function pointers,
* but that's whatever.
*
@brimonk
brimonk / brianbuild.c
Created August 9, 2019 04:59
A Trial Run Building Program to Replace Makefiles
/*
* Brian Chrzanowski
* Fri Aug 09, 2019 00:58
*
* Brian's Cool Builder (bcb)
*
* TODO
* 1. Add more wait end conditions, in 'recompile'
* 2. Add the ".d" dependency files
* 3. Add a mechanism to clean up the source tree
/*
* Brian Chrzanowski
* Fri Dec 06, 2019 18:43
*
* A small test to see if molt_gfquad_m is the problem in the simulation.
*
* Outputs
* 0.500000
* 0.539522
* 0.575920
/*
* Wed Mar 25, 2020 13:29
*
* Set the Windows Clipboard Type from the Content
* -t <type>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* Wed Mar 25, 2020 13:29
*
* Set the Windows Clipboard Type from the Content
* -t <type>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@brimonk
brimonk / imbuilder.ts
Last active March 21, 2021 09:31
just a little "immediate mode" experiment
// Brian Chrzanowski
// 2021-03-21 04:20:30
//
// Just a small HTML Form builder kind of a thing, no styling. This could obviously
// be extended to things other than HTML if you just replaced the `toHtml()` method
// and maybe standardized a little bit more on the sorts of tags / elements you want
// to stick into the builder.
class Builder {
@brimonk
brimonk / debugify.html
Created March 23, 2021 20:07
I was debugging some stuff in control-flow hell at work, and thought this might be useful. `eval()` outside of `<script>` tags doesn't work, but apparently it's just fine inside them.
<html>
<script>
function addone(v) { return v + 1; }
function debugify(fn) {
console.log("debugifying");
let source = fn.toString();
let parts = source.split(" ");
let decl = parts[1];
@brimonk
brimonk / distance.sh
Created September 9, 2021 19:19
Basically a small `dc` script that computes the distance between two points.
#!/usr/bin/env sh
dc -e "? ? - 2 ^ ? ? - 2 ^ + v p"