Skip to content

Instantly share code, notes, and snippets.

View leoh0's full-sized avatar
๐Ÿ•ถ๏ธ
Working

Eohyung Lee leoh0

๐Ÿ•ถ๏ธ
Working
View GitHub Profile
@leoh0
leoh0 / llm-wiki.md
Created April 12, 2026 09:08 — 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.

@leoh0
leoh0 / fiction.md
Last active May 1, 2022 12:41
(ํ”ฝ์…˜) cloud์˜ kubernetes ์„œ๋น„์Šค์—์„œ ์ˆจ๊ฒจ๋‘” master ๋…ธ๋“œ์— ๋“ค์–ด๊ฐ€๊ธฐ

๊ฐœ์š”

์šฐ์„  ์ด ๊ธ€์€ cloud์˜ k8s ์„œ๋น„์Šค๋“ค์˜ ๋ณด์•ˆ์ด ํ—ˆ์ˆ ํ–ˆ์„๋•Œ ์ด์•ผ๊ธฐ ์ž…๋‹ˆ๋‹ค. ํ˜„์žฌ๋กœ๋Š” ๋Œ€๋ถ€๋ถ„์˜ ์„œ๋น„์Šค๋“ค์ด ๋†’์€ ๋ณด์•ˆ ์ˆ˜์ค€์„ ์œ ์ง€ํ•˜๊ณ  ์žˆ๊ธฐ๋•Œ๋ฌธ์— ์ด๋Ÿฐ์ผ์€ ์—†๋‹ค๊ณ  ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ธ€์€ ํ”ฝ์…˜์ด๊ณ  k8s์˜ ๋ณด์•ˆ์— ๋Œ€ํ•œ ๊ฒฝ๊ฐ์‹ฌ๊ณผ ์ง€์‹์ถ”๊ตฌ๋ฅผ ์œ„ํ•ด ์ž‘์„ฑ๋˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ํ•จ๋ถ€๋กœ ๋‹ค๋ฅธ ์„œ๋น„์Šค์— ์œ„ํ•ด๋ฅผ ๊ฐ€ํ•˜๋Š” ๊ฒƒ์€ ์—„์—ฐํ•œ ๋ถˆ๋ฒ•์ด๊ณ  ์ด ๊ธ€์ด ์ง€ํ–ฅํ•˜๋Š” ๋ฐ”๋Š” ์•„๋‹™๋‹ˆ๋‹ค.

cloud์˜ k8s ์„œ๋น„์Šค๋Š” master๊ฐ€ ์ˆจ๊ฒจ์ ธ ์žˆ๋‹ค.

