Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / 1.txt
Last active May 21, 2026 08:53
PostgreSQL :: Tuning 2026
// 1. แต่ละ table มีจำนวน row เท่าไร มี size ของข้อมูลเท่าไร
SELECT relname AS table_name,
pg_size_pretty(pg_total_relation_size(relid)) AS total_size,
n_live_tup AS estimated_rows
FROM pg_stat_user_tables
ORDER BY pg_total_relation_size(relid) DESC;
ตัวอย่างผลการทำงาน
"customers" "20240 MB"
@up1
up1 / 1.txt
Last active May 14, 2026 12:15
Design.md
---
name: Neon Tokyo — Daybreak
colors:
surface: '#fcf8ff'
surface-dim: '#d9d7f4'
surface-bright: '#fcf8ff'
surface-container-lowest: '#ffffff'
surface-container-low: '#f5f2ff'
surface-container: '#efecff'
surface-container-high: '#e8e5ff'
@up1
up1 / ArchitectureTest.java
Last active May 12, 2026 17:12
ArchUnit for Spring Boot
@AnalyzeClasses(packages = "com.example.demoarch")
public class ArchitectureTest {
@ArchTest
static final ArchRule layer_dependencies = layeredArchitecture()
.consideringAllDependencies()
.layer("Controller").definedBy("..controller..")
.layer("Service").definedBy("..service..")
.layer("Repository").definedBy("..repository..")
@up1
up1 / 1.txt
Last active May 9, 2026 04:14
OpenAI CLI
$brew install openai/tools/openai
$openai -v
openai version 1.1.2
//MAC or Linux
$export OPENAI_API_KEY=<your key>
// Windows
$set OPENAI_API_KEY=<your key>
@up1
up1 / 1.md
Created April 27, 2026 05:02
Demo with SOLID principle

Demo with SOLID principle

  • SRP(Single Responsibility Principle)
  • OCP(Open/Closed Principle)
  • DIP(Dependency Inversion Principle)

Step 1 :: Order Processing with SRP

// Logic for holding order data
public class Order {
    private String orderId;
@up1
up1 / 1.txt
Last active April 22, 2026 06:43
Testing with Bun
# Upgrade
$bun upgrade
$bun -version
1.3.13
# Create a new project
$bun init demo
✓ Select a project template: Blank
@up1
up1 / 1.txt
Last active April 20, 2026 15:04
// เรียกใช้งานผ่าน LiteLLM Proxy
$curl -X POST 'http://127.0.0.1:4000/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer dummy' \
-d '{
"model": "openthaigpt",
"messages": [
{"role": "user", "content": "สวัสดี"}
]
}'
@up1
up1 / 1.ts
Last active April 17, 2026 09:56
Self-healing in test auotmation
// Version 1 : role
await page.getByRole('button', { name: 'OK' }).click();
// Version 2 : role
await page.getByRole('button', { name: 'Submit' }).click();
// Version 3 : role
await page.getByRole('button', { name: 'Login' }).click();
@up1
up1 / 1.txt
Last active April 17, 2026 05:06
Hello MiniMax CLI
$npm install -g mmx-cli
$mmx
███╗ ███╗███╗ ███╗██╗ ██╗
████╗ ████║████╗ ████║╚██╗██╔╝
██╔████╔██║██╔████╔██║ ╚███╔╝
██║╚██╔╝██║██║╚██╔╝██║ ██╔██╗
██║ ╚═╝ ██║██║ ╚═╝ ██║██╔╝ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
@up1
up1 / 1.txt
Last active April 15, 2026 16:04
Demo with LLM Wiki
# ติดตั้ง และ ทำการ setup ผ่าน wizard แบบ step-by-step
$pip install obsidian-llm-wiki
$olw setup
╭────────────────────────────────────────────────────╮
│ obsidian-llm-wiki v0.2.0 · first run setup │
╰────────────────────────────────────────────────────╯
Step 1/4 Ollama connection
Warning: Could not reach http://localhost:11434