Skip to content

Instantly share code, notes, and snippets.

View nguerrera's full-sized avatar

Nick Guerrera nguerrera

View GitHub Profile
@nguerrera
nguerrera / SamplePR.md
Last active August 24, 2026 15:49
AI PR description sample

Written by Claude

A UniFi OS console exports its settings only as an encrypted .unifi backup, which until now meant screenshots. This adds a skill that decodes one offline into redacted, diffable config under config/, with no browser, SSH, or API call to the console.

The format is a 16-byte IV, then AES-256-CBC/NoPadding under a key that is the same in every UniFi OS console, then gzip, then tar. The .unf tooling that exists does not touch it, and the one browser tool that claims .unifi support is closed; its key was read out of the JavaScript it ships to the browser and confirmed on a real backup with openssl. The key unlocks the archive framing every console shares and carries nothing private.

.claude/skills/unifi-config/unifi_config.py decrypts a dropped backup in memory, decodes the Network application's MongoDB dump, and writes one JSON file per collection. It redacts four ways: by field name (UniFi's own x_ prefix, plus passphrases, keys, tokens, and SIM identifiers), by opaque-token

@nguerrera
nguerrera / SampleNote.md
Last active August 24, 2026 14:58
AI notes sample

Written by Claude

aurora -- Minisforum UM870 Slim

Ordered from Amazon 2026-08-01 at $699, arrived 2026-08-04, and read off the machine 2026-08-06 under the Windows it shipped with. The boost clock, the sustained power, the noise and chassis figures, the adapter, the warranty and the port list stay from the Amazon and Newegg listings, since no command reaches them.

Make friendly client names

directive:
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].post.responses["200"].schema
    transform: >
      $["x-ms-client-name"] = "content";
  - from: swagger-document
    where: $.paths["/$schemagroups/{group-name}/schemas/{schema-name}"].post.responses["200"].headers["X-Schema-Type"]
Csc
Assembly = C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll
CommandLineArguments = C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Roslyn\csc.exe /nowarn:1701,1702,219,162 /reference:C:\Users\nicholg\Desktop\Test_ALC\CL.Interface\bin\Debug\netstandard2.0\CL.Interface.dll /reference:C:\Users\nicholg\.nuget\packages\microsoft.xmlserializer.generator\2.2.0-preview3.19551.4\lib\netstandard2.0\dotnet-Microsoft.XmlSerializer.Generator.dll /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\Microsoft.CSharp.dll" /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\Microsoft.VisualBasic.Core.dll" /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\Microsoft.VisualBasic.dll" /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\Microsoft.Win32.P
@nguerrera
nguerrera / VersionCompare.proj
Created April 4, 2019 01:00
Fun with msbuild version comparison
<Project>
<Target Name="Demo">
<Message Condition="4.5.10 > 4.5.9" Text=":) Yay, 3 parts work!" Importance="High" />
<Message Condition="2.9 > 2.10" Text=":( Wait, those are version numbers!" Importance="High" />
</Target>
</Project>
@nguerrera
nguerrera / CountPlaceholders.cs
Created July 24, 2018 21:09
Counting placeholders
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine(CountPlaceholders("{0,3} {1:x} {{2}}"));
}
static int CountPlaceholders(string format)
@nguerrera
nguerrera / run-devenv-for-core-setup.cmd
Last active July 5, 2018 21:36
Make Test Explorer work in core-setup
:: this makes test explorer work, replace d:\src\core-setup with path to enlistment.
:: Found the env vars by running build -MsBuildLogging=/bl, then look at the Exec task in RunTest target
@setlocal
set NUGET_PACKAGES=D:\Src\core-setup\packages/
set TEST_ARTIFACTS=D:\Src\core-setup\Bin\tests\win-x64.Debug\
set TEST_TARGETRID=win-x64
set BUILDRID=win-x64
set BUILD_ARCHITECTURE=x64
set BUILD_CONFIGURATION=Debug
using System;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
class Program
{
static void Main()
{
using (var pe = new PEReader(...))
@nguerrera
nguerrera / gitconfig.ini
Created March 6, 2018 18:46
Git config to prevent pushing to unwanted places
; safety net to enforce fork -> upstream flow
[url "Don't push here. Fork and send PR."]
pushinsteadof = https://github.com/dotnet/
pushinsteadof = https://github.com/microsoft/
static void OpenEmbeddedResources(string path)
{
using (var peStream = File.OpenRead(path))
using (var peReader = new PEReader(peStream))
{
var mdReader = peReader.GetMetadataReader();
foreach (var resourceHandle in mdReader.ManifestResources)
{
var resource = mdReader.GetManifestResource(resourceHandle);