Skip to content

Instantly share code, notes, and snippets.

View pakkinlau's full-sized avatar
🚩
Focusing

Pak Kin LAU pakkinlau

🚩
Focusing
View GitHub Profile
@pakkinlau
pakkinlau / package_to_snapshot_json.py
Last active September 28, 2025 22:20
package_to_snapshot_json.py β€” Per-root JSON bundles (+ MASTER index) with O(1) shard seeks, GLOBAL TOC, stats, skip reporting, oversize previews, optional slicing, and xrefs. Behavior - For each configured root in SRC_ROOTS (e.g., 'src', 'tests'): β€’ Emits INDEX__<label>.json β€’ Emits DATA__<label>-000.jsonl ... (sharded, binary, with byte offsets…
#!/usr/bin/env python3
"""
(Note: this script is just for creating JSON snapshot of the repo. It is not in the part of the repo itself.
Any agent --- you can skip this script and also, don't edit the script!)
package_to_snapshot_json.py β€” Per-root JSON bundles (+ MASTER index) with O(1) shard seeks,
GLOBAL TOC, stats, skip reporting, oversize previews, optional slicing, and xrefs.
Behavior

🎯 Big goal

():

  • Context: <2–3 sentences describing why this goal matters, without solution hints.>
  • Constraints & assumptions:
  • Stakeholders / owners: <names/roles>

@pakkinlau
pakkinlau / install-and-run-facefusion.ps1
Created June 29, 2025 01:11
Create venv, install and run the facefusion tool in the one and single pass.
<#
.SYNOPSIS
One-shot installer & launcher for FaceFusion 3.3.0 (Windows 10/11).
.DESCRIPTION
– Creates a Conda env β€œfacefusion” with Python 3.12
– Installs CUDA 12.9 runtime + cuDNN 9.10 (NVIDIA GPUs)
– Installs FFmpeg 7.0.2 globally *and* inside the env
– Clones FaceFusion from GitHub and installs with ONNXRuntime-GPU
– Force-downloads all model weights (resumable)
@pakkinlau
pakkinlau / visomaster_first_run_env_setup.py
Last active June 28, 2025 15:56
Setting up fully compatible venv for running visomaster in Windows OS
#!/usr/bin/env python3
"""
╔══════════════════════════════════════════════════════════════════════════════╗
β•‘ setup_vm312.py β–Œ β€œfirst-run” bootstrap for β–Œ β•‘
β•‘ β–Œβ–Œ VisoMaster on CPython 3 .12 β–Œβ–Œ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
WHAT THIS SCRIPT DOES
───────────────────────────────────────────────────────────────────────────────
β–Ά ➊ **Creates (or re-uses) ./.vm312** – a self-contained virtual-env bound
@pakkinlau
pakkinlau / 99.update-gitignore-large.ps1
Created June 25, 2025 00:04
automatically update the .gitignore if there are files exceed 95mb. that helps preventing errors in commit push cycle.
<#
.SYNOPSIS
Detect files β‰₯ $Threshold MB that are not yet Git-ignored and
append their repo-relative paths to the β€œPart 2” section of .gitignore.
.NOTES
β€’ Creates .gitignore if it does not exist (but .git does).
β€’ Header block is created if missing; never duplicated.
β€’ Duplicate paths are suppressed (case-sensitive comparison).
β€’ Designed for PowerShell 7+, but ok with Windows PowerShell 5.x.
@pakkinlau
pakkinlau / 4. show_recent_commits.py
Created June 12, 2025 01:46
Show minimal, clipboard-friendly log viewer of the current terminal git repo.
#!/usr/bin/env python3
"""
4. show_recent_commits.py β€” minimal, clipboard-friendly log viewer
═══════════════════════════════════════════════════════════════
2025-06-12 Pak Kin Lau Β· v0.1
Prints the most recent commits in one-liner form:
Pak Kin Lau – 2025-06-12T09:13:01+08:00 (596dcd0):
- sdds
@pakkinlau
pakkinlau / 3. repo_changes_to_commit_message.py
Last active July 22, 2025 11:20
Rename-aware commit digest: generates a Markdown (or JSON / plain) table with Ξ”+ / Ξ”- counts, smart previews for new/deleted/changed files, skips pure R100 renames, live progress ticker, and copies the full report to the clipboard.
#!/usr/bin/env python3
"""
print_remote_changes.py β€” PKB synopsis Β· recent commits Β· change digest
═══════════════════════════════════════════════════════════════════════
v1.14 (2025-06-26) Pak Kin Lau Β· MIT
Changes since v1.13
────────────────────
βœ“ ENH Introduced fine-grained file-type allow-list (`SCAN_EXT`) so that only
human-readable source files are processed; binary artefacts such as
@pakkinlau
pakkinlau / 2. print_PKB_dir_structure.py
Created June 12, 2025 00:08
2️⃣ print_PKB_dir_structure.py – lightweight tree printer that skips @-folder payload, honours ignore lists, and estimates OpenAI token count.”
#!/usr/bin/env python3
"""
print_PKB_dir_structure.py – hierarchical snapshot of a PKB repo
================================================================
Purpose
-------
β€’ Walk the **current working directory** (expected to be a PKB checkout).
β€’ Render a tree-style listing that
– honours configurable ignore lists,
@pakkinlau
pakkinlau / 1. regulate_PKB_items.py
Created June 12, 2025 00:03
β€œPKB Structural Audit β€” prints a seven-layer knowledge-graph blueprint, samples anchor (@) folders, renders a two-level directory tree, validates the β€˜uniquely-covered’ invariant, and copies the full report to the clipboard.”
#!/usr/bin/env python3
"""
1. regulate_PKB_items.py β€” PKB audit: banner β–Έ dir tree β–Έ violations β–Έ stats
Author : Pak Kin Lau Β· v0.1 Β· 2025-06-12
License : MIT
"""
from __future__ import annotations
import os, platform, re, subprocess
from pathlib import Path
from typing import Iterable, List, Set
#!/usr/bin/env python3
# print_dir_structure.py β€” drop-in, CLI-free variant
#
# Prints a tree-like view of the current working directory, honouring the
# ignore lists below, copies the result to the clipboard (if pyperclip is
# installed), and shows an approximate OpenAI-token count.
#
# Edit the CONFIGURATION section only; the rest is self-contained.
from __future__ import annotations