Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / HelloControllerTest.java
Created December 2, 2025 09:15
Spring Boot test in Spring boot 4.0.0
package com.example.demotest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.resttestclient.TestRestTemplate;
import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureRestTestClient;
import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.web.servlet.client.RestTestClient;
@up1
up1 / 1.txt
Last active November 30, 2025 04:10
Kiro CLI
$curl -fsSL https://cli.kiro.dev/install | bash
Kiro CLI installer:
Downloading package...
✓ Downloaded and extracted
✓ Package installed successfully
🎉 Installation complete! Happy coding!
@up1
up1 / application.properties
Last active November 29, 2025 10:57
OpenTelemetry in Spring Boot 4
spring.application.name=otel
# For demo only
management.tracing.sampling.probability=1.0
management.otlp.metrics.export.step=10s
management.observations.annotations.enabled=true
management.opentelemetry.tracing.export.otlp.transport=http
@up1
up1 / compose.yml
Last active November 21, 2025 23:46
n8n queue mode
services:
postgres:
env_file:
- .env
image: postgres:18
environment:
- POSTGRES_USER=n8n
- POSTGRES_PASSWORD=n8n
- POSTGRES_DB=n8n
@up1
up1 / 1.java
Last active November 10, 2025 16:21
Spring Boot 4 and Kafka share consumer
@Configuration
public class ShareConsumerConfig {
@Bean
public ShareConsumerFactory<String, String> shareConsumerFactory() {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
@up1
up1 / 1.txt
Last active October 13, 2025 15:05
Hello Bun 1.3
$bun upgrade
Bun v1.3.0 is out! You're on v1.2.4
[6.15s] Upgraded.
Welcome to Bun v1.3.0!
What's new in Bun v1.3.0:
https://bun.sh/blog/release-notes/bun-v1.3.0
@up1
up1 / 1.py
Last active October 12, 2025 07:01
Hello Python 3.14
world = "World"
template = t"Hello, {world}"
print(type(template))
print(list(template))
print(template.strings)
print(template.values)
print(template.interpolations)
# ผลการ run
@up1
up1 / 1.txt
Last active October 10, 2025 01:19
Playwright Agents
# 1. ติดตั้งผ่าน Claude Code
$npx playwright init-agents --loop=claude
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
Writing file: .claude/agents/playwright-test-generator.md
Writing file: .claude/agents/playwright-test-healer.md
Writing file: .claude/agents/playwright-test-planner.md
@up1
up1 / 1.sql
Last active October 2, 2025 13:10
PostgreSQL with unlogged table
CREATE UNLOGGED TABLE cache_data (
id serial PRIMARY KEY,
key text UNIQUE NOT NULL,
value jsonb,
created_at timestamp);
CREATE INDEX idx_cache_key ON cache_data (key);
@up1
up1 / 1.txt
Last active September 28, 2025 05:30
SubAgent with ClaudeCode
# 1. Initial Project
$claude doctor
$claude
$/init
# 2. Create subagent
$mkdir -p .claude/agents/backend
$vi backend.md