Skip to content

Instantly share code, notes, and snippets.

View zzstoatzz's full-sized avatar

nate nowack zzstoatzz

View GitHub Profile
#!/usr/bin/env -S uv run --quiet --script
# /// script
# dependencies = ["prefect"]
# ///
"""
Asset management script for Prefect Cloud.
This script provides CRUD operations for managing assets in Prefect Cloud workspaces.
Assets are created automatically by Prefect when events are emitted, but this script
@zzstoatzz
zzstoatzz / output
Created June 9, 2025 16:42
» uvx --with django pretty-mod tree django --depth 5 | pbcopy
📦 django
├── ⚡ functions: setup
├── 📌 constants: VERSION
├── 📦 apps
│ ├── 📜 __all__: AppConfig, apps
│ ├── 📦 config
│ │ ├── 🔷 classes: AppConfig
│ │ └── 📌 constants: APPS_MODULE_NAME, MODELS_MODULE_NAME
│ └── 📦 registry
│ └── 🔷 classes: Apps
import asyncio
from prefect import flow, task
@task
async def sleepy_task() -> None:
await asyncio.sleep(15)
from time import sleep
from prefect import flow
@flow
def sleepy(n: int = 3600):
sleep(n)
# /// script
# dependencies = ["prefect"]
# ///
import webbrowser
from dataclasses import dataclass, field
from datetime import datetime
from pathlib import Path
from typing import Any
from prefect import task
def some_fn(x: int, y: str) -> int:
return x + len(y)
some_task = task(some_fn)
print(some_task(x=1, y="hello"))
from typing import Annotated
from pydantic import Field
from pydantic_ai import Agent
# the Field description is respected by the LLM as it produces a list[HistoricEvent]
HistoricEvent = Annotated[str, Field(description="what, where, when, how, why - very concise")]
historic_event_brainstormer = Agent[None, list[HistoricEvent]](
"openai:gpt-4o",
# /// script
# dependencies = ["marvin@git+https://github.com/PrefectHQ/marvin.git@marvin-3"]
# ///
from typing import Annotated, Any, TypedDict
from pydantic import ConfigDict, Field, create_model
from pydantic_core import to_json
import marvin
# /// script
# dependencies = ["httpx", "pydantic-settings"]
# ///
from pathlib import Path
from typing import Any
import httpx
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
@zzstoatzz
zzstoatzz / index.html
Last active December 14, 2024 08:35
html particles impl
<html>
<body style="margin:0;overflow:hidden;background:#000;">
<canvas id="c"></canvas>
<div style="position:fixed;top:1em;right:1em;background:rgba(0,0,0,0.85);color:#fff;padding:1.5em;border-radius:8px;min-width:200px;box-shadow:0 2px 10px rgba(0,0,0,0.5);">
<h3 style="margin:0 0 1em 0;font-family:system-ui;font-weight:400;">Particle Controls</h3>
<label style="display:block;margin-bottom:0.5em;font-family:system-ui;">Count: <span id="v" style="color:#8FBC8F;"></span></label>
<input id="count" type="range" min="10" max="2000" value="500" step="10" style="width:100%;margin-bottom:1em;">
<label style="display:block;margin-bottom:0.5em;font-family:system-ui;">Attraction: <span id="fv" style="color:#87CEEB;"></span></label>
<input id="force" type="range" min="-10000" max="10000" value="0" step="10" style="width:100%;">
</div>