Skip to content

Instantly share code, notes, and snippets.

@amxv
amxv / clw-v5.py
Created July 5, 2025 22:47
clw-v5.py
#!/usr/bin/env python3
"""
clw – Chunk-Line-Wrapper (robust stream version)
Keeps *every* write to stdout/stderr ≤1550 bytes so Codex Cloud
never triggers its 1 600-byte PTY crash guard, even when a program
prints megabytes without a single newline (pnpm, progress bars,
binary hexdumps, etc.).
"""
import binascii, os, re, sys, signal
@amxv
amxv / clw-v4.py
Created July 5, 2025 22:10
clw-v4.py
#!/usr/bin/env python3
"""
CLW – Chunk-Line-Wrapper (v4-pnpm-fix)
Break every stdout/stderr line – whether delimited by LF or CR – into
≤1550-byte slices so Codex Cloud never exceeds the 1 600-byte PTY limit.
"""
import binascii, os, re, sys, signal
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
@amxv
amxv / codex-js-pnpm.sh
Last active July 5, 2025 22:32
codex setup script for pnpm projects
#!/usr/bin/env bash
export SHELL=/bin/bash
# Ensure non-interactive apt operations and higher open-file limits
export DEBIAN_FRONTEND=noninteractive
ulimit -n 1048576
# Install build-essential, curl, git, and other utilities
apt-get update -qq >/dev/null
@amxv
amxv / package.json
Created July 3, 2025 17:42
docmd process docs live
{
"name": "@repo/docmd",
"private": true,
"scripts": {
"process-docs": "node scripts/process-docs.js",
"watch:docs": "onchange '../../docs/**/*' -- pnpm process-docs",
"build": "pnpm process-docs && docmd build",
"dev": "pnpm process-docs && concurrently \"docmd dev\" \"pnpm watch:docs\"",
"dev:simple": "pnpm process-docs && docmd dev"
},
@amxv
amxv / clw-v3.py
Created June 26, 2025 03:32
clw-v3.py
#!/usr/bin/env python3
"""
CLW – Chunk‑Line‑Wrapper
Breaks every stdout/stderr line into ≤1550‑byte slices so Codex Cloud never
hits the 1 600‑byte PTY limit.
Changes vs upstream v1
----------------------
* Handle SIGPIPE quietly → no BrokenPipeError stack‑trace.
"""
@amxv
amxv / codex-byteguard.sh
Last active July 5, 2025 22:47
codex 1600 byte guard
#!/usr/bin/env bash
set -Eeuo pipefail
echo ">>> Installing universal 1 600‑byte guard (clw‑v1 + patches)"
###############################################################################
# 1. Download the clw-v3 #
###############################################################################
CLW_URL="https://gist.githubusercontent.com/amxv/9c930675a935cc10ed7fe2fc3068705a/raw"
curl -fsSL "$CLW_URL" -o /usr/local/bin/clw
@amxv
amxv / clw-v1
Created June 26, 2025 01:38
clw-v1 (by toriningen)
#!/usr/bin/env python3
"""
INFO FOR HUMANS: This script solves this error:
```
Error: Output for session 'shell' contained a line exceeding the max of 1600 bytes (observed at least 12345 bytes).
The byte sequence which exceeded the limit started with: b'\x1b[35m\x1b[K./node_modul'
The exec session has been deleted. Please start a new session.
@amxv
amxv / codex-js.sh
Last active June 26, 2025 03:37
Codex Setup Script for JS projects
#!/usr/bin/env bash
# Ensure non-interactive apt operations and higher open-file limits
export DEBIAN_FRONTEND=noninteractive
ulimit -n 1048576
# Install build-essential, curl, git, and other utilities
apt-get update -qq >/dev/null
apt-get install -y -qq --no-install-recommends apt-utils >/dev/null
apt-get install -y -qq --no-install-recommends \
@amxv
amxv / logdev.sh
Created June 24, 2025 00:49
logdev - Run development commands with continuous logging to logs/server.log
#!/bin/bash
# logdev - Run development commands with continuous logging to logs/server.log
# Usage: logdev <command> [args...]
# Example: logdev next dev --turbo
# Check if any arguments were provided
if [ $# -eq 0 ]; then
echo "Usage: logdev <command> [args...]"
echo "Example: logdev next dev --turbo"
@amxv
amxv / codex-setup.sh
Last active June 24, 2025 03:30
Codex Setup Script
#!/usr/bin/env bash
# Ensure non-interactive apt operations and higher open-file limits
export DEBIAN_FRONTEND=noninteractive
ulimit -n 1048576
# Install build-essential, curl, git, and other utilities
apt-get update -qq >/dev/null
apt-get install -y -qq --no-install-recommends apt-utils >/dev/null
apt-get install -y -qq --no-install-recommends \