Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / 2.txt
Last active May 5, 2024 09:57
FastAPI Cli
$fastapi dev main.py
INFO Using path main.py
INFO
╭─ Python module file ─╮
│ │
│ 🐍 main.py │
│ │
╰──────────────────────╯
@up1
up1 / 1.txt
Created May 4, 2024 11:56
NodeJS 22
$node -v
v22.1.0
$node --run test
PASS ./hello.test.js
✓ Hello test (1 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
@up1
up1 / Demo.java
Created April 29, 2024 15:38
Spring Framework 6.2.0-M1 :: @testbean
// Production code
@Configuration
class ProdConfiguration {
@Bean
MyService customService() {
return new ProdServiceImpl();
}
}
@up1
up1 / 1.txt
Last active April 25, 2024 06:42
Docker + OpenJDK
$docker image build -t v2 .
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
v2 latest be1d4e472288 12 minutes ago 94.4MB
v1 latest ea33af4a5e61 18 minutes ago 741MB
@up1
up1 / 1.txt
Last active April 20, 2024 04:40
bld:: java build tool
$bld
Downloading: https://repo1.maven.org/maven2/com/uwyn/rife2/bld/1.9.0/bld-1.9.0.jar ... done
Downloading: https://repo1.maven.org/maven2/com/uwyn/rife2/bld/1.9.0/bld-1.9.0-sources.jar ... done
Welcome to bld 1.9.0.
The bld CLI provides its features through a series of commands that
perform specific tasks. The help command provides more information about
the other commands.
Usage: help [command]
@up1
up1 / logback-spring.xml
Created April 13, 2024 04:46
Spring Boot + Loki push
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>http://localhost:3100/loki/api/v1/push</url>
</http>
<format>
<label>
<pattern>app=${name},host=${HOSTNAME},level=%level</pattern>
<readMarkers>true</readMarkers>
@up1
up1 / 1.txt
Last active April 1, 2024 14:43
Mac
$xz --version
xz (XZ Utils) 5.4.6
liblzma 5.4.6
$brew info xz
==> xz: stable 5.4.6 (bottled)
General-purpose data compression with high compression ratio
https://xz.tukaani.org/xz-utils/
/opt/homebrew/Cellar/xz/5.4.6 (163 files, 2.6MB) *
Poured from bottle using the formulae.brew.sh API on 2024-03-30 at 10:25:43
@up1
up1 / 1.txt
Created April 1, 2024 05:12
PostgreSQL :: generate data
# ตัวอย่าง table
CREATE TABLE merchants(
id serial PRIMARY KEY,
name VARCHAR (50) UNIQUE NOT NULL,
email VARCHAR (50) UNIQUE NOT NULL
);
# ใช้งาน GENERATE_SERIES สำหรับสร้างข้อมูลจำนวน 10,000 rows
INSERT INTO merchants (name, email)
SELECT
@up1
up1 / 1.cs
Last active March 31, 2024 08:46
YARP :: example
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
var app = builder.Build();
app.MapReverseProxy();
app.Run();
@up1
up1 / 1.json
Created March 28, 2024 15:35
Mock Data in Postman
{
"name": "{{$randomFullName}}",
"userName": "{{$randomUserName}}",
"location": "{{$randomCity}}",
"company": "{{$randomCompanyName}}",
"jobTitle": "{{$randomJobTitle}}",
"updatedAt": "{{$timestamp}}"
}