4 posts were merged into an existing topic: Off Topic Chit Chat - (Silliness factor 5)
Hello there!
Ainโt quite sure is it belongs to this topic, pls correct me if not.
If you are using Sway and struggle to make one wallpaper across two similar monitors (same resolution) without splitting picture then the next hack is for you:
- You need to install swaybg-Multi-monitor from Github;
- Make modification in the Variety script file ~/.config/variety/scripts/set_wallpaper. In the section which is starting from line 232. please find a lines with command *swaybg -i โ$WPโ -m fill * and change option โfillโ to option โmulti-monitorโ, like in example below.
...
PID=`pidof swaybg`
if [[ -n $PID ]]; then
# If swaybg is available, use it as prevents system freeze.
# See https://github.com/swaywm/sway/issues/5606
if command -v "swaybg" >/dev/null 2>&1; then
# Grey background flicker is prevented by killing old swaybg process after new one.
# See https://github.com/swaywm/swaybg/issues/17#issuecomment-851680720
#
# in the line below - option 'fill' change to 'multi-monitor'
swaybg -i "$WP" -m multi-monitor &
if [ ! -z "$PID" ]; then
sleep 1
kill $PID 2>/dev/null
fi
else
#
# in the line below - option 'fill' change to 'multi-monitor'
swaymsg output "*" bg "$WP" multi-monitor 2> /dev/null
fi
fi
...
Now in your variety app settings in section Wallpaper you could use Smart mode and your wallpapers could easy span across two displays without additional mods.
BUT once again thatโs all possible if you have - Two monitors with the same resolution horizontally placed.
I have been using fzf
for a very short while now. The very first issue I had with this was it not opening its results in an editor. Itโs searches are no doubt great but if it outputs just the file path for me thatโs not very useful now is it.
#!/bin/bash
IFS=$'\n' read -d '\n' -ra fzf_command <<< "$(fzf --height 60% -m -q "${1}" --ansi --preview="bat --style=numbers --color=always {}")"
if [ ${#fzf_command[@]} -ne 0 ]; then
lvim "${fzf_command[@]}"
fi
So this is what I came up with. This deals with the issue which I encountered where if fzf outputs a file name that has space in itโs name lvim will open it as two different files. The -m
option allows me to select multiple files to open at once with tab
and -q
allows me to run the script with arguments for what I wanna search (which I rarely doโฆ). The preview is pretty self explanatory.
Got an alias to it and everything.
alias fzfm "/path/to/fzfm.sh"
All in all I think I am quite fond of this method of searching my directory right now. I heard this can reverse lookup my shell history tooโฆ Maybe I will lookup that someday as well. For now this much brain storming is enough.
Fine, it works with micro too
I could not resist code-golfing it
fzf --height 60% -m -q "${1}" --ansi --preview="bat --style=numbers --color=always {}" |xargs -rd$'\n' $EDITOR
or with zero-delimited strings to allow even newlines and other crap in the filenames
fzf --height 60% -m -q "${1}" --ansi --preview="bat --style=numbers --color=always {}" --print0 |xargs -r0 $EDITOR
not that I would advise using such filenames in the first place
Thatโs a good one.
Made a fairly handy bulk file/folder renamer:
#!/bin/bash
# Function to add text to filenames
add_text() {
local dir=$1
local text=$2
local position=$3
cd "$dir" || exit 1
for entry in *; do
if [ -d "$entry" ]; then
mv "$entry" "$text$entry"
elif [ -f "$entry" ]; then
if [ "$position" == "beginning" ]; then
mv "$entry" "$text$entry"
elif [ "$position" == "end" ]; then
extension="${entry##*.}"
filename="${entry%.*}"
mv "$entry" "$filename$text.$extension"
fi
fi
done
cd - > /dev/null || exit 1
}
# Function to replace text in filenames
replace_text() {
local dir=$1
local old_text=$2
local new_text=$3
cd "$dir" || exit 1
for entry in *; do
if [ -d "$entry" ]; then
new_name=$(echo "$entry" | sed "s/$old_text/$new_text/gI")
mv "$entry" "$new_name"
elif [ -f "$entry" ]; then
new_name=$(echo "$entry" | sed "s/$old_text/$new_text/gI")
mv "$entry" "$new_name"
fi
done
cd - > /dev/null || exit 1
}
# Main script
echo "Bulk renaming script"
# Choose directory through file-picker
directory=$(zenity --file-selection --directory --title="Select Directory")
if [ $? -ne 0 ]; then
echo "No directory selected. Exiting..."
exit 1
fi
# Change to the selected directory
cd "$directory" || exit 1
echo "1. Add text to filenames"
echo "2. Replace text in filenames"
read -rp "Choose an option (1/2): " option
case $option in
1)
read -rp "Enter the text to add: " text
read -rp "Should it be appended to the beginning or end? (beginning/end): " position
echo "Adding \"$text\" to filenames and folder names..."
add_text "$(pwd)" "$text" "$position"
;;
2)
read -rp "Enter the text to replace: " old_text
read -rp "Enter the new text: " new_text
echo "Replacing \"$old_text\" with \"$new_text\" in filenames and folder names..."
replace_text "$(pwd)" "$old_text" "$new_text"
;;
*)
echo "Invalid option, exiting..."
exit 1
;;
esac
echo "Done"
Full explanation of what and why, as well as features and limitations here
Sometimes I drop something in the darkness of my room, and Iโm too lazy to switch on the lights.
For that reason I made this:
#!/bin/bash
# Let there be light!
shopt -s checkwinsize
(:)
printf -v BUFFER '%*s' $((COLUMNS*LINES)) ' '
printf '\033[48;2;255;255;255m%s\n\033[0m' "$BUFFER"
I just run light
in my terminal. On my big screen, itโs quite enough to illuminate the whole room. When Iโm done, a simple clear
brings back the darkness.
@Kresimir, nice to see youโre still hanging around the forum olโbuddy.
I fear my eyes couldnโt take the blare created by your handy script. Everything is in dark mode on my computer to lessen the eye strain.
Cheers bud.
My eyes!
If you canโt be bothered to look up the systemd service syntax all the time, check systemd-run
. It automatically generates services and even their timers which are temporarily active. Then you can just systemctl --user cat <servicename>.service
and the same for the timer and you get a working service with almost zero effort.
Donโt forget to stop (and disable?) the service afterwards
I love this tool. Makes services 200% easier.
Whereโs the fun in that?
Almost sounds like some devilish AI skullduggery!!!
This one is a super simple script to upload a single or multiple files on 0.0st website it can also a json data of that files with name if need super handy
-
itโs upload your file like
-
i made this because i want to apply skin on my minecraft id from server and i didnโt find anywhere wher i upload my skin easily
A simple sed
script, that takes stdin
and outputs it in sแดแดสส แดแดแดs to stdout
.
smallcaps:
#!/bin/sed -f
y/abcdefghijklmnopqrstuvwxyz/แดสแดแด
แด๊ฐษขสษชแดแดสแดษดแดแดวซสsแดแดแด แดกxสแดข/
Similarly, a sed
script that outputs in ๐๐๐๐๐๐๐:
fraktur:
#!/bin/sed -f
y/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐/
And one that gives แชแแแฉ-แแชแแฉแพ แฑแขแพแแ:
anglo-runes:
#!/bin/sed -f
s/./\L&/g
s/q/แฃแน/g
s/th/แฆ/g
s/ng/แ/g
s/ae/แซ/g
s/ea/แ /g
s/io/แก/g
s/oe/แ/g
y/abcdefghijklmnoprstuvwxyz/แชแแณแแแ แทแปแแแฃแแแพแฉแแฑแแแขแ แนแแฃแด/
And, of course, you can make your own.
An example of how they might be used:
fraktur <<< "absolutely proprietary" | xclip -sel c
And just paste it to get โ๐๐๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐โ.
Well, I use it a lot myself, but mostly with a one liner
curl -F "file=@1.mp4" "https://0x0.st" | wl-copy
but the problem with null pointer
(https://0x0.st/) is that you canโt upload anything, and it also includes some mincraft stuffs
I didnโt had any problem with that but sometimes I wanted to share some stuffs which I donโt want to be seen publicly, so I would make a zip file and then add a password to it
โญโankur@ankur in ~/something took 1s
โฐโฮป zip -r something.zip *
adding: nothing.txt (stored 0%)
adding: something.txt (stored 0%)
โญโankur@ankur in ~/something took 5ms
โฐโฮป zipcloak something.zip
Enter password:
Verify password:
encrypting: nothing.txt
encrypting: something.txt
Beware that they can block your ip address if they feel like you are doing some weirdo things
I can always keep trying with different VPN servers.
This was probably the best script I had been missing in my PC
Tweaked it a little and added it to .profile
export FZF_DEFAULT_OPTS="--height=15 --border=double --padding=1% --info=right --separator=_ --preview='bat {}' --preview-window
=hidden:right:69% --preview-label=eyes --margin=5% --border-label="search" --color=16 --layout=reverse --prompt=๐ซ --bind='alt-o
:toggle-preview'"
Now it can
- Toggle when a keybind is pressed
alt+o
Todo: Make preview extension specific i.e pdf files to open with pdf etc.
Thanks for teaching me files can be previewed
โThe editing part not done yet, I still want to see if different files can be opened differently
I like the flexibility of pacman, but keeping it under control is a bit tricky for me. I was reviewing all the nvidia files installed and found this is one liner from the ArchWiki pacman/Tips and tricks, section 1.2 helped a lot.
pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'
This produced 3 sections in the terminal, upper left for typing into, and 2 scrollable areas that you could move around in.
There are other variations on this, this was my favorite.
I see this was your first post @ARClite, welcome to the forum and thanks for giving back.
Useful for system monitoring:
watch -n 0.1 journalctl -n 100
watch -n 0.5 sensors