Skip to content

Instantly share code, notes, and snippets.

View veleek's full-sized avatar

Ben Randall veleek

View GitHub Profile
blueprint:
name: Z-Wave Secondary Light Control
description: 'Toggle an light using a Z-Wave event. This can be used to activate a different light than the one the
switch is wired to when it is double clicked.'
domain: automation
input:
control_switch:
name: Control Switch
description: The switch that will control the light when double-clicked.
selector:
public class Solution
{
public IList<int> FindNumOfValidWords(string[] words, string[] puzzles)
{
// Create a tree with all the words
var root = Node.PopulateWords(words);
int[] result = new int[puzzles.Length];
for (var i = 0; i < puzzles.Length; i++)
{
@veleek
veleek / MigrateTerragruntToTerraform.ps1
Last active April 12, 2023 13:43
Migrate a set of resources from terragrunt folders into a single terraform state with multiple modules.
<#
This is a script that scrapes terraform for a set of terragrunt folders and extracts all the resources to
generate a set of `terraform import` statements that can be used to import the existing state into the
Terraform state. Note: This uses the `address` field of the resource to generate the import statement.
For resources like access policies that is not actually correct because the address uses `/` separators
for everything and the import expects them to be broken into three space separated components. You need
to identify these (mostly stuff with a `role/blahblah` in the path) and separate the role, account, and
project segments manually.
#>
cd $PSScriptRoot
[ 0.000000] Linux version 6.2.0-20-generic (buildd@lcy02-amd64-035) (x86_64-linux-gnu-gcc-12 (Ubuntu 12.2.0-17ubuntu1) 12.2.0, GNU ld (GNU Binutils for Ubuntu) 2.40) #20-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 6 07:48:48 UTC 2023 (Ubuntu 6.2.0-20.20-generic 6.2.6)
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-6.2.0-20-generic root=UUID=9898fc09-df7d-4fef-be27-6525d6ff3c51 ro quiet splash vt.handoff=7
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Hygon HygonGenuine
[ 0.000000] Centaur CentaurHauls
[ 0.000000] zhaoxin Shanghai
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'