Skip to content

Instantly share code, notes, and snippets.

@Peetz0r
Peetz0r / 000-generate-barcodes.py
Last active October 9, 2024 12:15
AH dierenkaartjes barcode generator (only 1 ~ 96 actually work, but this generates 0~255)
#!/bin/python3
def num2bin(n):
p = f'{n:b}'.count('1')%2
b = (n<<3) | (p << 2) | ((p^1) <<1) | 1
return b
def bin2str(b):
return f'{b:013b}'
@jmsole
jmsole / kernproof.py
Last active April 29, 2023 19:52
Kern proof generator with Drawbot and drawbotgrid
from drawBotGrid import BaselineGrid, columnBaselineGridTextBox
import os
import datetime
import itertools
import unicodedata
# When you add more fonts, it stacks the strings for each
# weight to enable easy comparisons.
fonts = ('Helvetica Neue Thin', 'Helvetica Neue', 'Helvetica Neue Bold')
#fonts = ('Helvetica Neue Thin', 'Helvetica Neue')
import time
from random import shuffle
# ----------
# The Inputs
# ----------
pageSize = 500
maximumFrameCalculationDuration = 0.1
minimumPixelSize = 5