px DuanYuan notes & experiments

DuanYuan

One person's engineering lab: I write code, take systems apart, and write down what broke. Everything here is my own work.

Cases

Nineteen case studies — each page has its own visual language: colour, type, grid and layout never repeat.

Lab demos

Small systems I built for fun and for testing ideas. All of them run on this machine with sample data — click in and use them.

Multi-carrier tracking console — interface

Carrier tracking normalisation · folding eight couriers into one state machine

Eight couriers, eight field sets, eight vocabularies for status. Queries are dispatched per carrier, then mapped onto one state machine (picked up / in transit / out for delivery / delivered / exception), with exception nodes stored separately. One REST surface and one webhook out, fired only on state change. The hard part is not the request — it is field alignment and idempotent retries.

  • State machine
  • Batch import
  • Scheduled polling
  • Retries & idempotency
  • Webhook

Open the demo →(sample data)

Order vs payment reconciliation console — interface

Matching two tables · locating gaps between orders and payments

One orders table, one payments ledger, and a human going cross-eyed. Orders are indexed by number, then every order is classified into unpaid / amount mismatch / overpaid / duplicate payment, with four totals: ordered, received, outstanding, discrepancy count. CSV export carries a UTF-8 BOM so Excel opens it cleanly. You can upload your own CSVs and run it.

  • CSV cleanup
  • Table matching
  • Discrepancy classes
  • Totals
  • BOM export

Open the demo →(upload your own tables)

Tender field extraction and export — interface

Tender announcement extraction · crawl → structure → parse attachments → CSV

Search the list page by condition, open each detail page and pull fields (project, type, region, buyer, agency, publish time, deadline, budget), then download the PDF/Word attachment and parse the body for missing fields. Paging and incremental dedupe run on timestamp plus a unique key; failed rows retry on their own. This page shows the field schema and the export format.

  • Crawl paging
  • Attachment parsing
  • Field cleanup
  • Incremental dedupe
  • CSV export

Open the demo →(sample data)

Site migration and verification flow

Legacy migration · read-only backups, hash checks, page-by-page re-verification

Moving a decade-old site to a new machine: read-only backup with per-file hashes, restore in the new environment, take over old URLs with 301s, wire HTTPS with auto-renewal, then walk the page inventory one by one and keep a verification log. Before touching anything: check for encrypted cores or machine-bound licences — and never write to the source.

  • Read-only backup
  • Hash checks
  • 301 takeover
  • HTTPS renewal
  • Page re-check

Open the demo →(process notes)

Ops monitoring panel

Ops panel · monitoring and benchmarking with framework-free PHP + SQLite

No framework, no extensions: PHP reads system metrics straight into SQLite, and a single page shows disk, processes, site reachability and response time. Plus a concurrency benchmark — same machine, different worker_connections and opcache settings, compared on average response time.

  • PHP + SQLite
  • Metric collection
  • Reachability probes
  • Concurrency benchmark
  • Zero dependencies

Open the demo →(benchmark report)

Stack

The tools I reach for. Selection is deliberately conservative: fewer dependencies, and if one file solves it, no framework.

01

Backend

Mostly Python, PHP for lightweight sites.

  • Python: requests / Flask / opencv / scheduled jobs
  • PHP 8.x: hand-written MVC, templating, admin panels
  • SQLite: FTS5 search, WAL, triggers
02

Frontend

Hand-written HTML / CSS / vanilla JS, no framework.

  • Responsive layouts with mobile-first breakpoints
  • Vanilla JS for tables, filters, chart drawing
  • Static sites: no CDN, no external fonts
03

Ops

Linux servers, from install to years of upkeep.

  • Nginx / PHP-FPM / systemd / fail2ban
  • Let's Encrypt certificates and auto-renewal
  • Disk and backup strategy, incident triage, performance tuning
04

Things I have poked at

Automating the repetitive parts.

  • Browser automation: raw CDP, no driver library
  • Video: FFmpeg transcoding, frame extraction, compositing
  • Agent deployment: putting open-source agents like Hermes to work

Notes

Short write-ups of problems hit while building sites, moving old systems and tuning performance. Implementation and debugging only.

Read all notes →

About

A place for notes and experiments.

SOURCE

Download the source of every case — sign up with an email

All 19 cases ship their HTML / CSS / JS with implementation notes. No phone number, unsubscribe anytime.

Sign up free with email →Already have an account? Sign in