Linux

From Giki

firefox

enable gpu for video playback (h264)

source: https://ubuntuhandbook.org/index.php/2021/08/enable-hardware-video-acceleration-va-api-for-firefox-in-ubuntu-20-04-18-04-higher/

about:config

  • media.ffmpeg.vaapi.enabled = true
  • media.ffvpx.enabled = false
  • media.rdd-vpx.enabled = false
  • media.navigator.mediadatadecoder_vpx_enabled = true

~/.profile

# set VA-API driver to iHD
export LIBVA_DRIVER_NAME=iHD
export MOZ_DISABLE_RDD_SANDBOX=1
export MOZ_X11_EGL=1
#export MOZ_ENABLE_WAYLAND=1

review if settings work

run sudo intel_gpu_top (installed via sudo apt install intel-gpu-tools) to see if the ENGINE "Video/0" is used when videos are played.

usbguard

man page: http://manpages.ubuntu.com/manpages/bionic/man1/usbguard.1.html

list currently connected devices

sudo usbguard list-devices

add all currently connected devices (and allow them)

usbguard generate-policy | sudo tee > /etc/usbguard/rules.conf

activate rules

sudo systemctl enable usbguard

list all blocked devices

usbguard list-devices --blocked

allow specific device once (until unplugged)

the id can be retrieved with the parameter list-devices above

sudo usbguard allow-device 23

allow specific device permanent

the id can be retrieved with the parameter list-devices above

sudo usbguard allow-device 23 --permanent

block specific device

sudo usbguard block-device 40

allow device classes

source: https://warlord0blog.wordpress.com/2021/06/10/usbguard/

omitting anything with a class 08 (mass storage) and E0 (wireless)

/etc/usbguard/rules.conf

allow with-interface one-of { 09:*:* }
allow with-interface one-of { 07:*:* }
allow with-interface one-of { 06:*:* }
allow with-interface one-of { 03:*:* }
allow with-interface one-of { 02:*:* }
allow with-interface one-of { 01:*:* }
allow with-interface one-of { 0b:*:* }
allow with-interface one-of { 0d:*:* }
allow with-interface one-of { 0e:*:* }
allow with-interface one-of { 10:*:* }

IPC ERROR: request id=1: FileRuleSet saving: /etc/usbguard/rules.conf: Read-only file system

source: https://github.com/USBGuard/usbguard/issues/347

sudo mkdir /etc/systemd/system/usbguard.service.d
cat <<"EOF" | sudo tee /etc/systemd/system/usbguard.service.d/override.conf
[Service]
ReadWritePaths=-/dev/shm -/var/log/usbguard -/tmp -/etc/usbguard
EOF


games

cli

rename files (prepend text)

for i in *.txt; do mv -- "$i" "PREPEND_TEXT-${i}"; done

pi-hole

clear logs

service pihole-FTL stop
cd /etc/pihole/
rm pihole-FTL.db.old
mv pihole-FTL.db pihole-FTL.db.old
service pihole-FTL start

ssh

autostart tmux on ssh connection

source: http://blog.thelinuxkid.com/2013/06/automatically-start-tmux-on-ssh.html

  1. This should always be run last either in .bashrc or as a script in .bashrc.d

if -z "$TMUX" ; then

   tmux has-session &> /dev/null
   if [ $? -eq 1 ]; then
     exec tmux new
     exit
   else
     exec tmux attach
     exit
   fi

fi

xinput

list devices

xinput list | grep "Optical Mouse"

list devices - output

⎜   ↳ PixArt Lenovo USB Optical Mouse         	id=16	[slave  pointer  (2)]

set mouse speed

xinput --set-prop 16 "libinput Accel Speed" 0

pdf

remove encryption

qpdf --decrypt "in.pdf" "out.pdf"

or

qpdf --decrypt "in.pdf" --replace-input

merge pdfs

pdfunite '1 - first file.pdf' '2 another file.pdf' merged.pdf

upgrade issues

compose key not working

after upgrading from LM19 to LM20 the compose key (CAPSLOCK) would not work. to fix this I had to disable and re-enable the option in the keyboard settings.