Skip to content

Instantly share code, notes, and snippets.

@disco0
disco0 / 00 - Preamble.md
Last active Sep 5, 2022
Structure and Interpretation of Cruelty Squad Mods
View 00 - Preamble.md

Pre-Preamble

This assumes some experience with godot at the level of replacing materials/other resources inside nodes (I should be attaching pictures for reference regardless), and is more of a connecting the dots explainer. While technically possible to do otherwise, I'm going to say that all of this requires working in Godot in a decompiled project of the game.

Being comfortable with the command line is borderline necessary as you get further into this—again, not necessary, but it makes automating the pain points of all of this much easier.

Preamble

Some background on the details/pitfalls of loading mod content, I apologize but its important—these are all things I which I fully cemented in my brain earlier, for now just keep them in mind as we go through the actual details.

View Rehydrate.gd
tool
extends EditorScript
###
### Install (for Run usage)
### Copy to res://mod-scripts/RehydrateImports.gd
###
### Usage:
### var Rehydrate = load('res://mod-scripts/RehydrateImports.gd')
###
View TwitterLiveFeed.user.js
///<reference types="typed-query-selector"/>
///<reference types="typed-query-selector/parser"/>
///<reference path="./xpath-text-search.d.ts"/>
///<reference types="mousetrap"/>
// ==UserScript==
// @name TwitterLiveFeed
// @author disk0
// @description Force Twitter feed to display latest tweets
// @version 0.2.1
// @run-at document-idle
@disco0
disco0 / hosts
Created Mar 17, 2022 — forked from consti/hosts
/etc/hosts to block shock sites etc.
View hosts
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@disco0
disco0 / playground.js
Created Nov 12, 2021 — forked from calicoday/playground.js
Refactored tree-sitter playground.js
View playground.js
// Dev switch for loading prev state or force canned eg.
let activateSaveState = true;
let showParseCount = true;
// Prelim sample input, drawn from the cli/src/tests/query_test.rs (as-is, excess space).
const eg = {
lang: 'javascript',
code: `
class Person {
// the constructor
@disco0
disco0 / levenshtein_algorithm.lua
Created Nov 5, 2021 — forked from Badgerati/levenshtein_algorithm.lua
An implementation of the Levenshtein distance algorithm in LUA.
View levenshtein_algorithm.lua
-- Returns the Levenshtein distance between the two given strings
function string.levenshtein(str1, str2)
local len1 = string.len(str1)
local len2 = string.len(str2)
local matrix = {}
local cost = 0
-- quick cut-offs to save time
if (len1 == 0) then
return len2
@disco0
disco0 / MandatoryProperties.ps1
Created Oct 23, 2021 — forked from JustinGrote/MandatoryProperties.ps1
A Powershell Class with Mandatory Properties by Default
View MandatoryProperties.ps1
using namespace System.Collections
using namespace System.Management.Automation
using namespace System.ComponentModel.DataAnnotations
using namespace System.Runtime.Serialization
class MandatoryProperties {
MandatoryProperties([IDictionary]$properties) {
$this.GetType().GetProperties([System.Reflection.BindingFlags]'Instance,Public') | ForEach-Object {
$propertyName = $PSItem.Name
[bool]$isOptional = $PSItem.GetCustomAttributes([OptionalFieldAttribute], $true).count -gt 0
if (
@disco0
disco0 / bindkeys.cfg
Last active May 27, 2022
Quake 2021 - Cvar / Command List #gistpad-doc
View bindkeys.cfg
// Modifier/General Function Keys
space
lshift
rshift
lalt
ralt
lctrl
rctrl
tab
enter
View cologler.dev-tools.enable-GM-API-on-console.user.js
///<reference types="tampermonkey"/>
// @ts-check
// ==UserScript==
// @name DevTools - GM API on console
// @name:zh-CN 开发工具:在控制台启用 GM API
// @namespace https://github.com/cologler/
// @version 0.1.0.3
// @description Modified fork of original script <gist.github.com/Cologler/323558e1e55d20b73eadc8a5eb6bebde>
// @description:zh-CN try to take over the world!
@disco0
disco0 / vectorized-atan2f.cpp
Created Aug 18, 2021 — forked from bitonic/vectorized-atan2f.cpp
Vectorized & branchless atan2f
View vectorized-atan2f.cpp
// Branchless, vectorized `atan2f`. Various functions of increasing
// performance are presented. The fastest version is 50~ faster than libc
// on batch workloads, outputing a result every ~2 clock cycles, compared to
// ~110 for libc. The functions all use the same `atan` approximation, and their
// max error is around ~1/10000 of a degree.
//
// They also do not handle inf / -inf
// and the origin as an input as they should -- in our case these are a sign
// that something is wrong anyway. Moreover, manual_2 does not handle NaN
// correctly (it drops them silently), and all the auto_ functions do not