Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / 1.js
Created June 30, 2025 14:42
Workshop K6
import http from "k6/http";
import { check } from "k6";
export const options = {
stages: [
{ duration: "30s", target: 10 },
{ duration: "3m", target: 10 },
{ duration: "30s", target: 0 },
],
tags: {
@up1
up1 / 1.txt
Last active June 25, 2025 17:02
Gemini-cli
Now that all the files are created, I will run the tests to verify the implementation.
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ⊷ Shell npx jest (Run tests with jest.) │
│ │
│ ... first 5 lines hidden ... │
│ PASS routes/userRoutes.test.js │
│ GET /users/:id │
│ ✓ should return user details for a valid ID (19 ms) │
│ ✓ should return 404 for a non-existent user ID (4 ms) │
│ ✓ shoul
@up1
up1 / 1.py
Last active June 17, 2025 14:47
PDF with docling
from docling.document_converter import DocumentConverter
source = "./page_1.pdf"
converter = DocumentConverter()
doc = converter.convert(source).document
print(doc.export_to_markdown())
@up1
up1 / 1.txt
Last active June 15, 2025 16:16
PGLite + FastAPI
# ติดตั้ง
$pip install fastapi
$pip install py-pglite
$pip install sqlmodel
$pip install pytest
$pip install coverage
# Run test and coverage
@up1
up1 / demo.py
Created June 3, 2025 13:48
Mistral OCR with PDF file
import base64
import os
from mistralai import Mistral
def encode_pdf(pdf_path):
"""Encode the pdf to base64."""
try:
with open(pdf_path, "rb") as pdf_file:
return base64.b64encode(pdf_file.read()).decode('utf-8')
except FileNotFoundError:
@up1
up1 / 1.robot
Created May 31, 2025 05:00
Robot framework 7.3
*** Variables ***
${AGE: int} 1
*** Test Cases ***
Use variables
# FAIL: 1 (integer) != 1 (string)
Should Be Equal ${AGE} 1
# PASS
Should Be Equal ${AGE} ${1}
@up1
up1 / 1.txt
Last active May 21, 2025 15:37
Demo with Foundry Local
# 1. ติดตั้ง
$brew tap microsoft/foundrylocal
$brew install foundrylocal
# 2. ดู Model ที่สนับสนุน
$foundry model list
🟢 Service is Started on http://localhost:5273, PID 28974!
Alias Device Task File Size License Model ID
-----------------------------------------------------------------------------------------------
@up1
up1 / 1.txt
Last active May 15, 2025 14:18
AWS Serverless app
# SAM CLI
$sam --version
SAM CLI, version 1.138.0
# Create Hello Project
$sam init --runtime java11 --dependency-manager maven --app-template hello-world --name sqs-lambda-test

Cursor's Memory Bank

I am Cursor, an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read ALL memory bank files at the start of EVERY task - this is not optional.

Memory Bank Structure

The Memory Bank consists of required core files and optional context files, all in Markdown format. Files build upon each other in a clear hierarchy:

flowchart TD
#1. Install
$go install github.com/tienanr/docurift/cmd/docurift@latest
# 2. Run docurift proxy server
$docurift -proxy-port 9876 -analyzer-port 9877 -backend-url http://localhost:8080 -max-examples 20
2025/05/12 16:45:00 Starting DocuRift with proxy port 9876 and analyzer port 9877
2025/05/12 16:45:00 Using backend URL: http://localhost:8080
2025/05/12 16:45:00 Starting analyzer server on :9877
2025/05/12 16:45:00 Starting proxy server on :9876