Skip to content

Instantly share code, notes, and snippets.

@mitch-b
mitch-b / FormatSupportHandler.cs
Last active August 29, 2015 14:12
Verbose JSON for v2 from Web API v1-3 OData
using System;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.Http.Hosting;
namespace OData_v3_Demo.Helpers
{
/// <summary>
/// Built with assistance from https://gist.github.com/raghuramn/5556691#file-dollarformathandler-cs-L42
@mitch-b
mitch-b / OpenUI5_JSBin_Template.html
Last active August 29, 2015 14:25
Starting point for a JS Bin example for OpenUI5
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>UI5 JSBin Template</title>
<script id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
@mitch-b
mitch-b / test.js
Created April 28, 2017 20:24
Quick Gist
var array1 = [1,2,3];
var array2 = [1,2,3];
var isJavaScriptCrazy = true;
if (array1 === array2 || array1 == array2) {
isJavaScriptCrazy = false;
}
if (isJavaScriptCrazy) {
console.log('Indeed...');
}
@mitch-b
mitch-b / AssociateHybridConnections.ps1
Created June 8, 2017 13:18
Associate existing Hybrid Connections to Azure Web App with PowerShell
<#
AssociateHybridConnections
#>
param
(
[string] $webAppName,
[string] $relayName,
[string] $region,
[string] $webAppResourceGroup,
@mitch-b
mitch-b / .editorconfig
Last active December 19, 2018 14:36
C# Projects .editorconfig
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@mitch-b
mitch-b / Help.md
Created June 23, 2019 12:46
Windows Terminal
@mitch-b
mitch-b / windows-self-elevating-powershell-script.ps1
Last active September 24, 2019 14:54
Self-Elevating PowerShell Script Snippet
# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
# TODO stuff
@mitch-b
mitch-b / settings.json
Last active August 2, 2020 19:50
Windows Terminal Settings
// This file was initially generated by Windows Terminal (Preview) 1.0.1402.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@mitch-b
mitch-b / automations.yaml
Created November 18, 2023 03:06 — forked from RandomArray/automations.yaml
Home Assistant automation to randomly cycle through all WLED effects on a set interval
# Modified from examples found here: https://community.home-assistant.io/t/wled-script-to-alternate-between-effects-every-5-minutes/227553/39
# List of all effects: https://github.com/Aircoookie/WLED/wiki/List-of-effects-and-palettes
alias: WLED Cycle Random Effects
description: Sets WLED to random effect from list on interval while WLED remains on.
trigger:
- platform: device
type: turned_on
device_id: 94b3087d775f6f1a48286fc1e0230d6a # update to match device_id
entity_id: light.wled # update to match entity_id
domain: light
@mitch-b
mitch-b / reset_chores.yaml
Created January 23, 2024 01:33
Home Assistant Reset Chore Automation
# instead of specifying all chores that need to be reset, this can find any input_boolean that is prefixed with 'chore_' to turn off
alias: Reset Chores
description: ""
trigger:
- platform: time
at: "01:00:00"
condition: []
action:
- service: homeassistant.turn_off