Skip to content

Instantly share code, notes, and snippets.

@crazymonkyyy
crazymonkyyy / layout.kbd.json
Created July 14, 2023 23:41
Untitled Keyboard Layout
[
[
"Esc",
"~\n`",
"F1",
"F2",
"F3",
"F4",
"F5",
{
import core.stdc.stdio;
extern(C) void main(){
string s="hello";
printf("%s",&s[0]);
}
/*
dmd -c -betterC min.d
gcc min.o -o min
./min
import std;
struct opindexopdispatch{
int i=0;
auto opIndex(T...)(T args){
struct op{
opindexopdispatch* parent;
T args;
auto opDispatch(string op:"isnull",S...)(S args2){
//pragma(msg,op,T,S);
return (*parent).opopdispatch!(T,op)(args,args2);
#define NOTE_A2 110
#define NOTE_B2 123
#define NOTE_C3 131
#define NOTE_D3 147
#define NOTE_E3 165
#define NOTE_F3 175
#define NOTE_G3 196
#define speaker 2
#define keys 30
#define play 6

Interpolation strings

Field Value
DIP: (number/id -- assigned by DIP Manager)
Review Count: 0 (edited by DIP Manager)
Author: monkyyy, [email protected]
Implementation: (links to implementation PR if any)
Status: Draft
#define dw digitalWrite
#define aw analogWrite
#define maxspeed 1000
struct motor{
int pins=0;
bool parity=0;
int lastspeed=1;
bool abovezero=1;
@crazymonkyyy
crazymonkyyy / .d
Created December 29, 2023 23:01
weak values for default arguments
auto ref weak(T,alias A)(){
static if(is(T:typeof(A))){
return A;
} else {
return T.init;
}}
auto ref weak(T,S)(auto ref S a){
static if(is(T:S)){
return a;
} else {
import std.traits;
template polymorphic(alias F){
auto polymorphic(T...)(T args){
mixin((){
import std.conv:to;
string o;
foreach(i,S;(Parameters!F)[0..T.length]){
o~="args["~i.to!string~"].to!"~S.stringof~",";
}
return "return F("~o~");";
float isqrt(bool veryveryslow:true)(float f){
import std.math:sqrt;
return 1/sqrt(f);
}
//float isqrt()(float f){
// long i;
// float x2,y;
// const float threehalfs=1.5;
// x2=f*.5;

changing ranges

New std means an opptunity to make breaking changes ranges, this should be siezed and drasticly done.

rough goals:

  1. degrade doubly linked lists ("bidirectional") to be less important then arrays, hash maps, strings, databases, litterally any data stucture.

  2. different "paths" an ideal array is very different from a skiplist