Menu

sumologic: filter fields

(sourceCategory=prod/* ss-haproxy)
| parse "{|||}" as host,forwarded, referer, ua
| where forwarded matches ","
· 5 Sep 2023

Upgrade CentOS Stream 8 to CentOS Stream 9

  1. Update OS
dnf update -y
  1. Reboot system if there were any updates
reboot
  1. Disable CentOS 8-specific modules (they are blocking kernel updates)
dnf module disable python36 virt
  1. Install CentOS 9 repositories. All CentOS 9 packages are listed here
dnf install https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-release-9.0-22.el9.noarch.rpm https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-9.0-22.el9.noarch.rpm https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-9.0-22.el9.noarch.rpm
  1. Run command to switch packages:
dnf --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync -y
  1. Rebuild RPM database (this will chnage the backend to sqlite):
rpm --rebuilddb
  1. Disable subscription manager. Open file /etc/yum/pluginconf.d/subscription-manager.conf and set enabled to 0

  2. Reboot and verify

cat /etc/redhat-release
  1. Verify that the latest kernel is used (5.14+)
uname -a
  1. If not, use grubby to set the latest kernel as the default one, reboot the system and remove old kernels from CentOS 8:
# List all boot options
grubby --info=ALL

# Reflect the desired kernel in configuration
grubby --set-default vmlinuz-<version>.<arch>

# Make sure the index is also set in `/etc/default/grub` file

# Regenerate boot configuration
grub2-mkconfig -o /boot/grub2/grub.cfg

reboot

# Remove old kernels...

The instructions are inspired by CentOS 8 to CentOS Stream 8 migration guide and Fedora upgrade procedure

· 28 Aug 2023

How to use Android phone camera on desktop computer via WiFi with DroidCam

  1. Install DroidCam on your phone. There are free and paid versions. Paid version enables HD quality
  2. Install DroidCam in your desktop:
sudo dnf copr enable meeuw/droidcam
sudo dnf install droidcam
  1. Launch both mobile and desktop applications. Connect desktop client to your phone’s camera (IP address and port are displayed on your phone). Desktop client will connect to your camera via WiFi and create a virtual camera device.

If droidcam doesn’t start with the following error:

$ droidcam
Fatal: droidcam video device reported pixel format 34524742 (BGR4), expected 32315559 (YU12/I420)
Try 'v4l2loopback-ctl set-caps "video/x-raw, format=I420, width=640, height=480" /dev/video<N>'

Run this command:

v4l2loopback-ctl set-caps /dev/video "YU12:640x480"
· 2 Aug 2023

rygel: Disable inactivity timeout when streaming video

This script demonstrates how to disable system inactivity timeout in Gnome when running Rygel and restore it to the original value after exiting:

#!/bin/bash

# Save current inactivity timeout
TIMEOUT=$(gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout)
echo "Current timeout: $TIMEOUT"

# Execute commands on Ctrl + C
function ctrl_c() {
  echo "Exiting rygel..."
  gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout $TIMEOUT
  echo "Inactivity timeout restored to $TIMEOUT. Bye!"
  sleep 2
}

# Set the trap for Ctrl+C
trap ctrl_c INT

# Disable the inactivity timeout
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0

# Briefly start rygel to allow it to add new files
timeout 2s rygel

# Run command to fix filenames
rygel-titlefix

# Actually run rygel
rygel
· 17 Jul 2023

Monitor number of open sockets by a process

Example with watch command:

watch -n 1 'ps aux | kazy -i cmproxy -e kazy | kazy -r "[\d]+" -x | xargs -I % ls -l /proc/%/fd/ | kazy -i socket | wc -l'

Example with ttyplot command:

{ while true; do ps aux | kazy -i cmproxy -e kazy | kazy -r "[\d]+" -x | xargs -I % ls -l /proc/%/fd/ | kazy -i socket | wc -l; sleep 1; done } | ttyplot
· 16 Apr 2023

Monitor DNS query time

{ while true; do dig google.com | kazy -i "Query time" | kazy -r -x "[\d.]*"; sleep 1; done } | ttyplot -t "dig to google.com"
· 12 Apr 2023

Plot real time ping data in terminal

Install ttyplot:

grm install tenox7/ttyplot -n ttyplot

Ping plot:

ping 8.8.8.8 | sed -u 's/^.*time=//g; s/ ms//g' | ttyplot -t "ping to 8.8.8.8" -u ms

More examples

· 12 Apr 2023

Monitor all http traffic in wireshark on specific ports

Open wireshark GUI as root user:

sudo wireshark

Start capturing by clicking Capture button and add the following display filter:

http and (tcp.port == 8082 or tcp.port == 8000)
· 29 Mar 2023

git: How to remove submodule pointer update in pull request

Case 1: it is done in a separate commit:

  • rebase on a base branch git rebase -i <base_branch>
  • in the editor, find the commit which updates the pointer and remove it from history (by replacing pick with d)
  • force push it when the rebase is done

Case 2: it is done in the commit which contains other changes

  • rebase on a base branch git rebase -i <base_branch>
  • in the editor, find the commit which includes the pointer update and mark it for editing (by replacing pick with e)
  • git will start rebasing the code and will stop on selected commit for editing
  • unstage the change git restore --staged <path_to_submodule>
  • continue the rebase git rebase --continue
  • force push it when the rebase is done
· 29 Mar 2023

HUNT 44 Aerodynamicist Carbon Disc Wheelset

Tyre width: 23mm up to 40mm (max 50mm).

Max tyre pressure is 8.25 bar (120 psi). Recommended tyre pressure:

  • for 28 mm tyres: 5.4 bar (max 7 bar)
  • for 30 mm tyres: 4.7 bar (max 5.75 bar)
  • for 32 mm tyres: 4.0 bar (max 5.75 bar)
  • for 34 mm tyres: 3.6 bar (max 5.75 bar)
· 4 Mar 2023