Skip to content

Instantly share code, notes, and snippets.

View jbrzozoski's full-sized avatar

jbrzozoski

View GitHub Profile
@jbrzozoski
jbrzozoski / json2yaml
Last active January 12, 2024 20:43
Minimal JSON-to-YAML converter with smarter multi-line handling
#!/usr/bin/env python3
"""
Convert a JSON file to a YAML file
"""
import sys
import json
import ruamel.yaml as yaml
@jbrzozoski
jbrzozoski / view_textconv
Last active February 27, 2023 20:09
Script to use as a textconv tool for Ignition view.json files under git
#!/usr/bin/env python3
"""
Utility script to help diff/log Perspective view.json files under git.
The git "textconv" feature is intended to convert binary files to a
rough text approximation, so that viewing diffs or logs of those files
will provide an idea of what changed. This script can be used as a
textconv on Ignition Perspective view.json files to extract JSON-encoded
script blocks into something that almost resembles proper Python
@jbrzozoski
jbrzozoski / pwtest.sh
Created March 3, 2019 02:43
Simple bash script to safely check passwords against the pwnedpasswords.com API
#!/bin/bash
# Get a password from the user...
while read -s -p "Enter password to check or Ctrl-C to quit: " pass2check
do
# Output a blank line to clean up output...
echo
# Get the SHA1 of the entered password...
sha1sum_output=`echo -n ${pass2check} | sha1sum`
RegEdit tweaks circa Win10 22H2:
- Set RTC to UTC (if dual-booting Linux)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
DWORD RealTimeIsUniversal = 1
(may act flaky if you don't disable auto-timezone and auto-sync first, although it sometimes seems
okay to turn them back on after rebooting with this setting in place?)
- Disable Cortana
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search

This is ultra-low-priority junk I had stuck in my head last night, and I figured writing it all down might be the best way to stop thinking about it.

One of the issues with Sparkplug B is support for systems with multiple application nodes. Specifically, in terms of coordinating BIRTH messages.

These thoughts are not compatible with Sparkplug B, but are still interesting, possibly for a future generation... I'm trying to think them through before badgering people on the committee with them.

I'm contemplating what happens if you split the variable and non-variable portions of the NBIRTH into two messages, publishing the non-variant portion persistently, and using the LWT to both announce the node has gone offline and clear the persistent publish.

Let's call the new persistent topic NSCHEMA.

@jbrzozoski
jbrzozoski / git-lt
Last active January 6, 2022 14:56
Script to list annotated tags on the CLI with git in a nicely formatted manner
#!/bin/bash
# Get all the annotated tag references
refs=$(git for-each-ref --format="%(if:equals=tag)%(objecttype)%(then)%(refname:short)%(end)" refs/tags)
# Review those to find the longest reference name
refs_as_list=(${refs})
let longest_ref=0
for i in "${refs_as_list[@]}"
do
#!/usr/bin/env python3
from functools import lru_cache
@lru_cache(maxsize=1024)
def combinations(beads, low_points):
if low_points == 1:
return 1
return sum(combinations(n, (low_points - 1)) for n in range(0, (beads + 1)))
# Regeneratable SlickEdit Files
*.vtg
*.vpwhist
*.vpwhistu
@jbrzozoski
jbrzozoski / linux_gitconfig
Created January 28, 2021 18:36
My gitconfig template to make setting up new linux machines a little quicker
[user]
name = Set Name
email = set.email@example.com
[branch]
autosetuprebase = always
[core]
autocrlf = input
editor = nano
excludesfile = ~/.gitignore
[branch]
@jbrzozoski
jbrzozoski / gsmtime.c
Last active December 6, 2020 05:28
GSM Time to Unix
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#ifndef TM_YEAR_BASE
#define TM_YEAR_BASE 1900
#endif
#ifndef GSM_YEAR_BASE
#define GSM_YEAR_BASE 2000