Skip to content

Instantly share code, notes, and snippets.

View pirate's full-sized avatar
🅱️
Working on Stagehand

Nick Sweeting pirate

🅱️
Working on Stagehand
View GitHub Profile
@pirate
pirate / 0001-effect-greenfield-Effect.ts-port-skeleton-CDP-Browse.patch
Created May 13, 2026 23:12
Effect.ts port of stagehand-server (3 commits, branch effect-ts) — greenfield effect/ folder, native PubSub bus, full Browser+LLM surfaces
From 9f7c143fb01bdc780fd440a4689c530745d1f3cb Mon Sep 17 00:00:00 2001
From: Claude <noreply@anthropic.com>
Date: Wed, 29 Apr 2026 21:41:05 +0000
Subject: [PATCH 1/3] effect: greenfield Effect.ts port skeleton (CDP, Browser,
Stagehand, LLM)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
New top-level effect/ workspace package containing the start of the
"""Test to ensure navigation timeouts don't block subsequent operations"""
import asyncio
import pytest
from pytest_httpserver import HTTPServer
from browser_use.browser.profile import BrowserProfile
from browser_use.browser.session import BrowserSession
@pirate
pirate / CLAUDE.md
Created June 18, 2025 23:44
Claude Code guidelines for browser-use monorepo parent directory containing all our sub-projects

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Repository Overview

This is a monorepo containing multiple projects in the Browser Use ecosystem - an AI browser automation framework. The main components are:

Core project folders:

@pirate
pirate / asyncio_event_loop_debugger.py
Created June 13, 2025 22:54
Debug script to use in any codebase to print all the active event loops and all their pending and active tasks.
#!/usr/bin/env python
import asyncio
import threading
import logging
import pytest
from typing import Dict, List, Any
import sys
import weakref
@pirate
pirate / iterated_prisoners_dillema.html
Created February 7, 2025 14:07
Mini JS web game allowing you to simulate iterated prisoners dillema rounds against a bot character with a few different strategies
<!-- Iterated prisoners dillema mini JS web game by Nick Sweeting on 2025-02-07 https://blog.sweeting.me -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Iterated Prisoner's Dilemma Game</title>
<style>
/* Basic Styles */
body {
font-family: sans-serif;
@pirate
pirate / dxp4800_plus_lspci_fio_tests.txt
Last active January 30, 2025 22:50
lspci and fio speed testing the internal and main nvme slot speeds on a UGREEN DXP4800 Plus NAS
# This is the output of testing the nvme slot speeds on a UGREEN DXP4800 Plus NAS
# The internal slot is limited to PCIe 3.0 speeds and 25w compared to the main slots at PCIe 4.0 speeds and 75w.
# https://www.reddit.com/r/homelab/comments/1bya4n1/ugreen_nas_ama/m9sqojt/
root@ugnas[~]# fio --filename=/dev/nvme2n1 --direct=1 --rw=read --bs=1M --ioengine=libaio --iodepth=32 --numjobs=1 --name=seq_read_test --size=10g
seq_read_test: (g=0): rw=read, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=libaio, iodepth=32
fio-3.33
Starting 1 process
Jobs: 1 (f=1): [R(1)][-.-%][r=3360MiB/s][r=3360 IOPS][eta 00m:00s]
seq_read_test: (groupid=0, jobs=1): err= 0: pid=5961: Thu Jan 30 14:39:40 2025
@pirate
pirate / truenas_enable_boot_write.sh
Last active February 13, 2026 17:14
Commands to enable read-write / apt install on the boot pool for TrueNAS scale
# enable read-write / apt install on the boot pool for TrueNAS scale
mount -o remount,rw 'boot-pool/ROOT/24.10.2/usr'
chmod +x /bin/apt*
chmod +x /usr/bin/dpkg
apt-get update
/usr/local/libexec/disable-rootfs-protection
@pirate
pirate / Install FreeNAS SCALE on a partition and create a mirror.md
Created January 18, 2025 09:05 — forked from gangefors/Install FreeNAS SCALE on a partition and create a mirror.md
How to install TrueNAS SCALE on a partition instead of the full disk

Install TrueNAS SCALE on a partition instead of the full disk

The TrueNAS installer doesn't have a way to use anything less than the full device. This is usually a waste of resources when installing to a modern NVMe which is usually several hundred of GB. TrueNAS SCALE will use only a few GB for its system files so installing to a 16GB partition would be helpful.

The easiest way to solve this is to modify the installer script before starting the installation process.

@pirate
pirate / uuid7.py
Last active May 31, 2025 09:39
Pure python all-in-one UUIDv7 Implementation with graceful degradation between ms, µs, and ns timestamp precision
#!/usr/bin/env python3
# A single-file pure-python implementation of UUIDv7: (e.g. 01941230-851a-77fd-9b0b-8c8eac3b2d23)
# - makes sure UUIDv7s are always generated in alphabetic order (using system time + nanoseconds + extra monotonic random bits)
# - store millisecond, microsecond, nanosecond / variable precision timestamps all using same format
# - graceful degradation in precision, falls back to monotonic urandom bytes depending on user-provided timestamp precision
# - fully compatible with standard UUIDv7 spec (48 bit millisecond unix epoch time with rand_a & rand_b monotonic randomness)
# - allows you to generate a UUIDv7 with a given timestamp (of any precision), and parse the timestamp back out from any UUIDv7
# - helps guarantee that UUIDv7s generated back-to-back in the same thread are always monotonically sortable
# - helps lower the risk of UUIDv7s colliding with other UUIDv7s generated in other threads / on other machines
@pirate
pirate / cat_chat.tsx
Created December 24, 2024 09:11
A very simple dumb v0 app that lets you chat with your cat (listens for cat meows using browser microphone and then lets you type meows back).
'use client'
import { useState, useEffect, useRef } from 'react'
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
type Message = {
sender: 'human' | 'cat'
content: string