Skip to main content

#Vim - How to remove null bytes from a buffer "^@" with vim?

" Replace a null byte with a line feed
:% s/Ctrl+V000/Ctrl+VEnter/g

#Vim - How to repeat jobs with recording keys?

How to repeat jobs with vim 

vim *.js

# start recording to register x

// do stuff which has to be recorded

# stop recording

# playback to see if it works correctly

# do stuff previously recorded 10 times

#Grub - How to boot a linux kernel from a Grub console?

2 min read

After upgrading my personal servers to Debian Stretch, one of them would not reboot.
I had to use KVM over IP (via iLO) to figure there was an issue with the bootloader configuration.

I've successively encountered the following error messages:

no loaded kernel
file not found

After rebooting the server in rescue mode, I recovered the configuration file generated by Grub and I run the following commands in Grub console :

grub > insmod gzio
grub > insmod part_msdos
grub > insmod ext2
grub > set root='hd0,msdos1'
grub > search --no-floppy --fs-uuid --set=root BXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
grub > linux /vmlinuz-4.9.0-3-amd64 root=UUID=RXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX ro quiet
grub > initrd /initrd.img-4.9.0-3-amd64
grub > boot

The first UUID (BXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) matches with a boot partition (hd0,msdos1) of a disk drive and the second UUID (RXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) matches with a root partition of a disk drive.


After gaining access to a remote shell over ssh again, I've fixed Grub installation by running the following command:  

sudo grub-install /dev/sda

Eventually, I've ensured everything was OK by using greb-emu before rebooting again

sudo apt install grub-emu
grub-install --version # returns "grub-install (GRUB) 2.02~beta3-5"

#Shell - How to check the TLS certificate expiration date of a remote host?

1 min read

Inspired by articles read from ShellHacks, Mattias Geniar's blog and the answer to a question posted on stackoverflow, I've added a function and an alias to my shell start-up script to check the TLS certificate expiration date of a remote host

#PGP - How to leverage to encrypt, sign and decrypt messages?

1 min read

Install the GNU Privacy Guard implementation of the OpenPGP standard.

Install and configure a messaging client like Thunderbird 
for use with a plugin supporting OpenPGP.

Enigmail can be installed as a plugin for Thunderbird allowing to encrypt, sign and decrypt emails.

Sending emails which have been signed or encrypted will require 

  • the generation of a PGP key pair (a public key and a private key)
  • the exchange of public keys with recipients of messages
    (for example by organizing a physical meeting) 

Other initiatives allowing to encrypt, sign and decrypt messages from a browser :

Riseup has published a pretty list of OpenPGP best practices

I recommend watching the following discussion between Oxblood Ruffin (, Frank Rieger (, Gabriella Coleman ( and Stefania Milan ( about the history and practice of hacktivism :