Skip to content

Instantly share code, notes, and snippets.

@mitch-b
mitch-b / Rename-DirFiles.ps1
Last active June 23, 2025 17:59
PowerShell script to rename files/folders/contents
param (
[string]$Find,
[string]$Replace
)
# iwr "https://gist.githubusercontent.com/mitch-b/4a18d1a96a5d763cf3436174a616edc0/raw/Rename-DirFiles.ps1" -Out "$HOME\Rename-DirFiles.ps1"; powershell -ep Bypass -f "$HOME\Rename-DirFiles.ps1" -Find "Old" -Replace "New"
function Show-Header {
Write-Host ""
Write-Host "╔══════════════════════════════════════════════════╗" -ForegroundColor Magenta
@mitch-b
mitch-b / clear-binobj.ps1
Created February 21, 2025 22:19
Clear bin/obj Folders
Get-ChildItem -Path . -Include bin,obj -Directory -Recurse | Remove-Item -Recurse -Force
@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
@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 / 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 / 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 / .editorconfig
Last active April 1, 2025 00:32
C# Projects .editorconfig
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = false
trim_trailing_whitespace = true
quote_type = double
@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 / 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...');
}