Skip to content

Instantly share code, notes, and snippets.

View odysseus0's full-sized avatar
🎯
Focusing

George Zhang odysseus0

🎯
Focusing
View GitHub Profile
@odysseus0
odysseus0 / gist_ipv6_pattern_test.py
Created June 20, 2025 09:51
IPv6 Pattern Test - The script that revealed the hotel WiFi issue
#!/usr/bin/env python3
"""
IPv6 Pattern Test - The script that revealed the hotel WiFi issue
This is the actual script Claude Code wrote that tested multiple services
and revealed the pattern: all real IPv6 addresses failed at TLS,
while IPv6-mapped IPv4 addresses worked fine.
When run at home, everything worked - revealing it was the hotel WiFi
breaking IPv6 in a very specific way.
@odysseus0
odysseus0 / gist_compare_sync_async.py
Created June 20, 2025 09:51
Compare sync vs async httpx - Phase 1 investigation
#!/usr/bin/env python3
import asyncio
import httpx
import threading
import concurrent.futures
def sync_test():
"""Test with synchronous httpx client."""
print("🔄 Testing synchronous httpx.Client...")
@odysseus0
odysseus0 / gist_test_alternatives.py
Created June 20, 2025 09:51
Test alternative HTTP clients - aiohttp verification
#!/usr/bin/env python3
import asyncio
import aiohttp
import json
async def test_tikapi_aiohttp():
"""Test TikAPI using aiohttp instead of httpx."""
print("🧪 Testing TikAPI with aiohttp...")
@odysseus0
odysseus0 / gist_phase1_network_capture.py
Created June 20, 2025 09:51
Network capture analysis - Deep dive into socket operations
#!/usr/bin/env python3
"""
Phase 1: Network-Level Deep Dive - Packet Capture Analysis
Captures and compares network behavior between sync and async httpx clients
"""
import asyncio
import httpx
import socket
import ssl
@odysseus0
odysseus0 / gist_phase1_dns_resolution.py
Created June 20, 2025 09:51
DNS resolution analysis - IPv4 vs IPv6 investigation
#!/usr/bin/env python3
"""
Phase 1: Network-Level Deep Dive - DNS Resolution Testing
Tests DNS resolution behavior and IPv4/IPv6 connectivity
"""
import asyncio
import httpx
import socket
import ssl
@odysseus0
odysseus0 / gist_check_environment.py
Created June 20, 2025 09:51
Environment checker - System IPv6 capability analysis
#!/usr/bin/env python3
"""
Check why httpx AsyncClient works on some machines but not others
This will help identify environment differences
"""
import socket
import subprocess
import platform
import asyncio
@odysseus0
odysseus0 / gist_test_tikapi_ipv6_issue_raw.py
Created June 20, 2025 09:51
Test TikAPI IPv6 issue - Raw investigation script
#!/usr/bin/env python3
"""
Demonstrate how unusual TikAPI's IPv6 behavior is compared to other services.
"""
import asyncio
import socket
import ssl
import time
@odysseus0
odysseus0 / gist_blog_post.md
Created June 20, 2025 10:43
How a Hotel WiFi Taught Me That Happy Eyeballs Can't See Everything

How a Hotel WiFi Taught Me That Happy Eyeballs Can't See Everything

Or: The Empty Error String That Led Me Down a Rabbit Hole of Broken Networks

TL;DR: httpx AsyncClient was failing with empty error messages. After hours of debugging, I discovered a hotel WiFi firewall that accepts IPv6 TCP connections but kills them during TLS handshake - an edge case so specific it defeats Happy Eyeballs and every other protection mechanism.

It started with the most frustrating error message I've ever seen:

{"detail":"An error occurred while requesting TikAPI: "}
@odysseus0
odysseus0 / async-agents-design-doc.md
Last active July 1, 2025 03:28
Async Agent Architecture - Design and Exploration

Non-blocking Tasks for Claude Code - V1 Design

Overview

This design makes Claude Code more responsive by allowing the main agent to continue working while background tasks run. Currently, when Claude spawns multiple long-running tasks, everything freezes - the agent can't continue working on other things, and you can't interact with it. With this change, Claude can process results as they arrive, continue working on independent tasks, and remain available for user interaction.

Background: Understanding Claude Code

To understand the problem and solution, you need to know how Claude Code works today.

@odysseus0
odysseus0 / Selective Context Compaction for Claude Code.md
Created June 28, 2025 22:39
Selective Context Compaction for Claude Code - Feature Proposal

Selective Context Compaction for Claude Code

The Problem

Effective AI agent performance depends on maintaining high signal-to-noise ratio in the context window. Even with large contexts, noise degrades performance.

Claude Code currently offers only "Compact" - a nuclear option that rebuilds the entire conversation from scratch. This is like having only git rebase -i --root when you often just need git rebase -i HEAD~5.

The Git Analogy