Skip to content

Instantly share code, notes, and snippets.

@jhkchan
jhkchan / cursor-cleanup.sh
Created February 18, 2026 20:42
Cursor Cleanup Script
#!/bin/bash
# Cursor Cleanup Script
# Removes histories of non-existent projects/workspaces and compacts the database
#
# What this does:
# 1. Backs up state.vscdb before any changes
# 2. Removes non-existent paths from the recently opened list
# 3. Removes workspace storage directories for non-existent projects
# 4. Removes orphan workspace storage directories (no workspace.json or no folder)
# 5. Cleans up stale inline diff data in cursorDiskKV
@jhkchan
jhkchan / wrong2kr.py
Last active February 15, 2026 09:19
wrong2kr.py
#!/usr/bin/env python3
"""
Encoding analysis: Why the "Chinese" on the sign is wrong
The sign stored the text as KOREAN (EUC-KR encoding). The display system
mistakenly interpreted those same bytes as TRADITIONAL CHINESE (Big5/CP950).
So each 2-byte Korean syllable (e.g. 물 "water") became one Chinese character
(e.g. 僭 or 㤮 depending on font). The "translation" is not a translation
but a double encoding misinterpretation:
@jhkchan
jhkchan / notes2evernote.scpt
Created October 12, 2020 17:06
Migrating all notes from Apple Notes to Evernote (work with latest macOS Catalina)
tell application "Notes"
launch -- seems to work better than 'activate'
repeat with anAccount in accounts
set accountTitle to the name of anAccount
repeat with aFolder in folders of anAccount
repeat with aNote in notes of aFolder
set myTitle to the name of aNote
set myText to the body of aNote
set myCreateDate to the creation date of aNote
set myModDate to the modification date of aNote