Skip to content

Instantly share code, notes, and snippets.

@ubershmekel
ubershmekel / example.py
Last active February 23, 2023 08:16
Windows python process that upon death windows will kill its subprocesses
import subproc
import time
subproc.Popen('calc')
print('now close this window and see calc closing itself')
while True:
time.sleep(1)
@tatarize
tatarize / colorclusters.py
Last active February 14, 2022 15:29
Process color distances to find max color distances between all different colors.
import math
from copy import deepcopy
from functools import lru_cache
from PIL import ImageDraw, Image
# Color conversion formula borrowed from:
# http://www.easyrgb.com/index.php?X=MATH&H=02#text2
ref_X = 95.047 # ref_X = 95.047 Observer= 2°, Illuminant= D65
ref_Y = 100.000 # ref_Y = 100.000