Skip to content

Instantly share code, notes, and snippets.

View gtkatakura's full-sized avatar

gtkatakura

View GitHub Profile

LLM Wiki

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.

The core idea

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.

@trvswgnr
trvswgnr / enum.ts
Last active February 9, 2025 06:06
typescript enums that are compatible with the --experimental-strip-types flag introduced in node v22.6.0
// --- examples --- //
// happy path
const Priority = Enum("Low", "Normal", "High");
// ^?
type Priority = Enum<typeof Priority>;
// ^?
// invalid key starting with number
const InvalidPriority1 = Enum("1Low", "Normal", "High");
@VictorTaelin
VictorTaelin / hvm3_atomic_linker.md
Last active December 25, 2025 23:54
HVM3's Optimal Polarized Atomic Linker

HVM3's Optimal Atomic Linker (with Polarization)

Atomic linking is at the heart of HVM's implementation: it is what allows threads to collaborate towards massive parallelism. All major HVM versions started with a better atomic linker. From slow, buggy locks (HVM1), to AtomicCAS (HVM1.5), to AtomicSwap (HVM2), the algorithm became simpler and faster over the years.

On the initial HVM3 implementation, I noticed that one of the cases on the atomic linker never happened. After some reasoning, I now understand why, and

defmodule Primality do
# O jeito "ingênuo" de checar por primalidade é você simplesmente verificar
# se o número tem divisores. Ou seja, você pega todos os números menores
# que o seu número-alvo (começando em 2, pois 1 divide todos os números)
# e verifica se eles dividem o número (ou seja, se o resto da divisão -
# função `rem/1` - é igual a 0).
#
# Também precisamos de um caso especial para 1, que não tem divisores mas não
# é primo.
def check_naive(1), do: false
@Softwave
Softwave / README.md
Last active November 27, 2025 14:05
Fibonacci Program

Fib

Simple fibonacci number calculator.

Usage: fib nth Fibonacci number

@akitaonrails
akitaonrails / win11.xml
Created January 17, 2023 16:29
My Windows 11 libvirt XML configuration
<domain type='kvm'>
<name>win11-real</name>
<uuid>45768371-b871-4937-b7c2-60ed835011de</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/10"/>
</libosinfo:libosinfo>
</metadata>
<memory unit='KiB'>33554432</memory>
<currentMemory unit='KiB'>33554432</currentMemory>

We should kill Prop

Notação

Irei estar usando letras maiusculas para tipos e minusculas para o que não é um tipo ou é desconhecido.

Funções: (x : A) -> B === ∏x:A. B, uma função que aceita x de um tipo A e retorna algo do tipo B, também chamado de abstração, a variável pode ser omitida quando ela não aparece em B A -> B. Implicito: {x : A} -> B, uma função aonde o parametro é implicito, aka o compilador irá achar o argumento. Módulo: (x : A, B) === Σx:A. B, um módulo aonde a esquerda x tem um tipo A e a direita algo do tipo B, também chamado de par, módulos podem ser transparentes tendo a forma de (x : A = v, B.

Roadmap de estudos de SQL

Aviso: Muitas vezes detalhes de várias operações podem variar de banco para banco. Em questões onde fiquei em dúvida, este documento segue o funcionamento do PostgreSQL, pois é o banco que conheço melhor.

Pré-requisito: Álgebra Relacional básica

Antes de começar a escrever SQL, você precisa entender o modelo de como um banco de dados relacional funciona. Não precisa se aprofundar muito, mas você precisa entender como que dados e relacionamentos entre eles são representados. (Nota importante: Relacionamento e relação não são a

@Grubba27
Grubba27 / statistics.ts
Last active May 31, 2022 04:10
basico of Statistics
type Reverse<A> =
`${A}` extends `${infer AH}${infer AT}`
? `${Reverse<AT>}${AH}` : A
type Digs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
type DigsNext<I = Digs, R = {}> =
I extends [infer Head, infer Next, ...infer Tail]
? DigsNext<[Next, ...Tail], R & Record<Head, Next>>
: { [K in keyof R]: R[K] }
@Grubba27
Grubba27 / fizzbuzz.ts
Created April 20, 2022 01:13
FizzBuzz made in typelevel
type Reverse<A> =
`${A}` extends `${infer AH}${infer AT}`
? `${Reverse<AT>}${AH}` : A
type Digs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
type DigsNext<I = Digs, R = {}> =
I extends [infer Head, infer Next, ...infer Tail]