Skip to content

Instantly share code, notes, and snippets.

from cfn_tools import load_yaml
import cfn_flip.yaml_dumper
from cfn_flip import to_json
import yaml
import json
with open('k8s-cluster.yaml') as f:
raw = f.read()
print(type(raw))
@jaumzors
jaumzors / main.py
Created May 4, 2022 23:29
quick and dirty: get aws resources by tags
from pprint import pprint
import boto3
client = boto3.client('resourcegroupstaggingapi')
def get_resources_tags():
resources = client.get_resources(PaginationToken='')
filtered = {res['ResourceARN']: [r['Value'] for r in res['Tags']]
@jaumzors
jaumzors / Object Flatten
Created February 25, 2019 11:55 — forked from penguinboy/Object Flatten
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
@jaumzors
jaumzors / array_slicing_and_compaction.advanced.bash
Created April 12, 2018 12:07
Advanced Bash :: Array slicing and compaction in bash
# Advanced Bash :: Array slicing and compaction in bash
# TL;DR
X=(something 'whatever' "i have more S P A C E S than i can give away. arent you jealous?")
# ${X[@]} the usual whole array
# ${X[@]:index:length} slice from index to index+length-1 inclusive
# ${X[@]::length} slice from 0 to length-1 inclusive
# ${X[@]:index} slice from index to end of array inclusive