Skip to content

Instantly share code, notes, and snippets.

Avatar
😀

Blake Niemyjski niemyjski

😀
View GitHub Profile
@niemyjski
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...
View commit-msg
#!/bin/sh
# 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_FILE=$1
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 prompt...eg. "do you want to commit wihtout a message" and pass in optional attributes to git commit to allow this.
@niemyjski
niemyjski / prune.ts
Created March 10, 2023 12:28
Exceptionless Prune
View prune.ts
/**
* 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
niemyjski / mac-arm-brew-setup.md
Last active April 19, 2023 14:07
Arm Mac New Install (Brew)
View mac-arm-brew-setup.md
  • 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
View ugly.cs
#if false
throw null;
#else
#endif
unsafe get @event(ref string @as, byte? @throw = sizeof(double))
{
lock(typeof(get)) {}
try
@niemyjski
niemyjski / automation.yaml
Created February 23, 2022 12:51
Home Assistant: Audio - Normalize levels to 10% at 9pm
View automation.yaml
alias: Audio - Normalize levels to 10% at 9pm
trigger:
- platform: time
at: '21:00:00'
action:
- service: media_player.volume_set
data:
volume_level: 0.1
entity_id: media_player.everywhere,media_player.kitchen
mode: single
@niemyjski
niemyjski / App.test.tsx
Created January 31, 2022 18:02
React Exceptionless Jest Mock (Jest doesn't yet support esm modules).
View App.test.tsx
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
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 https://www.reddit.com/r/3Dprinting/comments/n7or5u/marlin_20x_guide_skr_mini_e3_v20_ender_3/ and other config for cr touch
View Configuration.h
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* 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
niemyjski / Mark500ErrorsAsCritical.cs
Created November 22, 2021 14:19
Exceptionless Mark 500 Errors as critical
View Mark500ErrorsAsCritical.cs
[Priority(100)]
public class Mark500ErrorsAsCritical : IEventPlugin {
public void Run(EventPluginContext ctx) {
if (!String.Equals(ctx.Event.Type, Event.KnownTypes.Error))
return;
if (ctx.ContextData.IsUnhandledError)
ctx.Event.Tags.Add(Event.KnownTags.Critical);
}
}
@niemyjski
niemyjski / Ignore404sFromNonUsers.cs
Created October 18, 2021 14:14
Exceptionless Ignore 404 from non users
View Ignore404sFromNonUsers.cs
ExceptionlessClient.Default.Configuration.AddPlugin<Ignore404sFromNonUsers>();
[Priority(100)]
public class Ignore404sFromNonUsers : IEventPlugin {
public void Run(EventPluginContext ctx) {
if (!String.Equals(ctx.Event.Type, Event.KnownTypes.NotFound))
return;
// Ignore any 404 that doesn't have user info.
ctx.Cancel = !ctx.Event.Data.ContainsKey(Event.KnownDataKeys.UserInfo);
@niemyjski
niemyjski / docker-compose.yml
Last active October 15, 2021 02:36
Home Assistant Portainer docker-compose for double-take & compreface
View docker-compose.yml
version: '3.7'
volumes:
double-take:
postgres-data:
services:
double-take:
container_name: double-take
image: jakowenko/double-take:1.4.1