Skip to content

Instantly share code, notes, and snippets.

View pramoth's full-sized avatar

Pramoth Suwanpech pramoth

View GitHub Profile
@pramoth
pramoth / python-packaging-ecosystem.md
Created June 28, 2026 11:07
Python Packaging, Demystified: interpreter → pip → venv → pipx → uv (a layered mental model with diagrams)

Python Packaging, Demystified: interpreter → pip → venv → pipx → uv

A layered mental model of the Python tooling stack — what each tool is, the exact problem it solves, and how the pieces fit together. Written for developers coming from other ecosystems who want to understand it, not just copy-paste commands.


TL;DR

ยินดีต้อนรับสู่บทเรียนคณิตศาสตร์พื้นฐานครับ ไม่ต้องกังวลเลยนะครับว่าตอนนี้ยังไม่เก่ง เราจะค่อย ๆ เดินไปทีละก้าวอย่างมั่นคงและละเอียดที่สุด ตามแนวทางของหนังสือ Kiselev ซึ่งขึ้นชื่อเรื่องความชัดเจน การพิสูจน์ทุกอย่างจากหลักการแรกเริ่ม (First Principles) และการปูพื้นฐานที่แน่นหนาครับ

เรามาเริ่มกันที่ ส่วนที่ 1: แนวคิดเบื้องต้น (Preliminary Concepts) กันเลยครับ


1. การใช้ตัวอักษรแทนจำนวน (Use of Letters)

ในคณิตศาสตร์ขั้นสูงหรือพีชคณิต เราจะไม่ใช้เพียงแค่ตัวเลข (เช่น $1, 2, 3$) เท่านั้น แต่เราจะใช้ ตัวอักษร (เช่น $a, b, c, x, y$) มาแทนสิ่งที่เราเรียกว่า "จำนวนทั่วไป" หรือ "ตัวแปรที่ยังไม่ระบุค่า"

@pramoth
pramoth / kill-all-connections-to-db.sql
Created February 27, 2026 15:20 — forked from jeffjohnson9046/kill-all-connections-to-db.sql
How to kill all connections to a Postgres database
-- Accepted answer from here: https://stackoverflow.com/questions/5408156/how-to-drop-a-postgresql-database-if-there-are-active-connections-to-it
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = '[your database name goes here]'
AND pid <> pg_backend_pid();
@pramoth
pramoth / luxurytravelwebsite.md
Created January 27, 2026 03:53 — forked from ivanfioravanti/luxurytravelwebsite.md
luxurytravelwebsite prompt for testing coding agents

Create a production-ready, visually stunning website with a futuristic luxury travel theme.

GOAL Build a single-page (plus optional “Destination” detail route) website for a fictional brand: “AURORA LUXE TRAVEL” — ultra-premium, concierge-level trips.

TECH STACK (use exactly this unless something breaks)

  • Next.js (latest stable) + TypeScript
  • Tailwind CSS
  • Framer Motion (for scroll/entrance animations)
-- Create an ACL for JDWP debugging (if not exists)
BEGIN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(
    acl          => 'jdwp_acl.xml',
    description  => 'ACL for JDWP debugging',
    principal    => 'xxx',  -- Replace with your actual schema/user
    is_grant     => TRUE,
    privilege    => 'jdwp'
  );

การรันโปรแกรมด้วย docker

  1. สร้าง docker volume เพื่อเก็บข้อมูล database โดยตั้งชื่อ acfs-data

      docker volume create acfs-data
  2. สร้าง docker container โดยให้รันแบบ background (daemon process) โดยใช้ image ดังนี้

    • docker.geniustree.io/dev/alro-acfs-certificate สำหรับเครื่องทดสอบ
    • docker.geniustree.io/prod/alro-acfs-certificate สำหรับเครื่อง production
    • --name alro-acfs ชื่อ container alro-acfs
#include <stdio.h>
int main(int argc, char **argv) {
for (int i = 1; i < argc; i++) {
printf("%s\n", argv[i]);
}
return 0;
}

2.1 การติดตั้ง JAVA version 11 2.1.1. download จาก link นี้ https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz

2.1.2. copy file JDK ไปยังเครื่อง ต่างๆ - scp OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz sunweb@10.3.x.x โดยที่ x.x คือ ip เครื่องทั้ง 4 เครื่อง

2.1.3 remote เข้าไปยังเครื่องทั้ง 4 เครื่อง แล้วรันคำสั่งสำหรับทุกเครื่อง - tar zxvf OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz -C /opt

2.1.4 ทดลองรันคำสั่ง /opt/jdk-11.0.14.1+1/bin/java -version เพื่อเช็คเวอร์ชั่น จะแสดงผลลัพธ์ดังนี้

Install PC/SC

ขั้นตอนนี้คือการติดตั้งไลบรารีเพื่อให้ Linux สามารถเชื่อมต่อกับเครื่องอ่านได้ (ลีนุกซ์บางรุ่นอาจจะติดตั้งไว้แล้ว ก็สามารถข้ามได้)

  1. กรณี Ubuntu,Debian

    1. ติดตั้ง lib/tools ที่จำเป็น ด้วย sudo apt-get install --reinstall pcscd pcsc-tools libpcsclite1 libpcsclite-dev libpcsclite1 libccid
    2. เมื่อติดตั้งเสร็จ ให้ทดสอบว่า smartcard ทำงวานหรือไม่ ด้วยคำสั่ง systemctl status pcscd จะต้อง Active หากต้องการเช็คว่าเชื่อมต่อเครื่องอ่านได้หรือไม่ ให้เสียบเครื่องอ่านและใช้คำสั่ง pcsc_scan จะแสดงรายการเครื่องอ่านที่เสียบอยู่
  2. กรณี Fedora,CentOS,RedHat

    1. ติดตั้ง lib/tools ที่จำเป็น ด้วย sudo yum -y install pcsc-tools
    2. เมื่อติดตั้งเสร็จ ให้ทดสอบว่า smartcard ทำงวานหรือไม่ ด้วยคำสั่ง systemctl status pcscd จะต้อง Active หากต้องการเช็คว่าเชื่อมต่อเครื่องอ่านได้หรือไม่ ให้เสียบเครื่องอ่านและใช้คำสั่ง pcsc_scan จะแสดงรายการเครื่องอ่านที่เสียบอยู่

IP Server

  • app (OPS1) 172.24.1.26
  • app (OPS2) 172.24.1.27
  • DB 172.24.4.22

SSL Installation

  1. copy file โดย scp key_store_file ops@172.24.1.26:~ โดยที่ key_store_file คือไฟล์ keystore .p12 , .jks ,.pfx
    • ตัวอย่างของในกรณีปี 2565 นี้คือ ไฟล์ SSL/pfx_for_iis_or_hardware/PFXCertificate.pfx ดังนั้น จึงใช้คำสั่ง scp SSL/pfx_for_iis_or_hardware/PFXCertificate.pfx ops@172.24.1.26:~ ซึ่งคือการ copy file PFXCertificate.pfx ที่เครื่อง local ไปยังเครื่องปลายทาง ที่ path /home/ops/
  2. remote เข้าไปที่เครื่อง 172.24.1.26 ด้วยคำสั่ง ssh ops@172.24.1.26 (ด้วย user ops)
  3. เปลี่ยนชื่อไฟล์จาก PFXCertificate.pfx เป็น ssl_keystore.pfx ด้วยคำสั่ง mv PFXCertificate.pfx ssl_keystore.pfx