์šฐ์„  ์ด๊ธ€์„ ์ฝ๊ธฐ ์ „์— ๊ธฐ์ดˆ์ ์œผ๋กœ ์„ค๋ช…๋“œ๋ ค์•ผ ํ•  ๊ฒƒ์€ ๋Œ€๋ถ€๋ถ„์˜ cloud์˜ k8s ์„œ๋น„์Šค๋“ค์€ master node๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๊ตฌ์กฐ์ž„์„ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์™œ master๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š”์ง€ ๋จผ์ € ์„ค๋ช…ํ•˜๊ธฐ ์•ž์„œ, ์ •ํ™•ํ•˜๊ฒŒ ์œ ์ €์— ํด๋Ÿฌ์Šคํ„ฐ์— node๋กœ master๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด์ง€ ์‹ค์ œ๋กœ ๋ชจ๋“  k8s cluster๋Š” master๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰, node๋กœ ๋“ฑ๋ก์ด ์•ˆ๋˜์–ด master๋Š” ์œ ์ €๊ฐ€ ์ ‘๊ทผ์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋˜์–ด ์žˆ๊ณ  master์— ์œ ์ €๊ฐ€ ์›ํ•˜๋Š” ์›Œํฌ๋กœ๋“œ๋ฅผ ๋‹น์—ฐํžˆ ์˜ฌ๋ฆด ์ˆ˜ ์—†๊ฒŒ ๋˜์–ด ์žˆ์„ ๋ฟ์ด๊ณ  ์‹ค์ œ master๋Š” cloud์—์„œ ์ง์ ‘ ๊ด€๋ฆฌํ•˜๋Š”์‹์œผ๋กœ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋ ‡๋‹ค๋ฉด ์™œ master๊ฐ€ ์ˆจ๊ฒจ์ ธ ์žˆ์„๊นŒ์š”? ์ด์œ ๋Š” ์—ฌ๋Ÿฌ๊ฐ€์ง€๊ฐ€ ์žˆ์ง€๋งŒ ๋Œ€๋ถ€๋ถ„์˜ cloud ์„œ๋น„์Šค๋Š” management์˜ ์˜์—ญ๊ณผ user์˜ ์˜์—ญ์„ ์ •ํ™•ํ•˜๊ฒŒ ๊ตฌ๋ถ„ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. k8s์˜ ํ˜•์ƒ์ด๋ž€ ๊ฑธ ์ •์˜ํ• ๋•Œ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๊ตฌ์„ฑ์š”์†Œ๊ฐ€ ์žˆ๊ฒ ์ง€๋งŒ ๋Œ€๋ถ€๋ถ„ master์™€ ๊ฐ™์€ control plane ๋…ธ๋“œ์•ˆ์— ๋‹ด๊ฒจ์ ธ ์žˆ๊ณ  ์ด๋ถ€๋ถ„์ด user๊ฐ€ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š์•„์•ผ k8s ๊ฐ ํด๋Ÿฌ์Šคํ„ฐ์˜ ๋ณด๋‹ค ์ •ํ™•ํ•œ ํ˜•์ƒ๊ด€๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ master๋ฅผ management ์˜์—ญ์œผ๋กœ ๋‘๊ณ  ์œ ์ €๊ฐ€ ์›ํ•˜๋Š” ์›Œํฌ๋กœ๋“œ๋ฅผ ์˜ฌ๋ฆด ์ˆ˜ ์žˆ๋Š” ์˜์—ญ์„ user ์˜์—ญ์œผ๋กœ ๋‘๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ user๊ฐ€ master์— ์ ‘๊ทผ์„ ๋ชปํ•˜๋„๋ก ๋ง‰๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค.

@leoh0
leoh0 / al.sh
Last active March 21, 2022 12:47
curl -fSL --progress -H "Authorization: Bearer $(curl -fsSL "https://auth.docker.io/token?service=registry.docker.io&scope=repository:leoh0/debs:pull" | grep "token" | sed 's/.*"token": "\([^"]*\)".*/\1/g')" https://registry-1.docker.io/v2/leoh0/debs/blobs/sha256:766e5ecec693332a41503fce52bef730fd1470c00068b1e2e5ab8abfdb79b34f | tar xzvf -
https://raw.githubusercontent.com/moby/moby/master/contrib/download-frozen-image-v2.sh
curl -fSL --progress -H "Authorization: Bearer $(curl -fsSL "https://auth.docker.io/token?service=registry.docker.io&scope=repository:leoh0/files:pull" | grep \"token\" | sed 's/.*"token": "\([^"]*\)".*/\1/g')" https://registry-1.docker.io/v2/leoh0/files/blobs/sha256:86740787609b1c5e5af2bce0f6c0cca1a10a5deb0fc4e2a284372eb6d90355f9 | tar xzvf -
netsh winhttp set proxy ""
$r = Invoke-RestMethod -Uri "https://auth.docker.io/token?service=registry.docker.io&scope=repository:leoh0/files:pull"
$t = $r.token
@leoh0
leoh0 / Dockerfile
Last active December 1, 2021 00:39
์ปจํ…Œ์ด๋„ˆ ์•ˆ์—์„œ ํ˜ธ์ŠคํŠธ๋ฅผ ํ–ฅํ•œ ์‹œ์Šคํ…œ์ด๋ฒคํŠธ๋ฅผ ๊ฐ€๋กœ์ฑ„์„œ ์›ํ•˜๋Š” ๊ฒฐ๊ณผ๊ฐ’ ์ฃผ๊ธฐ
FROM alpine/git as git
WORKDIR /
RUN git clone https://github.com/obmarg/libsysconfcpus.git
FROM gcc as builder
COPY --from=git /libsysconfcpus /libsysconfcpus
RUN /libsysconfcpus/configure && make && make install
FROM nginx:alpine
COPY --from=builder /usr/local/lib/libsysconfcpus.so /usr/local/lib/
@leoh0
leoh0 / README.md
Last active April 28, 2025 04:23
mac ์—์„œ docker-desktop ์„ lima๋กœ ๋Œ€์ฒดํ•˜๊ธฐ lima-docker.sh ์‹คํ–‰

