Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / Jenkinsfile
Created September 27, 2025 05:33
Jenkins pipeline :: detect change by folder
def hasChanges(String path) {
return !sh(script: "git diff --name-only HEAD~1 HEAD | grep '${path}' || true", returnStdout: true).trim().isEmpty()
}
pipeline {
agent any
stages {
stage('Detect changes') {
steps {
@up1
up1 / 1.txt
Created September 26, 2025 15:56
GitHub Copilot CLI
$npm install -g @github/copilot
$copilot
┌── ──┐
│ ▄██████▄ │
Welcome to GitHub ▄█▀▀▀▀▀██▀▀▀▀▀█▄
█████┐ █████┐ █████┐ ██┐██┐ █████┐ ██████┐ ▐█ ▐▌ █▌
██┌───┘██┌──██┐██┌─██┐██│██│ ██┌──██┐└─██┌─┘ ▐█▄ ▄██▄ ▄█▌
██│ ██│ ██│█████┌┘██│██│ ██│ ██│ ██│ ▄▄███████▀▀███████▄▄
██│ ██│ ██│██┌──┘ ██│██│ ██│ ██│ ██│ ████ ▄ ▄ ████
└█████┐└█████┌┘██│ ██│██████┐└█████┌┘ ██│ ████ █ █ ████
@up1
up1 / 1.txt
Last active September 11, 2025 08:39
SDD with Spec-Kit
# 1. สร้าง project ด้วย Spec-kit เพื่อสร้าง specification ขึ้นมา
$uvx --from git+https://github.com/github/spec-kit.git specify init demo-api
███████╗██████╗ ███████╗ ██████╗██╗███████╗██╗ ██╗
██╔════╝██╔══██╗██╔════╝██╔════╝██║██╔════╝╚██╗ ██╔╝
███████╗██████╔╝█████╗ ██║ ██║█████╗ ╚████╔╝
╚════██║██╔═══╝ ██╔══╝ ██║ ██║██╔══╝ ╚██╔╝
███████║██║ ███████╗╚██████╗██║██║ ██║
╚══════╝╚═╝ ╚══════╝ ╚═════╝╚═╝╚═╝ ╚═╝
@up1
up1 / 1.txt
Created September 7, 2025 06:42
Elasticsearch :: Hybrid search
# Hybrid search
GET rag-langchain/_search
{
"retriever": {
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"semantic": {
@up1
up1 / ArgoCD.md
Created September 2, 2025 15:30 — forked from bhimsur/ArgoCD.md
Installing ArgoCD on Minikube

Installing ArgoCD

  1. We will start with launching minikube cluster.
minikube start --driver=docker
  1. Create a namespace for argocd
kubectl create namespace argocd
  1. Apply ArgoCD manifest installation file from ArgoCD github repository
@up1
up1 / install.md
Last active September 2, 2025 15:02
ArgoCD in minikube

1. Start minikube

$minikube start

$minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
@up1
up1 / 1.txt
Last active September 2, 2025 04:45
Spring Boot 4 with OpenTelemetry starter
.m2/repository/io/opentelemetry/opentelemetry-sdk-trace/1.53.0/opentelemetry-sdk-trace-1.53.0.jar)
2025-09-02T11:41:27.145+07:00 INFO 91609 --- [demo_otel] [main] [ ] i.m.c.instrument.push.PushMeterRegistry :
Publishing metrics for OtlpMeterRegistry every 1m to http://localhost:4318/v1/metrics
with resource attributes {service.name=demo_otel}
@up1
up1 / 1.txt
Last active August 27, 2025 07:03
Go green tea
# Start with Green tea
$GOEXPERIMENT=greenteagc go run main.go
2025/08/27 11:01:27 pprof server on :6060
2025/08/27 11:01:27 Server running on :8080 with Green Tea GC enabled
/gc/heap/allocs:bytes = {1 2402052896 <nil>}
/gc/heap/frees:bytes = {1 2396205576 <nil>}
/gc/heap/allocs:objects = {1 22943712 <nil>}
/gc/heap/frees:objects = {1 22922079 <nil>}
/gc/heap/live:bytes = {1 5356376 <nil>}
@up1
up1 / Deleted fd cleanup.md
Created August 26, 2025 06:30 — forked from narate/Deleted fd cleanup.md
This script helps identify and optionally truncate files that have been deleted but are still held open by processes on a Linux system (commonly causing df to show full disk while du shows much less).

Script Explanation: deleted_fd_cleanup.sh

This script helps identify and optionally truncate files that have been deleted but are still held open by processes on a Linux system (commonly causing df to show full disk while du shows much less).


Features

  1. Detects all (deleted) files currently held open by processes using lsof.
  2. Ensures each PID+FD is handled only once to avoid duplicate operations.
@up1
up1 / 1.java
Last active August 18, 2025 15:15
Spring framework 7 and Spring Boot 4
@EnableResilientMethods
class Demo {
// 5 retry attempts and an exponential back-off strategy with a bit of jitter
@Retryable(maxAttempts = 5, delay = 100, jitter = 10, multiplier = 2, maxDelay = 1000)
public void sendNotification() {
this.jmsClient.destination("notifications").send(...);
}
//