Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / read.py
Last active February 23, 2026 03:55
Try PageIndex
query = "What are the conclusions in this document?"
doc_id = "your doc id" # This is the doc_id for the same document in step-01.py. You can also use your own doc_id here.
tree = pi_client.get_tree(doc_id, node_summary=True)['result']
print('Simplified Tree Structure of the Document:')
utils.print_tree(tree)
# ตัวอย่างข้อมูล index tree
Simplified Tree Structure of the Document:
[{'title': 'Abstract', 'node_id': '0000', 'summary': 'This text discusses the challenge of gen...'},
{'title': '1 Introduction',
@up1
up1 / 1.txt
Last active February 21, 2026 15:46
MArkdown for Agents
$curl https://blog.cloudflare.com/markdown-for-agents/ \
-H "Accept: text/markdown"
---
description: The way content is discovered online is shifting, from traditional search engines to AI agents that need structured data from a Web built for humans. It’s time to consider not just human visitors, but start to treat agents as first-class citizens. Markdown for Agents automatically converts any HTML page requested from our network to markdown.
title: Introducing Markdown for Agents
image: https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6Df02zjRb4inGPazW51EyD/278afaa16719f1080f12936c35a6c0ef/BLOG-3162_OG.png
---
@up1
up1 / 1.txt
Last active February 17, 2026 13:11
Redis design 01
// ค้นหา word1 และ word 2
ZINCRBY search:freq:2026-02-17 1 "word1"
ZINCRBY search:freq:2026-02-17 1 "word1"
ZINCRBY search:freq:2026-02-17 1 "word2"
// ดูผลการค้นหา
ZREVRANGE search:freq:2026-02-17 0 4 WITHSCORES
// ผล
1) "word1"
@up1
up1 / 1.txt
Last active February 10, 2026 05:16
Agent Browser from Vercel
// ติดตั้ง ต้องใช้งานผ่าน NodeJS
$npm install -g agent-browser
// เปิด web
$agent-browser open https://seleniumbase.io/coffee/
✓ Coffee Cart
https://seleniumbase.io/coffee/
// ทำการดูว่าทั้ง page มี element อะไรบ้าง
$agent-browser snapshot
@up1
up1 / 1.txt
Last active February 3, 2026 07:11
Hello Kimi code
$curl -L code.kimi.com/install.sh | bash
$kimi
╭────────────────────────────────────────────────────────────────────────╮
│ │
│ ▐█▛█▛█▌ Welcome to Kimi Code CLI! │
│ ▐█████▌ Send /help for help information. │
│ │ │
│ Session: c23cbb12-a6da-402a-a4c5-0c346d77efd3 │
│ Model: not set, send /login to login │
@up1
up1 / 1.txt
Last active January 22, 2026 15:45
Ollama with Claude code
$ollama --version
ollama version is 0.14.3
$ollama list
NAME ID SIZE MODIFIED
functiongemma:latest 7c19b650567a 300 MB 4 weeks ago
gemma3:270m b16d6d39dfbd 241 MB 5 months ago
gemma3:1b 8648f39daa8f 815 MB 8 months ago
deepseek-r1:7b 0a8c26691023 4.7 GB 12 months ago
llama3.1:latest 91ab477bec9d 4.7 GB 17 months ago
@up1
up1 / 1.txt
Last active January 21, 2026 03:37
Vercel :: React Skill
$npx add-skill vercel-labs/agent-skills
Need to install the following packages:
add-skill@1.0.21
┌ skills
◇ Source: https://github.com/vercel-labs/agent-skills.git
@up1
up1 / 1.txt
Created January 18, 2026 09:00
Postgresql :: Skip Locked
WITH cte AS (
SELECT id FROM tasks WHERE status = 'pending' ORDER BY created_at ASC LIMIT 1 FOR UPDATE SKIP LOCKED
)
UPDATE tasks SET status = 'in_progress'
FROM cte
WHERE tasks.id = cte.id
RETURNING tasks.*;
@up1
up1 / 1.json
Last active January 13, 2026 07:13
Tips :: Claude Code
"PostToolUse": [
{
"matcher":"Write|Edit",
"hooks": [
{
"type": "command",
"command": "bun run format || true"
}
]
}
@up1
up1 / 1.txt
Last active December 24, 2025 15:31
Hello FunctionGemma model
$ollama list
NAME ID SIZE MODIFIED
functiongemma:latest 7c19b650567a 300 MB 15 minutes ago
$ollama run functiongemma
pulling manifest
pulling 415f8f959d80: 100% ▕██████████████████████████████████████████████████████████████████████████▏ 300 MB
pulling 64c834d5c134: 100% ▕██████████████████████████████████████████████████████████████████████████▏ 10 KB
pulling b536e845ddda: 100% ▕██████████████████████████████████████████████████████████████████████████▏ 26 B
pulling d087699a8829: 100% ▕██████████████████████████████████████████████████████████████████████████▏ 468 B