Skip to content

Instantly share code, notes, and snippets.

@jaydub
jaydub / deduplicate_path.bash
Last active October 9, 2023 03:28
A $PATH de-duplicator for bash
deduplicate_path () {
IFS=':' read -r -a _path <<< "$PATH"
_path_uniq=()
for member in "${_path[@]}"; do
found=0
for u_member in "${_path_uniq[@]}"; do
if [ "$member" = "$u_member" ]; then
found=1
break;
fi
@jaydub
jaydub / Add to 10_linux or even replace inside grub-mkconfig_lib
Last active October 16, 2022 03:19
How to unlock just one LUKS volume on a btrfs RAID1 inside LUKS include /boot installation
prepare_grub_to_access_device ()
{
# If GRUB_BTRFS_RAID1 is set, then this function output fragments of config
# for each device surrounded by "if $root = $device", so eg only
# one cryptmount command is run, only one path is searched for root etc
# However it skips going to the trouble for insmod commands, as they're
# already duplicated all over the place and are O(1) if the module is already
# loaded.
#
# We use grub-probe --target=compatibility_hint to translate the devices
@jaydub
jaydub / startplasma.diff
Created April 11, 2021 10:19
A patch to make startplasma-x11 invoke ksmserver with --no-lockscreen for the benefit of xscreensaver. Relevant to versions 5.17 → 5.20
--- startplasma.cpp.orig 2021-04-11 21:16:44.570404892 +1200
+++ startplasma.cpp 2021-04-11 21:17:22.973819429 +1200
@@ -365,9 +365,7 @@
if (qEnvironmentVariableIsSet("KDEWM")) {
ksmserverOptions << QStringLiteral("--windowmanager") << qEnvironmentVariable("KDEWM");
}
- if (desktopLockedAtStart) {
- ksmserverOptions << QStringLiteral("--lockscreen");
- }
+ ksmserverOptions << QStringLiteral("--no-lockscreen");
@jaydub
jaydub / startkde.diff
Created April 11, 2021 10:07
A patch against KDE 5.00 → 5.16 startkde to invoke ksmserver with "--no-lockscreen" so eg xscreensaver-systemd can run.
--- /usr/bin/startkde 2019-02-14 09:06:30.000000000 +1300
+++ startkde 2021-04-06 14:21:36.507071358 +1200
@@ -309,8 +309,8 @@
test -n "$KDEWM" && KDEWM="--windowmanager $KDEWM"
# If the session should be locked from the start (locked autologin),
# lock now and do the rest of the KDE startup underneath the locker.
-KSMSERVEROPTIONS=""
-test -n "$dl" && KSMSERVEROPTIONS=" --lockscreen"
+KSMSERVEROPTIONS="--no-lockscreen"
+#test -n "$dl" && KSMSERVEROPTIONS=" --lockscreen"