Skip to content

Instantly share code, notes, and snippets.

@kirjavascript
Created September 26, 2024 20:16
Show Gist options
  • Save kirjavascript/723f18af174962a769f042d5bf46fe83 to your computer and use it in GitHub Desktop.
Save kirjavascript/723f18af174962a769f042d5bf46fe83 to your computer and use it in GitHub Desktop.
t=`
tttt
ttt:::t
t:::::t
t:::::t
ttttttt:::::ttttttt rrrrr rrrrrrrrr uuuuuu uuuuuu eeeeeeeeeeee
t:::::::::::::::::t r::::rrr:::::::::r u::::u u::::u ee::::::::::::ee
t:::::::::::::::::t r:::::::::::::::::r u::::u u::::u e::::::eeeee:::::ee
tttttt:::::::tttttt rr::::::rrrrr::::::ru::::u u::::u e::::::e e:::::e
t:::::t r:::::r r:::::ru::::u u::::u e:::::::eeeee::::::e
t:::::t r:::::r rrrrrrru::::u u::::u e:::::::::::::::::e
t:::::t r:::::r u::::u u::::u e::::::eeeeeeeeeee
t:::::t ttttttr:::::r u:::::uuuu:::::u e:::::::e
t::::::tttt:::::tr:::::r u:::::::::::::::uue::::::::e
tt::::::::::::::tr:::::r u:::::::::::::::u e::::::::eeeeeeee
tt:::::::::::ttr:::::r uu::::::::uu:::u ee:::::::::::::e
ttttttttttt rrrrrrr uuuuuuuu uuuu eeeeeeeeeeeeee
`;
f=`
ffffffffffffffff lllllll
f::::::::::::::::f l:::::l
f::::::::::::::::::f l:::::l
f::::::fffffff:::::f l:::::l
f:::::f ffffaaaaaaaaaaaaa l::::l ssssssssss eeeeeeeeeeee
f:::::f a::::::::::::a l::::l ss::::::::::s ee::::::::::::ee
f:::::::ffffff aaaaaaaaa:::::a l::::l ss:::::::::::::s e::::::eeeee:::::ee
f::::::::::::f a::::a l::::l s::::::ssss:::::se::::::e e:::::e
f::::::::::::f aaaaaaa:::::a l::::l s:::::s ssssss e:::::::eeeee::::::e
f:::::::ffffff aa::::::::::::a l::::l s::::::s e:::::::::::::::::e
f:::::f a::::aaaa::::::a l::::l s::::::s e::::::eeeeeeeeeee
f:::::f a::::a a:::::a l::::l ssssss s:::::s e:::::::e
f:::::::f a::::a a:::::a l::::::ls:::::ssss::::::se::::::::e
f:::::::f a:::::aaaa::::::a l::::::ls::::::::::::::s e::::::::eeeeeeee
f:::::::f a::::::::::aa:::al::::::l s:::::::::::ss ee:::::::::::::e
fffffffff aaaaaaaaaa aaaallllllll sssssssssss eeeeeeeeeeeeee
`;
// 16 x 80 = 1280 chars
// store in two byte (16bit) codepoints
// 80 codepoints for each
flatten = s => s.split('\n').slice(1, -1).map(d=>d.padEnd(80, ' ')).join('');
chunk = (n,o)=>0 in(n=[...n])?[n.splice(0,o),...chunk(n,o)]:n
compress = s => chunk(flatten(s), 8).map(d => {
c = d.join('').replace(/./g,_=>_==' '?0:1);
return String.fromCodePoint(0x400 + parseInt(c, 2))
}).join('')
// console.log(compress(t));
// console.log(compress(f));
eval(x=`0;
b='\\x60';
v=+x[0]^1;
s='eval(x='+b+v+x.replaceAll(d='\\x5c',d+d)+b+'.replace(/'+d+'s+/g,""))';
o='';
i=j=0;r=e=>{o+=e?(s[i++]||'/'):'\\x20';if(++j%80==0)o+='\\n'};
[...[
'ПӿӠЀПӀЀЀЀЀпӿӰЀПӀЀЀЀЀѿӿӸЀПӀЀЀЀЀѿӿӸЀПӀЀЀЀЀѿЁӿӿЏӁӿҀӿӰѿЀПӿҏӇӿӃӿӼӿӼПӿӏӟӿӧӿӿӿӼЀЏӏӟӿӿӰѿӿӼЇӿӏӏӧӯӿӿӿӼПӿӏӃӼЏӿӾѿЀпӿӏӀѿҏӿӼѿЀѾПӏӟҏӯӸЀӿҀѾПӟӿӿӿӼЀӿҀѿӿӟӿӿӧӿӼӿҀпӿӿӯӿӃӿӼӿҀПӹӿӧӿЀӿӼ'
,
'ЀѸЀЀЀЀЀЀЀЀЁӼЀЀЀЀЀЀЀЀЁӼЀЀЀЀЀЀЀЀЁӼЀЀЀЀЀЀЀЀӿӿӣӣӾпЏӀӿӰӿӿӣӿӿпЏӃӿӼӿӿӣӿӿҿЏӇӿӿӿӿӣӿӿӿЏӏӰѿЃӸЁӼПӿЏӏӿӿЃӸЁӼПӿЏӏӿӾЃӸЁӼЀпЏӏӿӼЃӸѿӼЀпӿӏӸЀЃӿӿӼЀпӿӿӼЀЃӿӿӼЀПӿӷӿӼЀӿӿӼЀЏӿӳӿӼЀпӹӼЀЃӼӰӿӼ'
][v]]
.map(c=>{
n=c.codePointAt()-0x400;
[...n.toString(2).padStart(8,0)].map(n=>r(+n));
});
/ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ/;
console.log(o)
`.replace(/\s+/g,""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment