Skip to content

Instantly share code, notes, and snippets.

View MolarFox's full-sized avatar
🦊

RJ MolarFox

🦊
View GitHub Profile
@MolarFox
MolarFox / blobfox_file_rename.py
Created April 18, 2024 11:42
[Python] Rename blobfox emotes to be indexable
#!/usr/bin/python3
"""
MolarFox 2024
On most platforms (Slack, Masto, Firefish, Discord, etc), you can search emotes by all words in them if the words are underscore delineated
This doesn't work by default for blobfox emotes since the filenames are all 1 word
This script will rename all files to be underscore delineated so you can let your software auto-index
This is just a quick script I smashed out in a half hour, it's stable but could be improved w/ better encapsulation, reading dirpath from stdin etc
@MolarFox
MolarFox / toggle_display_orientation.sh
Created April 3, 2024 07:30
Toggle display orientation (for 2-in-1 without working tilt sensor)
#!/bin/bash
tgt_disp="eDP-1"
# Determine which index the orientation will be at. +1 if tgt_disp is primary (try running the edpi_state xrandr command without the cut to see why)
disp_info=$(xrandr --query --verbose | grep "$tgt_disp")
if [ $(echo "$disp_info" | cut -d ' ' -f 3) == "primary" ]
then
cut_index=6
else
@MolarFox
MolarFox / filter.txt
Created August 29, 2023 07:04
Social Media Allowlist
! Title: Molar's Social Media Allowlist
! Description: Adguard Whitelist rules to allow some social media to function
!
@@||facebook.com^
@@||fbcdn.net^
@@||fbsbx.com^
@MolarFox
MolarFox / grpc_partialfailure_status.json
Created August 21, 2023 20:47
grpc partial failure object methods
{
"message": "This is a log detailing type and methods of the partial failure status object returned by Google grpc after an `add_offline_user_data_job_operations` call",
"type": "<class 'google.rpc.status_pb2.Status'>",
"methods": [
"ByteSize",
"Clear",
"ClearExtension",
"ClearField",
"CopyFrom",
"DESCRIPTOR",
@MolarFox
MolarFox / website_watcher.py
Last active June 27, 2023 13:54
Simple website watcher cobbled together in an hour
#!/usr/bin/python3
# MolarFox 2023
import re
import tkinter as tk
from tkinter.scrolledtext import ScrolledText
import hashlib
import urllib3
import datetime as dt
@MolarFox
MolarFox / challenge.md
Last active June 16, 2022 04:18
Data I/O Bookclub - 16 June 2022

A function that takes in an integer string, and converts it to "pretty" format aka comma-separated

e.g.

123123123 -> 123,123,123
12312312  ->  12,312,321
1000      ->       1,000

This is my solve for the 16th June Data I/O bookclub challenge.

@MolarFox
MolarFox / AvroHandler.py
Created March 4, 2022 05:26
FastAvro Basic writer + reader class for example file generation
#!/usr/bin/python3
from typing import List
from dataclasses import dataclass, field
from fastavro import writer, reader, parse_schema
# A simple base class to load in avros, anonymise the values of every record, and write back out
# For generating non-identifying example files from live cust data, all conforming to schema
@dataclass
@MolarFox
MolarFox / whorrre.py
Last active February 6, 2022 12:15
Script for SiSalt
import random
print(f"who{''.join(['r' for _ in range(1,random.randint(2,999))])}e")
@MolarFox
MolarFox / unzip_intodirs.fish
Created March 21, 2021 01:36
fish shell script to unzip all archives into their own folders in current directory
function unzip_intodirs
for zipfile in *.zip ;
set fdir (basename $zipfile .zip)
mkdir $fdir
unzip -d $fdir $zipfile
end
end
@MolarFox
MolarFox / error.yeet
Last active March 19, 2021 12:16
Excellent Error Messages
(steam:3329): LIBDBUSMENU-GLIB-WARNING **: Trying to remove a child that doesn't believe we're it's parent.