Some tips

By @lucasdicioccio, 321 words, 9 code snippets, 0 links, 0images.

linux

screencast to mp4 in Ubuntu

If you record your screen with (ctrl+shift+alt+R) in Ubuntu, you’ll get a webm file, GitHub, iPhones all want mp4. So you need to convert from webm to mp4.

The ffmpeg command allows such a conversion. As a bonus, Ubuntu’s file navigator allows to have some right-click scripts shortcuts.

#!/bin/bash

path=$1
ffmpeg -y -i "${path}" "${path}.mp4"
notify-send "converted ${path}"

You can benefit from contextual menu in Ubuntu’s file navigator. If you drop the script at a special path like ~/.local/share/nautilus/scripts/ffmpeg-convert-to-mp4 and do not forget to make it executable with chmod.

As an illustration, you can see a demo screencast showing a conversion to mp4 of the demo screencast.

debian qemu serial

Say you have an .iso and would like to to nasty things with it, like enable serial console for qemu. I needed that a while back and found it so hard to collect the right information that I’ve taken notes I swear I never want to lose.

  1. mount the existing .iso in loop mode on a local dir
mkdir original
mount -o loop $ISO original/
  1. copy files from local dir to new dir with
mkdir new-iso
rsync -a -H --exclude=TRANS.TBL original new-iso
umount original
  1. add a serial to isolinux.cfg precisely: at the beginning of isolinux/isolinux.cfg (1st line after comment)
  console serial 0 9600 0
  1. add a console to txt.cfg on the kernel parameter append line
  console=ttyS0,9600n8
  1. regenerate md5 files inside ./new-iso
cd ./new-iso
md5sum `find -follow -type f` > md5sum.txt
  1. build a bootable .iso from all this
genisoimage -o $NEWISO -r -J -no-emul-boot -boot-load-size 4  -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./new-iso
  1. start a qemu, pay attention to the -serial argument
qemu-img create -f qcow2 $IMG 5G
qemu-system-x86_64 -nographic \
  -m 512 \
  -boot d \
  -cdrom $NEWISO \
  -hda $IMG \
  -serial chardev:serial0 \
  -chardev socket,id=serial0,path=$UNIXSOCKET,server,nowait \
  -net nic,macaddr=52:54:11:22:33:01 \
  -net tap,ifname=tap0,script=no,downscript=no
minicom -D unix\#$UNIXSOCKET

postgrest-table

Even if I built Postgrest-Table (an UI for PostgREST) I sometimes need to re-learn how to do stuff.

The bookmarklet to save is:

javascript:location.href='https://postgrest-table.netlify.app?postgrest='+document.location.href;

Then, from a / endpoint of your PostgREST service, the bookmarklet will auto-fill the form for you.