Skip to content

Instantly share code, notes, and snippets.

View lifthrasiir's full-sized avatar

Kang Seonghoon lifthrasiir

View GitHub Profile
@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

@lifthrasiir
lifthrasiir / .gitignore
Last active December 10, 2022 21:44
Precision wall clock benchmark in Rust
target
Cargo.lock
@lifthrasiir
lifthrasiir / Cargo.toml
Last active December 10, 2022 11:50
Async_zip + tokio issue with nested streams
[package]
name = "async-zip-problem"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "async-zip-problem"
path = "main.rs"
[dependencies]
@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 / epyt-commented.js
Created July 13, 2022 13:44
epyt: a simple yet challenging typing game for JS1024 2022 https://js1024.fun/demos/2022/18/readme
// _
// ___ __ _ _ _ _| |
// / _ \ / _` | | | |__ | by Kang Seonghoon (@senokay, mearie.org)
// \__ | (_| | |_| |_| | 2022-07-13, for JS1024 2022
// |___/ \__, | .__/|__/ Public Domain (CC0 1.0)
// |_|\___|
//
// This is a simple typing game where you have lots of short English words to
// quickly type before a timer runs out. Perhaps most surprisingly, the game
// seems to have an access to lots of real English words (1,903 to be exact).
@lifthrasiir
lifthrasiir / gvim.sh
Last active May 9, 2022 20:59
Running Windows gvim.exe from WSL
gvim() {
local args rawargs path base usegvim=1 noopt=
declare -a args
rawargs=("$@")
while (($#)); do
case "$noopt$1" in
-[cSdirsTuUwW]|--cmd|--remote-expr|--remote-send|--servername|--version)
args[${#args[@]}]="$1"
rawargs[${#args[@]}]="$1"
shift
@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 / 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 / c11-to-rust.md
Last active September 16, 2021 13:30
C11 standard library to Rust standard library (as of 2014-07-19 nightly)

As a response to Issue #15753. Not yet complete.

Some notes:

  • All Rust translations assume the crate root (so the reference to std is freely available). The use of any other crates is noted.
  • Every string or vector argument is assumed to be a slice (&str or &[T]). Otherwise you need to convert String or Vec<T> to a slice with .as_slice() method.

<assert.h>

  • assert(cond): assert!(cond) macro. Note that it's always enabled; if you need to selectively disable the assertions, use debug_assert!(cond) macro.