Skip to content

Instantly share code, notes, and snippets.

Registering a custom URL scheme (e.g. hoge://fuga) — Windows & Linux, user-level steps and caveats

You can absolutely register a custom protocol like hoge:// so that hoge://fuga opens your app. Below is a compact, practical how-to for both Windows and Linux (user-only: no admin required), with ready-to-use examples and short security notes. Copy → paste → test — sanity checks included.


Windows (user-level, no admin)

1) Quick .reg (current user)

How to explicitly disable SSH keys when connecting

Sometimes you want the SSH client to stop offering any private keys (agent keys or files in ~/.ssh), so the server falls back to password/keyboard-interactive or some other auth method. A common attempt is:

ssh -i /dev/null user@host

but that often does not work by itself. Here’s why, and how to do it reliably.

Turn your Linux box into a Bluetooth audio endpoint (quick guide)

This short article shows a simple PipeWire + BlueZ setup to let a Linux machine act as a Bluetooth audio endpoint — for example, to play audio from your phone to a USB headset attached to the Linux box. The commands below are the minimal steps: install the packages, enable services, verify PipeWire is running, pair/connect from the phone, and optionally select the USB headset as the default sink.


Tested environment

The steps in this guide were validated on the following setup:

How to Mount a Partition from a Disk Image Using an Offset

When working with disk images, it’s often necessary to access the contents of a specific partition inside the image. Tools like parted, jq, and mount make this process straightforward by letting you find partition start offsets and then mount them directly. Adding sizelimit= makes the loop mount safer and more explicit by constraining how much of the image is exposed to the mount operation.

Step 1: Extract Partition Offsets (and Sizes)

Use parted with JSON output to list all partitions and capture both their starting offsets and lengths (in bytes). The following command stores the results into a Bash array named PARTS, where each element contains start:size:

mapfile -t PARTS < <(parted --json 2025-05-13-raspios-bookworm-arm64-lite-f2fs.img unit B print 2>/dev/null \

Create a Raspberry Pi Image with F2FS Root: It has been moved to aont/rpi-f2fs.

Understanding Chrome’s --user-data-dir Option

Google Chrome (and Chromium) provides several command-line options for customizing how the browser runs. One of the most useful for developers, testers, and power users is --user-data-dir. This flag lets you control where Chrome stores its entire user profile, including settings, extensions, cookies, and browsing history.


Overview

By default, Chrome saves user data (profiles, preferences, browsing history, etc.) in a predefined location that depends on your operating system (for example, %LOCALAPPDATA%\Google\Chrome\User Data on Windows). When you specify --user-data-dir, Chrome will instead use the folder you provide as the root directory for all user data.

mactype favorite preferences

Simple Asio + C++20 coroutine echo server (with build notes)

This short article explains a tiny C++ program that uses standalone Asio and C++20 coroutines to run multiple I/O tasks concurrently: a TCP echo server plus a couple of periodic timers. It also explains the provided g++ command line and a few Windows-specific macros that appear at the top of main.cpp.


What the program does

The program is a compact example showing how to mix network I/O and timers using co_await / co_spawn:

A Handy Bash Function to Open Remote Folders in VS Code via SSH

When working with multiple servers, it’s often convenient to open remote folders directly in Visual Studio Code (VS Code). Instead of manually constructing VS Code’s --remote or --folder-uri arguments every time, you can define a simple Bash function to handle this automatically.

The Bash Function

The function below wraps the code command and maps different types of arguments into the proper VS Code format:

code() {

Create a Debian rootfs as a non-root user using unshare --user --map-root-user and debootstrap

This short article explains a simple, practical one-shot workflow that lets a non-root user create a root filesystem (rootfs) with debootstrap and install packages inside it using apt, by running the operations inside an unprivileged user namespace where the user appears as root. It includes a ready-to-run script, key explanations, and troubleshooting hints.


What this does (short)

Run the provided script as a regular user. It uses unshare --user --map-root-user to create a user/mount/pid namespace where your UID is mapped to UID 0 inside that namespace. Inside that namespace the script mounts necessary pseudo-filesystems, runs debootstrap to populate a target directory with a minimal Debian rootfs, then chroots into that rootfs and runs apt-get to install packages (e.g. vim). When finished, it unmounts the bind mounts and leaves the populated rootfs at the path you chose.