Created
October 15, 2023 14:27
-
-
Save wader/de3fbbc004b3c1dfe438b9a6247958e8 to your computer and use it in GitHub Desktop.
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
{ | |
"descriptions": [ | |
[ | |
6, | |
"header", | |
"GIF89a" | |
], | |
[ | |
2, | |
"width", | |
"4" | |
], | |
[ | |
2, | |
"height", | |
"4" | |
], | |
[ | |
0, | |
"gcp_follows", | |
"true" | |
], | |
[ | |
0, | |
"color_resolution", | |
"8" | |
], | |
[ | |
0, | |
"zero", | |
"0" | |
], | |
[ | |
0, | |
"bit_depth", | |
"1" | |
], | |
[ | |
1, | |
"black_color", | |
"0" | |
], | |
[ | |
1, | |
"pixel_aspect_ratio", | |
"0" | |
], | |
[ | |
1, | |
"terminator", | |
"59" | |
], | |
[ | |
1, | |
"0", | |
"0" | |
], | |
[ | |
1, | |
"1", | |
"0" | |
], | |
[ | |
1, | |
"2", | |
"0" | |
], | |
[ | |
1, | |
"0", | |
"0" | |
], | |
[ | |
1, | |
"1", | |
"0" | |
], | |
[ | |
1, | |
"2", | |
"0" | |
], | |
[ | |
1, | |
"introducer", | |
"33" | |
], | |
[ | |
1, | |
"function_code", | |
"GraphicalControl" | |
], | |
[ | |
1, | |
"byte_count", | |
"4" | |
], | |
[ | |
4, | |
"data", | |
"\u0000\u0000\u0000\u0000" | |
], | |
[ | |
1, | |
"terminator", | |
"0" | |
], | |
[ | |
1, | |
"introducer", | |
"33" | |
], | |
[ | |
1, | |
"function_code", | |
"Application" | |
], | |
[ | |
1, | |
"byte_count", | |
"11" | |
], | |
[ | |
11, | |
"data", | |
"NETSCAPE2.0" | |
], | |
[ | |
1, | |
"byte_count", | |
"3" | |
], | |
[ | |
3, | |
"data", | |
"\u0001\u0000\u0000" | |
], | |
[ | |
1, | |
"terminator", | |
"0" | |
], | |
[ | |
1, | |
"separator_character", | |
"44" | |
], | |
[ | |
2, | |
"left", | |
"0" | |
], | |
[ | |
2, | |
"top", | |
"0" | |
], | |
[ | |
2, | |
"width", | |
"4" | |
], | |
[ | |
2, | |
"height", | |
"4" | |
], | |
[ | |
0, | |
"local_color_map_follows", | |
"false" | |
], | |
[ | |
0, | |
"image_interlaced", | |
"false" | |
], | |
[ | |
0, | |
"zero", | |
"0" | |
], | |
[ | |
0, | |
"bit_depth", | |
"1" | |
], | |
[ | |
1, | |
"code_size", | |
"2" | |
], | |
[ | |
1, | |
"byte_count", | |
"4" | |
], | |
[ | |
4, | |
"data", | |
"\ufffd\ufffd\t\u0005" | |
], | |
[ | |
1, | |
"terminator", | |
"0" | |
], | |
[ | |
1, | |
"introducer", | |
"33" | |
], | |
[ | |
1, | |
"function_code", | |
"GraphicalControl" | |
], | |
[ | |
1, | |
"byte_count", | |
"4" | |
], | |
[ | |
4, | |
"data", | |
"\u0000\u0000\u0000\u0000" | |
], | |
[ | |
1, | |
"terminator", | |
"0" | |
], | |
[ | |
1, | |
"separator_character", | |
"44" | |
], | |
[ | |
2, | |
"left", | |
"0" | |
], | |
[ | |
2, | |
"top", | |
"0" | |
], | |
[ | |
2, | |
"width", | |
"4" | |
], | |
[ | |
2, | |
"height", | |
"4" | |
], | |
[ | |
0, | |
"local_color_map_follows", | |
"true" | |
], | |
[ | |
0, | |
"image_interlaced", | |
"false" | |
], | |
[ | |
0, | |
"zero", | |
"0" | |
], | |
[ | |
0, | |
"bit_depth", | |
"1" | |
], | |
[ | |
1, | |
"code_size", | |
"255" | |
], | |
[ | |
1, | |
"0", | |
"255" | |
], | |
[ | |
1, | |
"1", | |
"255" | |
], | |
[ | |
1, | |
"2", | |
"0" | |
], | |
[ | |
1, | |
"0", | |
"0" | |
], | |
[ | |
1, | |
"1", | |
"0" | |
], | |
[ | |
1, | |
"2", | |
"2" | |
], | |
[ | |
1, | |
"byte_count", | |
"4" | |
], | |
[ | |
4, | |
"data", | |
"\ufffd\ufffd\t\u0005" | |
], | |
[ | |
1, | |
"terminator", | |
"0" | |
] | |
], | |
"hexii": [ | |
"G", | |
"I", | |
"F", | |
"8", | |
"9", | |
"a", | |
4, | |
0, | |
4, | |
0, | |
1, | |
7, | |
0, | |
0, | |
0, | |
0, | |
";", | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
"!", | |
249, | |
4, | |
0, | |
0, | |
0, | |
0, | |
0, | |
"!", | |
255, | |
11, | |
"N", | |
"E", | |
"T", | |
"S", | |
"C", | |
"A", | |
"P", | |
"E", | |
"2", | |
".", | |
"0", | |
3, | |
1, | |
0, | |
0, | |
0, | |
",", | |
0, | |
0, | |
0, | |
0, | |
4, | |
0, | |
4, | |
0, | |
0, | |
0, | |
0, | |
0, | |
2, | |
4, | |
132, | |
143, | |
9, | |
5, | |
0, | |
"!", | |
249, | |
4, | |
0, | |
0, | |
0, | |
0, | |
0, | |
",", | |
0, | |
0, | |
0, | |
0, | |
4, | |
0, | |
4, | |
0, | |
1, | |
0, | |
0, | |
0, | |
255, | |
255, | |
255, | |
0, | |
0, | |
0, | |
2, | |
4, | |
132, | |
143, | |
9, | |
5, | |
0 | |
] | |
} |
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
# Usage: | |
# fq -L . 'include "to_sbud"; to_sbud' format/gif/testdata/4x4.gif | pbcopy | |
def to_sbud: | |
( [.. | to_entries?[]] as $entries | |
| { hexii: | |
[ $entries[].value | |
| scalars | |
| tobytes? | |
| explode[] | |
| if . >= 33 and . <= 126 then [.] | implode end | |
] | |
, descriptions: | |
[ $entries[] as {$key, $value} | |
| $value | |
| scalars | |
| [ tobytesrange.size | |
, ($key | tostring) | |
, if type != "string" then tojson end | |
]? | |
] | |
} | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment