| name | explain-diff-html |
|---|---|
| description | Use when the user asks for a rich explanation of a code change, diff, branch, or PR. Produces HTML output. |
Please make me a rich, interactive explanation of the specified code change.
It should have these sections:
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.
| #cloud-config | |
| # Enable automatic package updates and upgrades during cloud-init execution | |
| package_update: true | |
| package_upgrade: true | |
| packages: | |
| # Security and Hardening | |
| - ufw | |
| - fail2ban |
Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.
Start by creating the SQS queue.
resource "aws_sqs_queue" "queue" {| # Place this in your .bashrc | |
| # Covers several corner cases such as nested apostrophes, history extraction in screens/subshells, Slack being down, etc. | |
| # Strings to replace with your own credentials: | |
| ## {your email address} (1 instance) | |
| ## {slack webhook url} (1 instance) | |
| ## {your computer name} (2 instances) | |
| slack() { | |
| # Get slack message when a command exits | |
| # Example usage: python long_job.py; slack |
| # Ruby on Rails Development Environment | |
| FROM ruby:2.5.0 | |
| # Set up Linux | |
| RUN apt-get update | |
| RUN apt-get install -y build-essential inotify-tools libpq-dev nodejs postgresql-client | |
| WORKDIR /app | |
| EXPOSE 3000 |
| # A user session class, a simplified mix of the following code samples: | |
| # * https://github.com/blog/1661-modeling-your-app-s-user-session | |
| # * http://www.jonathanleighton.com/articles/2013/revocable-sessions-with-devise/ | |
| class Session < ActiveRecord::Base | |
| # Uncomment if you use Hobo Fields, else add these yourself | |
| # fields do | |
| # session_id :string, :index => true, :unique => true | |
| # accessed_at :datetime | |
| # user_ip :string |
A little background on my context:
We run multiple Solr JVMs per box, which live in directories like:
/mnt/solr_8983
/mnt/solr_8984
/mnt/solr_8985
...
/mnt/solr_${PORT}
| CREATE KEYSPACE IF NOT EXISTS docstore WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; | |
| CREATE TABLE IF NOT EXISTS docstore.metadata ( | |
| userid text, | |
| docid text, | |
| joinkey text, | |
| title text, | |
| body text, | |
| PRIMARY KEY(userid, docid)); |
WAL-E needs to be installed on all machines, masters and slaves.
Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:
archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60