Skip to content

Instantly share code, notes, and snippets.

View kolibril13's full-sized avatar
🐶

Jan-Hendrik Müller kolibril13

🐶
View GitHub Profile
from typst_importer.typst_to_svg import typst_express
def typst_codeblock(code: str, position: tuple, name: str):
preamble = '''
#set page(width: 950pt, height: auto, margin: 0cm, fill: none)
#import "@preview/codelst:2.0.2": sourcecode
#import "@preview/tablex:0.0.8": tablex
'''
content = f"""{preamble}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "ffmpeg-python",
# ]
# ///
"""
This script takes two MP4 videos and creates a transition where:
- Video1 is extended by 0.5 seconds (via a frozen last frame) and the final 0.2 seconds
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "uvtrick",
# ]
# ///
from uvtrick import Env
def benchmark():
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "pillow",
# ]
# ///
from pathlib import Path
from PIL import Image
@kolibril13
kolibril13 / blender_valuetracker.py
Created February 1, 2025 12:05
set keyframes via t.animate(value=12, run_time=.5, mode=LINEAR)
import bpy
# Predefined interpolation constants for auto-complete
BEZIER = ("BEZIER", None)
LINEAR = ("LINEAR", None)
EASE_IN = ("SINE", "EASE_IN")
BOUNCE = ("BOUNCE", "EASE_OUT")
class ValueTracker:
def __init__(self, default_value=0, fps=24, name="Tracker"):
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "ffmpeg-python",
# ]
# ///
# header generated with
# uv add --script convert_mov_to_mp4.py ffmpeg-python
from pathlib import Path
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "typst",
# ]
# ///
from pathlib import Path
import typst
typst_file = Path.cwd() / "hello.typ"
@kolibril13
kolibril13 / png_to_mp4.py
Last active March 18, 2025 21:24
convert png sequence to mp4
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "ffmpeg-python",
# ]
# ///
from pathlib import Path
import shutil
import ffmpeg
@kolibril13
kolibril13 / convert_clipboard_png_to_jpeg.py
Created January 17, 2025 13:47
clipboard from png to jpeg
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "pillow",
# "pyobjc-framework-Quartz",
# ]
# ///
from pathlib import Path
from PIL import Image