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 February 1, 2025 15:02
Posting :: API tesing in terminal
# quick install on MacOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# install Posting (will also quickly install Python 3.12 if needed)
uv tool install --python 3.12 posting
# Use to run script
uv tool install posting --with httpx
# Start
@up1
up1 / 1.txt
Last active January 31, 2025 08:54
MongoDB Atlas local + Docker
$docker compose up -d
$docker compose ps
@up1
up1 / SeleniumWithNetworkInterceptorTest.java
Last active January 30, 2025 08:59
Selenium WebDriver BiDi + Network intercepter
public class SeleniumWithNetworkInterceptorTest {
static WebDriver driver;
@BeforeAll
public static void initial() {
System.setProperty("webdriver.chrome.driver", "path-to-driver");
var options = new ChromeOptions();
// Enable BiDi
options.setCapability("webSocketUrl", true);
@up1
up1 / 1.txt
Last active January 29, 2025 15:34
Go Testing + MySQL + TestContainer
$go test ./... -cover -v
=== RUN TestSuccessWithGetDataByID
2025/01/29 22:24:37 github.com/testcontainers/testcontainers-go - Connected to docker:
Server Version: 27.4.0
API Version: 1.46
Operating System: Docker Desktop
Total Memory: 11948 MB
Testcontainers for Go Version: v0.35.0
Resolved Docker Host: unix:///var/run/docker.sock
@up1
up1 / 1.txt
Last active January 28, 2025 16:20
Browser use + Gemini
$pip install browser-use
$playwright install
@up1
up1 / 1.robot
Last active January 27, 2025 07:08
Robot frameworm 7.2 + Group syntax
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${URL} https://seleniumbase.io/coffee/
${BROWSER} chrome
*** Test Cases ***
Success case ทำการสั่งซื้อกาแฟ Americano 1 แก้ว
Open Browser ${URL} ${BROWSER}
@up1
up1 / 1.txt
Last active January 25, 2025 16:33
DeepSeek R1 + Ollaman
# Download
$ollama pull deepseek-r1:7b
pulling manifest
pulling f4d24e9138dd... 100% ▕████████████████████████▏ 148 B
pulling 40fb844194b2... 100% ▕████████████████████████▏ 487 B
verifying sha256 digest
writing manifest
success
# Run
@up1
up1 / 1.txt
Last active January 10, 2025 07:23
MCP server + Playwright
1. Navigate to website https://demo-frontend-reactjs.vercel.app
2. In the home page, check result in page
2.1 Show message "Call REST API 2024/12/25 new !!" in atrtribute "data-testid="message_text""
2.2 Show message "Hello World!" in attribute "data-testid="hello_text""
@up1
up1 / 1.js
Last active January 10, 2025 04:45
Keyv with javascript
// Redis
import KeyvRedis from '@keyv/redis';
const keyv = new Keyv(new KeyvRedis('redis://user:pass@localhost:6379'));
// ใช้งานผ่าน namespace
const users = new Keyv(new KeyvRedis('redis://user:pass@localhost:6379'), { namespace: 'users' });
const cache = new Keyv(new KeyvRedis('redis://user:pass@localhost:6379'), { namespace: 'cache' });
// SQLite
import KeyvSqlite from '@keyv/sqlite';
@up1
up1 / 1.yml
Created January 1, 2025 06:22
Spring Boot support multiple compose files
spring:
application:
name: demo-service
docker:
compose:
file:
- "compose-for-db.yml"
- "compose-for-cached.yml"