Skip to content

Instantly share code, notes, and snippets.

View niemyjski's full-sized avatar

Blake Niemyjski niemyjski

View GitHub Profile
niemyjski / test.cs
Created March 7, 2024 22:50
.NET always Parsing log formats
public void TestLogLevel()
Log.MinimumLevel = LogLevel.Information;
var logger = Log.CreateLogger("TestLogLevel");
logger.LogTrace("({BadBracket}}", Boolean.TrueString);
Input string was not in a correct format. Failure to parse near offset 10. Format item ends prematurely.
niemyjski / commit-msg
Created March 30, 2023 15:05 — forked from projectpwr/commit-msg
git commit-msg hook to prepend jira ticket number to commit messages...
# hook identifies jira ids in branch names, adds on more goodies if we are a hotifx or release branch and attempts to prevent blank commit messages...although this needs a bit more work...
COMMIT_MSG=$(cat $1)
#First and foremost check whether the commit message is blank. if so then abort the commit. strip any spaces out too
#this one only works at present when someone tries to do git commit -m "" or git commit -m " "
#if anyone uses tools such as sourcetree, then these GUIs typically present a "do you want to commit wihtout a message" and pass in optional attributes to git commit to allow this.
niemyjski / prune.ts
Created March 10, 2023 12:28
Exceptionless Prune
* This function will prune an object to a certain depth and return a new object.
* The following rules will be applied:
* 1. If the value is null or undefined, it will be returned as is.
* 2. If the value is a function or unsupported type it will be return undefined.
* 3. If the value is an array, it will be pruned to the specified depth and truncated.
* 4. If the value is an object, it will be pruned to the specified depth and
* a. If the object is a Circular Reference it will return undefined.
* b. If the object is a Map, it will be converted to an object.
* c. If the object is a Set, it will be converted to an array.
niemyjski /
Last active April 19, 2023 14:07
Arm Mac New Install (Brew)
  • xcode-select --install
  • softwareupdate --all --install --force
  • softwareupdate --install-rosetta --agree-to-license
  • Brew
    • brew install --cask microsoft-teams
    • brew install --cask slack
    • brew install --cask discord
    • brew install --cask iterm2
    • brew install --cask dotnet-sdk
  • brew install --cask google-chrome
#if false
throw null;
unsafe get @event(ref string @as, byte? @throw = sizeof(double))
lock(typeof(get)) {}
niemyjski / automation.yaml
Created February 23, 2022 12:51
Home Assistant: Audio - Normalize levels to 10% at 9pm
alias: Audio - Normalize levels to 10% at 9pm
- platform: time
at: '21:00:00'
- service: media_player.volume_set
volume_level: 0.1
entity_id: media_player.everywhere,
mode: single
niemyjski / App.test.tsx
Created January 31, 2022 18:02
React Exceptionless Jest Mock (Jest doesn't yet support esm modules).
import { ClassAttributes, HTMLAttributes } from "react";
jest.mock("@exceptionless/react", () => {
return {
__esModule: true,
Exceptionless: {
startup: jest.fn()
ExceptionlessErrorBoundary: (props: JSX.IntrinsicAttributes & ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement>) => {
return <div {...props} />;
niemyjski / Configuration.h
Last active February 5, 2023 17:17
Marlin Ender 3 Pro (SKR Mini 2.0) with Creality Touch (2/5/2023 bugfix-2.1.x) based on and other config for cr touch
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware []
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
niemyjski / Mark500ErrorsAsCritical.cs
Created November 22, 2021 14:19
Exceptionless Mark 500 Errors as critical
public class Mark500ErrorsAsCritical : IEventPlugin {
public void Run(EventPluginContext ctx) {
if (!String.Equals(ctx.Event.Type, Event.KnownTypes.Error))
if (ctx.ContextData.IsUnhandledError)
niemyjski / Ignore404sFromNonUsers.cs
Created October 18, 2021 14:14
Exceptionless Ignore 404 from non users
public class Ignore404sFromNonUsers : IEventPlugin {
public void Run(EventPluginContext ctx) {
if (!String.Equals(ctx.Event.Type, Event.KnownTypes.NotFound))
// Ignore any 404 that doesn't have user info.
ctx.Cancel = !ctx.Event.Data.ContainsKey(Event.KnownDataKeys.UserInfo);