Skip to content

Instantly share code, notes, and snippets.

View ChaunceyHoover's full-sized avatar

Chauncey Hoover ChaunceyHoover

View GitHub Profile
@ChaunceyHoover
ChaunceyHoover / PermissionNode.cs
Last active August 11, 2023 19:46
Period separated, string-based nodes to a C# parent-child / tree-like node list
public class PermissionNode : List<PermissionNode> {
/// <summary>
/// Represents each text-based node inside of a permission string
/// </summary>
public string Key { get; set; }
/// <summary>
/// The original, non-split permission string for this node
/// </summary>
public string Original { get; set; }
@ChaunceyHoover
ChaunceyHoover / index.js
Created March 23, 2022 20:55
Wordle Solver
// NOTE: requires file "words.txt", which is a JSON array of every possible word guessable (i.e. both answers and valid guesses that will never be answers)
// see next file for word list
const fs = require('fs');
const data = fs.readFileSync('words.txt').toString();
const words = JSON.parse(data);//data.split('\r\n'); // if using 1 word per line
const candidates = [];
// NOTE: Capitalize all letters in these values. I got lazy.
@ChaunceyHoover
ChaunceyHoover / data-align.js
Created October 25, 2021 20:05
Align any given number to the nearest specified amount of bits or bytes
/**
* Returns a number that is n-bits aligned, where n is the number of bits specified
* @param x The input number to be aligned
* @param bits The amount of bits to align the number to
* @returns `x` aligned to the nearest n-bits, where `n` is the specified amount of bits
*/
function alignToBits(x, bits) {
return (x + (bits - 1)) & (-1 * bits);
}
@ChaunceyHoover
ChaunceyHoover / US-States.json
Created September 15, 2021 18:40
Minimal list of all 50 states in the US with name and abbreviation. Use it instead of storing it in a database or hard coding it or something idk.
[
{
"name": "Alabama",
"value": "AL"
},
{
"name": "Alaska",
"value": "AK"
},
{
@ChaunceyHoover
ChaunceyHoover / US-States.xml
Last active September 15, 2021 18:38
Minimal list of all 50 states in the US with name and abbreviation. Use it for a DataSource in Visual Studio or something idk.
<?xml version="1.0" encoding="UTF-8"?>
<states>
<state name="Alabama" value="AL" />
<state name="Alaska" value="AK" />
<state name="Arizona" value="AZ" />
<state name="Arkansas" value="AR" />
<state name="California" value="CA" />
<state name="Colorado" value="CO" />
<state name="Connecticut" value="CT" />
<state name="Delaware" value="DE" />
@ChaunceyHoover
ChaunceyHoover / minimal-logger.js
Last active July 12, 2021 16:10
My bare minimum logger. Nothing fancy, no extra features, just something to log output with fancy colors.
const { inspect } = require('util');
const chalk = require('chalk');
class Output {
#l = 0;
#c = chalk.grey;
constructor(level, color) {
this.#l = level;
this.#c = color;
@ChaunceyHoover
ChaunceyHoover / nanorc
Created June 10, 2021 05:31
My nanorc
## This is a system-wide configuration file for the nano editor.
##
## Each user can save his own configuration to ~/.nanorc
##
## See the nanorc(5) man page for details.
## Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read! Also note that this file should not be in
@ChaunceyHoover
ChaunceyHoover / music-fixer-upper-format.sh
Last active March 3, 2020 06:04
Run in Music folder - Removes artist name from album folder. NOTE: Comment out "mv" to make sure nothing unexpected happens
# Fixes error generated from using `mv` with files that have spaces in names
IFS='
'
for d in ./*/
do
cd "$d"
for f in ./*/
do
cd "$f"
@ChaunceyHoover
ChaunceyHoover / music-fixer-upper-symbols.sh
Last active March 2, 2020 07:30
Run in Music folder - removes all special characters from file name
for d in ./*/
do
cd $d
for file in ./*
do
infile=`echo "${file:2}"|sed \
-e 's|"\"|"\\"|g' \
-e 's| |\ |g' -e 's|!|\!|g' \
-e 's|@|\@|g' -e 's|*|\*|g' \
-e 's|&|\&|g' -e 's|]|\]|g' \
@ChaunceyHoover
ChaunceyHoover / ComputerCraft Matrix Program.lua
Last active August 8, 2019 13:02
A useful server welcome program for ComputerCraft, complete with hackermans style tendrils in the background. Can be used to show server rules and other important messages.
--[[ Configuration ]]--
-- Max amount of tendrils on screen at a time
max_tendrils = 50
-- How fast the screen updates
-- note: Setting it to 0 or less will cause program to not work properly
update_speed = 0.25
-- Possible colors tendrils can be
-- note: the more you put the same color in a table, the more likely it is to be chosen