Skip to content

Instantly share code, notes, and snippets.

@r33drichards
r33drichards / cua-fleet-windows-all-code.md
Created July 28, 2026 22:41
Create, control, and delete a Windows Cua Fleet with cua-fleet (no Terraform)

Create, Control, and Delete a Windows Cua Fleet with cua-fleet

This is an all-Python alternative to Terraform. It creates a Windows Cua Fleet pool through the PyPI cua-fleet SDK, waits for a sandbox claim, initializes the Windows computer-server MCP endpoint, and deletes the claim and pool when it exits.

It mirrors Cua's Windows Fleet configuration:

  • KubeVirt runtime
@r33drichards
r33drichards / cua-fleet-windows-live-control.md
Created July 28, 2026 22:34
Provision and control a Windows Cua Fleet with Terraform and cua-fleet

Provision and Control a Windows Cua Fleet with Terraform and cua-fleet

This guide provisions the Windows Fleet configuration from Cua's Terraform how-to guide, then uses the PyPI cua-fleet package to claim a sandbox, initialize its computer-server MCP endpoint, and release the claim.

The Terraform resource owns the Fleet pool. The Python program only borrows a sandbox from that existing pool, so it never deletes the pool or namespace.

What you need

@r33drichards
r33drichards / cua_fleet_pypi_example.py
Created July 28, 2026 20:58
CUA Fleet live MCP example using the cua-fleet PyPI package and uv
#!/usr/bin/env python3
import asyncio
import json
import os
import time
import urllib.error
import urllib.request
from cyclops_sdk import (
CreateClaimRequest,
@r33drichards
r33drichards / agent.py
Created July 14, 2026 20:19
Mini-SWE Agent for Jhonny - CUA sandbox with double MCP servers. Pool names use {randhex6} template for uniqueness.
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "boto3",
# "cua-train",
# "httpx",
# "mcp>=1.28.1,<2",
# "pyyaml",
# ]
@r33drichards
r33drichards / agent.py
Last active July 16, 2026 14:11
Mini-SWE Agent for filed - CUA sandbox with double MCP servers
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "boto3",
# "cua-train",
# "httpx",
# "mcp>=1.28.1,<2",
# "pyyaml",
# ]
@r33drichards
r33drichards / compressor.lua
Created July 7, 2026 01:15
CC:Tweaked stationary crafty turtle: melon slices → melon blocks
-- Melon slice -> melon block compressor (stationary crafty turtle)
-- Input chest above: melon slices
-- Output chest below: melon blocks
--
-- Setup:
-- 1. Equip a crafting-table upgrade on the turtle.
-- 2. Place a chest with melon slices above the turtle.
-- 3. Place a chest below the turtle for melon blocks.
-- 4. Run this program (or put it in startup.lua to loop):
-- while true do shell.run("compressor") sleep(30) end
@r33drichards
r33drichards / bctest.lua
Last active June 10, 2026 02:45
does this CC computer load Lua 5.1 bytecode? (CC:T 1.109+ blocks it)
-- bctest — does this computer's Lua load 5.1 bytecode? CC:Tweaked >= 1.109.0
-- refuses binary chunks, which disables wasmcraft's jit (compiled) mode — the
-- engine then falls back to the interpreter automatically. This prints which
-- world you're in. The probe chunk is a minimal valid 5.1 proto: "return 42".
local bc = "\27\76\117\97\81\0\1\4\4\4\8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\2\2\0\0\0\1\0\0\0\30\0\0\1\1\0\0\0\3\0\0\0\0\0\0\69\64\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
local f, lerr = (loadstring or load)(bc)
if type(f) == "function" then
local okrun, v = pcall(f)
if okrun and v == 42 then
print("bytecode loading WORKS (got " .. tostring(v) .. ") - jit mode available")
@r33drichards
r33drichards / picbench.lua
Last active June 10, 2026 03:34
wasmcraft: remote interp-vs-jit Picat benchmark via picatd
-- picbench — benchmark a picatd daemon FROM ANY computer on the network:
-- the daemon runs the same Picat fib(N) program end-to-end (engine boot + solve)
-- through the tree-walking INTERPRETER and through the wasm->Lua-bytecode
-- COMPILER (jit), times each on its own clock (rednet latency excluded), and
-- this client reports both + the speedup. Jobs queue on the daemon's 'main'
-- session, so a busy daemon finishes its current work first.
-- Usage: picbench [daemon] [N] [mode] (default: first daemon, fib(10), jit)
-- mode = the compiled leg (jit|transpile|auto), always compared vs interp.
-- jit is STRICT: on a CC build that refuses bytecode it FAILS LOUDLY - rerun
-- with mode transpile there.
-- sqlite ON DISK via the raw WebAssembly API, on a ComputerCraft computer.
-- Sibling of examples/sqlite.lua, but instead of ":memory:" this opens a real
-- file through the `fs` cap, so the database survives the wasm instance and lands
-- on the computer's save dir as an inspectable .sqlite file.
--
-- How the path maps (verified against the engine source):
-- * wasm.instantiate(..., { fs = "sql" }) resolves to this computer's own save
-- dir + "sql": <world>/computercraft/computer/<id>/sql (WasmLuaAPI.resolveFs
-- + computerRoot).
-- * The `fs` cap mounts that host directory at the guest root "/"
-- sqlite via the raw WebAssembly API, on a ComputerCraft computer.
--
-- This loads the module straight from an OCI registry (digest-verified). For that
-- to work, wasm-cc.json must enable it:
-- "allowOciModules": true,
-- "ociRegistryAllow": ["ghcr.io"]
-- The host fetches the module itself, so only the "wasi" cap is needed here (no
-- "http" cap). The ghcr.io/r33drichards/sqlite artifact is published by the
-- release workflow (or manually via `make publish-sqlite`); until the first `v*`
-- tag is pushed this ref will not resolve yet -- meanwhile you can use the local