Skip to content

Instantly share code, notes, and snippets.

View littledivy's full-sized avatar

Divy Srivastava littledivy

View GitHub Profile
@littledivy
littledivy / jc.py
Created July 20, 2026 07:26
Jacobian map C^3->C^3: constant det -2, three distinct points -> (-1/4,0,0)
import sympy as sp
x, y, z = sp.symbols('x y z')
u = 1 + x*y
w = 4 + 3*x*y
F = [u**3*z + y**2*u*w, y + 3*x*u**2*z + 3*x*y**2*w, 2*x - 3*x**2*y - x**3*z]
J = sp.Matrix([[sp.diff(f, v) for v in (x, y, z)] for f in F])
print(sp.expand(J.det()))
@littledivy
littledivy / verify.py
Created July 20, 2026 07:24
sympy verification: polynomial map C^3->C^3 with constant Jacobian -2, non-injective (3 distinct points -> (-1/4,0,0)), 3-to-1
#!/usr/bin/env python3
"""
Verify the claimed properties of the polynomial map F: C^3 -> C^3
F0 = (1+xy)^3 z + y^2 (1+xy)(4+3xy)
F1 = y + 3x(1+xy)^2 z + 3x y^2 (4+3xy)
F2 = 2x - 3x^2 y - x^3 z
Claims checked:
1. det(Jacobian F) is the constant -2 (nonzero constant everywhere)
@littledivy
littledivy / SEARCH_FINDING.md
Created July 20, 2026 07:08
Search finding: the -2 constant-Jacobian non-injective map is Vitushkin's classic 'fake counterexample' to the Jacobian Conjecture

The "-2 Jacobian" non-injective map — what a search turns up

Search query: Jacobian conjecture fake counterexample constant Jacobian -2 non-injective

The hit: Vitushkin's classic example

A map with Jacobian determinant exactly −2 that is not injective is a well-known "trick" example, usually attributed to Vitushkin:

@littledivy
littledivy / JacobianCounterexample.lean
Created July 20, 2026 06:58
Lean 4 / Mathlib verifier: polynomial map C^3->C^3 with constant Jacobian -2 sending 3 distinct points to (-1/4,0,0)
/-
Jacobian "counterexample" verifier.
The map F : ℂ³ → ℂ³ (here checked over ℚ ⊂ ℂ; all data is rational)
F₀ = (1+xy)³ z + y² (1+xy) (4+3xy)
F₁ = y + 3x (1+xy)² z + 3x y² (4+3xy)
F₂ = 2x − 3x² y − x³ z
Claimed facts, machine-verified below:
@littledivy
littledivy / unclaw-mini-dev-setup.md
Created May 4, 2026 17:57
unclaw-mini / clawpatrol local dev setup

clawpatrol — local dev setup

Prerequisites: Go 1.22+, Node 18+, npm

Step 1 — create dev config

cat > dev.hcl <<'HCL'
listen      = "0.0.0.0:8443"
info_listen = "0.0.0.0:8080"
$ deno sandbox new --expose-http 18789 --memory 3gb --ssh

Created sandbox with id 'sbx_ord_f02azv7t0x7tjxz4y51n'
Exposed port 18789 to https://1ef0cf0c631d49b9b5ad1300ec939252.sandbox.deno.net
ssh 1531786bd2d9b9c96f56095a0f7e2dcd@ssh.deno.net

            __    ╭─────────────────────────────────────╮
           /ᵔ_)  <  Welcome to Deno Sandbox             │
 .-----/ / │ Sandbox sbx_ord_f02azv7t0x7tjxz4y51n│
@littledivy
littledivy / rescue.sh
Created January 16, 2026 06:32
rusty_v8 publish release rescue
#!/bin/bash
set -e
rm -rf gen_temp gen
mkdir -p gen_temp
gh run download 21040538462 -p "src_binding_*.rs" -D gen_temp
mkdir -p gen
for dir in gen_temp/*/; do
sh <(curl -L https://nixos.org/nix/install)
mkdir -p ~/.config/nix 
cat <<EOF > ~/.config/nix/nix.conf
experimental-features = nix-command flakes
EOF
cd ~/.config/nix 
nix flake init -t nix-darwin

nix run nix-darwin -- switch --flake .

Migrate from ring to aws_lc_rs

rg -l 'ring::' --glob '*.rs' | xargs -I{} perl -pi -e 's/\bring::/aws_lc_rs::/g' {}
rg -l --fixed-strings 'ring.workspace' --glob '*.toml' \
  | xargs -I{} perl -pi -e 's/\bring\.workspace\b/aws-lc-rs.workspace/g' {}
@littledivy
littledivy / notes.md
Last active April 6, 2025 12:03
libsui PE resource table layout

Icons in PE are very sensitive to resource table ordering. Here's what works:

image

We can't use editpe's builtin set_icon because it lays out Icon and Icon Group together before/after the RCData. Instead, we need a custom implementation that places RCData between the icon entries. This means we defer Icon Group to always happen during PortableExecutable::build.

After the fix: