Skip to content

Instantly share code, notes, and snippets.

View sblack4's full-sized avatar
:shipit:
taking care of business

Steven B sblack4

:shipit:
taking care of business
View GitHub Profile
@sblack4
sblack4 / save-sqs-queue.py
Last active August 26, 2021 15:33 — forked from fabiob/save-sqs-queue.py
Saves all messages from an AWS SQS queue into a folder, messages are TXT or JSON
#!/usr/bin/env python3
import argparse
import boto3
import json
import os
from datetime import datetime
parser = argparse.ArgumentParser(
@sblack4
sblack4 / commenting_tf_in_different_languages.md
Created April 15, 2021 17:30
Comment all your terraform out in a variety of languages.

Comment out all your terraform code

vscode snippets for comments

other necessary files included. cmd+alt+b will select the line and make it a full comment block

awk

awk '{print "#" $0}' *.tf
@sblack4
sblack4 / ubuntu-pod.yaml
Created March 25, 2021 14:49
Ubuntu Pod
---
apiVersion: v1
kind: Pod
metadata:
name: ubuntu
labels:
app: ubuntu
spec:
restartPolicy: Always
containers:
@sblack4
sblack4 / update-terraform-module.sh
Last active December 7, 2021 20:22
Updates a module to whatever is in our template module: https://github.com/rhythmictech/terraform-terraform-template
#!/bin/bash -e
# run with
# git clone https://gist.github.com/a43c1352d3ddc84f61af43bf38661beb.git
# bash ./a43c1352d3ddc84f61af43bf38661beb/update-terraform-module.sh
git clone https://github.com/rhythmictech/terraform-terraform-template.git tmp
rm -rf .github bin
mv tmp/.github .github
@sblack4
sblack4 / gist:71a10452466392cc78d06dcbb1d145d2
Created October 27, 2020 15:44
Running it over multiple helm charts required a simple script. Here I use bash to get the helm charts from every namespace in the cluster and then iterate over them, running them through the mapkubeapis tool.
#!/bin/bash
helm list -A | while read line; do
linearray=($line)
release=${linearray[0]}
namespace=${linearray[1]}
@sblack4
sblack4 / date_list.py
Created September 4, 2020 15:00
Write a list of dates to a file with python
import datetime
from datetime import timedelta, date
def test_backfill():
numdays = 720
base = datetime.datetime.today()
date_list = [base - datetime.timedelta(days=x) for x in range(numdays)]
with open('mahdates.csv', 'w') as f:
for date in date_list:
@sblack4
sblack4 / 01PostgreSQLSnippets.md
Last active August 13, 2020 17:15 — forked from DominikSerafin/01PostgreSQLSnippets.md
PostgreSQL Snippets
@sblack4
sblack4 / example.md
Last active February 9, 2021 14:26 — forked from ericclemmons/example.md
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@sblack4
sblack4 / terrorize_ssm.py
Last active August 22, 2022 20:57
Script to turn all the SSM parameters into terraform resources. Uses Pagination. Can also output JSON.
#!/bin/env python3
"""
Script to turn all the SSM parameters in one region into terraform resources
it can also turn them into JSON with get_parameters_with_values_as_json()
Use different regions with the env var AWS_DEFAULT_REGION
ie for Northern Cali use:
export AWS_DEFAULT_REGION=us-west-1
"""
#!/bin/bash
terraform-config-inspect --json | jq -r '.variables | keys | .[]' | sort | awk '{printf $1 " = var." $1 "\n"}'