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
Created April 14, 2025 05:12
Basic PostgreSQL
// 1. Create table
CREATE TABLE orders (
id SERIAL PRIMARY KEY,
customer_id INT NOT NULL,
order_date DATE NOT NULL,
amount DECIMAL(10,2)
);
// 2. Generate test data (100,000 records)
@up1
up1 / compose.yml
Created April 11, 2025 16:07
Keycloak 26.2 + Healthcheck + Docker compose
# https://www.keycloak.org/observability/health
services:
keycloak:
image: quay.io/keycloak/keycloak:26.2
command:
- start-dev
- --import-realm
environment:
KEYCLOAK_ADMIN: admin
@up1
up1 / 1.txt
Last active April 10, 2025 09:42
Install n8n with docker compose
$docker compose up -d
$docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
n8n n8nio/n8n "tini -- /docker-ent…" n8n 15 minutes ago Up 15 minutes 0.0.0.0:5678->5678/tcp
@up1
up1 / DemoGatewayTest.java
Created March 30, 2025 14:32
Spring Boot testing with WireMock
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.ResponseEntity;
import org.wiremock.spring.EnableWireMock;
@up1
up1 / 1.txt
Last active March 30, 2025 11:23
Dagger LLM
// ขั้นตอนที่ 1
$export ANTHROPIC_API_KEY=<your key>
$dagger
─ ←↑↓→ move · home first · end last · +/- verbosity=1 · q quit ─────────────────────────────● connect 0.1s
● connect 0.2s
│ ● connecting to engine 0.0s │✔ connect 0.3s ✔ connect 0.3s
Dagger interactive shell. Type ".help" for more information. Press Ctrl+D to exit.\n
✔ connect 0.3s ⋈
─ esc nav mode · > run prompt ──────────────────────────────────────────────────────────────
@up1
up1 / 1.json
Last active March 29, 2025 09:25
MCP with Playwright
// with Head or UI mode
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
@up1
up1 / 1.txt
Created March 21, 2025 16:28
MokAPI
$npm install -g go-mokapi
// HTTP server จากไฟล์ Swagger/OpenAPI
$mokapi --providers-http-url https://petstore3.swagger.io/api/v3/openapi.json
// Apache Kafka จากไฟล์ AsyncAPI
$mokapi --providers-file-filename asyncapi.yaml
@up1
up1 / 1.java
Last active March 21, 2025 14:04
Demo code of Java 24
import static java.lang.System.out;
public class Main {
void main() {
var main = new Main();
var grade = main.calculateGrade(50);
out.println(grade);
}
public String calculateGrade(int score) {
@up1
up1 / 1.txt
Last active March 14, 2025 06:15
Redis :: Data structure
// เพิ่มข้อมูล
$LPUSH datas tx1
$LPUSH datas tx2
$LPUSH datas tx3
$LPUSH datas tx4
$LPUSH datas tx5
// ดึงข้อมูล
$LRANGE datas 0 -1
@up1
up1 / 1.txt
Last active March 11, 2025 15:15
Hello Lynxjs
$npm create rspeedy@latest
Need to install the following packages:
[email protected]
Ok to proceed? (y)
> npx
> create-rspeedy