Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View makoConstruct's full-sized avatar

mako yass makoConstruct

View GitHub Profile
@makoConstruct
makoConstruct / nis.md
Last active January 6, 2024 20:52
proposal of the Nix syntax, Nis

I propose "Nis", a new syntax for Nix.

Nix's syntax has a couple of issues. Its function invocation syntax breaks in arrays, which is fairly serious. It also involves a lot of semicolons. Neither of these things are necessary.

Nix version:

{
  outputs = inputs: let
    username = "mako";
    defaultHostname = "yoga";
@makoConstruct
makoConstruct / bench_copy.rs
Last active September 13, 2021 06:16
using criterion to benchmark copy and copy_nonoverlapping
[package]
name = "toying"
version = "0.1.0"
edition = "2018"
[dependencies]
[dev-dependencies]
itertools = "0.8.2"
criterion = "0.3.5"
@makoConstruct
makoConstruct / gist:5e27e47a5c2f9bb3e8d5f9929451f8a9
Created September 11, 2021 00:09
performance of various overlapping and nonoverlapping mem copies in rust
Benchmarking copy_maybeoverlapping_1: 3.6362 ns 3.6482 ns 3.6601 ns
Benchmarking copy_maybeoverlapping_2: 3.6623 ns 3.6684 ns 3.6748 ns
Benchmarking copy_maybeoverlapping_4: 4.2384 ns 4.2447 ns 4.2508 ns
Benchmarking copy_maybeoverlapping_8: 5.6183 ns 5.6267 ns 5.6350 ns
Benchmarking copy_maybeoverlapping_16: 7.4764 ns 7.4959 ns 7.5211 ns
Benchmarking copy_maybeoverlapping_32: 49.636 ns 52.097 ns 54.614 ns
Benchmarking copy_maybeoverlapping_64: 69.645 ns 69.900 ns 70.167 ns
Benchmarking copy_maybeoverlapping_128: 144.11 ns 144.32 ns 144.53 ns
Benchmarking copy_maybeoverlapping_256: 280.74 ns 281.18 ns 281.64 ns
Benchmarking copy_maybeoverlapping_512: 582.23 ns 583.35 ns 584.48 ns
@makoConstruct
makoConstruct / sitegen.rs
Created May 6, 2020 10:57
the little ... script? (can it be a script if it's a compiled language? It felt like writing a script) that generates the html at aboutmako.makopool.com from a termpose tree of markdown
// extern crate tinytemplate;
extern crate comrak;
extern crate wood;
use wood::Wood;
use std::{path::Path, fs::{read_to_string, write}};
use comrak::{markdown_to_html, ComrakOptions};
fn indent_level(d:&Wood, indent:&mut String, out:&mut String){
out.push_str(indent);
out.push_str("<div class=\"level\">\n");
@makoConstruct
makoConstruct / metrica.rs
Created January 28, 2020 06:33
a battery of tests for comparing different mathematical specifications of comparison aggregation
trait MetricaWire {
fn sign(&self)-> f32;
// fn controversy(&self)-> f32;
// fn certainty(&self)-> f32;
fn negate(&self)-> Self;
fn zero()-> Self;
fn unit()-> Self;
fn of_strength(v:f32)-> Self;
}
@makoConstruct
makoConstruct / fauns_criteria.rs
Last active January 22, 2020 03:15
tests whether a graph rank aggregation (referred to as "rank") satisfies some necessary features of large collaborative curation processes
#[cfg(test)]
mod fauns_criteria {
use super::*;
fn mapping(results: Vec<(f32, str&)>)-> HashMap<String, f32> {
results.into_iter().map(|(score, name)| (name.into(), score)).collect()
}
fn equalish(a:f32, b:f32)-> bool {
abs(a - b) < 0.00001
// o o o o . . .
// o o o o o . .
// o o o o o o .
// o o o o o o o
// . o o o o o o
// . . o o o o o
// . . . o o o o
v2 hexify(v2 v){ return v2{v.x+v.y/2, v.y*SQRTTHREEQUAR}; } //from square to hex
@makoConstruct
makoConstruct / updateApproacher.cpp
Last active August 12, 2019 07:55
accelerate towards a target and stop perfectly once arrived, with maximum speed
float movementWhileAccelerating(float subdelta, float velocity, float acceleration){
return subdelta*(velocity + subdelta*acceleration/2);
}
void updateApproacher(float delta, float target, float& position, float& velocity, float maxSpeed, float acceleration, float deceleration){
if(position == target && velocity == 0){
return;
}
float dif = target - position;
@makoConstruct
makoConstruct / the evolution of deliberative thought.md
Created July 19, 2019 01:18
unrefined ravings about the likely evolution of deliberative thought

[this is a draft. Some of the things written here are guessed, unconfirmed, and maybe wrong. You are not seeing me say these words. You are seeing me trying to figure out what to say.]

I'm wondering if I should post a summary of the bicameral theory in LW for its metascientific significance, as a revolutionary theory that seems not to have done much, because I don't think the core interesting stuff has been boiled down very well. I'm not good at this kind of work so I'm going to need a bunch of votes of confidence from yall that yes this is the theory and yes this is the part of the theory has not been falsified

bicameral evolution of consciousness

@makoConstruct
makoConstruct / pursuit.cpp
Created January 3, 2019 00:14
pursuit behaviour
float distanceToSlowDown(float initialSpeed, float deceleration){ return sq(initialSpeed)/(2*deceleration); }
float maxDistanceBeforeSlowingWithin(float initialSpeed, float time){ return initialSpeed*time/2; }
bool updateApproacher(float dif, float& currentVelocity, float deceleration, float acceleration, float delta, float error = 1){ //dif is target - position, returns true iff zeroing
float dist = abs(dif);
float sign = dif/dist;
float absvel = currentVelocity*sign;
float acd = acceleration*delta;
float avd = absvel*delta;
float ded = deceleration*delta;