Articles in the Notebook category



FROM gentoo/portage:latest as portage
FROM gentoo/stage3-amd64:latest

COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo

    EMERGE_DEFAULT_OPTS="--jobs=4 --quiet" \
    FEATURES="-sandbox -usersandbox -ipc-sandbox -network-sandbox -mount-sandbox -pid-sandbox" \
    MAKEOPTS="-j4" \

RUN emerge dev-vcs/git app-portage/repoman dev-util/pkgcheck \
 && rm -rf /var …



FFmpeg has three concat methods.

concat protocol

ffmpeg -i 'concat:input1|input2' -codec copy output

concat video filter

ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv \
  -filter_complex '[0:0] [0:1] [1:0] [1:1] [2:0] [2:1] concat=n=3:v=1:a=1 [v …


Shrink a vdi VirtualBox disk image

  • Run defrag in the guest (Windows only)
  • Nullify free space:

With a Linux Guest run this:

cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill

With a Windows Guest, download SDelete from Sysinternals and run this:

sdelete.exe c: -z …

Creating a new GPG key

At the time of writing GnuPG unfortunately defaults to a 1024 bit DSAkey as the primary with SHA1 as the preferred hash. Due to weaknessesfound with the SHA1 hashing algorithm Debian prefers to use keys thatare at least 2048 bits and preferring SHA2. The following instructionsprovide a guide to how …


clean up git

git reflog expire --expire=1.minute refs/heads/master
git fsck --unreachable
git prune
git gc

A simple way to create git repository on a server machine connecting via ssh

Create a working copy repository

First, create a new local git repository and add all files within …

Update Lenovo Bios on Linux

Just put the extracted Bios Update utilities into the WinPE 4.0 64-bit Image and create a bootable usbstick. Then, from the admin console launch:

InsydeFlashx64.exe <BiosUpdate>.ROM

To extract the bios:

innoextract <Version>.exe

Command Comparison:

DOS Command UNIX or Bash Command Action
DIR ls -l List directory …

Recover Btrfs Partition

Let's assume that you don't have a physical device failure (which is a different set of tools -- mount -odegraded, btrfs dev del missing).

First thing to do is to take a btrfs-image -c9 -t4 of the filesystem, and keep a copy of the output to show josef. :)

Then start with …

Standalone BootX64.efi by GRUB2

GRUB2 can create a standalone UEFI application, with the menu included in the binary.<br/> This can be copied around.

The binary can be built and installed by:

echo "sys-boot/grub:2" >> /etc/portage/package.accept_keywords
echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf
emerge -avt sys-boot/grub:2

Create a …

Using Xephyr

$ Xephyr -ac -screen 800x600 -reset :1 &

-ac : Disables access control restrictions and allows to forward the session -screen : sets the resolution of the new X session. Set it according to your need. -:1 : This specifies that the new X session is display number “1“. Your current Display is most probably …

Unzipping a problematic archive

Nice little tip for unzipping problematic archives (.zip) from AskUbuntu.com. I downloaded a .zip archive and could not for the life of me unzip. I tried gunzip and unzip – both failed with the following errors:


$ gunzip foo.gzip
gzip: foo.gzip: unknown suffix -- ignored


$ unzip foo.zip …


Boot Kernel Command Line

On boot systemd activates (by default), the target unit default.target whose job is to activate services and other units by pulling them in via dependencies.

To override the unit to activate, systemd parses its own kernel command line arguments via the systemd.unit= command line …



find /home/user -type d -print0 | xargs -0 chmod 0775
find /home/user -type f -print0 | xargs -0 chmod 0664

clean up dconf

For a single key:

dconf reset "/path/to/the/key"

Must …



pdfimages -j foo.pdf  bar

This will extract all images from foo.pdf and save them in JPEG format (option -j) to bar-000.jpg, bar-001.jpg, bar-002.jpg, etc.

delete metadata

exiftool -exif:all= *.jpg
exiftool -xmp:all= *.jpg

or use MAT: Metadata Anonymisation Toolkit https://0xacab.org/jvoisin …

Western Digital GreenPower Disks

WD GreenPower disks have some problems under Linux with their “head parking” feature parking the head every 8 seconds. This destroys the disk over a short time span. For Linux, there's idle3ctl from the idle3-tools.

You can display the current value with the following command:

$ sudo ./idle3ctl -g /dev/sdX …


rtmpsrv allows you to get all parameters that are required by rtmpdump. You don't need packet sniffers or complex analysis to use rtmpdump when using rtmpsrv. The only problem you may have is when a video consists of several segments (chapters). In such cases just skip to the next chapter …

ATA Secure Erase (SE) and hdparm


The instructions below will irretrievably destroy data. Moreover, as the hdparm manpage explains, "these switches are DANGEROUS to experiment with, and might not work with every kernel. USE AT YOUR OWN RISK."


According to National Institute of Standards and Technology (NIST) Special Publication 800-88: Guidelines for Media Sanitization …


shrink lvm

# Unmount the filesystem and check its' LV
umount /mnt/foo
e2fsck -f /dev/mapper/vg0-foo

# Shrink ext4 and then the LV to the desired size
resize2fs -p /dev/mapper/vg0-foo 40G
lvreduce -L 40G /dev/mapper/vg0-foo

# Before continuing, run e2fsck. If it bails because the partition
# is …




You need support for namespaces and multiple devpts instances in your kernel:



Downloading the Stage Tarball:

mkdir /var/lib/machines/gentoo-stage3-amd64 && cd /var/lib/machines/gentoo-stage3-amd64
wget https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64 …

Converting DTS to AC3

Get the track information

mkvmerge -i /path/to/matroska.file.mkv

Sample output

Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_DTS)

This means that the matroska.file.mkv contains two tracks, a video track with id 1 and a DTS track with id 2.

Extract the …



This is the command to start the calibrator:

dispcal -v -y l -g 2.2 -t 6500 -q h target

There are a few options that can be set in this command by changing the values after the option flags (the dash followed by a letter):

Monitor type: -y …

Encoding Audio


cdparanoia -B -- "-3"


for i in *.flac; do flac -d "$i"; done

split cue

shnsplit -o flac -f FILE.cue -t %n.%t FILE.flac


for i in *.wav; do lame -vbr-new -V 0 "$i" "${i%.wav}.mp3"; done


eyeD3 --add-image=./cover.jpg:FRONT_COVER ./*.mp3

scan …