Skip to content

Instantly share code, notes, and snippets.

@twilwa
twilwa / fetch_claude_docs.py
Created August 30, 2025 01:56 — forked from allisoneer/fetch_claude_docs.py
Download all claude code docs from web to directory in markdown
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.8"
# dependencies = [
# "requests>=2.31.0",
# "rich>=13.0.0",
# ]
# ///
"""
Fetch complete Claude Code documentation from Anthropic docs site
#!/usr/bin/env python3
"""
Demonstrate banning the em-dash (and common variants) with logit_bias.
import os, sys, textwrap
import openai # pip install openai>=1.9.0
MODEL = "chatgpt-4o-latest"
PROMPT = ("Write a short sentence that would normally include an em dash "
"(for example between two clauses).")
@twilwa
twilwa / llm_samplers_explained.md
Created July 29, 2025 04:35 — forked from kalomaze/llm_samplers_explained.md
LLM Samplers Explained

LLM Samplers Explained

Everytime a large language model makes predictions, all of the thousands of tokens in the vocabulary are assigned some degree of probability, from almost 0%, to almost 100%. There are different ways you can decide to choose from those predictions. This process is known as "sampling", and there are various strategies you can use which I will cover here.

OpenAI Samplers

Temperature

  • Temperature is a way to control the overall confidence of the model's scores (the logits). What this means is that, if you use a lower value than 1.0, the relative distance between the tokens will become larger (more deterministic), and if you use a larger value than 1.0, the relative distance between the tokens becomes smaller (less deterministic).
  • 1.0 Temperature is the original distribution that the model was trained to optimize for, since the scores remain the same.
  • Graph demonstration with voiceover: https://files.catbox.moe/6ht56x.mp4
@twilwa
twilwa / explore-plan-code-test.md
Created July 14, 2025 01:05 — forked from sergeyk/explore-plan-code-test.md
Explore - Plan - Code - Test Workflow

At the end of this message, I will ask you to do something. Please follow the "Explore, Plan, Code, Test" workflow when you start.

Explore

First, use parallel subagents to find and read all files that may be useful for implementing the ticket, either as examples or as edit targets. The subagents should return relevant file paths, and any other info that may be useful.

Plan

Next, think hard and write up a detailed implementation plan. Don't forget to include tests, lookbook components, and documentation. Use your judgement as to what is necessary, given the standards of this repo.

If there are things you are not sure about, use parallel subagents to do some web research. They should only return useful information, no noise.

@twilwa
twilwa / testRegex.js
Created June 28, 2025 00:11 — forked from hanxiao/testRegex.js
Regex for chunking by using all semantic cues
// Updated: Aug. 20, 2024
// Run: node testRegex.js whatever.txt
// Live demo: https://jina.ai/tokenizer
// LICENSE: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0)
// COPYRIGHT: Jina AI
const fs = require('fs');
const util = require('util');
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 7;
@twilwa
twilwa / claude_repo_manager
Created March 14, 2025 19:50 — forked from moonlockwood/claude_repo_manager
Semantic repo management. Raw claude output, for reference not to run. (it may just work/be good, prob not)
"""
Claude-Optimized Repository Structure
====================================
This structure implements a specialized metadata layer on top of a standard Python
repository to optimize Claude AI interaction with the codebase.
"""
import os
import json
@twilwa
twilwa / agent loop
Created March 14, 2025 19:46 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@twilwa
twilwa / git_new_local_branch.md
Created December 21, 2023 03:50 — forked from nanusdad/git_new_local_branch.md
Git - create new local branch push to GitHub
@twilwa
twilwa / async.md
Created March 18, 2023 20:35 — forked from chriseth/async.md
Async Solidity Contracts

Having seen @pirapira's sketch of Bamboo ( https://github.com/pirapira/bamboo/ ), which proposed to add better control about the "smart contract program flow", even across calls, I thought that this should certainly be added to Solidity, and actually, it might even be possible now to a certain degree using inline assembly.

The problem is that with many functions in a contract, it is not always clear which can be called at which stage in the contract's lifetime. Certain smart contracts would be easier to understand if written as follows: