Skip to content

Instantly share code, notes, and snippets.

View lifthrasiir's full-sized avatar

Kang Seonghoon lifthrasiir

View GitHub Profile
@lifthrasiir
lifthrasiir / dj40.c
Last active September 13, 2022 16:42
Pre-release version of J40 JPEG XL decoder, see https://github.com/lifthrasiir/j40 for recent releases
#define J40_CONFIRM_THAT_THIS_IS_EXPERIMENTAL_AND_POTENTIALLY_UNSAFE
#define J40_IMPLEMENTATION
#include "j40.h"
#ifdef __GNUC__ // stb_image_write issues too many warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#endif
#define STB_IMAGE_WRITE_IMPLEMENTATION
@lifthrasiir
lifthrasiir / radio.html
Created April 2, 2022 04:35
xkcd 2022-04-01: transcript and runner (up to 2:17:00)
<!doctype html>
<meta http-equiv=refresh content=2>
<canvas id=canvas width=2000 height=2000></canvas>
<script>
function draw(s) {
try {
const ctx = canvas.getContext('2d');
ctx.scale(1.5, 1.5);
ctx.translate(500, 500);
ctx.scale(1, -1);
// really inefficient MicroW8 quine
// 2022-03-01 Kang Seonghoon, public domain
import "env.memory" memory(4);
import "env.printString" fn printString(i32);
export fn upd() {
if 0!64 > 0 {
return;
@lifthrasiir
lifthrasiir / numeric-tzid.md
Last active February 3, 2025 01:32
Proposal for stable short identifier (or two) of time zones

This proposal was originally written in 2018 as a concrete proposal for numeric time zone identifiers. I'm still not sure if this has a merit or not, but for the historical perspective, I reproduce the (incomplete) proposal in verbatim here. --Kang Seonghoon


[...]

The needs for the short and stable identifier are most importantly observed by the case of the Unicode CLDR project. CLDR required a stable identifier for the locales, which requires a stable identifier for the time zones. [...]

Short Identifiers

@lifthrasiir
lifthrasiir / brotli-preset.mjs
Last active September 10, 2021 08:16
Brotli preset dictionary recovery experiment
import * as fs from 'fs';
import * as crypto from 'crypto';
import * as zlib from 'zlib';
function makeBrotliPreset() {
const buf = [];
let bits = 0;
let nbits = 0;
const write = (v, n=1) => {
if ((v >>> 0) >= (1 << n)) throw 'write failed';
@lifthrasiir
lifthrasiir / jxl-preflate.py
Last active February 6, 2022 07:41
Super-experimental PNG recompressor with JPEG XL and reconstruction support
#!/usr/bin/env python3
# jxl-preflate.py - Experimental reconstructable PNG recompressor to JXL
# Kang Seonghoon, 2021-07-18, Public Domain.
import sys
import os.path
import tempfile
import subprocess
import struct
import zlib
@lifthrasiir
lifthrasiir / analyze-material-design-icons-svg.py
Created June 16, 2021 02:50
Material Design Icons experiment for IconVG
import os, os.path, sys, re, math, collections
mults = [1, 2, 4, 8, 10, 16, 100]
freqs = {}
for absmult in mults:
for relmult in mults:
freqs[absmult, relmult] = collections.Counter()
ops = collections.Counter()
lineops = collections.Counter()
// ==UserScript==
// @name 리디북스 신간 캘린더 플러그인
// @namespace https://gist.github.com/lifthrasiir/200ae9a9b289520ceba835cd804c1cdd
// @version 1.4
// @author Kang Seonghoon (https://mearie.org/)
// @match https://ridibooks.com/event/*
// @run-at document-start
// @updateURL https://gist.github.com/lifthrasiir/200ae9a9b289520ceba835cd804c1cdd/raw/ridibooks-event-calendar.user.js
// @downloadURL https://gist.github.com/lifthrasiir/200ae9a9b289520ceba835cd804c1cdd/raw/ridibooks-event-calendar.user.js
// ==/UserScript==
@lifthrasiir
lifthrasiir / transcript.md
Created September 18, 2020 03:48
2020-09-17 주호민 위펄래쉬2 "검열" 발언 전체 녹취
  • 정확도는 일절 보장하지 않음. 정확한지 아닌지는 링크 보고 판단할 것.
  • 본인은 주호민의 발언에 대해 비판적이지만 일부만 알려진 녹취록으로부터 유추한 대부분의 의견과는 다른 이유로 비판적임.

녹취

4:15:13

아이 아무튼, 이걸로 해서 위펄래쉬 시즌 2가 다 끝났습니다.
시즌 2를 하면서 느낀 거는, 위펄래쉬 시즌 2는,
@lifthrasiir
lifthrasiir / README.md
Last active January 30, 2023 15:55
Compact Temporal Notation (Provisional)

Motivation

I write a lot, a lot of personal journals in a plain text. They contain a lot of dates and times, many of them should be ideally tracked automatically (like, if I've written "15:00 tomorrow" some software ought to alarm at that time), so they should be written in a consistent manner. So far I've used ISO 8601 date and time format (e.g. 2020-09-05 or 11:30) and a bunch of natural extensions (e.g. tomorrow, last Sun).

And folks, it's verbose or often ambiguous to other plain text! For example I tend to schedule things in a multiple of hours so :00 is not necessary, but a single number 15 would be less recognizable as hours. Many systems will helpfully try to recognize at 15 or 3pm, but how would you know that at 15 is not a part of at 15 km/h or similar? Also my journals are in Korean anyway, and such workarounds tend to not work well crosslingually. How about the intervals like 15:00 thru 18:30? ISO 8601 interval 15:00/18:30 would be particularly problematic because a