Skip to content

Instantly share code, notes, and snippets.

Dump of commands

BTRFS Restore

yes a | btrfs restore -i -m -S -x -o /dev/mapper/backup--vg-backup /mnt; echo $?

Find Corruption

find /mnt/backuppc/ -type f -exec sh -c 'for x; do cat "$x" > /dev/null || echo "$x"; done' -- {} + | tee broken_files.txt

@raoulbhatia
raoulbhatia / dovecot-unzip.sh
Created January 25, 2020 20:59
Unzip Dovecot emails crypted using zlib plugin
#!/bin/bash
# Unzip /var/vmail
find /var/vmail/ -type f -regextype egrep -regex '.*S=.*W=.*' | while read -r file; do
if [[ $(head -c11 "$file") == "Dovecot-LZ4" ]]; then
doveadm fs get compress lz4:0:posix:prefix=/ \
"$file" > "/tmp/$(basename "$file")"
if [[ -s "/tmp/$(basename "$file")" ]]; then
chmod 600 "/tmp/$(basename "$file")"
chown 5000:5000 "/tmp/$(basename "$file")"
mv "/tmp/$(basename "$file")" "$file"
# getmail configuration to be placed in $HOME/.getmail/myemail@gmx.at
# Launch the getmail4 in a "daemon" mode via:
# $ while :; do getmail -v -r myemail@gmx.at -iINBOX; sleep 5; done
[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmx.net
port = 993
username = myemail@gmx.at
password = mypassword
@raoulbhatia
raoulbhatia / Dockerfile.debian10
Last active May 22, 2020 19:40
BackupPC Debian 10 Buster Dockerfile
FROM debian:buster
LABEL maintainer="raoul@bhatia.at"
#######################################
RUN apt -y update && apt -y install \
sudo \
wget \
git \
$ grep-status -n -sPackage -FStatus config-files
[...]
$ dpkg-query -f ' \n' -W | grep config-files$ | cut -d" " -f1
[...]
aptitude purge ~c
@raoulbhatia
raoulbhatia / keybase.md
Created March 1, 2018 13:02
keybase.md

Keybase proof

I hereby claim:

  • I am raoulbhatia on github.
  • I am raoulbhatia (https://keybase.io/raoulbhatia) on keybase.
  • I have a public key ASCuZghJ8Pd7bbgNfNSviu85c5aYNprBe2otiAoLgw5dmgo

To claim this, I am signing this object: