calcmarkdown.py

Created by yannis300307

Created on June 04, 2024

4.85 KB


import kandinsky as kd
import time


WHITE = kd.color(255, 255, 255)
BLACK = kd.color(0, 0, 0)

kd.fill_rect(0, 0, 320, 222, BLACK)

def decode(data):
    override = max(data.count("="), 1)
    data = data.replace("=", "A")
    
    out = 0
    for i in data:
        index = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".index(i)
        out<<=6
        out+=index
    return out.to_bytes(len(data)*6//8, "big")[:-override]
      
def decompress(d):
  r,c="",0
  while c<len(d):
    if d[c]=="°":
      r+=d[c+4]*int(d[c+1:c+4], 16)
      c+=5
    else:
      r+=d[c]
      c+=1
  return r

width = 256
height = 26

line="°fffA°df5AGAAABgAAAYAAAGAAAB//4Af/+AGABgBgAwAYAMAGAGAAAAg°00aAB4AAD/wAD//AA4f4AcGOAGDhgBgwYAYcGAHODgA/DwAP/4AA/8°011AEAAAHAAAHwAAPwAAPwAAfgAAfgAAfgAA/AAAPAAAC°01eADAAAB4AAAeAAAHgAAAw°026ABgAAAYAAAGAAABgAAAYAAAGAAABg°024ADgAAB+AAA/gAAd4AAGAAABg°016AYAAAGAAABgAAAYAAAGAAA//AAP/wAD/8AABgAAAYAAAGAAABg°015AzAAAMgAAB4AADewAA/8AAAwAAAeAAAMwAADM°01cA/gAB//AA/v4A+APgeAA8OAADjAAAY°01eAMAABjwAB4eAA8D4A8AP/+AA/+AAB8°02bAPwAAD8AAA/°01bAGAAAB3gAAf4AADwPgA+H8AZ7nAGPwwBh4MAYPnAHH/gB/n4APwAAA4°007APgBAH8BwBjA4AYw8AHccAA+eAAHeeAAPfwAPHMAHhjAHgYwBwH8AQA8°00aAHwAAD+BgA7gYAYcHgGH/4B//4D/+GA+BjgBgfwAYD8AHAe°00cAYAADGAAAx+AB//gB//AAcxgAAMYAADH4AP/+AH/4ABzGAAAxgAAM°016A/AAAPw°00bADwAAD8AAA/°028AHP/wBz/8Acf/°060A============="
decoded = int.from_bytes(decode(decompress(line)), "big")
del line
for x in range(width):
   for y in range(height):
      kd.set_pixel(x, y+height*0, WHITE if (decoded & (1 << y+x*height)) != 0 else BLACK)
del decoded

line="°fffA°df4AMAMAHADgBgAYAYAGAGABgBgAYAcAOAHgHAA+HwAH/4AA/4°00fAfHgAP78AHv/gBh44AYMGAGDBgBgwYAYMGAH//gB//4°00eAcAAAH8AAA/4AAD/wAAz/gAMH4ADAOAAwfgAN/wAD/gAH/AAB+AAAc°008AP/gAP/+ADABgwz8MMP/DDB8wwwwMMMMfDDD/hg4fhwHgD4A//8AD/4°010AD4AAB/AAA94AAMGAHPBwBzwMAcADAAAAw°017AGAAABgAAA8AAAfgAAOcAAHDgADgcAAwDAAcA4ACAE°013ABmAAAZgAAGYAABmAAAZgAAGYAABmAAAZgAAGYAABmAAAZg°013AIAQAHAOAA4HAAHDgABw4AAOcAAB+AAAPAAABg°020APAwAH4eAD+HgBzh4AYAAAG°027AMDAAHh4AB4eAAeHg°020AH/AAD/8AB/PAA5g4AcYGAGGBgBhgYAYYOAGHnABg/wAAHw°00eAB4eAA/PwAf/+AGHhgBhwYAYMGAGHhgBh8YAf38AD8/AAeD°011AOAAAPgAAf4AAfmAAfhgAfgYAfgGAHgBgBgAYAAAGAAABg°00eAfgAAP8GAHjhgBgYYAYGGAGBhgBgY4AcGcAD/+AAf/AAD/°010AcAAAfwYAP8GADDhgBgYYAYGGAGBhgBgYYAYH+AGB/g°00eAGAAABgAAAYAAB//4Af/+AAYDgAGBwABh4AAY4AAG8AAB8AAAeAAAG°00cAOAAAHx4AD+/ABx94AYMGAGDBgBgwYAYMGAGABgBgAw°012AGAAABgfgAYP8AGHngBjgYAZwGAG4BgB8AYAeAMAHAHABg°014A==="
decoded = int.from_bytes(decode(decompress(line)), "big")
del line
for x in range(width):
   for y in range(height):
      kd.set_pixel(x, y+height*1, WHITE if (decoded & (1 << y+x*height)) != 0 else BLACK)
del decoded

line="°fffA°df3Af/4AP/+AHgAABgAAAYAAAGAAABgAAAYAAAHgAAA//4AH/+°00cAGAAABgAAAYAAAGAAABgB//4Af/+AH//gAAAYAAAGAAABgAAAY°00eAHgAAD+BgA/gYAYcGAGHBgBg4YAYOGAGBzgBgfwAYD8AHAc°00aAEAAABwAAAeD8AD5/AAP44AA+GAADBgAAwYAAMGAH//gB//4°00dAHB/gBh/+AY//wGOAeBnADgfgAYD4AGAOABgBwA4AeA8AD/+AAf/AAA+°00cAH4AAD/AAA54AAcOAAGBgABgYAAYGAAGBgB//4Af/+°00fAf4AAf/gAP/8ADgHgBwAYAYAGAGABgBgAYAcAOADgHAA//gAH/wAAPw°00aAH//gB//4AeAAAD4AAAPgAAAfAAAB8AAAHwAAAeAH//gB//4°009AB/8AAf/+AAf/gAAD4AAH4AAPwAADwAAA/gAAB+AAAH4Af/+AH//gB+°00bABgAAAYAAAGAAABgAAAYAAAGAAABgAAAf/+AH//gB//4°012AGAAgBwAYAeAeADwPAAPHgAB7gAAPwAAA4AAf/+AH//g°017Af/gAf/4AP/+AHABgBgAYAYAGAGABgBgAYAcAG°012ABgAYAYAGAGABgBgAYAf/+AH//gB//4AYAGAGABgBgAY°012AH//gB//4AAMAAADAAAAwAAAMAAADAAAAwAAAMAAH//gB//4°00eAf8MAH/DgBgwYAYMGAGDBgBgAYAYAOAHAHAA8DwAH/4AA/8AABw°010AMGAADBgAAwYAAMGAADBgAAwYAf/+AH//gB//4°016ABgwYAYMGAGDBgBgwYAYMGAGDBgB//4Af/+AH//g°00eAD8AAD/wAB//AA8BwAcAOAGABgBgAYAYAGAGABgBgAYAf/+AH//g°012A=="
decoded = int.from_bytes(decode(decompress(line)), "big")
del line
for x in range(width):
   for y in range(height):
      kd.set_pixel(x, y+height*2, WHITE if (decoded & (1 << y+x*height)) != 0 else BLACK)
del decoded

line="°fffA°e16AYAYAfAGAH4/gDuP4AxnOAMZhgDGYYAxmGAMZzgDv/wAf/8AHm°00eADAAAwwAAMMAADDAAAwwAAMcAf/+AH//gAAMAAADAAAAwAAAM°00fAM+AAHPwABjeAAYxgAGMYABjGAAYxgAHM4AA/8AAP+AAA/°00fAB//8Af//AH//wA4GAAcBgAGAYABgGAAYDgAHzwAA/4AAH8°013ABwOAAYBgAGAYABgGAAYBgAHA4AB4cAAP/AAB/°014AD+AAD/wAA4eAAcBgAGAYABgGAAYDgAGBwAB//8Af//°012AB/4AAf/AAH/4AAzOAAYxgAGMYABjGAAZxgAH44AA+MAAH°024AQAAAGAAABwAAAMAAABAAAAQ°008ADAAAAwAAAMAAADAAAAwAAAMAAADAAAAwAAAMAAADAAAAwAAAMAAADAAAAw°00eAQAAAHAAAA8AAAHwAAAeAAABgAAB4AAB4AAB4AAAcAAAE°01bAD///4///+MAABjAAAYwAAGMAABg°015ADAAAA8AAAH4AAAfgAAA/AAAD8AAAPwAAAfgAAB8AAAD°01aADAAAYwAAGMAABjAAAY///+P///g°01aAGADgBgB4AYB+AGA9gBg+YAYeGAGfBgBvAYAfgGAHgBgBwAY°00cAYAAAeAAAfAAAPgAAPgAH/gAB/wAAf/AAAD8AAAPgAAA+AAADgAAAYAAAAAEAAgBwAYAfAeAD4fAAPvAAA/gAAHwAAH+AADz4AD4PAB4B4AcAGAEAAg°006AP+AH//gB/wAAfAAAD+AAAH8AAAfAAAfwAB/AAAeAAAH//gB//4AAA+AAAAgAAB4AAB+AAD/AAH+AAP8AAHwAABwAAAfwAAD/gAAH/AAAP+AAAfgAAA4°00eA=="
decoded = int.from_bytes(decode(decompress(line)), "big")
del line
for x in range(width):
   for y in range(height):
      kd.set_pixel(x, y+height*3, WHITE if (decoded & (1 << y+x*height)) != 0 else BLACK)
del decoded

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.