Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,27 @@
# Pretty printing
def lpad($len): tostring | ($len - length) as $l | (" " * $l)[:$l] + .;
def nwise($n):
def n: if length <= $n then . else .[0:$n] , (.[$n:] | n) end;
n;
def table($ncols; $colwidth):
nwise($ncols) | map(lpad($colwidth)) | join(" ");
# transposed table
def ttable($rows):
[nwise($rows)] | transpose[] | join(" ");
# Representation of control characters, etc
def humanize:
def special:
{ "0": "NUL", "7": "BEL", "8": "BKS",
"9": "TAB", "10": "LF ", "13": "CR ",
"27": "ESC", "127": "DEL", "155": "CSI" };
if . < 32 or . == 127 or . == 155
then (special[tostring] // "^" + ([64+.]|implode))
elif . > 127 and . < 160 then "\\\(.+72|tostring)"
else [.] | implode
end
| lpad(4) ;

View file

@ -0,0 +1,9 @@
# produce a flat array
def prepare($m;$n):
[range($m; $n) | "\(lpad(7)): \(humanize)" ];
# Row-wise presentation of 32 through 127 in 6 columns
prepare(32;128) | table(6; 10)
# Column-wise with 16 rows would be produced by:
# prepare(32;128) | ttable(16)

View file

@ -0,0 +1,2 @@
# Column-wise representation with 16 rows
(prepare(128;256) | ttable(16))