Skip to content

Instantly share code, notes, and snippets.

@p7cq
p7cq / EJBCA_CE_Nitrokey_HSM_PKI.md
Last active March 20, 2024 08:20
EJBCA CE & Nitrokey HSM - A lab PKI

EJBCA CE & Nitrokey HSM - A lab PKI

Configuration steps for a lab CA, created using EJBCA CE and Nitrokey HSM.

Installation details

Hardware: Raspberry Pi 4 Model B

Crypto token: Nitrokey HSM 2

@p7cq
p7cq / GH60.md
Created December 12, 2022 18:12
GH60
@p7cq
p7cq / i3_Remap_Right_Win_to_Right_Hyper.md
Last active October 13, 2022 11:30
i3 WM: Remap Right Win key to Right Hyper

i3 WM: Remap Right Win key to Right Hyper

As sometimes I use a TKL keyboard without multimedia keys, I wanted Right Win and some other key combination to control audio volume.

My keyboard layout is us and I am using Left Win key assigned to mod4 as the modifier key. The spacebar row on my keyboard looks like this:

[Ctrl] [Left Win] [Alt] [Space] [Alt] [Right Win] [Menu] [Ctrl]

Using X

@p7cq
p7cq / SSH_Authentication_TPM2_PKCS11_Arch_Linux.md
Last active January 17, 2024 03:30
SSH Authentication with TPM 2.0 and PKCS#11 on Arch Linux

SSH Authentication with TPM 2.0 and PKCS#11 on Arch Linux

Hardware: a TPM 2.0 module based on Infineon SLB9665 cryptographic processor available in the system as /dev/tpmrm0.

Installation

Required software:

# pacman -S tpm2-tools tpm2-pkcs11
@p7cq
p7cq / Arch_Linux_Root_On_ZFS.md
Last active January 5, 2024 14:58
Install Arch Linux with Root on ZFS

Arch Linux Root on ZFS

Installation steps for running Arch Linux with root on ZFS using UEFI and systemd-boot. All steps are run as root.

Requires an Arch Linux image with ZFS built-in (see References).

In live environment

If using KVM, add a Serial number for each virtual disk and reboot the VM. The disks should now be available in /dev/disk/by-id as virtio-<Serial>.

@p7cq
p7cq / Arch_Linux_Root_on_Btrfs.md
Last active October 10, 2020 22:40
Install Arch Linux with Root on Btrfs

Arch Linux Root on Btrfs

Prepare disks

Keeping about 15% unallocated space on both disks.

sgdisk --zap-all /dev/disk/by-id/ata-CT240BX500SSD1_A
sgdisk -n1:0:+550M -t1:ef00 /dev/disk/by-id/ata-CT240BX500SSD1_A
sgdisk -n2:0:+190G -t2:8300 /dev/disk/by-id/ata-CT240BX500SSD1_A
@p7cq
p7cq / vm1-start.sh
Last active January 19, 2024 14:27
Dynamic CPU isolation in QEMU/KVM
#!/usr/bin/env bash
#
# CPU isolation in QEMU/KVM
#
# As the cset scripts no longer work (systemd switched to cgroups v2), this is my
# attempt at emulating its functionality. It may be incorrect and/or it may break
# stuff. Blind copy-pasting with some reasoning follows.
#
# Host:
@p7cq
p7cq / Arch_Linux_Root_on_LVM.md
Last active June 4, 2023 20:09
Install Arch Linux with Root on LVM

Arch Linux with Root on LVM

Arch Linux with root on LVM and systemd boot.

  • Set a bigger font (if using a 4K laptop display)
setfont latarcyrheb-sun32
  • To connect to the internet add the ESSID and passphrase
@p7cq
p7cq / slss
Created April 26, 2020 21:03
Steam locomotive screensaver
#!/bin/bash
echo
echo "to exit, press Ctrl-C and wait for the locomotive to pass"
echo
sleep 3
clear
trap "exit" INT
declare -a ca=( "-a" "-l" "-F" "-c" "-al" "-aF" "-ac" "-lF" "-lc" "-alF" "-alc" "-lFc" "-alFc")
@p7cq
p7cq / UTF-8-demo.txt
Created April 26, 2020 19:52
UTF-8 demo text file
UTF-8 encoded sample plain-text file
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25 CC BY
The ASCII compatible UTF-8 encoding used in this plain-text file
is defined in Unicode, ISO 10646-1, and RFC 2279.
Using Unicode/UTF-8, you can write in emails and source code things such as