Skip to content

Instantly share code, notes, and snippets.

View baronfel's full-sized avatar

Chet Husk baronfel

View GitHub Profile
@baronfel
baronfel / update-npc-actors.js
Created August 31, 2024 15:32
Update NPC Actors to work with WBHarry/pf2e-bestiary-tracking's NPC Tracker
// Change this to whatever makes sense for your layout.
// For me, I have only a top-level of folders that I put all of the current NPCs into, so a simple single-level traversal works great.
let npcFolders =
game.actors.apps[0].folders.filter(f => f.name === "Classmates" || f.name === "Faculty");
// dig into the folders chosen and make a single array of all actors in them
let npcs =
npcFolders.flatMap(f => f.contents);
@baronfel
baronfel / initialize.json
Created August 20, 2024 22:10
Sample VSCode Initialize call for FSAutoComplete
{
"processId": 21092,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.92.2"
},
"locale": "en",
"rootPath": "e:\\Code\\FsAutoComplete",
"rootUri": "file:///e%3A/Code/FsAutoComplete",
"capabilities": {
#! /bin/python3
from dataclasses import dataclass
from os import walk, stat
from os.path import join
from typing import Dict
sdk_dir="/mnt/c/Program Files/dotnet/sdk/9.0.100-preview.3.24204.13"
@dataclass
@baronfel
baronfel / main.rs
Created May 10, 2024 15:41
Clap example showing multiple options with multiple tokens per opsion
use clap::Arg;
use clap::ArgAction;
use clap::Command;
fn main() {
let cmd = Command::new("hello").arg(
Arg::new("name")
.long("name")
.num_args(1..) // allow multiple tokens
.action(ArgAction::Append), // when you get multiple tokens, jam them together into a Vec (List to us)
@baronfel
baronfel / study.js
Last active April 6, 2024 17:45
Pf2e Study action replacement
// built off of the data put in place by the magaambya-study-helper module
function getFlags(actor) {
return actor.getFlag('magaambya-study-helper', 'branch-data');
}
function updateFlags(actor, data) {
actor.setFlag('magaambya-study-helper', 'branch-data', data);
}
function slugify(str) {
return game.pf2e.system.sluggify(str);
@baronfel
baronfel / spec.md
Last active March 27, 2024 18:53
.NET SDK Compound Templates

Core Idea

Allow templates to easily orchestrate the invocation of other templates by name/id, making multi-project and multi-item templates easier to keep up to date, and factoring out subsets of currently-giant templates into maintainable chunks.

Motivating Examples

  • A JS API with a corresponding .NET Backend
  • A Library project, a console project, and a test project
@baronfel
baronfel / terminal-logger-progress.md
Last active March 28, 2024 15:57
Speclet for terminallogger progress

Progress speclet

  • allows to specify the progress of the task
  • allows describing the overall operation
  • allows describing the 'instant' state
  • allows determinate status (x/y)
  • allows indeterminate status

Example API usage:

@baronfel
baronfel / gist:12386b8961b0324b1ee8697d10554eee
Created September 20, 2023 15:32
.NET CLI command for cross-platform AOT
# the nuget.config is needed to get nightly feeds, since the 'nightly' container is also using rc2 builds of sdk/runtime ahead of release
# the docker socket and docker binary are needed to light up the SDK tooling
# the nightly base image is needed because the -aot SDK images are only present there
# the explicit ContainerBaseImage is because SDK base image inference doesn't know about the 'nightly' feeds pattern
docker run --rm -it \
-v $(pwd):/source \
-v $(pwd)/../../nuget.config:/source/nuget.config \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/bin/docker:/usr/bin/docker \
-w /source \
@baronfel
baronfel / CliFlag.fs
Last active September 18, 2023 17:42
System.CommandLine Flag variant
module CliFlag
open System
open System.CommandLine
open System.CommandLine.Parsing
type CliFlag<'t> =
inherit CliOption<'t>
val private enabledFlagName: string
val private disabledFlagName: string
@baronfel
baronfel / pinkcatme.json
Created July 27, 2023 22:11
Windows Terminal version of the pinkcatme theme for KDE
{
"background": "#FFEAF1",
"black": "#666666",
"blue": "#B39FD6",
"brightBlack": "#000000",
"brightBlue": "#8966D6",
"brightCyan": "#3CB4EB",
"brightGreen": "#85D468",
"brightPurple": "#DF81CB",
"brightRed": "#F02070",