Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@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
@up1
up1 / gist:3a1a2f91522fff4c3325ac6aa697331b
Created July 6, 2026 14:37
Github Copilot Chat + Kimi K2.7 Code
Changelog for v1.0.68
2026-07-01
- Add support for the kimi-k2.7-code model
@up1
up1 / 2.txt
Last active July 4, 2026 03:05
ULimit BEAM
# 1. Check in OS limit
ulimit -n
# 2. Check on system (ulimit -n cannot exceed)
cat /proc/sys/fs/file-max
# 3. check in BEAM
:erlang.system_info(:port_limit) # the +Q ceiling
:erlang.system_info(:port_count) # current usage
@up1
up1 / Hello.java
Last active July 3, 2026 06:52
Hello Java
import static java.lang.IO.print;
import static java.lang.IO.println;
void main() {
int[] arr = {1, 2, 3, 4, 5};
// For each
for (int i : arr) {
print(i + " ");
}