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 / print_dir_structure.py
Last active December 14, 2025 04:17
It's a Python script that prints a tree-like directory structure (folders + optional files) and automatically copies the output to the clipboard. It supports specifying a target directory or defaults to the current one. Use the --full flag to show files. Requires pyperclip.
#!/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
@pakkinlau
pakkinlau / gpt2md.py
Last active January 7, 2026 23:56
gpt2md — Convert ChatGPT/Codex-style Markdown-with-math into a strict, portable Markdown+LaTeX subset that renders cleanly in Obsidian and Quarto (via KaTeX/MathJax). The script normalizes delimiters, fixes common LaTeX pitfalls, and refuses to touch code/links/previous math.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
gpt2md — Make LLM-ish Markdown safe for Obsidian/Quarto (KaTeX/MathJax)
PURPOSE
Convert ChatGPT/Codex-style Markdown-with-math into a strict, portable
Markdown+LaTeX subset that renders cleanly in Obsidian and Quarto (via
KaTeX/MathJax). The script normalizes delimiters, fixes common LaTeX
pitfalls, and refuses to touch code/links/previous math.