Monitor thread count
watch -n 0.5 "ps -eLf | grep traffic_server | wc -l"
watch -n 0.5 "ps -eLf | grep traffic_server | wc -l"
I’ve started to experience quite high CPU usage when watching youtube videos on 1440p screen (video sample). By default, youtube loads videos in VP9 codec. Using this codec results in 80% CPU usage (i3-8100T). By installing this extension enhanced-h264ify and by blocking VP8, VP9 and AV1, youtube will load videos in avc1(h.264) codec. The CPU usage is down to about 30%.
Unfortunately, this will disable all 4k videos - they are available only in VP9.
Some examples to add exit code to command line prompt in bash (put it into ~/.bashrc):
export PS1="\[\033[01;31m\]\$([ \$? == 0 ] || echo \"!\$? \" )\[\033[00m\]\[\033[01;32m\]\t \[\033[01;34m\]\w\[\033[00m\]\[\033[1;32m\]\n\$ \[\033[m\]"
Add to the default PS1 in CentOS:
export PS1="\[\033[01;31m\]\${?##0}\[\033[00m\][\u@\h \W]\\$"
List all available input devices:
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech M185 id=10 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft® Nano Transceiver v2.0 Consumer Control id=14 [slave pointer (2)]
⎜ ↳ Microsoft Bluetooth Mouse id=20 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft® Nano Transceiver v2.0 Consumer Control id=13 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft® Nano Transceiver v2.0 Mouse id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Microsoft Microsoft® Nano Transceiver v2.0 id=11 [slave keyboard (3)]
↳ Microsoft Microsoft® Nano Transceiver v2.0 System Control id=15 [slave keyboard (3)]
↳ Dell WMI hotkeys id=16 [slave keyboard (3)]
↳ Logitech M185 id=17 [slave keyboard (3)]
↳ Microsoft Microsoft® Nano Transceiver v2.0 Consumer Control id=18 [slave keyboard (3)]
↳ Microsoft Microsoft® Nano Transceiver v2.0 Consumer Control id=19 [slave keyboard (3)]
↳ Microsoft Bluetooth Mouse Keyboard id=21 [slave keyboard (3)]
The touchpad device is known as Microsoft Microsoft® Nano Transceiver v2.0 in the system. Disable it with this command:
xinput disable 12
And enable it again with this command:
xinput enable 12
Or one-liner:
xinput enable `xinput list | grep "Microsoft Microsoft® Nano Transceiver v2.0 Mouse" | grep -oP "id=[0-9]*" | grep -oP "[0-9]*"`
Packages from this repository improve font rendering in fedora a lot:
sudo dnf copr enable dawid/better_fonts -y
sudo dnf install fontconfig-font-replacements fontconfig-enhanced-defaults levien-inconsolata-fonts -y
gsettings set org.gnome.desktop.interface document-font-name "Cantarell 11"
gsettings set org.gnome.desktop.interface font-name "Cantarell 11"
gsettings set org.gnome.desktop.interface monospace-font-name "Inconsolata 13"
CPU benchmark from Dell Precision 5540 i5-9400H
$ sysbench cpu run --time=5
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 1352.90
General statistics:
total time: 5.0007s
total number of events: 6767
Latency (ms):
min: 0.70
avg: 0.74
max: 1.59
95th percentile: 0.77
sum: 4999.03
Threads fairness:
events (avg/stddev): 6767.0000/0.00
execution time (avg/stddev): 4.9990/0.00
CPU benchmark from Dell Optiplex 3060 micro i3-8100T
$ sysbench cpu run --time=5
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 1029.12
General statistics:
total time: 5.0007s
total number of events: 5148
Latency (ms):
min: 0.97
avg: 0.97
max: 1.11
95th percentile: 0.97
sum: 4999.22
Threads fairness:
events (avg/stddev): 5148.0000/0.00
execution time (avg/stddev): 4.9992/0.00
Edit file /etc/sysconfig/firewalld:
FIREWALLD_ARGS=--debug=10
List all routes in system:
route -n
Get route for a specific IP:
ip route get 1.1.1.1
Create a file located in /usr/lib/systemd/system-sleep directory:
#!/bin/sh
if [ "${1}" == "pre" ]; then
nordvpn d
elif [ "${1}" == "post" ]; then
echo "Hello"
fi