Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / 1.json
Created July 29, 2026 05:38
Hello hooks
{
"hooks": {
"PreToolUse": [
{
"matcher": "Read",
"hooks": [
{
"type": "command",
"command": "python ~/.claude/hooks/dedupe_read.py"
}
@up1
up1 / 1.txt
Last active July 27, 2026 07:57
Hello Pi Coding Agent
# 1. ติดตั้ง Pi
$curl -fsSL https://pi.dev/install.sh | sh
$pi update
$pi --version
0.82.1
# 2. Buildins tools
read - Read file contents
bash - Execute bash commands
edit - Edit files with find/replace
@up1
up1 / 1.txt
Last active July 26, 2026 05:23
TypeScript 7
$npm install -g typescript
$tsc -version
Version 7.0.2
$npm install -g typescript@npm:@typescript/typescript6
$tsc6 -version
Version 6.0.3
@up1
up1 / 1.go
Last active July 24, 2026 16:35
Golang :: Compare JSON Serializer
// 1. SonicSerializer implements echo.JSONSerializer using bytedance/sonic
type SonicSerializer struct{}
// Serialize converts a Go object into a JSON byte slice and writes it to the context
func (s SonicSerializer) Serialize(c echo.Context, i interface{}, indent string) error {
enc := sonic.ConfigDefault.NewEncoder(c.Response())
if indent != "" {
enc.SetIndent("", indent)
}
return enc.Encode(i)
@up1
up1 / 1.txt
Last active July 24, 2026 09:28
Install Quarkus Agent MCP
// 1. ติดตั้ง JBang
$curl -Ls https://sh.jbang.dev | bash -s - app setup
$bang --version
// 2. Start MCP Server
$jbang quarkus-agent-mcp@quarkusio --port 8080 --project-dir ./demo-app
// 3. ตัวอย่างการเพิ่ม MCP เข้าไปใน Claude Code
$claude mcp add quarkus-agent -- jbang quarkus-agent-mcp@quarkusio
@up1
up1 / 1.js
Created July 19, 2026 05:00
Playwright :: Visual testing
import { test, expect } from '@playwright/test';
test('example test', async ({ page }) => {
await page.goto('https://playwright.dev');
await expect(page).toHaveScreenshot();
});
@up1
up1 / 1.txt
Last active July 9, 2026 08:32
PostgreSQL :: partitioning table
// 1. Create table
CREATE TABLE orders_partitioned (
id BIGSERIAL NOT NULL,
customer_id BIGINT NOT NULL,
customer_name VARCHAR(255) NOT NULL,
status order_status NOT NULL DEFAULT 'new',
total_amount NUMERIC(12, 2) NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
-- Partition key (created_at) must be part of the primary key
PRIMARY KEY (id, created_at)
@up1
up1 / 1.txt
Last active July 9, 2026 03:44
HTTP Query method 101
QUERY /search HTTP/1.1
Host: ://demo.com
Content-Type: application/json
{
"status": "completed",
"date_range": { "start": "2026-01-01", "end": "2026-07-31" },
"sort": "DESC
}
@up1
up1 / 1.txt
Last active July 8, 2026 06:44
Hello Vite+
$curl -fsSL https://vite.plus | bash
Setting up VITE+...
Would you like Vite+ to manage your Node.js versions?
It adds `node`, `npm`, `npx`, and `corepack` shims to ~/.vite-plus/bin/ and automatically uses the right version.
Opt out anytime with `vp env off`.
Press Enter to accept (Y/n):Y
✔ VITE+ successfully installed!
@up1
up1 / 1.txt
Created July 7, 2026 09:43
PostgreSQL :: table !!
--- 1. View CacheMemoryContext ---
SELECT pg_size_pretty(total_bytes)
FROM pg_get_backend_memory_contexts()
WHERE name = 'CacheMemoryContext';
ผลการทำงาน
1024 kB
--- 2. Select from all tables in database
DO