About a decade ago I was playing a game on Linux and the game crashed and took the entire DE with it. So I went to a different tty
and started a fresh x desktop session and started playing again until the game crashed again (I was running a bunch of mods so it would crash every couple of hours or so) and still didn't feel like rebooting so I went to yet another tty
and started yet another x desktop session. I did this about 3 times in total before I finally went "I should probably actually reboot because this has to be making a bigger mess of things"
Linux
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
I made a script to add a middle click scroll function with a toggle. I can share the script, it's a really bash script
this sounds quit useful tbf
Here's a few of the micro-hacks that I've hacked up in the past.
A 2-line script to chroot into Debian when logging in as a certain user on FreeBSD.
#!/bin/sh
clear
doas chroot /linux /bin/login
I didn't have an IDE, so I just made a script called
ide
which runs Vim, and then compiles the code and makes it executable.
#!/bin/sh
#Works only for C
vim $1.c && cc -O3 -Wall -Werror -Wno-unused-result $1.c -o $1
#MODE=`stat -f "%OLp" $1`
if ("stat -f "%OLp" $1 | grep -e 6 -e 4 -e 2") then
chmod +x $1
fi
This thing, called
demoronize
, which does what it says in the comments
#!/bin/sh
#dos2unix -O -e -s $1 | sed 's/ / /g' | sed 's/“/"/g' | sed 's/”/"/g'
cat $1 | sed 's/ / /g' | sed 's/“/"/g' | sed 's/”/"/g'
#Convert DOS line endings to Unix ones and add a final newline if there isn't one,
#replace sequence of 4 spaces with tab,
#and replace "smart" quotes with normal ones
I just keep those ones for historical value, but there's one hack I use every day. My keyboard doesn't have a function key (Fn), so I use the Super/Windows key instead.
I have xdotool keyup Super_L keyup Super_R keyup F4 key XF86Sleep
bound to a custom keyboard shortcut. It unpresses the keys used for the shortcut (Super + F4), then presses the sleep key.
wayland.windowManager.sway.config.keybindings = let
# ...
screenshot = with pkgs; writeShellScriptBin "screenshot.sh" ''
DATE=$(date +"%Y%m%d%H%M%S")
if [ "$1" = "full" ]; then
${grim}/bin/grim ~/Pictures/shot_$DATE.png
${libnotify}/bin/notify-send "saved full screenshot to shot_$DATE.png"
elif [ "$1" = "full-copy" ]; then
${grim}/bin/grim - | ${wl-clipboard}/bin/wl-copy -t image/png
${libnotify}/bin/notify-send "copied full screenshot"
elif [ "$1" = "sel" ]; then
${grim}/bin/grim -g "$(${slurp}/bin/slurp)" ~/Pictures/sel_$(date +"%Y%m%d%H%M%S").png
${libnotify}/bin/notify-send "saved selection to sel_$DATE.png"
elif [ "$1" = "sel-copy" ]; then
${grim}/bin/grim -g "$(${slurp}/bin/slurp)" - | ${wl-clipboard}/bin/wl-copy -t image/png
${libnotify}/bin/notify-send "copied screenshot"
else
printf "Invalid argument: '$1'\n"
fi
'';
in lib.mkOptionDefault { # ...
This is in my Home Manager configuration. I don't think this is that bad, it's just kinda messy. If you can't tell, it's a script for taking screenshots, embedded in my configuration.
Hmm. Maybe systemctl enable rc-local
because I was too lazy to get the service order correct and I just wanted something to happen last and be done with it.
When installing an encrypted Arch system, I couldn't figure out how to change the keymap in GRUB stage 1, which asks for the passphrase and then decrypts /boot
. I just entered my passphrase with the default en-us keymap without really knowing what characters it outputs.
I’ll leave this one here for someone:
You can tunnel L2 over OpenVPN. Just bridge your interfaces in both sides and it works.
That way if you need to provision a VOIP phone or just have something NetBoot remotely. Not that I recommend doing that…
I used to have a bug with my KVM switch muting my audio devices when I switch. Tried so many things but ended up running a login script that continuously runs unmute command on loop every 100ms.
can't you just trigger a script after some udev event? Your battery would be happg
That was when I first switched to Linux so safe to say I did my best lol. A correction, the issue happened when I used the switch in my Bluetooth keyboard which connects to 3 devices but was working fine using a dedicated KVM switch with WiFi dongle. Maybe I should check again if its still a thing as its been almost an year now.
I wrote a script to turn the power of the the Wifi+Bluetooth chip off, then enumerate the PCIe bus again to start it back up.
The chip sometimes hung itself when using both. I looked for the bug and even found an Intel engineer on some mailing list admitting that they had issues with coexistance mode.
Just turning the wireless off and back on wasn't enough I needed to reeinitialize the hardware and that was the best way I knew.
I converted a custom raspberry pi distribution (some kind of a debian I think) into an Arch Linux ARM without a reinstall.
bindntr=CTRL,C,exec,hyprctl dispatch closewindow alacrittyclipboard & hyprctl activewindow | rg -q "class: Wfica" && alacritty -qq --config-file ~/.config/alacritty/alacrittyclipboard.toml --class 'alacrittyclipboard' --title 'Office365 Desktop - Nexus (SSL/TLS Secured, 256 bit)' -e sh -c 'sleep .03 && xclip -o | wl-copy ; wl-paste | xclip -i'
windowrulev2 = float,class:(alacrittyclipboard)
windowrulev2 = stayfocused,class:(alacrittyclipboard)
windowrulev2 = noborder,class:(alacrittyclipboard)
windowrulev2 = noanim,class:(alacrittyclipboard)
windowrulev2 = noblur,class:(alacrittyclipboard)
windowrulev2 = opacity 0,class:(alacrittyclipboard)
windowrulev2 = maxsize 1 1,class:(alacrittyclipboard)
Fixes the fucking clipboard in citrix, no, I cannot figure out a better solution.
the move to aquamarine with hyprland mostly resolved this... but not completely and i'm going to have to write a new duct tape solution for that.
If you're wondering why I launch alacritty... it doesn't work without alacritty, wayland needs the window to be in focus, if alacritty isn't there there's no in focus window and it doesn't update the clipboard.
I had to use unity game engine for one of my assignments for school, but unity wouldn't generate files needed for the language server unless I set the code editor to vscode. I fixed this by creating a bash script with the path /usr/bin/code
that opens neovim
in konsole
.
#!/usr/bin/env bash
konsole -e "nvim $@"
based
I had an external hard drive enclosure that I stored my Plex content on before I built a nas, and the enclosure would go to sleep after 15 minutes and take the drives offline. So i had a cron script write a 1 kb file to each drive every 14 minutes. Worked well enough
Couldn’t figure out how to access my headless server’s desktop environment via VNC without a monitor connected and turned on. I bought a hardware displayport dummy adapter to pretend to be a real display to get it to work.
A hardware solution to a software problem… felt really wrong.
I’ve since wrapped my head around tmux and managing all my services via command-line or web-ui so I have no need for it anymore.
Some years ago, I had a client with a really fucked up set of requirements:
- Must run Gentoo Linux. (No, I don't know why. But it was written into the project specs and everybody who had to sign off did.)
- Must use LUKS for FDE.
- Login (loosely interpreted as "booting up") must have MFA.
This was during the days when booting into a LUKS encrypted Gentoo install involved copy-and-pasting a shell script out of the Gentoo wiki and adding it to the initrd. I want to say late 2006 or early 2007.
I remember creating a /boot partition, a tiny little LUKS partition (512 megs, at most) after it, and the rest of the drive was the LUKS encrypted root partition. The encrypted root partition had a randomly generated keyfile as its unlocker; it was symmetrically encrypted using gnupg and a passphrase before being stored in the tiny partition. The tiny partition had a passphrase to unlock it. gnupg was in the initrd. I think the workflow went something like this:
- System boots up.
- Script in the initrd prompted the user for the passphrase for the tiny LUKS partition. (first authentication step)
- User entered passphrase.
- Script in the initrd unlocked the tiny partition and prompted the user for the passphrase to decrypt the root partition's keyfile stored therein.
- User entered the symmetric passphrase for keyfile. (second authentication step_
- Script used the passphrase to decrypt the keyfile to stdout, piped into an evocation of cryptsetup to unlock the root partition.
- /dev/mapper/root mounted, /boot mounted, boot process continued.
- User logged into the box.
I don't miss those days.
Wow, that sounds like quite the adventure!! I can’t imagine juggling all those steps just to boot up the system....
Huge pain in the ass to set up, but from the user's end of things it was pretty easy to do.
@drwho It's amazing how much work can go on behind the scenes to make things smooth and simple for the user....