Table of Contents

HOWTOs

Instructions for performing tasks that I do often enough to need to know but infrequently enough to never remember the details.

Add Linux swap space

These commands should all be performed with root permissions. The instructions below assume a destination path of /swapfile and file size of 1 GiB.

First, allocate space:

fallocate -l 1G /swapfile
# alternatively
dd if=/dev/zero of=/swapfile bs=1024 count=1048576

Ensure only root can read the swap file's contents:

chmod 600 /swapfile

Finally, activate and enable the swap file:

mkswap /swapfile
swapon /swapfile

To have the swap automount on boot, add the following to /etc/fstab:

/swapfile swap swap defaults 0 0

Boot an ISO from GRUB

Adapted from https://forum.manjaro.org/t/howto-boot-manjaro-iso-directly-with-grub/15892. Run the following commands from the GRUB2 prompt.

set isofile="/path/to/isofile.iso"
set dri="free"
set lang="en_US"
set keytable="us"
set timezone="America/Los_Angeles"
search --no-floppy -f --set=root $isofile
probe -u $root --set=abc
set pqr="/dev/disk/by-uuid/$abc"
loopback loop $isofile
linux (loop)/boot/vmlinuz-x86_64 img_dev=$pqr img_loop=$isofile driver=$dri tz=$timezone lang=$lang keytable=$keytable copytoram
initrd (loop)/boot/intel_ucode.img (loop)/boot/initramfs-x86_64.img

Adjust intel_ucode.img to amd_ucode.img for AMD CPUs.

Note that the GreatFET has Facedancer capabilities, so it should be possible to use it to emulate a mass storage device with the ISO as the source and boot that instead.

Make an ethernet loopback connector

This trick works with either a socket or a plug. Connect the following pins:

Mount an ext4 drive in WSL2

Open a PowerShell window as an administrator, then run the following command to list available disk drives:

GET-CimInstance -query "SELECT * from Win32_DiskDrive"

Locate the desired entry, then attach it to the WSL instance:

wsl --mount \\.\PHYSICALDRIVE2

Finally, locate and mount the disk within the WSL instance.

https://learn.microsoft.com/en-us/windows/wsl/wsl2-mount-disk

Fake a document scan

Create a reverse SSH connection