Skip to content

Instantly share code, notes, and snippets.

View tobchen's full-sized avatar

Tobias Heukäufer tobchen

View GitHub Profile
@tobchen
tobchen / comic_template.svg
Created September 23, 2016 09:10
Comic template for a 7x10.5 inch page with a 6.75x10.25 inch trim area and a 6x9 inch live area with markers for fourth/third panel layouts.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tobchen
tobchen / comic_template2.svg
Created December 15, 2017 14:00
Comic template for a spread.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tobchen
tobchen / convert.py
Created April 10, 2021 18:55
Convert images to XBM; e.g. "python3 convert.py img.png icon.h" or "python3 convert.py img.png icon.h icon_name"
import sys
import os
from PIL import Image
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Not enough arguments; needs input and output!")
else:
image = Image.open(sys.argv[1])
image = image.convert("L")
@tobchen
tobchen / insta_story.py
Created May 29, 2021 10:58
Python script to convert and speed up any video to a 14.9s video for use in Instagram stories
import sys
import subprocess
import re
if len(sys.argv) < 3:
print("Needs input & output arguments!")
exit()
in_path: str = sys.argv[1]
@tobchen
tobchen / shane-mas.py
Created October 30, 2021 12:27
List movies to watch for Shane-Mas
import sys
import random
movies = [
"Lethal Weapon (1987)",
"The Monster Squad (1987)",
"Lethal Weapon 2 (1989)",
"The Last Boy Scout (1991)",
"Last Action Hero (1993)",
"The Long Kiss Goodnight (1996)",
@tobchen
tobchen / cologne-phonetics.sql
Created May 1, 2024 18:32
My go at Cologne Phonetics in PostgreSQL
CREATE FUNCTION cologne_phonetics_preprocess(txt varchar) RETURNS varchar AS $$
BEGIN
RETURN replace(replace(replace(replace(upper(txt), 'Ä', 'A'), 'Ö', 'O'), 'Ü', 'U'), 'ß', 'SS');
END;
$$ LANGUAGE plpgsql
IMMUTABLE
RETURNS NULL ON NULL INPUT;
CREATE FUNCTION cologne_phonetics_encode_except_cx(ch varchar, next_ch varchar) RETURNS varchar AS $$
DECLARE
@tobchen
tobchen / gray-gen.py
Last active May 12, 2024 09:53
A python script for generating a dither SVG in any size
import sys
import math
size = int(sys.argv[1]) if len(sys.argv) > 1 else 4
# https://www.wolframalpha.com/input?i=solve+s*s%2F2+%3D+%28pi*r%5E2%29*2+for+r
radius = size / (2 * math.sqrt(math.pi))
print(f"""<svg version="1.1" width="{size}" height="{size}" xmlns="http://www.w3.org/2000/svg">