This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This a crude but reasonably effective way of extracting blocks from Terraform/HCL in something like PowerShell. | |
I'm sure there are edge cases that are not covered here but this is handy when you want to parse Terraform configurations en masse. | |
In my particular case I needed to replace all `github_branch_protection` resources with `github_branch_protection_v3` resources due to the current GraphQL implementation of the GitHub Terraform provider causing lengthy Terraform runs. :( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -RunAsAdministrator | |
<# | |
.SYNOPSIS | |
Installs a basic HID UPS monitor that triggers a script in the event of power loss or battery drain. | |
.DESCRIPTION | |
Recently my UPS software (Powermaster) stopped working for my Salicru 850 home after some Windows update knocked it out (Server 2019). | |
I noticed it was still detected as a HID battery device, so I wrote this simple script to trigger a secondary script in the event of power loss. | |
This script creates a permanent event consumer (persists through reboots) to keep an eye on the power status and then trigger a script on either AC Power or battery threshold falling below a certain level. | |
.NOTES | |
This script is quite basic and I am using it in conjuction with Puppet to ensure things get set correctly, I've done my best to adapt it into a gist that hopefully someone will find handy. |