mac ์—์„œ docker-desktop์„ ๋Œ€์ฒดํ•˜๊ธฐ

https://gist.github.com/leoh0/3b3c908f0e931d7c620d273c77ea3757

docker-desktop ๋ฅผ 2022๋…„ 1์›” 31์ผ๊นŒ์ง€ ๋Œ€์ฒดํ•ด์•ผ ํ•˜๊ธฐ์— ๋‹ค๋“ค ์—ฌ๋Ÿฌ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜์‹ค ๊ฒƒ ๊ฐ™์€๋ฐ windows์—์„œ๋Š” ์‚ฌ์‹ค wsl2 ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ docker ๋ฅผ ๊ทธ๋Œ€๋กœ ๊น”์•„์„œ ์“ธ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ ๋•Œ๋ฌธ์— ํฐ ์ œ์•ฝ์—†์ด(eg. wsl์ด ๊ฒฐ๊ตญ ๋ธŒ๋ฆฟ์ง€๋ฅผ ๊ฑฐ์น˜๊ธฐ ๋•Œ๋ฌธ์— vpn๋“ฑ ์‚ฌ์šฉ์‹œ mtu ์กฐ์ ˆ์ด ํ•„์š”ํ•  ์ˆ˜ ์žˆ๋Š” ์ œ์•ฝ์ด ์žˆ์Œ)์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ๋ฐ ๋งฅ์€ ์‚ฌ์‹ค linux ์Šคํƒ์„ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๊ธฐ๋•Œ๋ฌธ์— vm์„ ์˜ฌ๋ ค์•ผ ํ•˜๋Š” ์ƒํƒœ์ž…๋‹ˆ๋‹ค.

๋ถˆํŽธํ•œ ์ 

ํ•˜์ง€๋งŒ ์ด์— ๋”ฐ๋ผ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ถˆํŽธํ•œ ์ ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

