Skip to content

Instantly share code, notes, and snippets.

/*
dsl for piping generating 'pipexec' commands
```
foo | bar |
cat
---
c:42>f:69
```
will have foo piping into bar into foo
import std;
enum filename="base-16.csv";
struct color{
int r;
int g;
int b;
}
auto rebase(T)(T a, T min, T max){
if(a>=min&&a<=max){
return a-min;
import std;
struct verifiedindex{
int i;
}
auto enumeratedfilter(alias F,R)(R r){
struct range{
R r;
R r_old;
auto front(){return tuple(verifiedindex(i),r.front);}
int i;
void replacebestmatch(alias distencefun,T)(ref T value,T[] pattern){
size_t i;
typeof(distencefun(T.init,T.init)) best;
best=typeof(best).max;
foreach(j,e;pattern){
auto temp=distencefun(value,e);
if(temp<best){
best=temp;
i=j;
}
bool isascii(dchar c){
return c <dchar(127);
}
auto processtext(dstring s){
import std.sumtype;
struct range{
dstring s;
bool isunicode;
long i,j;
alias sumtype=SumType!(string,dchar);
bool isascii(dchar c){
return c <dchar(127);
}
auto processtext(dstring s){
import std.sumtype;
struct range{
dstring s;
bool isunicode;
long i,j;
alias sumtype=SumType!(string,dchar);
import std;
ProcessPipes pipe;
void init(){
pipe=pipeShell("calc -p");
pipe.stdout.byLine.take(10);
}
string calc(string s){
pipe.stdin.writeln(s);
pipe.stdin.flush;
string t;
struct optassoarray(V, K) {
struct triple {
ulong index;
K key;
V value;
auto tuple(){
import std.typecons:t=tuple;
return t(index,key,value);
}
}
#!/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++;
@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