Linux [11]
When transferring VM images between machines with different sector sizes (for example, one machine uses 512-byte sectors and another uses 4096-byte sectors), you may need to edit the partition table of the target device using a tool like . This ensures that the start and end positions align with the actual physical positions on the disk. Additionally, you may need to create a BIOS boot pa...
PDF files can be encrypted using command line tools QPDF and PDFtk. These are available for Windows and Linux.
Using QPDF
Description from QPDF:
> This is the QPDF package. QPDF is a command-line tool and C++ library that performs content-preserving transformations on PDF files. It supports linearization, encryption, and numerous other features. It can also b...
NGINX conditional logging and responses
2020-11-01
Here are some examples on how to configure NGINX to conditionally log requests based on certain conditions like remote IP address, URI etc by using the map module and variables.
Conditional logging
Create a variable using ngx\http\map\_module.
This is placed in...
LUKS Encryption Cheat Sheet
2020-10-27
Install and create partition
Install on a Debian based system
apt-get install cryptsetup
Install on a Red Hat based system
yum install cryptsetup
Creating a new LUKS partition
cryptsetup -y -v luksFormat /dev/$DEVICE
Key management
Generate 4096-bit random key file
head -c 512 /dev/random > KEYFILE
Add a key file to next free key slot. This will prompt for a pass...
Raspberry Pi Kiosk HOW-TO
2020-09-13
Tested with Raspberry Pi 3 and 4, but should work on some older models too.
For Ethernet connected kiosk machines.
Download and install Raspberry Pi OS
Download img file and image to micro SD card.
- Raspberry Pi OS (32-bit) with desktop, Image with desktop based on Debian Buster. Warning: This is not the distribution with "recomm...
GPG Cheat Sheet
2020-07-25
For GPG versions 2.x only.
List keys
List public keys
gpg --list-keys
List all secret keys
gpg --list-secret-keys
List public or secret keys, but show subkey fingerprints as well
gpg --list-keys --with-subkey-fingerprints
gpg --list-secret-keys --with-subkey-fingerprints
The key ring location is normally shown on the first line on stdout.
Use different key ring
Lis...
In this example, we'll show how to convert multiple PNG images to a multi page searchable PDF file. We'll use the following command line tools:
- ImageMagick for converting PNGs into multi page TIFF and PDF files.
- Tesseract OCR, an open source OCR engine.
- [PDFtk Free](https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit...
Installation
Install Debian with . Use MBR and create a single root partition filling the entire disk.
Choose minimal with no graphical desktop environment. Only choose standard system utilities.
Create the default root user and a separate user with username .
Install the following packages as root:
apt-get install -y...
Generate some easy to remember passwords
2016-03-17
This method is not suitable for transmitting sensitive data. For such purposes, consider using a public key encryption scheme like PGP or GnuPG. The following procedure is appropriate for generating passwords for online logins and similar applications.
Word List Acquisition
Begin by preparing a text file with dictionary words. We will download word lists from [Scowl](http://wordlist.aspell.n...
For RedHat based OS
e.g RHEL or CentOS
Install
yum -y install yum-utils
Check current running kernel version
rpm -q kernel
Remove old kernels, but leave the 2 latest ones.
package-cleanup --oldkernels --count=2
Edit and set:
installonly_limit=2
This will delete old kernels automatically but leave the latest two next time you perform a `yum...
This article provides a comprehensive guide, or more aptly, a set of personal notes, on how to migrate a WordPress blog from one domain name to another. This process is also applicable when transitioning from one web host to another.
Initially, you need to gather some details about your old database:
- Database host name (e.g., or )
- Database name
- Username
-...