Skip to content

Instantly share code, notes, and snippets.

View Varriount's full-sized avatar

Clay Sweetser Varriount

View GitHub Profile
@Varriount
Varriount / Export-Certificates.ps1
Created July 19, 2024 20:34
PowerShell script to export certificates from Window's Certificate Store (to WSL)
# Prompt user for a pattern
$pattern = Read-Host "Enter the regular expression to search for in the certificate subject"
# Get the certificates matching the pattern.
$certificates = Get-ChildItem -Recurse Cert:\LocalMachine\ `
| Where-Object PSIsContainer -eq $false `
| Where-Object Subject -cmatch $pattern
# Check if any certificates match the pattern.
if ($certificates.Count -eq 0) {
@Varriount
Varriount / cross-compile-gdb.sh
Last active May 12, 2024 22:07
Script to cross-compile GDB for Windows
# NOTES
# - Credit goes to @adamrehn for https://github.com/adamrehn/gdb-multiarch-windows,
# which much of this script is based upon.
# - `texinfo` may need to be installed on your system, otherwise the GDB
# build process may fail.
# - If any of the build processes fail due to problems such as missing
# dependencies, the entire build directory must usually be wiped, even if
# `configure` completed successfully. Otherwise `configure` and `make` will
# used cached information (and not pick up on any fixes).
bash set -euo pipefail
@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();