Skip to content

Instantly share code, notes, and snippets.

View MortalHappiness's full-sized avatar

Chi-Sheng Liu MortalHappiness

View GitHub Profile

Keyboard Remapping Scripts for Linux and Windows

Requirements

Remappings

  • Esc: ` (backtick)
@MortalHappiness
MortalHappiness / keyd-kensington.conf
Last active February 19, 2025 10:21
Button remapping for Kensington Expert Mouse on Linux Mint using https://github.com/rvaiya/keyd
# Save this file to /etc/keyd/kensington.conf
# Kensington Expert Mouse Default Bindings:
# - bottom left: leftmouse
# - bottom right: rightmouse
# - top left: middlemouse
# - top right: mouse1
# Result:
# - bottom left: leftmouse
@MortalHappiness
MortalHappiness / graphrag_monkey_patch.py
Last active April 9, 2025 06:32
Monkey-patching the https://github.com/microsoft/graphrag package to make it support the locally hosted LLM models on Ollama. See https://chishengliu.com/posts/graphrag-local-ollama/ for details.
# Monkey patch the graphrag package to support local models deployed via Ollama. Only tested for graphrag version 0.3.2.
# See https://chishengliu.com/posts/graphrag-local-ollama/ for details.
#
# Usage:
# * How to patch the `graphrag.index` CLI:
# * Save https://github.com/microsoft/graphrag/blob/v0.3.2/graphrag/index/__main__.py as "index.py"
# * Replace line 8 with:
# ```python
# from graphrag.index.cli import index_cli
# from graphrag_monkey_patch import patch_graphrag
@MortalHappiness
MortalHappiness / commit-msg
Last active August 13, 2024 19:19
commit-msg git hook to add Sign-off-by trailer to every commit message automatically
#!/usr/bin/env bash
# Usage:
# 1. Download this file and save it as .git/hooks/commit-msg under current repo.
# 2. Run `chmod +x .git/hooks/commit-msg`
COMMIT_MSG_FILE=$1
# If the commit message is fixup! or squash! or Merge, exit without changing it.
grep -qE '^(fixup!|squash!|Merge)' "$COMMIT_MSG_FILE" && exit 0