Friday, April 24, 2020

crop video with ffmpeg

$ ffmpeg -i in.mp4 -vf "crop=w:h:x:y" out.mp4

* for screen captures, the true size of capture may be lower than sreen size, check the stdout of a failed conversion to see this:

Tuesday, April 7, 2020

python unzip list

for pairs of values:

[(key1, val1), (key2, val2), ...]

[keys, values] = list(zip(*KeyValueList))


https://www.geeksforgeeks.org/python-unzip-a-list-of-tuples/

C++ static methods in template classes

In C++, when declaring a static method in a templated class, it is mandatory that the definition of the function be placed in the .h file, not the .cpp file.


Thursday, December 26, 2019

grub2 background color on Ubuntu

  • 17.10 and later:
    sudo -H gedit /usr/share/plymouth/themes/default.grub
    
And change the grub background color as you want, in my case I change grub background to black (0,0,0)
if background_color 0,0,0 ; then
   clear
fi
Then, update grub
sudo update-grub


https://askubuntu.com/questions/47488/how-to-change-the-purple-background-color-in-grub

Nice teal that stands out from Win and Ubuntu alike: rgb(0, 123, 96)

Monday, December 23, 2019

Ubuntu upgrade kernel

Install ukuu and run it to get other kernel:
https://linuxhint.com/upgrade-kernel-ubuntu-1804/

Disable secure boot using an older kernel selected at grub level
https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS

Only install critical security updates on ubuntu

I read the apt-get man page carefully when I got tired of manually editing the sources.list every time I wanted to only apply security updates (that means the second time).
Figured this solution out:
sudo cp /etc/apt/sources.list /etc/apt/security.sources.list
Edit the latter to contain only security repositories, then:
sudo apt-get upgrade -o Dir::Etc::SourceList=/etc/apt/security.sources.list
 
https://serverfault.com/questions/270260/how-do-you-use-apt-get-to-only-install-critical-security-updates-on-ubuntu