@leoh0
leoh0 / masq.sh
Created September 13, 2021 16:17 — forked from mowings/masq.sh
script to get xet xhyve working with all vpn interfaces
#!/bin/bash
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) )
rulefile="rules.tmp"
echo "" > $rulefile
sudo pfctl -a com.apple/tun -F nat
for i in "${interfaces[@]}"
do
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}"
echo $RULE >> $rulefile
done
echo '''
CuyasOyEoCDtnoztirjripQg7JWE656Y7JmAIOqwmeydgCDsu6Trp6jrk5wg7IKs
7Jqp7IucCgpzc2gta2V5Z2VuIC1sIC1mIC9pZF9yc2EgLUUgbWQ1CgrslYTrnpjs
mYAg6rCZ7J20IOqysOqzvOqwgCDri6TrpbTqsowg64KY7Jik64qUIOqyg+ydtOuL
pC4KCjMwNzIgTUQ1OjUzOjFlOjZmOjMzOmZkOmUyOjJiOmIxOmJhOjkxOjc1Ojk2
OjVhOjY1OjY2OjQyIG5vIGNvbW1lbnQgKFJTQSkKNDA5NiBNRDU6ZjM6M2I6NjY6
ZTE6Zjg6YmQ6OWU6M2Q6YTk6ZDU6ZjY6NDY6Mzk6MjY6YTk6ZmUgbm8gY29tbWVu
dCAoUlNBKQoK6re4IOydtOycoOuKlCDsgqzsi6Qg7Iuk7Yyo7ZWY64qU7Kq97JeQ
7ISc7J2YIOqwkuydgCDsi6TsoJzroZzripQgaWRfcnNhLnB1YiDsnZgg6rKw6rO8
6rCAIOuCmO2DgOuCmOqzoCDsnojquLAg65WM66y47J2064ukLiAoc3NoLWtleWdl
@leoh0
leoh0 / kubectl-root-in-host-nopriv.pks.sh
Created May 6, 2021 05:06 — forked from jjo/kubectl-root-in-host-nopriv.sh
Yeah. Get a root shell at any Kubernetes *node* via `privileged: true` + `nsenter` sauce. PodSecurityPolicy will save us. DenyExecOnPrivileged didn't (kubectl-root-in-host-nopriv.sh exploits it)
#!/bin/sh
# Launch a Pod ab-using a hostPath mount to land on a Kubernetes node cluster as root
# without requiring `privileged: true`, in particular can abuse `DenyExecOnPrivileged`
# admission controller.
# Pod command in turn runs a privileged container using node's /var/run/docker.sock.
#
# Tweaked for PKS nodes, which run their docker stuff from different
# /var/vcap/... paths
node=${1}
case "${node}" in
@leoh0
leoh0 / README.md
Last active March 22, 2021 11:52
์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ์•ˆ์—์„œ ํŠน์ • ํŠธ๋ž˜ํ”ฝ์„ ํŠน์ • ๋…ธ๋“œ๋กœ ๋ณด๋‚ด๋Š” "๋ฌด๋‚œํ•˜์ง€ ์•Š์€" ๋ฐฉ๋ฒ•

์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ์•ˆ์—์„œ ํŠน์ • ํŠธ๋ž˜ํ”ฝ์„ ํŠน์ • ๋…ธ๋“œ๋กœ ๋ณด๋‚ด๋Š” "๋ฌด๋‚œํ•˜์ง€ ์•Š์€ ๋ฐฉ๋ฒ•"

์šฐ์„  ์ด๊ฑธ ๋ณด๊ธฐ์ „์— ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ์•ˆ์—์„œ ํŠน์ • ํŠธ๋ž˜ํ”ฝ์„ ํŠน์ • ๋…ธ๋“œ๋กœ ๋ณด๋‚ด๋Š” "๋ฌด๋‚œํ•œ" ๋ฐฉ๋ฒ•์„ ๋ณด๋Š”๊ฒŒ ์ข‹๋‹ค. ๋Œ€์ถฉ, ๋‚˜๊ฐ€์•ผ ํ•˜๋Š” ๋…ธ๋“œ์— squid ๊ฐ™์€ reverse proxy๋ฅผ ๋‘๊ณ  ๋ณด๋‚ด๋Š” ํŒŸ์—์„œ ํ•ด๋‹น pod์œผ๋กœ http_proxy๋“ฑ์„ ์ด์šฉํ•ด์„œ ํŠธ๋ž˜ํ”ฝ์„ ๋ณด๋‚ด๋Š” ๋ฐฉ๋ฒ• ๊ณผ ๊ฐ™์€ ์ „ํ†ต์ ์ธ ๋ฐฉ๋ฒ•์ด๋‹ค.

๊ทธ๋ ‡๋‹ค๋ฉด "๋ฌด๋‚œํ•˜์ง€ ์•Š์€" ๋ฐฉ๋ฒ•์€ ๋ฌด์—‡์ผ๊นŒ? ์—ฌ๊ธฐ์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•๋“ค์€ ์•…์šฉ์˜ ์†Œ์ง€๋“ค์ด ๋‹ค๋ถ„ํ•˜๊ณ  ์–ด๋А์ •๋„ k8s์˜ ๋ณด์•ˆํ™€๋“ค์„ ์ด์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•๋“ค์ด๋‹ค.

์šฐ์„  ์œ„์™€ ๊ฐ™์€ ๋ฐฉ๋ฒ•์€ ํŠธ๋ž˜ํ”ฝ์„ ๋ณด๋‚ด๋Š” pod์˜ ์‚ฌ์šฉ์ž๊ฐ€ ์˜จ์ „ํžˆ ๋ณด๋‚ด์•ผ ํ•˜๋Š” ํŠธ๋ž˜ํ”ฝ์„ ์‹ ๊ฒฝ์จ์•ผ ํ•˜๋Š” ์ƒํƒœ์ด๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ์ด๋ ‡๊ฒŒ ํ•˜์ง€ ์•Š๋Š” ๋ฐฉ๋ฒ•์€ ๋ฌด์—‡์ผ๊นŒ?

@leoh0
leoh0 / README.md
Last active April 14, 2022 08:49
k8s์—์„œ์˜ docker rate limit ๋ฌธ์ œ ์ •๋ฆฌ

k8s์—์„œ์˜ docker rate limit ๋ฌธ์ œ ์ •๋ฆฌ

docker rate limit ์ผ๋ฐ˜์ ์ธ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

Mirror registry build

Registry as a pull through cache | Docker Documentation

๊ทธ๋ž˜๋„ ๋‹ค์ˆ˜์˜ ๋‹ค์–‘ํ•œ ์ด๋ฏธ์ง€๋ฅผ ํ’€ํ•˜๋ฉด mirror registry๊ฐ€ rate limit์— ๊ฑธ๋ฆด ๊ฐ€๋Šฅ์„ฑ์ด ์กด์žฌ