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 August 14, 2024 06:57
Grafana Beyla with Go
# ดูข้อมูล metrics ผ่าน Grafana Beyla
$curl http://localhost:8999/metrics
# HELP promhttp_metric_handler_errors_total Total number of internal errors encountered by the promhttp metric handler.
# TYPE promhttp_metric_handler_errors_total counter
promhttp_metric_handler_errors_total{cause="encoding"} 0
promhttp_metric_handler_errors_total{cause="gathering"} 0
# เข้าใจงาน web ที่พัฒนาด้วยภาษา go
$curl http://localhost:8080/hello
hello
@up1
up1 / 1.txt
Last active August 14, 2024 02:44
Go 1.23
$go env -w GOTOOLCHAIN=go1.23.0
$go version
go: downloading go1.23.0 (darwin/arm64)
go version go1.23.0 darwin/arm64
@up1
up1 / 1.txt
Last active August 13, 2024 12:56
Spring Boot :: Problem Detail
{
    "type":"https://problems-registry.smartbear.com/missing-body-property",
    "status":400,
    "title":"Missing body property",
    "detail":"The request is missing an expected body property.",
    "code":"400-09",
    "instance":"/logs/regisrations/1234",
    "errors":[
       {
          "detail":"The body property {name} is required",
@up1
up1 / 1.txt
Last active August 2, 2024 10:05
FastHTML
$pip install -r requirements.txt
$python hello.py
Link: http://localhost:5001
INFO: Will watch for changes in these directories: ['/python/fasthtml']
INFO: Uvicorn running on http://0.0.0.0:5001 (Press CTRL+C to quit)
INFO: Started reloader process [54266] using WatchFiles
INFO: Started server process [54268]
INFO: Waiting for application startup.
INFO: Application startup complete.
@up1
up1 / 1.txt
Last active July 30, 2024 14:44
Docker Build Check
$docker build .
[+] Building 0.9s (5/5) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 73B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 0.9s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [1/1] FROM docker.io/library/alpine:latest@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8 0.0s
=> exporting to image 0.0s
@up1
up1 / 1.txt
Last active July 28, 2024 06:21
Skip tool
$skip
OVERVIEW: skip 0.10.7
USAGE: skip <subcommand>
OPTIONS:
-h, --help Show help information.
SUBCOMMANDS:
version Print the skip version
@up1
up1 / 1.txt
Created July 26, 2024 08:34
Demo with microcks
$git clone https://github.com/microcks/microcks.git --depth 10
$cd microcks/install/docker-compose
$docker compose up -d
$docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
microcks quay.io/microcks/microcks:1.9.1 "/deployments/run-ja…" app 8 seconds ago Up 7 seconds 0.0.0.0:8080->8080/tcp, 0.0.0.0:9090->9090/tcp
microcks-db mongo:3.6.23 "docker-entrypoint.s…" mongo 8 seconds ago Up 7 seconds 27017/tcp
microcks-postman-runtime quay.io/microcks/microcks-postman-runtime:latest "docker-entrypoint.s…" postman 8 seconds ago Up 8 seconds 3000/tcp
microcks-sso quay.io/keycloak/keycloak:22.0.2 "/opt/keycloak/bin/k…" keycloak 8 seconds ago Up 7 seconds 8443/tcp, 0.0.0.0:18080->8080/tcp
@up1
up1 / 1.txt
Last active July 26, 2024 06:13
Spring Boot 3.4.0 :: Structured logging
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.4.0-SNAPSHOT)
{"@timestamp":"2024-07-26T06:04:39.148855Z","log.level":"INFO","process.pid":60567,"process.thread.name":"main","service.name":"MyService","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"com.example.slog.SlogApplication","message":"Starting SlogApplication using Java 21-ea with PID 60567 ","ecs.version":"8.11"}
@up1
up1 / 1.txt
Last active July 24, 2024 08:34
Mesop :: UI framework
$pip install mesop --break-system-packages
@up1
up1 / go.mod
Last active July 24, 2024 06:06
Hello, GoFR
module demo
go 1.22.5
require gofr.dev v1.15.0
require (
cloud.google.com/go v0.115.0 // indirect
cloud.google.com/go/auth v0.7.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect