Skip to content

Instantly share code, notes, and snippets.

View Drewlius's full-sized avatar
💭
Where did this all go wrong?

Drewlius Drewlius

💭
Where did this all go wrong?
View GitHub Profile
@Drewlius
Drewlius / set-gpu-wattage.sh
Created August 1, 2026 15:13
NVIDIA-SMI interact-able to adjust GPU power limit on the fly
#!/bin/bash
printf "Set Temporary NVIDIA GPU Power Limit\n"
read -p "Enter wattage (RTX 5090 range: 400-600): " WATTS
if sudo nvidia-smi -pl "$WATTS"; then
printf "GPU power limit set to %s W.\n" "$WATTS"
else
printf "Error: NVIDIA rejected the requested power limit.\n"
exit 1
fi
@Drewlius
Drewlius / garuda-health
Last active July 17, 2026 19:37
Remove BTRFS and Snapper notifications from garuda-health on non BTRFS Garuda Linux installs file belongs in /usr/bin/garuda-health
#!/usr/bin/env python3
import filecmp
import os
from pathlib import Path
import pty
import re
import sys
import subprocess
import argparse
@Drewlius
Drewlius / adjacency_matrix.py
Created June 7, 2026 14:43
Adjacency Matrix path finder
INF = float('inf')
adj_matrix = [
[0, 5, 3, INF, 11, INF],
[5, 0, 1, INF, INF, 2],
[3, 1, 0, 1, 5, INF],
[INF, INF, 1, 0, 9, 3],
[11, INF, 5, 9, 0, INF],
[INF, 2, INF, 3, INF, 0],
]
@Drewlius
Drewlius / LuhnAlgorithm.py
Created June 4, 2026 12:27
Luhn Algorithm
def verify_card_number(nums):
card_numbers=[]
special_nums=[]
stripped=nums.replace(" ", "").replace("-", "")
for num in stripped:
card_numbers.append(int(num))
check_digit = card_numbers.pop(-1)
r_card_numbers = card_numbers[::-1]
for num in r_card_numbers[0::2]:
if num+num < 10:
@Drewlius
Drewlius / Zswapoff.sh
Created May 20, 2026 21:48
script to disable ZRAM and Swap in one command.
#!/bin/bash
sudo swapoff -a;sudo zramctl --reset /dev/zram0;echo "ensure if a ZRAM line is configured that you remove it now";sleep 10;wait;sudo nano /etc/fstab;sudo systemctl mask --now systemd-zram-setup@zram0.service;sudo touch /etc/systemd/zram-generator.conf;echo "Here you are going to write vm.swappiness=0, save(ctrl+s), and then exit(ctrl+x, Enter)";sleep 10;wait;sudo nano /etc/sysctl.d/99-swappiness.conf;echo "ZRAM is OFF";sleep 3;wait;exit 0
@Drewlius
Drewlius / Nvmon.sh
Created May 20, 2026 19:07
Interactive Nvidia GPU Monitoring Utility
#!/bin/bash
read -n1 -p "1:NVTOP 2:NVIDIA-SMI DMON 3:NVIDIA-SMI PMON > " c; echo
case $c in
1) nvtop ;;
2) read -n1 -p "1:FAST 2:SLOW > " d; echo
case $d in
1) nvidia-smi dmon -s u ;;
2) nvidia-smi dmon -d 1 ;;
esac
@Drewlius
Drewlius / BackupHomeDirectory.md
Last active July 17, 2026 19:45
Backup Home Profile

Backup Your Home Directory

So simple you mother could do it

This script expects you to have a secondary storage drive mounted in /mnt (/mnt/<Desired_Location>

This is not a strictly enforced requirement and you may edit the script to suit your needs.

Grant the script the permission to be executed

chmod +x ~/Home/Downloads/<backup-home.sh> (or wherever you saved it)  

Run the script in your preferred terminal via its absolute path

@Drewlius
Drewlius / StartAdguard.sh
Last active May 20, 2026 21:43
Start adguard-cli and Adguardvpn-cli software in the proper order.
#!/bin/bash
sudo adguardvpn-cli connect -l '<location>';sudo aguard-cli check-update;sudo adguard-cli start
@Drewlius
Drewlius / User_Config_Manager.py
Created May 2, 2026 11:16
Build A User Configuration Manager
test_settings = {'mouse': 'large',
'theme': 'hdr',
'resolution': '1920x1080',
'refresh': '60Hz',
}
settings = {}
def add_setting(settings, key_value):
key = key_value[0].lower()
@Drewlius
Drewlius / Budget_App.Py
Created May 2, 2026 11:15
Budget App W/ Visual Chart Representation
class Category(object):
def __init__(self, name):
self.name = name
self.ledger = []
def __str__(self):
return f'{self.cat_obj()}\n{self.transaction_list()}\nTotal: {self.get_balance()}'
def transaction_list(self):