Skip to content

Instantly share code, notes, and snippets.

View agoldstein03's full-sized avatar

Adam Goldstein agoldstein03

  • Berkeley
View GitHub Profile
@agoldstein03
agoldstein03 / snippet.js
Created November 16, 2020 21:32
629-character asynchronous function that, when run on an Actively Learn book page, generates a function to convert encrypted text to decrypted text
async()=>{let k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",l='eng',c=document.createElement("canvas"),t=c.getContext("2d");c.height=100;c.width=1500;t.fillStyle="#000";t.font=getComputedStyle(document.querySelector(".encrypted .textSection")).font;t.fillText(k.replace(/./g,"$& "),10,50);if(typeof Tesseract=="undefined")await import("https://unpkg.com/tesseract.js@2.0.0/dist/tesseract.min.js");const w=new Tesseract.createWorker();await w.load();await w.loadLanguage(l);await w.initialize(l);const m=new Map([...(await w.recognize(c)).data.text].map((l,i)=>[k[i],l]));return(e)=>[...e].map(l=>m.get(l)||l).join("")}
@agoldstein03
agoldstein03 / veitch.b
Last active November 2, 2020 02:42
Solution to ACSL 2019-2020 Contest #3 Intermediate Division - Veitch (written in Brainf**k)
+++++
[
>
+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+
>>>>>>>>>>>>>>>>>>>>
+
[>,[->+>+<<]>>[-<<+>>]<---------->+<[>-<[-]]>[-<<[-]>>]<<]
<[<]