When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:
main {
max-width: 38rem;
padding: 2rem;
margin: auto;
}| ''' listing 6: pi_mp.py | |
| Multiprocessing based code to estimate the value of PI | |
| using monte carlo sampling | |
| Ref: http://math.fullerton.edu/mathews/n2003/montecarlopimod.html | |
| Uses workers: | |
| http://docs.python.org/library/multiprocessing.html#module-multiprocessing.pool | |
| ''' | |
| import random |
| """ | |
| This code computes pi. It's not the first python | |
| pi computation tool that I've written. This program | |
| is a good test of the mpi4py library, which is | |
| essentially a python wrapper to the C MPI library. | |
| To execute this code: | |
| mpiexec -np NUMBER_OF_PROCESSES -f NODES_FILE python mpipypi.py |
| =begin | |
| Find pi by the Monte-Carlo method. | |
| area of a circle = pi r^2 | |
| area of a square = (2r)^2 = 4 r^2 | |
| Perform random uniform sampling between -1 and 1. | |
| The proportion of points in the unit circle is: | |
| p = (pi r^2) / (4r^2) |
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| letters-to-100.py | |
| """ | |
| import string | |
| letter_values = dict((l, i) for i, l in enumerate(string.lowercase, start=1)) | |
| english_dict = open('/usr/share/dict/words', 'rU') |
| #!/bin/bash | |
| if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF | |
| appify v3.0.1 for Mac OS X - http://mths.be/appify | |
| Creates the simplest possible Mac app from a shell script. | |
| Appify takes a shell script as its first argument: | |
| `basename "$0"` my-script.sh |
A pattern for building personal knowledge bases using LLMs.
This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.
Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.