Skip to content

Instantly share code, notes, and snippets.

@amxv
amxv / svelte5.mdc
Last active July 15, 2026 13:43
Svelte 5 and SvelteKit Cursor Rules (scroll down to see sveltekit.mdc) - Pop these in the `.cursor/rules` folder in the root of your project.
---
description: writing svelte code
globs: *.svelte, *.svelte.ts
---
In this project, we use Tailwind CSS for styling and shacn-svelte as the UI component library (built on top of Bits UI).
It is a port of shadcn/ui to Svelte. You can use their CLI to install all the same shadcn components by running this command `bunx shadcn-svelte@next add <component-1> <component-2>`, just like the Original React version.
Please use the new Svelte 5 syntax when working in .svelte and .svelte.ts files.
Some key points include:
@amxv
amxv / clw-v2
Last active June 26, 2025 01:38
clw-v2
# /usr/local/bin/clw
#!/usr/bin/env python3
import os, sys
LIM = int(os.getenv("CLW_MAX_LINE_LENGTH", "1550"))
MARK = (os.getenv("CLW_WRAP_MARK", "⏎") + "\n").encode("utf‑8")
def flush(chunk: bytes):
"""Emit chunk in ≤LIM slices."""
while len(chunk) > LIM:
@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 \
@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-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 / 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-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-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 / 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 / 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