Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@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}}"
}
@up1
up1 / 1.txt
Last active March 23, 2024 17:41
Hello Garnet from microsoft
// Build
$git clone git@github.com:microsoft/garnet.git
$cd garnet
$dotnet restore
$dotnet build -c Release
$dotnet test -c Release -f net8.0 -l "console;verbosity=detailed"
// Start server
$cd main/GarnetServer
$dotnet run -c Release -f net8.0
@up1
up1 / 1.txt
Last active March 23, 2024 12:35
Json Schema Faker
$node sample.js
{
"id": 32844286,
"username": "labore",
"email": "ad in enim consequat nisi",
"firstName": "Ut nisi",
"lastName": "cillum aute est mollit minim",
"gender": "female",
"image": "velit proident commodo do",
"token": "elit dolore"
@up1
up1 / 1.txt
Last active March 15, 2024 13:47
Docker Otel LGTM
$docker-compose up -d
$docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
lgtm-lgtm-1 grafana/otel-lgtm "/bin/sh -c ./run-al…" lgtm 45 seconds ago Up 45 seconds 0.0.0.0:3000->3000/tcp, 0.0.0.0:4317-4318->4317-4318/tcp
$docker images | grep "grafana/otel-lgtm"
grafana/otel-lgtm latest f11d1d6cc69b 2 weeks ago 1.34GB
@up1
up1 / Dockerfile
Last active March 12, 2024 15:16
JSON Crack
# Builder
FROM node:18-alpine as builder
# Reference :: https://pnpm.io/docker
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /src
# Cache dependencies first
COPY package.json pnpm-lock.yaml ./
@up1
up1 / 1.bru
Last active March 12, 2024 07:12
Hello Bruno :: REST API testing
meta {
name: Get user detail
type: http
seq: 1
}
get {
url: https://jsonplaceholder.typicode.com/users/1
body: none
auth: none
@up1
up1 / 1.java
Last active March 9, 2024 08:30
RestClient :: Spring Boot 3.2
// Get data
var response = restClient
.get()
.uri("/users/1")
.retrieve()
.toEntity(UserResponse.class);
// Error handling
var request = restClient
.get()
@up1
up1 / 1.go
Last active March 3, 2024 04:13
OpenTelemetry + Test result + Prometheus + Grafana
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
shutdown := initProvider(ctx)
defer shutdown()
commonLabels := []attribute.KeyValue{
attribute.String("result", "[skiped|success|failure]"),
@up1
up1 / 1.js
Last active March 2, 2024 05:01
Playwright 1.42.0
test('test customer login', { tag: ['@fast', '@login'] }, async ({ page }) => {
// ...
});
// ทำการ run test ด้วย tag
$npx playwright test --grep @fast
@up1
up1 / 1.xml
Last active February 20, 2024 02:38
Java :: Async logging
<Appenders>
<!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->
<RandomAccessFile name="demo" fileName="mylog.log"
immediateFlush="false" append="false">
...
</RandomAccessFile>
</Appenders>