Skip to content

Instantly share code, notes, and snippets.

@mekb-turtle
mekb-turtle / update-dracut.sh
Created June 15, 2024 05:45
Script to regenerate dracut initramfs
#!/bin/sh
set -o errexit
KERNEL="$(pacman -Q linux | awk '{print $2}' | sed 's/\.\([a-z]\+\)/-\1/')"
echo "Generating initramfs for kernel $KERNEL"
echo "This may take a while..."
echo "Generaing /boot/initramfs-linux.img..."
dracut --hostonly --no-hostonly-cmdline /boot/initramfs-linux.img -f "$KERNEL"
echo "Generaing /boot/initramfs-linux-fallback.img..."
dracut /boot/initramfs-linux-fallback.img -f "$KERNEL"
@mekb-turtle
mekb-turtle / screenshot.sh
Last active June 8, 2024 16:16
ultimate hyprland screenshot script
#!/usr/bin/bash
SCREENSHOTS_DIR="$HOME/screenshots"
SCREENSHOT_NAME_FORMAT="screenshot-%Y.%m.%d.%H.%M.%S"
if [[ "$1" == "area" ]] || [[ "$1" == "active" ]] || [[ "$1" == "monitor" ]] || [[ "$1" == "desktop" ]]; then
if ! pidof -s slurp; then
unset GEOM GEOM_POS GEOM_SIZE GEOM_WIN GEOM_WIN_EXTRA
unset PICKER_PROC
# some of this code comes from https://github.com/hyprwm/contrib/blob/main/grimblast/grimblast
case "$1" in
area)
@mekb-turtle
mekb-turtle / explain.bash
Last active May 19, 2024 05:15
Explain a command using explainshell.com
#!/bin/bash
explain() {
if [[ "$#" == 0 ]]; then
echo "Usage: explain <command>..."
echo "Explain a command using explainshell.com"
echo "Example: explain 'ls -l -a'"
echo "For best results, quote the command to prevent shell expansion"
return 1
fi
diff --git a/src/bot.js b/src/bot.js
index ce523a4..716f3da 100644
--- a/src/bot.js
+++ b/src/bot.js
@@ -171,7 +171,7 @@ async function handleMessage(message) {
if (reply.author.id != client.user.id) return;
if (messages[channelID] == null) return;
if ((context = messages[channelID][reply.id]) == null) return;
- } else if (message.type != MessageType.Default || (message.guild && !message.content.match(myMention))) {
+ } else if (message.type != MessageType.Default) {
@mekb-turtle
mekb-turtle / power
Last active September 8, 2023 02:45
rofi power menu script
#!/bin/bash
RES="$(rofi -dmenu -p "Power" <<< $'Shutdown\nRestart\nLog Out\nLock')"
if [[ "$RES" == "Shutdown" ]]; then /usr/local/sbin/do shutdown & disown; fi
if [[ "$RES" == "Restart" ]]; then /usr/local/sbin/do restart & disown; fi
if [[ "$RES" == "Log Out" ]]; then hyprctl dispatch exit; fi
if [[ "$RES" == "Lock" ]]; then swaylock; fi
#if [[ "$RES" == "Suspend" ]]; then swaylock & /usr/local/sbin/do suspend1 & disown; fi
@mekb-turtle
mekb-turtle / swapfile
Last active April 28, 2023 08:55
bash script to swap two files around
#!/usr/bin/bash
if [[ "$#" != "2" ]]; then echo "Usage: swapfile <file1> <file2>"; exit 1; fi
f1="$1"
f2="$2"
if [[ ! -e "$f1" ]]; then echo "File not found: $f1"; exit 1; fi
if [[ ! -e "$f2" ]]; then echo "File not found: $f2"; exit 1; fi
while [[ "$f1" == */ ]]; do f1="${f1%\/}"; done
while [[ "$f2" == */ ]]; do f2="${f2%\/}"; done
echo "Swapping $f1 and $f2"
IDTEMP="$(uuidgen|tr -d '-')"
@mekb-turtle
mekb-turtle / openpgp.md
Created April 21, 2023 02:26
pgp key proof

openpgp4fpr:EAB0A643ABD82124552040FE39F3751CDD35BB5F

@mekb-turtle
mekb-turtle / minecraftcolors.sh
Created April 17, 2023 04:26
preview minecraft colours in terminal
#!/usr/bin/bash
echo -e ' \x1b[48;5;15;38;2;0;0;0mblack\x1b[0m - &0 - §0 - \\u00a70 '
echo -e ' \x1b[48;5;15;38;2;0;0;170mdark_blue\x1b[0m - &1 - §1 - \\u00a71 '
echo -e ' \x1b[48;5;15;38;2;0;170;0mdark_green\x1b[0m - &2 - §2 - \\u00a72 '
echo -e ' \x1b[48;5;15;38;2;0;170;170mdark_aqua\x1b[0m - &3 - §3 - \\u00a73 '
echo -e ' \x1b[48;5;15;38;2;170;0;0mdark_red\x1b[0m - &4 - §4 - \\u00a74 '
echo -e ' \x1b[48;5;15;38;2;170;0;170mdark_purple\x1b[0m - &5 - §5 - \\u00a75 '
echo -e ' \x1b[48;5;15;38;2;255;170;0mgold\x1b[0m - &6 - §6 - \\u00a76 '
echo -e ' \x1b[38;2;170;170;170mgray\x1b[0m - &7 - §7 - \\u00a77 '
echo -e ' \x1b[48;5;15;38;2;85;85;85mdark_gray\x1b[0m - &8 - §8 - \\u00a78 '
@mekb-turtle
mekb-turtle / colorbars.sh
Last active April 17, 2023 04:24
bash script to show terminal colors
#!/usr/bin/bash
if [[ "$TERM" == "linux" ]]; then
printf "%s" $'\x1b[48;5;0;38;5;15m 0 \x1b[48;5;1;38;5;15m 1 \x1b[48;5;2;38;5;15m 2 \x1b[48;5;3;38;5;15m 3 \x1b[48;5;4;38;5;15m 4 \x1b[48;5;5;38;5;15m 5 \x1b[48;5;6;38;5;15m 6 \x1b[48;5;7;38;5;15m 7 \x1b[0m\n'
printf "%s" $'\x1b[48;5;0;38;5;15m 8 \x1b[48;5;1;38;5;15m 9 \x1b[48;5;2;38;5;15m10 \x1b[48;5;3;38;5;15m11 \x1b[48;5;4;38;5;15m12 \x1b[48;5;5;38;5;15m13 \x1b[48;5;6;38;5;15m14 \x1b[48;5;7;38;5;15m15 \x1b[0m\n'
else
printf "%s" $'\x1b[48;5;0;38;5;255m 0 \x1b[48;5;1;38;5;255m 1 \x1b[48;5;2;38;5;255m 2 \x1b[48;5;3;38;5;255m 3 \x1b[48;5;4;38;5;255m 4 \x1b[48;5;5;38;5;255m 5 \x1b[48;5;6;38;5;255m 6 \x1b[48;5;7;38;5;16m 7 \x1b[0m\n'
printf "%s" $'\x1b[48;5;8;38;5;255m 8 \x1b[48;5;9;38;5;16m 9 \x1b[48;5;10;38;5;16m10 \x1b[48;5;11;38;5;16m11 \x1b[48;5;12;38;5;16m12 \x1b[48;5;13;38;5;16m13 \x1b[48;5;14;38;5;16m14 \x1b[48;5;15;38;5;16m15 \x1b[0m\n'
printf "%s" $'\n'
for m in {0..5}; do
for l in {0..5}; do
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>
<alias>
<family>serif</family>