Skip to content

Instantly share code, notes, and snippets.

View MolarFox's full-sized avatar
🦊

RJ MolarFox

🦊
View GitHub Profile
@MolarFox
MolarFox / common_attributes.rb
Created May 19, 2025 03:17
Ruby / common attributes in array of models
def common_attributes(records)
# records should be T::Array[M] of any model M
common = records.first.attributes.dup
records.each do |r|
common.each_key do |key|
common.delete(key) if r.attributes[key] != common[key]
end
end
@MolarFox
MolarFox / autohack_basic.js
Last active September 8, 2024 14:30
Bitburner Stuff
// Basic Autohack v1.0
// Basic first pass dingus script. Just grows, weakens, and hacks every loop
/** @param {NS} ns */
export async function main(ns) {
const args = arguments["0"]["args"];
let tgt = args[0]
while(true) {
@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")