Skip to content

Instantly share code, notes, and snippets.

/* For browsers that don't understand import statements, the
`preferDynamicImport` transform replaces them with dynamic import.
The pseudo-code transpiler rule below explains the strategy.
It's unrealistic to aim for that level of correctness with regexps,
and in this project, simplicity wins over perfect accuracy. (If you
want correctness, use babel.)
Nonetheless, it' still useful to have a clear concept of what the
theoretically ideal goal would be, to ensure a clear understanding
#!/bin/bash
# -*- coding: utf-8, tab-width: 2 -*-
function file_repl () {
export LANG{,UAGE}=en_US.UTF-8 # make error messages search engine-friendly
local SELFPATH="$(readlink -m -- "$BASH_SOURCE"/..)"
cd -- "$SELFPATH" || return $?
local BFN="$FUNCNAME.$(printf '%(%y%m%d-%H%M%S)T' -1)-$$"
local DEFAULT_SCAN_INTV=10
@mk-pmb
mk-pmb / just_analog_stereo_please.md
Last active July 7, 2025 03:50
Don't clutter the profile selection list with HDMI and surround modes that I don't want anyway.

PulseAudio: Just analog stereo, please!

#:via: hdtw-lib:config-util-pmb/pulseaudio/
#:web: https://gist.github.com/mk-pmb/2296fc95463d332b7c4d0c500be6864d
@mk-pmb
mk-pmb / 01_bar.js
Last active March 2, 2025 04:12
Easiest way to release example code as free software via gist.
console.log('This is a template for easily releasing example code as free software via gist.');
{ "id": "urn:uuid:fbe641ee-6631-455f-9556-a20cb56c0052",
"dc:title": "Red dress",
"target": {
"scope": "https://digi.ub.uni-heidelberg.de/diglit/cpg389/0055",
"source": "https://digi.ub.uni-heidelberg.de/diglit/cpg389/0055/_image",
"selector": {
"type": "SvgSelector",
"value": "<svg xmlns='http://www.w3.org/2000/svg' width='3000'><rect x='1800' y='3830' width='780' height='332' /></svg>"
}
},
@mk-pmb
mk-pmb / issue.md
Last active August 16, 2023 14:49
Example for drawing a custom spinner into MPV's window.
#!/usr/bin/perl
# -*- coding: UTF-8, tab-width: 2 -*-
# Origin: https://gist.github.com/mk-pmb/b8a32f005d507ae07733c9ccbcd7340f
# License: CC-0
use strict;
use warnings;
use Data::Dumper;
use HTML::Entities; # Not shipping in default Ubuntu :-(
@mk-pmb
mk-pmb / gist:ef2a1bc0e8c50d8bdd4c1566654bdf32
Created August 20, 2017 18:43 — forked from sumardi/gist:5559896
Subdirectory checkouts with Git sparse-checkout
# New repository
mkdir <repo> && cd <repo>
git init
git remote add –f <name> <url>
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git pull <remote> <branch>
# Existing repository
// -*- coding: utf-8, tab-width: 2 -*-
// https://github.com/mk-pmb/is-error-js/issues/5
const isError = require('is-error');
const FakeError = function() {
this[Symbol.toStringTag] = 'Error';
};
+## BEGIN PATCHZONE search_external_id ##################################
search --set=extroot --file /boot/external.id
+## ................................................... (filler bytes) ##
+## ENDOF PATCHZONE search_external_id ##################################
+## BEGIN PATCHZONE config_external_cfg #################################
configfile ($extroot)/boot/grub/external.cfg
+## ................................................... (filler bytes) ##
+## ENDOF PATCHZONE config_external_cfg #################################