Skip to content

Instantly share code, notes, and snippets.

@sidkang
sidkang / SPEC.md
Created May 11, 2026 02:03
Hammerspoon Whichkey

WhichKey Plugin SPEC

Purpose

whichkey.lua is a small Hammerspoon helper that shows a delayed, floating key guide for modal shortcuts.

It is intended for workflows where another tool or hotkey layer enters a mode, waits for the next key, and wants to display an on-screen cheat sheet only if the user hesitates.

Typical usage:

@sidkang
sidkang / 18comic.js
Created March 31, 2026 14:26
18comic.vip 键盘导航增强
// ==UserScript==
// @name 18comic.vip 键盘导航增强
// @namespace http://tampermonkey.net/
// @version 1.7
// @description 左右键翻页,上下键快速滚动,默认隐藏顶部导航,H键切换
// @match https://18comic.vip/photo/*
// @grant none
// @run-at document-idle
// ==/UserScript==
@sidkang
sidkang / config.lua
Created October 13, 2023 10:30
beancount cmp with nvim
return {
{
"hrsh7th/nvim-cmp",
dependencies = {
"crispgm/cmp-beancount",
"hrsh7th/cmp-nvim-lsp-signature-help",
},
opts = function(_, opts)
local cmp = require "cmp"
@sidkang
sidkang / beancount.lua
Created January 29, 2023 03:25
Neovim Beancount Basic Config
-- after/ftplugin/beancount.lua
vim.opt.wrap = false
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.g.beancount_separator_col = 55
vim.g.beancount_root = vim.trim(vim.fn.system('pwd')) .. "/" .. "main.bean"
@sidkang
sidkang / resize-pdf.py
Last active May 13, 2025 10:52
Resize PDF Files to Same Page Size Using Python
from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.pdf import PageObject
from pathlib import Path
pdf_file = Path.home() / 'Downloads' / 'General harmony - practical, analysis and principle.pdf'
pdf_reader = PdfFileReader(str(pdf_file))
writer = PdfFileWriter()
# assume page 0 is the desired size
page0 = pdf_reader.getPage(0)
@sidkang
sidkang / script.scpt
Last active November 1, 2021 12:14
change IME using AppleScript
launch application "System Events"
delay 0.1
ignoring application responses
tell application "System Events" to tell process "TextInputMenuAgent"
click menu bar item 1 of menu bar 2
end tell
end ignoring
do shell script "killall 'System Events'"
delay 0.1
import win32com.client as win32
@sidkang
sidkang / learn_pandas.py
Created November 19, 2017 15:03
New Try
import pandas as pd
for i in range(10):