Skip to content

Instantly share code, notes, and snippets.

Avatar
😀

Blake Niemyjski niemyjski

😀
View GitHub Profile
@niemyjski
niemyjski / mac-arm-brew-setup.md
Created Jun 1, 2022
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 Feb 23, 2022
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 Jan 31, 2022
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 Jun 10, 2022
Marlin Ender 3 Pro (SKR Mini 2.0) with Creality Touch (6/9/2022 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 Nov 22, 2021
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 Oct 18, 2021
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 Oct 15, 2021
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
@niemyjski
niemyjski / save-camera-snapshot-notification-on-motion.yaml
Last active Jan 7, 2022
Home Assistant Blueprint - Save a camera snapshot with archive when motion is detected
View save-camera-snapshot-notification-on-motion.yaml
blueprint:
name: Save a camera snapshot when motion is detected
description: Save a camera snapshot with archive when motion is detected
domain: automation
source_url: https://gist.github.com/niemyjski/08c566a4fe64fb2e70998ee4f38c9d1e
input:
motion_sensor:
name: Motion sensor
description: The sensor wich triggers the snapshot creation
selector:
@niemyjski
niemyjski / exceptionless.cs
Last active Dec 15, 2020
Exceptionless Ignore Third Party Exceptions
View exceptionless.cs
// Create our own client instance so we aren't conflicting if anyone else is using exceptionless in an addon.
private readonly ExceptionlessClient _client = new ExceptionlessClient();
_client.Configuration.AddPlugin<IgnoreLicensingAndNonGeneratorExceptionsPlugin>();
[Priority(30)]
private class IgnoreLicensingAndNonGeneratorExceptionsPlugin : IEventPlugin {
private static readonly List<string> _handledNamespaces = new List<string> {
"MyNamespace",
"MyThirdPartyDependencyNamespace"
};