This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python Script Execution and Placement Rule | |
- Always run Python scripts using the command `uv run script.py`, where `script.py` is the name of the script. | |
All Python script tools must be placed in the project's ROOT folder. DO NOT create subfolders under any circumstances. | |
- Again, I repeat: use the "." (current directory); don't create subfolders. Also, do not create subfolders with the same name as the current folder. | |
- Do not ask, "Would you like to run the script now to see the output?" Just run it. | |
# Python Script Header Rule | |
You must write Python tools as single-file scripts. Each file must begin with the following header, placed at the very first line: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.13" | |
# dependencies = [ | |
# "marimo", | |
# "typst==0.13.2", | |
# ] | |
# /// | |
import marimo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "pypdf", | |
# "pillow", | |
# ] | |
# /// | |
from pathlib import Path | |
from pypdf import PdfReader, PdfWriter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "uvtrick", | |
# ] | |
# /// | |
from uvtrick import Env | |
def benchmark(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "pillow", | |
# ] | |
# /// | |
from pathlib import Path | |
from PIL import Image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// 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 |
NewerOlder