Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / main.dart
Created March 5, 2025 13:58
Generated code from pixels2flutter.dev
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@up1
up1 / 1.txt
Created March 2, 2025 04:53
Bun :: Bundle frontend & static sites
$bun upgrade
$bun -version
1.2.4
$bun ./index.html ./about.html
DEV Bun v1.2.4 ready in 22.78 ms
➜ http://localhost:3000/
Routes:
@up1
up1 / 1.txt
Last active February 27, 2025 10:59
Claude code :: Demo
> Add test case with jest and supertest library for app.js in folder __tests__
⏺ I'll create a test case for app.js using Jest and Supertest. First, let's check if these
libraries are installed.
Bash(npm list jest supertest || echo "Libraries not installed")…
╭────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Bash command │
│ │
@up1
up1 / 1.txt
Created February 23, 2025 08:58
PayPay with Rust
// Cargo.toml
[dependencies]
actix-web = "4"
// main.rs
use actix_web::{web, App, HttpResponse, HttpServer};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
@up1
up1 / 1.txt
Last active February 22, 2025 06:16
DEno 2.2 :: OpenTelemetry
$deno --version
deno 2.2.1 (stable, release, aarch64-apple-darwin)
v8 13.4.114.9-rusty
typescript 5.7.3
@up1
up1 / 1.txt
Last active February 21, 2025 15:29
MongoDB-RAG
// ติดตั้ง cli ของ mongo-rag
$npm install -g mongodb-rag
// สร้าง configuration ของ Mongo-RAG ผ่าน cli
$npx mongodb-rag init
✔ Enter your MongoDB connection string: · mongodb+srv://your_user:your_password@host
✔ Enter the database name: · mongodb-rag
✔ Enter the collection name: · documents
✔ Select an embedding provider: · openai
@up1
up1 / 1.txt
Last active February 18, 2025 16:50
MCP Server with Go
$export ANTHROPIC_API_KEY='your-api-key'
$mcphost --config ./mcp-server.json
2025/02/18 23:50:07 INFO Model loaded provider=anthropic model=claude-3-5-sonnet-latest
2025/02/18 23:50:07 INFO Initializing server... name=mcp-calculator-with-docker
2025/02/18 23:50:09 INFO Server connected name=mcp-calculator-with-docker
2025/02/18 23:50:09 INFO Tools loaded server=mcp-calculator-with-docker count=1
┃ Enter your prompt (Type /help for commands, Ctrl+C to quit)
@up1
up1 / 1.txt
Created February 7, 2025 11:24
GitHub Copilot :: Agent
# Run test failure
➜ go test -v
../go/pkg/mod/github.com/stretchr/[email protected]/assert/assertions.go:20:2: missing go.sum entry for module providing package github.com/davecgh/go-spew/spew (imported by github.com/stretchr/testify/assert); to add:
go get github.com/stretchr/testify/[email protected]
FAIL airflow [setup failed]
# Resolve issue
➜ go mod tidy
go: downloading gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
@up1
up1 / 1.txt
Last active February 6, 2025 07:11
Playwright + Prometheus + Grafana
$npx playwright test
[2025-02-05 14:09:43.147 +0700] DEBUG: [PumpoEvents] Loading configuration file from resolved config path /workshop-playwright-2025/monitor-test/config.conf
[2025-02-05 14:09:43.147 +0700] INFO: Adding custom label: environment=ppe
[2025-02-05 14:09:43.147 +0700] INFO: Adding custom label: type=end-to-end
[2025-02-05 14:09:43.156 +0700] INFO: Starting the run with 2 tests.
[2025-02-05 14:09:43.407 +0700] INFO: Starting test "has title_chromium_example.spec.ts"
[2025-02-05 14:09:43.407 +0700] INFO: Starting test "get started link_chromium_example.spec.ts"
[2025-02-05 14:09:44.514 +0700] INFO: Test case name: has title_chromium_example.spec.ts job name undefined
[2025-02-05 14:09:44.514 +0700] INFO: Finished test "has title_chromium_example.spec.ts" with result passed
@up1
up1 / 1.go
Last active February 5, 2025 16:01
Go 1.24 rc2
import (
"testing"
)
func BenchmarkOld(b *testing.B) {
for n := 0; n < b.N; n++ {
try()
}
}