Skip to content

Instantly share code, notes, and snippets.


Matt Whitlock whitslack

  • New Hampshire, USA
View GitHub Profile
whitslack / bsync.c
Created Mar 3, 2020
bsync: a write-minimizing block device synchronizing utility
View bsync.c
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <error.h>
#include <fcntl.h>
#include <sysexits.h>
#include <unistd.h>
whitslack /
Created May 31, 2017
Mitigating transaction malleability by redefining TxId
BIP: whitlock-txid-draft
Layer: Consensus (hard fork)
Title: Mitigating transaction malleability by redefining TxId
Author: Matt Whitlock <>
Type: Standards Track
Created: 2017-04-01
License: WTFPL <>
whitslack / portage-utils.bash
Last active May 4, 2021
Prints diagnostics pertaining to redundant USE flags specified in /etc/portage/make.conf and /etc/portage/package.use/*.
View portage-utils.bash
# Accumulates flags in the associative array named by ${1}.
accumulate() {
declare -Ag ${1?}
local -n var=${1} ; shift
local flag ; for flag in "${@}" ; do
case ${flag} in
'-*') var=( ['*']=0 ) ;;
-*) var[${flag:1}]=0 ;;
*) var[${flag}]=1 ;;

Early Userspace without Initramfs

If you've built your own kernel with all necessary storage-controller and file-system drivers built in, then you may have no need of an early userspace environment. However, if you want to do anything non-trivial with your root file system (LVM, LUKS, etc.), then you need an early userspace to set up and mount it. The traditional mechanism for this is initramfs, but building and maintaining an initramfs image is awkward and tiresome. Initramfs is a sledgehammer when, nine times out of ten, all you need is a screwdriver. This guide details a method of booting into an early userspace environment located in an ordinary file system on a physical disk partition, where an init script in this environment in turn sets up and mounts the real root file system and pivots into it.

Setting Up the Basic Environment

In order to employ this method of booting your system, you will need a traditional (non-LVM) disk partition containing a file system that your kernel can mount without


Keybase proof

I hereby claim:

  • I am whitslack on github.
  • I am whitslack ( on keybase.
  • I have a public key ASBHukTHa5TM_Tp-2UG__gee3nPwZeEO4USiwJTKAXRCtwo

To claim this, I am signing this object: