- Web Server: Play (framework) or http4s (library)
- Actors: akka
- Asynchronous Programming: monix (for tasks, reactors, observables, scheduler etc)
- Authentication: Silhouette
- Authorization: Deadbolt
- Command-line option parsing: case-app
- CSV Parsing: kantan.csv
- DB: doobie (for PostgreSQL)
| require 'benchmark' | |
| require 'yaml' | |
| def encode(msg, format) | |
| case format | |
| when :yaml | |
| str = msg.to_yaml | |
| when :binary | |
| str = Marshal.dump(msg) | |
| end |
| require 'rubygems' | |
| require "builder" | |
| require "benchmark" | |
| require 'nokogiri' | |
| require 'erb' | |
| require 'erubis' | |
| ITERATIONS = 1_000 | |
| ERB_TEMPLATE = <<-EOL |
| """ | |
| (C) Mathieu Blondel - 2010 | |
| License: BSD 3 clause | |
| Implementation of the collapsed Gibbs sampler for | |
| Latent Dirichlet Allocation, as described in | |
| Finding scientifc topics (Griffiths and Steyvers) | |
| """ |
| // Just an example of some code I ended up not using, but which is kinda neat. | |
| object Utils { | |
| def linesFromFile(file: File) = { | |
| io.Source.fromInputStream(getMemoryMappedFileInputStream(file)).getLines | |
| } | |
| def getMemoryMappedFileInputStream(file: File): InputStream = { |
| #!/usr/bin/python | |
| """ | |
| Author: Jeremy M. Stober | |
| Program: GP.PY | |
| Date: Thursday, July 17 2008 | |
| Description: Example of Gaussian Process Regression. | |
| """ | |
| from numpy import * | |
| import pylab |
| object Transducer { | |
| type RF[R, A] = (R, A) => R | |
| def apply[A, B](f: A => B) = | |
| new Transducer[B, A] { | |
| def apply[R](rf: RF[R, B]) = (r, a) => rf(r, f(a)) | |
| } | |
| } | |
| import Transducer.RF |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <xmmintrin.h> // SSE | |
| #include <immintrin.h> // AVX | |
| #ifdef _WIN32 | |
| #include <intrin.h> // for __movsb, __movsd, __movsq |
| package half | |
| import scala.math.{pow, round, signum} | |
| import scala.util.Random.nextInt | |
| import java.lang.{Float => JFloat} | |
| /** | |
| * Float16 represents 16-bit floating-point values. | |
| * | |
| * This type does not actually support arithmetic directly. The |
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.