Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
pcolazurdo / list_all_resources.sh
Created October 5, 2021 21:31
CloudControl for the win
# very basic but you can see the gist of it:
aws cloudformation list-types --type RESOURCE --visibility PUBLIC | \
jq '.TypeSummaries[].TypeName' | \
cut -d\" -f2 | \
while read a
do
aws cloudcontrol list-resources --type-name $a 2>/dev/null| \
jq '.ResourceDescriptions[].Identifier'
done
@pcolazurdo
pcolazurdo / main-instrumented.go
Last active August 24, 2021 16:04
AWS_SDK_BUGREPORT1
// This sample code triggers the problem if run against a large directory structure (+50K objects)
// I added some instrumention to check how many connections were being resued versus created new
// Please change the table name in line 283 and path in line 286
package main
import (
"context"
"crypto/md5"
"strings"
@pcolazurdo
pcolazurdo / README.md
Created July 2, 2021 12:44
AWS SHD parsing

Download the file from

wget https://status.aws.amazon.com/data.json

basic parsing

jq -r '(.archive[] | 
       (.date| tonumber | todate) as $D | 
       select($D | startswith("2021"))| 
 [.service_name, $D[0:10] ,.service,.summary]) | @csv ' \
@pcolazurdo
pcolazurdo / find_chome_dependency.sh
Created May 14, 2021 11:22
How to get list of libraries to fulfil dependency requirements
ldd /var/task/node_modules/puppeteer/.local-chromium/linux-869685/chrome-linux/chrome | grep not | \
cut -d= -f1 | while read a
do
yum provides $a | head -2 | tail -1 | cut -d\ -f1
done
@pcolazurdo
pcolazurdo / Dockerfile.18.04
Last active April 19, 2021 11:26
Building ingraind in AL2
FROM ubuntu:18.04
ARG openssl_arch=linux-x86_64
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install curl wget lsb-release wget software-properties-common \
@pcolazurdo
pcolazurdo / cwagent-otel-collector.yaml
Last active March 28, 2021 22:12
OpenTelemetry Playground
# Config file to add a Prometheus receiver - not fully as I can't make it scrape another process yet
extensions:
health_check:
receivers:
prometheus:
config:
scrape_configs:
- job_name: "otel-collector"
scrape_interval: 5s
@pcolazurdo
pcolazurdo / readme.md
Last active March 26, 2021 22:21
Dotfiles setup recommendations

How to setup a git repo for your dotfiles

For general guidance follow this great write up: https://www.atlassian.com/git/tutorials/dotfiles

In summary:

On the main computer:

git init --bare $HOME/.cfg
alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
@pcolazurdo
pcolazurdo / ssm-runscript.py
Created March 8, 2021 14:48
Sends a script to SSM Run Command
import json
import boto3
import argparse
class Args(object):
import argparse
parser = argparse.ArgumentParser(
description='Allows user to execute a local script using SSM Run Commands')
@pcolazurdo
pcolazurdo / readme.md
Created January 22, 2021 22:25
JQ for botocore

This example helps to find a specific property into all the APIs that supports it

cat service-2.json | jq '[paths(.)] | .[] | flatten| select ( . | index("CopyTagsToSnapshot") ) '

To be more specific, this helps

cat service-2.json | jq '[paths(.)] | .[] | flatten| select ( . | index("CopyTagsToSnapshot") ) | .[1]'