Skip to content

Instantly share code, notes, and snippets.

View REASY's full-sized avatar

Artavazd Balaian REASY

View GitHub Profile
@REASY
REASY / llm-wiki.md
Created April 5, 2026 04:10 — forked from karpathy/llm-wiki.md
llm-wiki

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.

@REASY
REASY / socks5_endpoint_client.py
Created March 18, 2026 04:43
socks5_endpoint_client.py
#!/usr/bin/env python3
"""Send Hello to tcp/udp/http endpoints through a SOCKS5 proxy.
Examples:
python3 tools/socks5_endpoint_client.py \
--proxy 127.0.0.1:1080 \
tcp:example.com:9000
python3 tools/socks5_endpoint_client.py \
--proxy proxy.example.com:1080 \
@REASY
REASY / redroid_ebpf.diff
Created February 27, 2026 11:22
eBPF for Redroid
project device/generic/arm64/
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 5c54c8b..fc2dcc5 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -36,9 +36,14 @@ BOARD_USE_LEGACY_UI := true
# PDK does not use ext4 image, but it is added here to prevent build break.
TARGET_USERIMAGES_USE_EXT4 := true
@REASY
REASY / GCP.md
Last active February 10, 2026 02:23
How to run Redroid in GCP with the best performance

How to run Redroid in GCP with the best performance

Use arm64 instance types like n4a and Ubuntu 24.04

Install required packages

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get -y install linux-modules-extra-`uname -r`
@REASY
REASY / gil_threads.py
Created December 15, 2025 03:51
Python: Multi-Threading with GIL and Free-Threading
import threading
import sys
import time
import os
from typing import List, NamedTuple
# Optional import for visualization
try:
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
@REASY
REASY / thread_170_dump.txt
Created November 30, 2025 23:07
Thread dump of a thread 170
(gdb) thread 170
[Switching to thread 170 (Thread 0x7fb367dfe6c0 (LWP 26))]
#0 futex_wait (private=0, expected=2, futex_word=0x7fb366e146a8) at ../sysdeps/nptl/futex-internal.h:146
warning: 146 ../sysdeps/nptl/futex-internal.h: No such file or directory
(gdb) bt
#0 futex_wait (private=0, expected=2, futex_word=0x7fb366e146a8) at ../sysdeps/nptl/futex-internal.h:146
#1 __GI___lll_lock_wait (futex=futex@entry=0x7fb366e146a8, private=0) at ./nptl/lowlevellock.c:49
#2 0x00007fb3d3f26101 in lll_mutex_lock_optimized (mutex=0x7fb366e146a8) at ./nptl/pthread_mutex_lock.c:48
#3 ___pthread_mutex_lock (mutex=mutex@entry=0x7fb366e146a8) at ./nptl/pthread_mutex_lock.c:93
#4 0x00005648ca696ac2 in malloc_mutex_lock_final (mutex=0x7fb366e14668) at include/jemalloc/internal/mutex.h:151
@REASY
REASY / futex_wait.txt
Created November 30, 2025 05:02
Threads waiting for the same futex
(gdb) info threads
Id Target Id Frame
13 Thread 0x7fb1b128a6c0 (LWP 193) "tokio-runtime-w" futex_wait (private=0, expected=2, futex_word=0x7fb366e146a8) at ../sysdeps/nptl/futex-internal.h:146
44 Thread 0x7fb1b62a96c0 (LWP 162) "tokio-runtime-w" futex_wait (private=0, expected=2, futex_word=0x7fb366e146a8) at ../sysdeps/nptl/futex-internal.h:146
77 Thread 0x7fb1ba4ca6c0 (LWP 129) "tokio-runtime-w" futex_wait (private=0, expected=2, futex_word=0x7fb366e146a8) at ../sysdeps/nptl/futex-internal.h:146
109 Thread 0x7fb1be4ea6c0 (LWP 97) "tokio-runtime-w" futex_wait (private=0, expected=2, futex_word=0x7fb366e146a8) at ../sysdeps/nptl/futex-internal.h:146
136 Thread 0x7fb2e8df86c0 (LWP 65) "chunk-reader" futex_wait (private=0, expected=2, futex_word=0x7fb366e146a8) at ../sysdeps/nptl/futex-internal.h:146
170 Thread 0x7fb367dfe6c0 (LWP 26) "otlp-worker" futex_wait (private=0, expected=2, futex_word=0x7fb366e146a8) at ../sysdeps/nptl/futex-int
@REASY
REASY / threads.txt
Created November 30, 2025 04:51
All the threads of the app
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7fb3d3d45600 (LWP 7) "app" 0x00007fb3d3fb1c1a in __libc_recv (flags=<optimized out>, len=1, buf=0x7ffe418c1647, fd=50) at ../sysdeps/unix/sysv/linux/recv.c:28
2 Thread 0x7fb1afc7f6c0 (LWP 204) "tokio-runtime-w" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
3 Thread 0x7fb1afe806c0 (LWP 203) "tokio-runtime-w" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
4 Thread 0x7fb1b00816c0 (LWP 202) "tokio-runtime-w" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
5 Thread 0x7fb1b02826c0 (LWP 201) "tokio-runtime-w" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
6 Thread 0x7fb1b04836c0 (LWP 200) "tokio-runtime-w" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
7 Thread 0x7fb1b06846c0 (LWP 199) "tokio-runtime-w" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
8 Thread 0x7fb1b08856c0 (LWP 198) "tokio
@REASY
REASY / fory_contention.rs
Created November 25, 2025 11:19
fory_contention.rs
/*
[dependencies]
fory = "0.13.1"
fory-derive = "0.13.1"
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
criterion = { version = "0.7", features = ["async_tokio"] }
*/
CREATE TABLE IF NOT EXISTS waf_events
(
event_time DateTime64(3),
data_date Date DEFAULT toDate(event_time),
hour_key UInt32 DEFAULT toYYYYMMDD(event_time) * 100 + toHour(event_time),
bucket_s DateTime DEFAULT toStartOfSecond(event_time),
topic LowCardinality(String),
partition Int32,
offset Int64,
queue_time DateTime64(3),