Skip to content

Instantly share code, notes, and snippets.

View xh4n3's full-sized avatar
🎯
Focusing

Shane Xie xh4n3

🎯
Focusing
  • Alibaba Cloud
  • Hangzhou, China
  • X @xh4n3
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.

@DavadDi
DavadDi / traceicmpsoftirq.py
Created November 27, 2020 02:02 — forked from theojulienne/traceicmpsoftirq.py
ICMP packet tracer using BCC
#!/usr/bin/python
bpf_text = """
#include <linux/ptrace.h>
#include <linux/sched.h> /* For TASK_COMM_LEN */
#include <linux/icmp.h>
#include <linux/netdevice.h>
struct probe_icmp_data_t
{
@cmpark0126
cmpark0126 / llvm-ir-gen.sh
Last active October 26, 2025 20:28
How to Generate LLVM IR from C Source Code?
#!/bin/bash
name=${1%.*c} # detatch .c from c file name
clang-9 -O0 -Xclang -disable-O0-optnone -fno-discard-value-names -emit-llvm -c $name.c # convert source code(.c) to bit code(.bc)
llvm-dis-9 $name.bc -o $name.ll # generate llvm ir(.ll) from bit code(.bc) obtained above without any optimization
opt-9 -mem2reg $name.bc -o $name.mem2reg.bc # optimize bit code using `mem2reg` optimization pass before generating llvm ir
llvm-dis-9 $name.mem2reg.bc -o $name.mem2reg.ll # generate llvm ir(.ll) from optimized bit code(.bc)
@chendotjs
chendotjs / skbtracer.c
Last active March 31, 2025 05:13
ebpf-skbtracer
#include <bcc/proto.h>
#include <uapi/linux/ip.h>
#include <uapi/linux/ipv6.h>
#include <uapi/linux/icmp.h>
#include <uapi/linux/tcp.h>
#include <uapi/linux/udp.h>
#include <uapi/linux/icmpv6.h>
#include <net/inet_sock.h>
#include <linux/netfilter/x_tables.h>
@DzeryCZ
DzeryCZ / ReadingHelmResources.md
Last active February 24, 2026 00:10
Decoding Helm3 resources in secrets

Helm 3 is storing description of it's releases in secrets. You can simply find them via

$ kubectl get secrets
NAME                                                TYPE                                  DATA   AGE
sh.helm.release.v1.wordpress.v1                     helm.sh/release.v1                    1      1h

If you want to get more info about the secret, you can try to describe the secret

$ kubectl describe secret sh.helm.release.v1.wordpress.v1
@miguelmota
miguelmota / uint8_to_hex.cpp
Last active May 19, 2025 02:10
C++ uint8_t to hex string
#include <sstream>
#include <iostream>
#include <iomanip>
std::string uint8_to_hex_string(const uint8_t *v, const size_t s) {
std::stringstream ss;
ss << std::hex << std::setfill('0');
for (int i = 0; i < s; i++) {
#!/bin/bash
# Script to determine what named images and containers are dependent on the specified image (or a containers image) from stdin or in the args
# An unmatchable input is ignored
# All of the following will be found:
# Any image name / tag / name:tag / id that has a prefix in it that matches the input
# Any other image that relies on the images specified
# Any containers (running or not) that use any of these images
set -euf -o pipefail
@lizrice
lizrice / main.go
Created August 25, 2016 10:02
Container from scratch
package main
// @lizrice, mostly copied from @doctor_julz: https://gist.github.com/julz/c0017fa7a40de0543001
import (
"fmt"
"os"
"os/exec"
"syscall"
)
@arfon
arfon / big_query_examples.md
Last active September 19, 2022 13:00
BigQuery Examples for blog post

How many times shouldn't it happen...

-- https://news.ycombinator.com/item?id=11396045

SELECT count(*)
FROM (SELECT id, repo_name, path
        FROM [bigquery-public-data:github_repos.sample_files]
 ) AS F