Skip to content

Instantly share code, notes, and snippets.

View uduwat's full-sized avatar

Lorenzo Landi uduwat

View GitHub Profile
@uduwat
uduwat / rsync-usage.sh
Created March 4, 2026 16:22
rsync sketch copy with dry run
rsync -avhn /data_temp/ /data/ # dry run
rsync -avh /data_temp/ /data/ # copy with archive mode, permissions, lock
@uduwat
uduwat / lvm-xfs-data-partition.sh
Created March 4, 2026 15:43
Sketches about create and mount xfs filesystem on lvm for data partition
# 1. Check that the disk is empty (no partitions)
lsblk /dev/sdb
# 2. Create GPT partition table
parted /dev/sdb --script mklabel gpt
# 3. Create one full-size LVM partition
parted /dev/sdb --script mkpart primary 0% 100%
# 4. Mark the partition as LVM type
@uduwat
uduwat / create-admin-gitea.sh
Created February 23, 2026 08:30
Create Gitea admin user
# Create admin user in Gitea CLI
# substitute $USER, $PASSWORD, $EMAIL
gitea admin user create \
--username $USER \
--password $PASSWORD \
--email $EMAIL \
--admin
@uduwat
uduwat / remove-this.sh
Created February 18, 2026 18:53
keyring login issue?
rm -f ~/.local/share/keyrings/user.keystore
rm -f ~/.local/share/keyrings/login.keyring
@uduwat
uduwat / .xsession
Created February 18, 2026 13:53
configure a specific DE like XFCE for the XRDP remote session
# put this file in hour $HOME path with the following content
/usr/bin/dbus-launch --exit-with-session xfce4-session
# do chmod 700 .xsession
# in Fedora 43, no need to create or modify /etc/xrdp/startwm.sh
@uduwat
uduwat / SSID.nmconnection
Last active February 18, 2026 13:35
System defined wifi connection (pre login network enabled, to remote access after reboot for example)
# set $SSID, $KEY (clear text yes), $IFACE, $UUID (generate uuidgen), to have system defined pre login wifi connection, do not set permissions, set psk-flags=0
# path /etc/NetworkManager/system-connections/
# after creation, sudo systemctl restart NetworkManager
[connection]
id=$SSID
uuid=$UUID
type=wifi
interface-name=$IFACE
permissions=
@uduwat
uduwat / openssh-self.sh
Last active February 18, 2026 13:37
create self signed certificate and key
openssl req -x509 -nodes -days 365 \
-newkey rsa:4096 \
-keyout self.key \
-out self.crt \
-subj "/C=CT/ST=ST/L=L/O=O/OU=IT/CN=FQDN"
# set gateway to wireguard interface gw and the interface (like wg2)
GATEWAY="$GATEWAY"
IFACE="$IFACE"
INTERVAL=10
while true; do
if ! ping -c 2 -W 2 "$GATEWAY" > /dev/null; then
logger "WireGuard watchdog: gateway not reachable, shutting down $IFACE"
wg-quick down "$IFACE"
exit 0
fi
@uduwat
uduwat / 99-xrdp.pkla
Created February 17, 2026 20:31
xrdp polkit permission as local user
# substitute your user
# path: /etc/polkit-1/localauthority/50-local.d/
# sudo systemctl restart polkit
[Allow all for $USER]
Identity=unix-user:$USER
Action=*
ResultAny=yes
ResultInactive=yes
ResultActive=yes