I really needed to run a compositor from an arch chroot and systemd's udev is straight up broken in chroot, so I used libudev-zero and made sure that every time systemd updated I would delete the libudev .so file and plunk libudev-zero ontop of it, no i've moved on to greener pastures (Artix) but hey, it did work.
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
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.
In the earlier days of Plasma 6, it would crash on me when waking from sleep, so I had a small script that would basically restart plasmashell when waking so I didn't have to wait the several seconds for the system to realize that it was frozen before I had a functional desktop.
On the client side of a relayd-based wireless bridge using OpenWrt, I discovered there was a bug in that relayd version which made the process hang after it moved so many gigs of data. I made a cron job that pings the network relayd makes accessible. If the ping fails, it nukes relayd. Of course this relies on a live machine to ping. If this machine dies for some reason, the cron job would just keep killing relayd over and over again. 🥹
It makes me mad to see the current state sway is in, I even bought an AMD GPU for nothing.
I too was a bit underwhelmed by sway. I also bought an amd gpu, but I don't regret it. I couldn't get Wayland to work at all on my 3060 ti.
gtk3-classic
still doesn't work properly on Wayland and I doubt it will ever be fixed so I include WAYLAND_DISPLAY=0
in each shortcut file to force them into xwayland.
Don't remember the specifics but I had a key combo setup to force a soft reset in my DE. Occasionally a kernel or driver update would fuck up my video and make the system unusable but still live. I try to avoid hard resets.
Bootstraping.
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.
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
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 converted a custom raspberry pi distribution (some kind of a debian I think) into an Arch Linux ARM without a reinstall.