Skip to content

Instantly share code, notes, and snippets.

@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 {
#define dw digitalWrite
#define aw analogWrite
#define maxspeed 1000
struct motor{
int pins=0;
bool parity=0;
int lastspeed=1;
bool abovezero=1;

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 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
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);
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
@crazymonkyyy
crazymonkyyy / layout.kbd.json
Created July 14, 2023 23:41
Untitled Keyboard Layout
[
[
"Esc",
"~\n`",
"F1",
"F2",
"F3",
"F4",
"F5",
{
@crazymonkyyy
crazymonkyyy / fehlstart.rc
Created May 21, 2023 15:46
~/.config.fehlstart.rc ; fehlstart --one-way
[Bindings]
launch=no
[Matching]
executable=true
[Icons]
show=true
scale=true
#!/usr/bin/env -S sh -c 'dmd -run "$0" "$1" "$2" "$3" | ffmpeg -f rawvideo -pixel_format rgb24 -video_size $1x$2 -i pipe: -preset ultrafast $(basename "$0" .d).mp4'
import std;
enum pixels=32;
ubyte[3*pixels] pixels_;
int sentpixels;
pragma(inline):
//void pix(T,S,U)(T r,S b,U g){
void pix(int r,int g,int b){
sentpixels++;
struct optassoarray(V, K) {
struct triple {
ulong index;
K key;
V value;
auto tuple(){
import std.typecons:t=tuple;
return t(index,key,value);
}
}