This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| dsl for piping generating 'pipexec' commands | |
| ``` | |
| foo | bar | | |
| cat | |
| --- | |
| c:42>f:69 | |
| ``` | |
| will have foo piping into bar into foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct optassoarray(V, K) { | |
| struct triple { | |
| ulong index; | |
| K key; | |
| V value; | |
| auto tuple(){ | |
| import std.typecons:t=tuple; | |
| return t(index,key,value); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Bindings] | |
| launch=no | |
| [Matching] | |
| executable=true | |
| [Icons] | |
| show=true | |
| scale=true |