Monday, November 24, 2025

systemd-timesyncd

sudo apt update && sudo apt install systemd-timesyncd && sudo systemctl enable --now systemd-timesyncd

Tuesday, November 11, 2025

xfce-install.sh


#!/usr/bin/env bash

## configure and install minimal xfce desktop environment

## check for sudo/root
if ! [ $(id -u) = 0 ]; then
  echo "This script must run with sudo, try again..."
  exit 1
fi

#cat ./xsessionrc >> /home/$SUDO_USER/.xsessionrc
#chown $SUDO_USER:$SUDO_USER /home/$SUDO_USER/.xsessionrc

apt install -y libxfce4ui-utils
apt install -y thunar
#apt install -y xfce4-appfinder
apt install -y xfce4-panel
apt install -y xfce4-pulseaudio-plugin
#apt install -y xfce4-whiskermenu-plugin
apt install -y xfce4-session
apt install -y xfce4-settings
#apt install -y xfce4-terminal
apt install -y tilix
apt install -y xfconf
apt install -y xfdesktop4
apt install -y xfwm4
#apt install -y adwaita-qt
#apt install -y qt5ct 

echo 
echo xfce install complete, please reboot and issue 'startx'
echo



Debian 13 active services

clear;systemctl list-unit-files --state=enabled UNIT FILE STATE PRESET anacron.service enabled enabled console-setup.service enabled enabled cron.service enabled enabled e2scrub_reap.service enabled enabled getty@.service enabled enabled grub-common.service enabled enabled keyboard-setup.service enabled enabled lightdm.service enabled enabled lm-sensors.service enabled enabled NetworkManager.service enabled enabled systemd-pstore.service enabled enabled systemd-timesyncd.service enabled enabled udisks2.service enabled enabled wtmpdb-update-boot.service enabled enabled anacron.timer enabled enabled apt-daily-upgrade.timer enabled enabled apt-daily.timer enabled enabled dpkg-db-backup.timer enabled enabled e2scrub_all.timer enabled enabled fstrim.timer enabled enabled logrotate.timer enabled enabled 21 unit files listed. root@pedro:~#

Debian 13 - /etc/apt/sources.list.d/debian.sources


Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: trixie
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: trixie-updates
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb deb-src
URIs: http://security.debian.org/debian-security/
Suites: trixie-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: trixie-backports
Components: main contrib non-free non-free-firmware


Sunday, February 23, 2025

What's the quickest way to find duplicated files?

find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD
fdupes -r /
linux_czkawka_gui.AppImage

Wednesday, January 01, 2025

Git get all remote branches

git branch -r \
  | grep -v '\->' \
  | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" \
  | while read remote; do \
      git branch --track "${remote#origin/}" "$remote"; \
    done
git fetch --all
git pull --all

Sort commits by date

git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:iso8601) %(refname:short)'
or put in .gitconfig alias
[alias]
recent = "!git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:iso8601) %(refname:short)'"

Check git configuration

git config --global -l

Thursday, December 12, 2024

How to set php executable path php.validate.executablePath in VS Code (vscode) when php is inside docker container?

I've used such solution:

First, create a php file inside /usr/local/bin/ and make it executable:

sudo touch /usr/local/bin/php
sudo chmod +x /usr/local/bin/php
Update content of it with:

docker exec $(docker_php-1) php "$@"

And then update php.validate.executablePath with /usr/local/bin/php:

{
    "php.validate.executablePath": "/usr/local/bin/php"
}

Thursday, August 15, 2024

𝟖 𝐋𝐨𝐚𝐝 𝐁𝐚𝐥𝐚𝐧𝐜𝐢𝐧𝐠 𝐀𝐥𝐠𝐨𝐫𝐢𝐭𝐡𝐦𝐬 𝐘𝐨𝐮 𝐌𝐮𝐬𝐭 𝐊𝐧𝐨𝐰

1. Round Robin
It assigns a request to the first server, then moves to the second, third, and so on, and after reaching the last server, it starts again at the first.

2. Least Connections
The Least Connections algorithm directs incoming requests to the server with the lowest number of active connections.

3. Weighted Round Robin
It assigns different weights to servers based on their capacities and distributes requests proportionally to these weights.

4. Weighted Least Connections
The Weighted Least Connections algorithm combines the Least Connections and Weighted Round Robin algorithms. It directs incoming requests to the server with the lowest ratio of active connections to assigned weight.

5. IP Hash
The IP Hash algorithm determines the server to which a request should be sent based on the source and/or destination IP address. This method maintains session persistence, ensuring that requests from a specific user are directed to the same server.

6. Least Response Time
It directs incoming requests to the server with the lowest response time and the fewest active connections.

7. Random
It directs incoming requests to a randomly selected server from the available pool.

8. Least Bandwidth
It directs incoming requests to the server currently utilizing the least amount of bandwidth. This approach helps to ensure that servers are not overwhelmed by network traffic.

Tuesday, November 28, 2023

xfce4-screenshooter keyboard shortcut

sh -c 'xfce4-screenshooter --fullscreen --save "$HOME/Pictures/Screenshots/Screenshot_$(date +%Y-%m-%d_%H:%M:%S).png"'

sh -c 'xfce4-screenshooter --window --save "$HOME/Pictures/Screenshots/Screenshot_$(date +%Y-%m-%d_%H:%M:%S).png"'

Monday, November 27, 2023

Parallel compression using Pigz

#no compression
tar --use-compress-program="pigz -k -0 " -cf dir.tar.gz dir

#best compression
tar --use-compress-program="pigz -k -11 " -cf dir.tar.gz dir

#uncompress
unpigz dir.tar.gz

Wednesday, October 18, 2023

Debian 12 - sudo vim /etc/apt/sources.list

deb     http://deb.debian.org/debian/ bookworm 				main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm 				main contrib non-free non-free-firmware

deb     http://deb.debian.org/debian/ bookworm-updates 			main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates 			main contrib non-free non-free-firmware

deb     http://security.debian.org/debian-security/ bookworm-security 	main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security/ bookworm-security 	main contrib non-free non-free-firmware

deb     http://deb.debian.org/debian/ bookworm-backports 		main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-backports 		main contrib non-free non-free-firmware

Tuesday, June 20, 2023

Javascript async defer

Both async and defer have one common thing: downloading of such scripts doesn’t block page rendering. So the user can read page content and get acquainted with the page immediately.

But there are also essential differences between them:

OrderDOMContentLoaded
asyncLoad-first order.
Their document order doesn’t matter which loads first runs first
Irrelevant.
May load and execute while the document has not yet been fully downloaded.
That happens if scripts are small or cached, and the document is long enough.
deferDocument order (as they go in the document).Execute after the document is loaded and parsed (they wait if needed), right before DOMContentLoaded.

In practice, defer is used for scripts that need the whole DOM and/or their relative execution order is important.

And async is used for independent scripts, like counters or ads. And their relative execution order does not matter.

Page without scripts should be usable

Please note: if you’re using defer or async, then user will see the page before the script loads.

In such case, some graphical components are probably not initialized yet.

Don’t forget to put “loading” indication and disable buttons that aren’t functional yet. Let the user clearly see what he can do on the page, and what’s still getting ready.

systemd-timesyncd

sudo apt update && sudo apt install systemd-timesyncd && sudo systemctl enable --now systemd-timesyncd