Skip to content

Instantly share code, notes, and snippets.

@rquackenbush
rquackenbush / az_cli.sh
Last active August 25, 2025 18:11
git shortcuts
# Get the lock information for a remote storage blob
az storage blob show --blob-url https://datalabterraformdev.blob.core.windows.net/dlreg-dev-eastus2-01/common.tfstate --auth-mode=login --query metadata.Terraformlockid --output tsv | base64 -d
@rquackenbush
rquackenbush / _README.md
Last active August 20, 2025 16:42
Complex map reduction

Complex map reduction in terraform

This example takes a list of objects, and builds a dictionary of the attributes from that list of objects into a single, flat map(strig).

References

@rquackenbush
rquackenbush / Notifer.cs
Created July 28, 2025 22:54
Simple notification framework to let interested parties know that something has happened in a decoupled way.
using System.Collections.Concurrent;
namespace TheNotifer;
internal class NotificationSource : IDisposable
{
private bool _disposed;
private readonly ConcurrentDictionary<IDisposable, Subscription> _notifications = new ConcurrentDictionary<IDisposable, Subscription>();
@rquackenbush
rquackenbush / terraform output
Created December 19, 2024 00:56
terraform output
rquackenbush@REMRXQ015570:/mnt/c/scratch/TerraformPasswordRotateRepo$ terraform apply
2024-12-18T19:50:44.320-0500 [INFO] Terraform version: 1.10.2
2024-12-18T19:50:44.320-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.70.0
2024-12-18T19:50:44.320-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.23.0
2024-12-18T19:50:44.320-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-12-18T19:50:44.320-0500 [DEBUG] using github.com/zclconf/go-cty v1.15.1-0.20241111215639-63279be090d7
2024-12-18T19:50:44.320-0500 [INFO] Go runtime version: go1.23.3
2024-12-18T19:50:44.320-0500 [INFO] CLI args: []string{"terraform", "apply"}
2024-12-18T19:50:44.320-0500 [DEBUG] Attempting to open CLI config file: /home/rquackenbush/.terraformrc
2024-12-18T19:50:44.320-0500 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
@rquackenbush
rquackenbush / Explicit.cs
Created May 28, 2024 11:35
CosmosDB / Gremlin Snippets
[Fact]
public async Task Explicit()
{
var twinId = Guid.NewGuid().ToString();
var requestScript = $"g.addV('twin').property('id', '{twinId}').property('partitionKey', '{twinId}').property('Prop1', 'SomeValue').property('Prop2', 42)";
var results = await _client.SubmitAsync<IDictionary<string, object>>(requestScript: requestScript);
var result = results.SingleOrDefault();
@rquackenbush
rquackenbush / endersgame1.printer.cfg
Last active December 27, 2023 05:15
Klipper config for Creality Ender 3 - v4.2.7 with BLTouch wired to the 5 pin connector
[include moonraker_obico_macros.cfg]
# This file contains pin mappings for the Creality "v4.2.7" board. To
# use this config, during "make menuconfig" select the STM32F103 with
# a "28KiB bootloader" and serial (on USART1 PA10/PA9) communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
@rquackenbush
rquackenbush / end.gcode
Last active October 29, 2023 03:51
Ender 3 Custom GCode Prusa Slicer
M104 S0 ; turn off hot end temperature
M140 S0 ; turn off bed temp
; To avoid the Z axis crashing into the print
; https://github.com/MarlinFirmware/Marlin/issues/5652#issuecomment-270745225
G92 Z0 ; fake z home
G1 Z5 ; raise Z up a bit
; G1 Y190 F5000 ; get bed forward
G28 X0 ; home X axis
@rquackenbush
rquackenbush / generate-pfx.sh
Created July 24, 2023 18:34
Generate PFX Cert
# Create a new key / certificate signing request
openssl req -new -newkey rsa:4096 -nodes -keyout snakeoil.key -out snakeoil.csr
# Set CN (common name) to "localhost"
openssl x509 -req -sha256 -days 365 -in snakeoil.csr -signkey snakeoil.key -out snakeoil.pem
# Export the pfx
openssl pkcs12 -export -in snakeoil.pem -inkey snakeoil.key -out snakeoil.pfx
@rquackenbush
rquackenbush / autorest.md
Created May 24, 2023 19:12
Autorest directive that sets the description
directive:
- from: openapi-document
  where: '$.paths["/health/startup"].get'
  debug: true
  transform: |
    $.responses["200"].description = "Startup Health check";
- from: openapi-document
  where: '$.paths["/health/ready"].get'
 debug: true
@rquackenbush
rquackenbush / CashOrMaterialize.cs
Created January 5, 2023 18:53
Take an IEnumerable<T> and cast to IList<T> (if possible), otherwise materialize the list with .ToList()
namespace ConsoleApp1
{
public static class IEnumerableExtensions
{
public static IList<T> CastOrMaterializeList<T>(this IEnumerable<T> source)
{
if (source is IList<T>)
return (IList<T>)source;
return source