Skip to content

Instantly share code, notes, and snippets.

testing titty tablets

Mingye Wang Artoria2e5

testing titty tablets
View GitHub Profile
Artoria2e5 /
Created May 19, 2021
glob(3) for winpaths

Instead of writing stuff I decided to chicken out and talk.

Anyways, Windows paths use \ as the path separator. You might see it as horrible (it is), but for globbing it is actually fine since ? and * are disallowed in filenames. You will still need to escape [ and the extglob (, but recall that | is disallowed too so you can just use that as the escape character.

You may or may not need to have a compile step to convert this glob into actual glob(7). For that you just replace all instances of \ with /, and all

Artoria2e5 /
Last active May 4, 2021
Pretend that your 32-bit floating-point WAV is 32-bit integer
#!/usr/bin/env python3
This cursed piece of shit lets you pretend your 32-bit floating-point
WAV is actually 32-bit integer, so FLAC may take it. Now the only encoder
that does 32-bit integer is some SVN build of FLAKE I have no intention
of compiling, so I can't test how badly it compresses.
What I can tell you is that WavPack hates it. It compressess down to about
84% of the original, which is worse than 7-zip. On the other hand the original
f32 version goes down to 58%. The test file is decoded from Open Goldberg,
Artoria2e5 /
Created Mar 8, 2021
Addendum to "Italics and colour in manual pages on a nosh user-space virtual terminal"

Addendum to Italics and colour in manual pages on a nosh user-space virtual terminal

This is an addendum to Jonathan de Boyne Pollard's Italics and colour in manual pages on a nosh user-space virtual terminal.

FreeBSD and other mandoc deployments

FreeBSD et al. has switched to mandoc as their main manpage formatter. This formatter is faster, but is only capable of emitting overstrike for bold and underline. The only way to see italicized text is by telling less to make italics when it wants underline:

export LESS_TERMCAP_us=$(tput sitm || tput us) LESS_TERMCAP_ue=$(tput ritm || tput ue) 2>/dev/null
View gist:1f63fe5826f6786d268edf035706a0ea
Artoria2e5 / sun_getopt.c
Last active Oct 5, 2020
getopt(3) in the Solaris way, as a wrapper around getopt_long(3)
View sun_getopt.c
* sun_getopt - Solaris-style getopt(3), as a wrapper around getopt_long(3).
* Written by Mingye Wang (Artoria2e5). Dedicated to the public domain under
* Creative Commons Zero.
* Untested. Like not even fed to a compiler once.
#include "sun_getopt.h"
Artoria2e5 /
Last active Jul 4, 2020
Copy a minecraft directory with some symlinks
# duplicate-minecraft-dir: copies a minecraft directory with some symlinks.
# Requires uname and GNU coreutils.
# Requires admin priv under Windows.
# Dedicated to the public domain under Creative Commons Zero. Do what the heck you wanna do with it.
die(){ printf '%s: %s\n' "$SELF" "$1">&2; exit "${2-2}"; }
log() { local level=$1; if ((VERBOSE >= level)); then printf '%s: %s\n' "$SELF" "$2">&2; fi; }
nolink=(config options\*.txt launcher_profiles.json servers.dat config baritone Impact mods)
Artoria2e5 / run_as_admin.vbs
Created Mar 18, 2020
Proxy script for running anything as an admin. Contains an CommandLineToArgvW escaper.
View run_as_admin.vbs
' Proxy script for running anything as an admin. In this case, AHK.
Set UAC = CreateObject("Shell.Application")
Dim Arguments
' Build arguments
Arguments = ""
For Each strArg in WScript.Arguments
Arguments = Arguments & Escape(strArg) & " "
UAC.ShellExecute "C:\Program Files\AutoHotkey\AutoHotkey.exe", Arguments, "", "runas", 1
#include <iostream>
#include <cstdint>
template<typename T>
class MerssenePerfect {
// A000043
"MerssenePerfect should use an unsigned type");
const static int_fast8_t primes[18] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61 };
ptrdiff_t offset;
View CurlyFakePolyp.cpp
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
Artoria2e5 / pref.json
Created Sep 19, 2017
vscode settings, zh-cn
View pref.json
"workbench.colorTheme": "Default Light+",
"editor.fontFamily": "'Inziu Iosevka SC', monospace",
"editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?《》?!()。【】;:“”‘’"