Create comic book files

After downloading comic book or anime images as a mix of .webp and .jpg, run the following:

find . -name "* *" -type f | rename -v -f 's/ /_/g' && for f in *.webp; do dwebp $f -o $f.jpg;done && rename -v 's/\.webp\.jpg/\.jpg/' * && rm *.webp && sudo chown -R jeff:users * && sudo chmod -R 777 *

This will change any spaces to underscores, convert any .webp to .webp.jpg, rename those to just .jpg, set permissions and ownership.

Use the compress option in Gnomes Files to compress the jpg’s into a .zip, then rename the .zip to .cbz

or:

zip bookname.cbz *.jpg

Install cryptsetup on Linux

In this example, we’ll set up a 16Gb encrypted partition on a separate disk.

Note that this will wipe everything on your partition.

As root, use fdisk to determine which partition you want to use:

# fdisk -l

You could also use lsblk to show your installed drives:

# lsblk

In our case, we’re going to encrypt /dev/sde1, a 16GB USB stick.

First thing you need to do is to come up with a passphrase that you can remember.

Next, we’ll start the encryption process.

In our case, we want:

# cryptsetup -v luksFormat --type=luks2 /dev/sde1

Pay attention to the prompts.

You can check the man page for more options.

Now let’s open the encrypted volume, and give it a name for mapping the partition:

# cryptsetup open /dev/sde1 mypart

Next, give it a filesystem, using ext4:

# mkfs.ext4 /dev/mapper/mypart

Now create a mount point:

# mkdir /mnt/testenc
To mount the encrypted volume, you can use the cryptsetup with the mount command.
# cryptsetup --type luks open /dev/sde1 mypart
# mount -t ext4 /dev/mapper/mypart /mnt/testenc

To close the partition, do the following:

# umount /place/to/mount
# cryptsetup close mypart

Weird folder names in Raspberry Pi file list

raspi occasionally creates weird folders under /root with incomprehensible names:

drwx------ 3 root root 4.0K Jul 7 2022 ''$'\033''[?25h'$'\033''[?7h'/ 

You can’t easily delete the folder with rm -rf.

First, you need to find the inode to the folder:

# ls -ihalF
total 80K
15     drwx------ 11 root root 4.0K Apr 18 10:42 ./
2      drwxr-xr-x 18 root root 4.0K Jul 21 08:34 ../
524545 drwx------ 3 root root 4.0K Jul 7 2022 ''$'\033''[?25h'$'\033''[?7h'/

So in this case the inode is 524545

Use ‘find’ to get rid of it:

find . -maxdepth 1 -type d -inum 524545 -exec rm -rf {} \;

Folder is now deleted