Skip to content

Instantly share code, notes, and snippets.

View zartstrom's full-sized avatar
🦀
Hello!

Philipp Hitzler zartstrom

🦀
Hello!
View GitHub Profile
@zartstrom
zartstrom / aoc-2023-23.scala
Created December 23, 2023 21:15
AOC 2023 Day 23
import scala.io.Source.fromFile
enum Dir:
def toVec: Vec = this match {
case North => Vec(0, -1)
case East => Vec(1, 0)
case South => Vec(0, 1)
case West => Vec(-1, 0)
}
case North, East, South, West
@zartstrom
zartstrom / get_configuration_items.py
Last active March 3, 2023 11:49
Query recorded configuration items from AWS Config
"""
Query recorded `Configuration Items` for a given resource and related resources.
Usage:
* Install requirements. Todo: provide requirements.txt
* Set AWS_PROFILE to desired account.
* Pick a resource in account and get its type and id
(ie AWS::EC2::VPC, vpc-006fd4ebe2axxxxxx or AWS::EC2::Instance, i-0c93934d13axxxxxx)
See https://docs.aws.amazon.com/cli/latest/reference/configservice/get-resource-config-history.html
for a list of resource types.
@zartstrom
zartstrom / tree_and_rank.sql
Created April 9, 2019 20:31
Sketch for working withs trees in SQL
-- drop table edges;
create table edges (
node_top varchar(15),
node_bottom varchar(15)
);
insert into edges values ('A', 'B'), ('A', 'C'), ('B', 'D'), ('B', 'E'), ('E', 'F');
select * from edges;
/* Category tree