Skip to content

Instantly share code, notes, and snippets.

View elibroftw's full-sized avatar
😮‍💨

Elijah Lopez elibroftw

😮‍💨
View GitHub Profile
@elibroftw
elibroftw / rank_anything_top_10.py
Last active April 7, 2026 00:41
An easy way to rank items of your choosing, such as movies, tv shows, food/dishes.
import os
import itertools
import csv
MOVIES = '/media/elijah/Big Dipper/Videos/Movies'
TV_SHOWS = '/media/elijah/Big Dipper/Videos/TV Shows'
SELECTION = MOVIES
@elibroftw
elibroftw / Win32WindowHelper.cs
Created April 1, 2026 20:22
A reference for what to do if WinUIEx isn't enough. Just install CsWin32, add the dpi method to NativeMethods.txt
using Microsoft.UI.Xaml;
using System;
using System.Runtime.InteropServices;
internal partial class Win32WindowHelper
{
private static WinProc? newWndProc = null;
private static nint oldWndProc = nint.Zero;
private POINT? minWindowSize = null;
@elibroftw
elibroftw / Win32WindowHelper.cs
Created April 1, 2026 20:22
Just install CsWin32, add the dpi method to NativeMethods.txt
using Microsoft.UI.Xaml;
using System;
using System.Runtime.InteropServices;
internal partial class Win32WindowHelper
{
private static WinProc? newWndProc = null;
private static nint oldWndProc = nint.Zero;
private POINT? minWindowSize = null;
@elibroftw
elibroftw / install_caddy.yml
Created March 27, 2026 04:10
How to Install Caddy on Almalinux via Ansible Playback
- name: NAME
hosts: HOSTS
become: yes
tasks:
- name: Install copr
ansible.builtin.dnf:
name:
- 'dnf-command(copr)'
- 'dnf-plugins-core'
state: present
@elibroftw
elibroftw / casefold.py
Created December 3, 2025 22:25
Case Fold JavaScript. Note that I decided to use normalize because u and ü should match each other when a user is filtering items. In casefolding, they are still distinct characters which makes this a waste of work.
#!/usr/bin/env python3
"""
Parse CaseFolding.txt and generate a TypeScript file with case folding mappings.
https://www.unicode.org/Public/UCD/latest/ucd/CaseFolding.txt
This script reads the Unicode CaseFolding.txt file and creates a TypeScript
module with mappings for case-insensitive string comparison.
"""
@elibroftw
elibroftw / openpyxl_utils.py
Last active November 26, 2024 03:19
Openpyxl Utility Functions
# LICENSE: public domain
import warnings
from openpyxl.cell import Cell
from openpyxl.worksheet.worksheet import Worksheet
from openpyxl.styles.stylesheet import Stylesheet, BUILTIN_FORMATS_MAX_SIZE, BUILTIN_FORMATS
from openpyxl.drawing.text import Font as DrawingFont
from openpyxl.descriptors import MinMax
from copy import copy
from contextlib import suppress
@elibroftw
elibroftw / country_and_currencies.json
Last active June 18, 2023 14:31
A list of countries and the currencies each one uses. Data sourced from three sources.
{
"af": {
"currencyName": "Afghan afghani",
"currencyIso": "AFN",
"countryName": "Afghanistan",
"symbol": "\u060b",
"decimalPoint": ".",
"thousandsSeparator": ",",
"decimalPlaces": 2
},
@elibroftw
elibroftw / removeDuplicates.gs
Created April 23, 2023 22:20
Google Sheets script to remove duplicate rows related to MAC, IP addresses, and Semantic Versioning
function isNewerVersion(oldVer, newVer) {
const oldParts = oldVer.split('.');
const newParts = newVer.split('.');
for (var i = 0; i < newParts.length; i++) {
const a = ~~newParts[i]; // parse int
const b = ~~oldParts[i]; // parse int
if (a > b) return 1;
if (a < b) return -1;
}
return 0
[target.'cfg(target_os = "linux")'.dependencies]
dbus = "0.9"
@elibroftw
elibroftw / cs350_cli.py
Last active April 24, 2023 14:18
A CLI to increase productivity for the CS 350 Operating Systems course. This should sit two levels above the os161-X.Y directory. Script is robust enough to work with the naming convention recommended by the course as well as my own.
#!/usr/bin/python3
import argparse
import subprocess
from subprocess import DEVNULL
import os
import glob
from pathlib import Path
import time
import shutil
import sys