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 / Geospatial Map with Geopandas.md
Created April 15, 2024 03:49
This code snippet loads a geospatial data, creates a base map using the GeoJson library, adds markers or popups for specific locations, and displays it in an interactive notebook.

Geospatial Map with Geopandas

Preview:
from e2b_code_interpreter import CodeInterpreter

code = """
import geopandas as gpd
import folium

# Load geospatial data
@twilwa
twilwa / Audio Analysis and Visualization with Librosa and Plotly.md
Created April 15, 2024 03:48
Performing audio analysis using Librosa to extract features like mel spectrogram, MFCCs, and chroma, then visualizing them with interactive plots using Plotly.

Audio Analysis and Visualization with Librosa and Plotly

Preview:
from e2b_code_interpreter import CodeInterpreter

code = """
import librosa
import librosa.display
import plotly.graph_objects as go
@twilwa
twilwa / Generate Generative Art with Random Shapes using PIL and NumPy.md
Created April 15, 2024 03:47
Create generative art by drawing random shapes like ellipses, rectangles, and lines on a canvas.

Generate Generative Art with Random Shapes using PIL and NumPy

Preview:
from e2b_code_interpreter import CodeInterpreter

code = """
import numpy as np
from PIL import Image, ImageDraw

def create_generative_art(width, height, num_shapes):