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 / 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 May 26, 2026 00:08
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 on /mnt/

This is not a strictly enforced requirement and can be bypassed to back up the $HOME Directory anywhere, but it is implied and expected for there to be a drive at /mnt

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):
@Drewlius
Drewlius / Polygon_Calculator.py
Created May 2, 2026 11:14
Polygon Calculator W/ Visual Representation
class Rectangle:
def __init__(self, width, height):
self._width = width
self._height = height
def __str__(self):
return f'Rectangle(width={self._width}, height={self._height})'
def set_width(self, width):
@Drewlius
Drewlius / Build_A_Hash_Table.py
Last active May 2, 2026 11:12
Building A Hash Table
class HashTable:
def __init__(self):
self.collection = {}
def hash(self, str):
self.str = str
result = 0
for char in self.str: