Skip to content

Instantly share code, notes, and snippets.

View Varriount's full-sized avatar

Clay Sweetser Varriount

View GitHub Profile
// 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
import json
import mechanize
import os
import re
import sys
from getpass import getpass
# Inputs
USERNAME = os.environ.get("FOUNDRY_USERNAME") or input("Username?")
(function (flipX=true, flipY=true){
// Note, Wall PlaceableObjects
const walls = canvas.walls.controlled;
if (walls.length === 0){
return;
}
let xBounds = [walls[0].data.c[0], walls[0].data.c[2]];
let yBounds = [walls[0].data.c[1], walls[0].data.c[3]];
@Varriount
Varriount / mousekeys.ahk
Created February 1, 2021 02:31
AutoHotkey script to control the keyboard via the mouse.
; MIT License
;
; Copyright (c) 2020 Clay Sweetser
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
@Varriount
Varriount / generate_fixture_pattern.py
Created January 14, 2021 08:09
Sample fixture generator pattern.
"""
Sample fixture pattern for data generation.
Note that this is merely a pattern, not a complete implementation.
Provides two fixtures:
- A `pet_generator` fixture that allows a test to generate arbitrary pets.
- A `pet` fixture that represents a single pet.
Both fixtures clean up resources.
type
OneType = object
fieldA: string
TwoType = ref object
{.genProcedures.}
fieldB: int
type
OneType = object
fieldA: string
TwoType {.genProcedures.} = ref object
fieldB: int
_dsl = regexes.to_regex(r"""
(?(DEFINE)
# Divider for syntactical elements
(?P<syntax_edge> \s+ )
# Divider for statements
(?P<statement_edge> (?:
# A syntax edge
(
**syntax_edge