Skip to content

Instantly share code, notes, and snippets.

@harjitmoe
harjitmoe / ivs_to_moji_joho.txt
Last active January 25, 2026 22:22
Normalisation for duplicate or disunified variation-selector sequences (SVSes or IVSes) for CJK Unified Ideographs in Unicode
3402+E0100 CID+13698 → 3402+E0103 MJ000006
3402+E0101 CID+13697 → 3402+E0104 TK01000160
#3402+E0102 CID+13699
3427+E0100 CID+13910 → 3427+E0101 IA0105
342A+E0100 IA0106 → 342A+E0103 MJ000022
342C+E0100 CID+17246 → 342C+E0101 MJ000025
342E+E0100 CID+14216 → 342E+E0103 MJ000029
34BC+E0100 CID+17303 → 34BC+E0101 MJ000150
34C7+E0100 CID+17307 → 34C7+E0101 JD0315
34DE+E0101 KS022440 → 2D0CC MJ057043
@harjitmoe
harjitmoe / glyphwiki_aliased_ivses.py
Last active December 11, 2025 14:02
Uses GlyphWiki data to determine which SVSes and IVSes for a codepoint refer to the same glyph.
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
__doc__ = """\
Uses GlyphWiki data to determine which SVSes and IVSes for a codepoint refer to the same glyph.
Usage: glyphwiki_aliased_ivses.py < dump_newest_only.txt > duplicate_ivses.txt
GlyphWiki data download instructions:
https://en.glyphwiki.org/wiki/GlyphWiki:AdvancedApplication#i0
@harjitmoe
harjitmoe / colourdistribution.py
Created October 22, 2025 16:40
Adjusts the levels histogram of an input image to match that of a reference image.
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
# By HarJIT in 2025.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
"""Adjusts the levels histogram of an input image to match that of a reference image."""
/*
* ReWild - Replacement for Wildfire.
* Copyright (c) 2016, 2018, 2020 HarJIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
@harjitmoe
harjitmoe / nbtpickle.py
Last active November 1, 2019 16:04
Use the pickle/json/marshal basic API with NBT data.
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
""" Use the pickle/json/marshal basic API with NBT data. """
# Authored by HarJIT in 2019. This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at
# https://mozilla.org/MPL/2.0/.
from ctypes import c_byte, c_int16, c_int32, c_int64, c_float, c_double
@harjitmoe
harjitmoe / system_b_cyrillic.txt
Last active May 29, 2018 12:03
IBUS table for Cyrillic using adapted GOST 7.79 System B mappings.
SCIM_Generic_Table_Phrase_Library_TEXT
VERSION_1_0
BEGIN_DEFINITION
NAME = System B
AUTHOR = HarJIT <harjit@harjit.moe>
LANGUAGES = ru
SERIAL_NUMBER = 20180528
UUID = db34eefb-cc62-46a8-85c2-d5b5a26444df
@harjitmoe
harjitmoe / deseret.txt
Last active April 18, 2018 23:07
IBUS table for Deseret
SCIM_Generic_Table_Phrase_Library_TEXT
VERSION_1_0
BEGIN_DEFINITION
# Library of Congress romanisation of Deseret (followed except for ï, which it does not define):
# > https://www.loc.gov/catdir/cpso/romanization/deseret.pdf
#
# Macron accents (overlines) are represented here by a single x prefix, other accents (umlaut and
# circumflex) are represented by a doubled x prefix.
(obsolete, see https://gist.github.com/harjitmoe/19f0412ec9bb8a6330bce6683fbbb760 )
@harjitmoe
harjitmoe / xhtml2shim.js
Last active July 5, 2017 11:02
JavaScript shim to add support for suitably-namespaced XHTML2 elements in XHTML5 code (currently just <xhtml2:img>). Requires jQuery.
// Namespaces assumed:
// xmlns="http://www.w3.org/1999/xhtml"
// xmlns:xhtml2="http://www.w3.org/2002/06/xhtml2/"
// xmlns:ev="http://www.w3.org/2001/xml-events"
// By Thomas Hori, copyright 2017. Zlib licence.
jQuery(function () { // Good practice to not assume $ at top level is jQuery (due to e.g. PrototypeJS).
var $ = jQuery;
////////////////
# Copyright (c) Secret Labs AB 1997-2003.
# Copyright (c) Fredrik Lundh 1995-2003.
#
# By obtaining, using, and/or copying this software and/or its
# associated documentation, you agree that you have read, understood,
# and will comply with the following terms and conditions:
#
# Permission to use, copy, modify, and distribute this software and its
# associated documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appears in all