This file contains 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
#define COPY(dst, src, n) for (int i = 0; i < n; i++) dst = src; | |
typedef struct { | |
uint32_t range, FF, cache; uint64_t low; FILE * source; | |
} rc_t; | |
void rc_init(rc_t * rc, FILE * source) { | |
rc->range = 0xFFFFFFFF; | |
rc->FF = rc->cache = 0; rc->low = 0; | |
rc->source = source; | |
} | |
void rc_init_dec(rc_t * rc, FILE * source) { |
This file contains 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
106 : ES6 | |
107 : Nim | |
110 : Keg | |
114 : Fig | |
115 : Cubix | |
116 : Attache | |
117 : k | |
122 : Ly | |
123 : tinylisp | |
124 : Oracle |
This file contains 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
#include <book.h> | |
#define CODE_MAX 65534 | |
#define DICT (1 << 17) | |
#define LZWEOF 256 | |
struct { int32_t parent; int16_t c, code; } dict[DICT]; | |
void encode(FILE * in, FILE * out) { | |
int nc = LZWEOF + 1, c, sc, i; | |
COPY(dict[i].code, -1, DICT); | |
if ((sc = fgetc(in)) == EOF) sc = LZWEOF; | |
while ((c = fgetc(in)) != EOF) { |
This file contains 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 Control.Monad | |
import System.Random | |
import Control.Monad.Trans.State | |
import Control.Lens hiding(under) | |
import Control.Conditional hiding(unless, when) | |
import Data.List | |
import Data.Functor | |
import Data.Random.Lift | |
import Control.Monad.IO.Class | |
import Control.Monad.Fix |
This file contains 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 magic(float * x, size_t n) { | |
uint32_t * result = malloc(n * sizeof(uint32_t)), | |
* buckets = malloc(0x100*sizeof(uint32_t)), | |
* si = malloc(0x100*sizeof(uint32_t)), | |
* y = (uint32_t *) x, key, temp; | |
for (size_t i = 0; i < n; i++) y[i] ^= 0x80000000; | |
for (int i = 0; i < n; ++i) ++buckets[y[i] & 0xFF]; | |
si[0] = 0; | |
for (int j = 1; j < 0x100; ++j) si[j] = si[j - 1] + buckets[j - 1]; | |
for (int i = n-1; i >= 0; --i) key = y[i] & 0xFF, result[si[key] + --buckets[key]] = y[i]; |
This file contains 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
e1←{⍵/⍨⍵≥⌈\⍵} | |
e2←⌽⍷⍥⌽ | |
e3←{(⍺∘⌽⌷⍨∘⊂⍵⍳⍨⊢)' ',⎕A} | |
e4←×2⊥>-< | |
e5←{n,l-n←(l↑⍺)+.≤⍵↑⍨l←⍺⌊⍥≢⍵} | |
e6←(⊢⍴⍨2,⍨2÷⍨⍴)~⍤∊⍨⊆⊢ | |
e7←(,÷∨)∘1 | |
e8←{3↑⊃¯2⎕dt(1⎕dt⊂⍵)+⌊/644 924 759|⍺-⍥(1⎕dt⊆)⍵} | |
e9←{↑,/⌽¨⍵⊂⍨1 0⍴⍨≢⍵} | |
e0←{(⊢,(⊂'')↑⍨⍺-≢)1↓¨(' ',⍵)⊂⍨(⊢∧⍺≥+\)1,' '=⍵} |
This file contains 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
template<typename T> | |
struct artificially_constructible { | |
template<typename... Args> | |
explicit artificially_constructible(Args&&... args) { | |
new (&storage) T(std::forward<Args>(args)...); | |
} | |
~artificially_constructible() { | |
get_ptr()->~T(); | |
} |
This file contains 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
<p id="p"></p> | |
<canvas style="border: 1px solid black"></canvas> | |
<script defer> | |
const q = document.querySelector("canvas") | |
let canstart = true | |
J=q.width=q.height=Math.min(500, document.querySelector("#p").clientWidth);Q='50px monospace';with(Math)with(C=q.getContext`2d`)with(X=Y=R=0,init=e=(e=>{w=f=Y=X=0,R=1,H=250,q.focus(),canstart=false,V=-10,P=[],(F=(e=>{e-w>1/60&&(Y&&(V=-10,Y=0),H+=V,V+=.8,P.forEach(e=>e.P-=3),f%50||P.push({P:J,L:150+(0|200*random()),C:'rgb('+255*random()+','+255*random()+','+255*random()+')'}),(P.some(e=>abs(e.L-H+2)>60&&0<e.P&&e.P<25)||H>J||H<0)&&(R=0,setTimeout(e=>{font=Q,fillStyle='red',fillText(':(',50,90),canstart=true},99)),clearRect(0,0,J,J),P.forEach(e=>{with(e){fillStyle=C,fillRect(P,0,20,L-60),fillRect(P,L+60,20,J-(L+60))}}),fillStyle='red',fillRect(20,H,10,10),font=Q,fillStyle='red',fillText(ceil(f/50-10/3),40,40),f++,w=e),R&&requestAnimationFrame(F)}))()}),document)onkeydown=(e=>{' '==e.key&&R?++Y:' '==e.key; if (canstart) {init()}}),onmousedown=(e=>{R&&++Y; if (canstart) {in |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
char ** split(char * string, char * delim) { | |
int count = 0; | |
char * tmp = string; | |
while (strstr(tmp, delim)) | |
tmp = strstr(tmp, delim) + strlen(delim), count++; |
This file contains 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
D'`_M?>n<5Gz276vStPPr/LKml*jFhWDfecc>`v_)yxwvuWm3210/.-,+*)('&%$\[`Y}|{zyxwvutsrqpo2NGLEDCgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFED$#"!~}v<;:987654lTpih.lNjihg`&dcba`Y}|\[Z<;WVONrqpoIHMFEihgfed>CB;_^]\[ZYXW70/43,10)MLKJIHGFEDCBA@?>=<;:9876543210hgfejiba'e^]b[ZY}|{zyxwvutsrqpoO10LKDhgfedcba`_^]\<;492VUTSRQPONMLKJIHGFEDCBA@?>=<;:987654rkpoh.-,+*)('&%]\a`Y}|{[ZSXQPUTMqQJnNGFjiIHG@?cC<;@?>7[Z:9870/SRQ10p(-&JIHGFEDC#zy?>=<;:987on43210/.-,+*)('&%$#"!~}|{zyYR:u8TSRQPONGkjihgfedcba`_?8=<;43WVUTSRQPONML,+$#(!&}CBA@?>=<;:9876543210/.-,+*)('&%$#"Z_X|{zyxwvutsrq4PONGLEihgfF?>C<A:^]\<|:3W76v43,+O).'&+$)(!E%|#zy?}|u]sxq765Vrqj0nmlNjihg`&^c\a`Y}W\UTYXQutsrqponmGFKDhgfedcba`@?87[ZYXWVUTSRQPONMLKJIHGFEf$#"!x}v<]yxwpon43210/.-,+*)gI_d]\"!~}|{zyxwW9ONrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQ10p(-&JIHGFEDCBA@?>={tyxq76543kSinmlkd*)g`e^cb[!_^@?UTxXQVONMq4JIHMLEiCHA@?DC<`@"!=<;4X810T43sr*N(n,+*#G'gf${zy?w|{tyr8vonsrkj0/mfkjchgf_%$#"!~}|{[TSRQPtsrqponmlFEDCHAFE>ba`_^]\[ZYXWVUTSRQPON.-m%*#G'&%$#"baw=<;:9876543qSong-,+*)('&%c\aZ~}|{zyxwvutsrqpon |
NewerOlder