Skip to content

Instantly share code, notes, and snippets.

review Alias

git config alias.review "! f() { git fetch public pull/$1/head:$2; }; f "

git review 1234 feature/new-feature

Fetches the commit with the given GitHub ID from the public remote and checks it out with the given branch name.

@EliteMasterEric
EliteMasterEric / Eric's EZ Guide to Harmony Patches.md
Created August 16, 2025 22:14
A guide to creating Prefix and Postfix patches in Harmony, for beginner Unity modders.

Introduction to BepInEx

(If you understand how BepInEx works and what it does, you can skip this and go to the next section.)

Modding Unity games is pretty standardized in 2025. In general, you have to create your mod code in C#, build it into a DLL file, then convince the game to execute your code.

There are two ways of doing this. The first is if the game has a mod loader built in, you just have to create and install mods based on their instructions. Games that work like this include Rimworld and Oxygen Not Included, and games that work like this generally have Steam Workshop support or some other standard way of distributing mods.

The other way is that if the game doesn't natively support mods, you can use BepInEx. BepInEx is a modloader, similar to Fabric for Minecraft. BepInEx works by placing a winhttp.dll file in your game folder, which does all the same things as the winhttp.dll file in your System32 folder, but it also tells it to load the code in the BepInEx DLL. From there, BepInEx can de

@EliteMasterEric
EliteMasterEric / Null Safety Examples.hx
Created June 23, 2025 19:39
Examples of the different types of null safety.
class MyClass {
public var foo:Null<String>;
public function cleanup() {
foo = null;
}
}
class Test {
@EliteMasterEric
EliteMasterEric / git-filter-repo.sh
Created May 25, 2025 08:44
git-filter-repo script used to remap assets module commits
// Commands for rewriting commit history to remove certain files.
// Requires installing git-filter-repo: https://github.com/newren/git-filter-repo
// Any one of these commands creates a new, incompatible Git history starting with any commits that have changed,
// so only do it when absolutely necessary,and be prepared to run several of these commands before you have a stable history again.
// Remove files from the given list from a repo.
git filter-repo --invert-paths --paths-from-file ../to-sanitize-assets.txt --force
// Utilize the commit map to fix commit links.
-- Handles functionality for managing the fight against Mom in Depths 2.
-- Determine whether the hooks in this module are relevant for the current challenge.
---@return boolean Whether the hooks are valid.
local function isHookValid()
if not ChallengeAPI:AreHooksActive() then
return false
end
local goal = ChallengeAPI:GetCurrentChallengeGoal()
@EliteMasterEric
EliteMasterEric / sort_dependencies.py
Created April 15, 2025 04:27
Sort dependencies generated by Haxe compiler (-D dump-dependencies)
import os
from collections import defaultdict
def is_core_file(file):
"""Determine if a file is a core file that should be prioritized in dependency resolution."""
core_indicators = ['StdTypes.hx', 'String.hx', 'Array.hx']
return any(indicator in file for indicator in core_indicators)
def find_strongly_connected_components(graph):
"""Find all strongly connected components in the graph using Tarjan's algorithm."""

Creative Commons Assets Used:

Graphics:

Sound Effects:

Why License?

With no license, code is "All Rights Reserved" and any other application using your code is committing copyright infringement! So you should choose a license for any code you distribute publically.

Licenses will additionally protect the copyright holder from damages, and absolve any liability or unstated warranties related to the copyrighted code.

Copyleft Licenses

  • Generally require any changes to the provided source files to be redistributed.
  • Pros:
    • Encourages contributions to the original project and benefits the open-source community.
  • Prevents massive companies from selling open-source software.
package;
import flixel.system.FlxAssets.FlxShader;
import openfl.display.BitmapData;
/**
* Implements the overlay blend mode as a Flixel shader.
*
* @see https://en.wikipedia.org/wiki/Blend_modes#Overlay
* @author EliteMasterEric
@EliteMasterEric
EliteMasterEric / tweepy_unfollow.py
Created November 3, 2022 04:59
Get a list of all the users who are not your mutuals, and unfollow them. Updated for Twitter API v2.
import time
import tweepy
import sys
# Debug
#import logging
#logging.basicConfig(level=logging.DEBUG)
# Go here and create a Project: https://developer.twitter.com/en/portal/projects-and-apps
# Then go to the Keys and Tokens tab and copy the values below.