Skip to content

Instantly share code, notes, and snippets.

View Varriount's full-sized avatar

Clay Sweetser Varriount

View GitHub Profile
@findstr/v "^@f.*&" "%~f0" | powershell -NoProfile -ExecutionPolicy Bypass - & pause & goto:eof
# The above line allows running this file as a batch file, to overcome the
# need for execution policy changes.
# Note, when making changes to this script, testing needs to be done under the
# version of PowerShell that comes with Windows (PowerShell v5), as that is
# what most users will have access to.
# ## Constants ## #
$OUT_FILE_PATH = "${env:temp}\BG3 Installation Data.txt"
@Varriount
Varriount / sort_terms.py
Created October 3, 2023 20:38
Sort terms based on word and character similarity
import codecs
import sys
from editdistance import eval as distance
from pprint import pprint
import re
def sort_phrases(phrase_list):
result = []
result.append(phrase_list.pop())
@Varriount
Varriount / small_ghidra_functions.py
Created September 30, 2023 00:18
Small Python snippet to find small functions in Ghidra (to mark as inline)
TARGET_FUNCTION_PREFIXES = [
'FUN_', # Default prefix for functions found by Ghidra
'f_p__', # CUSTOM_AUTO_FUNC_PREFIX
'f_p__TS__', # CUSTOM_AUTO_THREAD_FUNC_PREFIX
]
from pprint import pprint
cp = currentProgram
// language=Handlebars
const RAW_CLASS_TEMPLATE = `
class SettingsClass extends {{baseClassName}} {
namespace = {{toStringLiteral namespace}}
//// Private Methods ////
static _register() {
{{#each settings as | setting |}}
game.settings.register(
this.namespace,
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action import ActionBase
# Load the display handler to send logging to CLI or relevant display mechanism
try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
@Varriount
Varriount / .env
Created February 11, 2022 20:29
Using Docker Compose's `.env` File to Automatically Use Multiple Compose Files.
COMPOSE_FILES=this.yaml:that.yaml
async function setElevation(value) {
// Scenarios:
// - Tokens are selected, hovered token is undefined.
// - Set elevation of selected tokens.
// - Tokens are selected, hovered token is in selection.
// - Set elevation of selected tokens.
// - Tokens are selected, hovered token is not in selection.
// - Set elevation of hovered token.
// - No tokens are selected, hovered token is undefined.
// - Do nothing
// let realRawData = `...`
// Note: The following code uses inconsistant processing strategies for the purposes of example.
{
//// Utility Functions ////
const querySelectorAll = (node, expr) => node.querySelectorAll(expr);
const querySelector = (node, expr) => node.querySelector(expr);
function* queryXPathAll(node, expr) {
const evaluator = new XPathEvaluator();
@Varriount
Varriount / docker-compose.yaml
Created December 28, 2021 00:09
Docker Compose Anchor Bug Example
# Will error with "yaml: did not find expected alphabetic or numeric character"
x-test-service-image: &test-service.image "ubuntu"
services:
test-service:
image: *test-service.image
command: bash -c 'echo hello world; sleep 30'
from dataclasses import dataclass, fields, asdict
from json import dumps
@dataclass
class Foo:
a: int
b: str