Skip to content

Instantly share code, notes, and snippets.

View stopthatastronaut's full-sized avatar

Jason Brown stopthatastronaut

View GitHub Profile
@stopthatastronaut
stopthatastronaut / USB MIDI Interface.json
Created April 21, 2023 07:10
Yamaha DTXPlorer Melodics JSON config
{
"controls_image": "",
"filters": [
],
"inputs": [
{
"channel": 1,
"events": [
{
"message": "hihatposition",
@stopthatastronaut
stopthatastronaut / gist:0dfa0dcde4ed8e306bf7126e22b3abb3
Created February 3, 2021 05:17
powershell/git: Have files changed in subfolders?
Get-ChildItem -Directory | ForEach-Item {
$folder = $_.Name
$LATEST_COMMIT = $(git rev-list -n 1 --no-merges HEAD)
$FOLDER1_COMMIT = $(git log -1 --format=format:%H --full-diff ./${folder}/)
Write-Output $folder
Write-Output "latest commit $LATEST_COMMIT"
Write-Output "folder commit $FOLDER1_COMMIT"
@stopthatastronaut
stopthatastronaut / gist:d0cf0be0e0cf14bcd585c8601b4b5f54
Created February 1, 2021 00:40
(Truncated) gist for terraform azurerm_monitor_alert issue
azurerm_monitor_activity_log_alert.main: Creating...
2021/02/01 11:38:15 [DEBUG] EvalApply: ProviderMeta config value set
2021/02/01 11:38:15 [DEBUG] azurerm_monitor_activity_log_alert.main: applying the planned Create change
2021-02-01T11:38:15.851+1100 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: [DEBUG] AzureRM Request:
2021-02-01T11:38:15.851+1100 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: GET /subscriptions/b080ddce-e747-4026-98bb-fa27f98d0ab5/resourceGroups/example-resources/providers/microsoft.insights/activityLogAlerts/example-activitylogalert?api-version=2017-04-01 HTTP/1.1
2021-02-01T11:38:15.851+1100 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Host: management.azure.com
2021-02-01T11:38:15.851+1100 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: User-Agent: Go/go1.12.6 (amd64-darwin) go-autorest/v13.3.0 Azure-SDK-For-Go/v38.1.0 insights/2019-06-01 HashiCorp Terraform/0.14.5 (+https://www.terraform.io) Terraform Plugin SDK/1.6.0 terraform-provider-azurerm/2.0.0 pid-2
@stopthatastronaut
stopthatastronaut / gist:be67e94f0bbfcdfea5a9b50bb8f9a1d2
Created May 1, 2018 00:36
Get-SpongeBob. A powershell snippet for quick transposed caps spongebob memeification
# http://knowyourmeme.com/memes/mocking-spongebob
#
# This snippet lives in my profile for quick access
Function Get-Spongebob
{
[CmdletBinding()]
param
(
@stopthatastronaut
stopthatastronaut / CollisionChance.ps1
Created March 6, 2018 05:01
PowerShell Collision Calculator, aka "The Birthday Problem"
# Birthday Problem aka Birthday Paradox.
# Calculates probability of a collision in a given range of random values
# uses a coarse approximation from
# https://en.wikipedia.org/wiki/Birthday_problem#Approximations
Function Get-CollisionChance
{
param($range, $repetitions)
$d = [double]$range
@stopthatastronaut
stopthatastronaut / Install-ARR.ps1
Created June 14, 2017 03:34
Install URLRewrite and Application Request Routing
$downloadUrl = "http://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi"
$downloadtarget = ([uri]$downloadUrl).segments | select -last 1
Invoke-WebRequest $downloadUrl -OutFile $env:tmp\$downloadtarget
Start-Process $env:tmp\$downloadtarget '/qn' -PassThru | Wait-Process
Set-Location ($env:ProgramFiles + "\Microsoft\Web Platform Installer")
.\WebpiCmd.exe /Install /Products:'UrlRewrite2,ARRv3_0' /AcceptEULA /Log:$env:tmp\WebpiCmd.log
@stopthatastronaut
stopthatastronaut / dlfiles.ps1
Created June 7, 2017 04:39
Download files from an array of URLs
# Here's our array of files
$files = @(
"https://download.octopusdeploy.com/octopus/Octopus.3.13.9-x64.msi",
"https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.13.9-x64.msi",
"https://download.octopusdeploy.com/octopus/Octopus.3.13.10-x64.msi",
"https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.13.10-x64.msi"
# etctera
)
# loop through the array, extract the filename using uri segments, download the file
# gets past a problem in Invoke-WebRequest which causes issues with UTF-8 Responses (such as those from raw.githubusercontent.com)
Function Invoke-UTF8WebRequest
{
# based loosely on https://gist.github.com/angel-vladov/9482676
param($uri)
[Net.HttpWebRequest]$req = [Net.WebRequest]::Create($Uri)
[Net.HttpWebResponse]$res = $req.GetResponse()
$sr = [IO.StreamReader]::new($res.GetResponseStream())
$body = $sr.ReadToEnd()
@stopthatastronaut
stopthatastronaut / Get-R53ResourceRecordList
Created May 25, 2017 02:12
Get-R53ResourceRecordList
# Gets all Route53 DNS records for the requested Zone
Function Get-R53ResourceRecordList
{
[CmdletBinding()]
param
(
[ValidateScript(
{
$_ -like "*."