Skip to content

Instantly share code, notes, and snippets.

View precondition's full-sized avatar

precondition

View GitHub Profile
@precondition
precondition / _qmk
Last active October 6, 2021 18:07
Zsh autocompletion file for the QMK CLI tool. To use it, just add this file in one of the directories of your $fpath and `compdef _qmk qmk` to your .zshrc
#compdef qmk
_qmk_compile(){
_arguments \
'-h[Print help text.]' \
'--help[Print help text.]' \
"-n[Don't actually build, just show the make command to be run.]::_qmk_compile" \
"--dry-run[Don't actually build, just show the make command to be run.]::_qmk_compile" \
'-km[The keymap to build a firmware for. Ignored when a configurator export is supplied.]::_qmk_compile' \
'--keymap[The keymap to build a firmware for. Ignored when a configurator export is supplied.]::_qmk_compile' \
@precondition
precondition / HID_X11_converter.py
Last active February 9, 2025 19:33
Converter between HID and X11 keycodes
#!/usr/bin/env python3
"""
Usage:
$ python3 HID_X11_converter.py --type X11 <keycode number as shown in `xmodmap -pke`>
$ python3 HID_X11_converter.py --type HID <keycode number used in QMK>
HID keycodes as used in QMK can be found in https://docs.google.com/spreadsheets/d/1TAK6df8bObeswn8CnxIGgZJB_NYON_p8GReMfZ2O-sE/edit#gid=0.
Look for the "Basic Keycodes" sheet and don't forget to convert from hexadecimal to decimal notation when using this tool.
An enum starts on 0 unless specified otherwise and the integer affected to every item in the enum increases one by one as you go down the enum, unless a specific integer is assigned to an enum item.
@precondition
precondition / code2name.json
Last active July 21, 2022 10:37
Lookup Table to convert QMK keycodes into their readable keycode name (US) aliases
{
"0": "KC_NO",
"1": "KC_TRANSPARENT",
"2": "KC_POST_FAIL",
"3": "KC_UNDEFINED",
"4": "KC_A",
"5": "KC_B",
"6": "KC_C",
"7": "KC_D",
"8": "KC_E",
@precondition
precondition / color_coded_ja_text_template.tex
Last active July 31, 2025 19:30
Python script to convert pitch-accent color-coded Japanese HTML (from https://kotu.io/media/reader/) into LaTeX for insertion into `color_coded_ja_text_template.tex`. Compile w/ XeLaTeX. ![Preview](https://do4ryrayvtpwi.cloudfront.net/original/3X/2/d/2d7d2f399ddd4c66550a32f71ca126218845cb31.png)
\documentclass[11pt]{extarticle}
\usepackage{parskip}
\usepackage[japanese]{babel}
\usepackage[a4paper,width=160mm,top=20mm, bottom=20mm]{geometry}
\usepackage{fancyhdr}
\usepackage{xeCJK}
\usepackage{ruby}
\setCJKmainfont{Noto Serif CJK JP}
%\setCJKmainfont{IPAMincho}
\setCJKsansfont{IPAGothic}