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 / get_alphabetized_terraform_variables.sh
Created June 14, 2020 21:41
Get a list of all your terraform variables, alphabetized
#!/bin/bash
# requires:
# - https://github.com/hashicorp/terraform-config-inspect
# - jq
# - sort
terraform-config-inspect --json | jq -r '.variables | keys | .[]' | sort
@sblack4
sblack4 / README.md
Created June 5, 2020 14:46
Quickly get Bucket_Name, Number_Items, Creation_Date, Last_Modified on your S3 buckets

bucketeer

Are you using your buckets?

python bucketeer.py > my-buckets.csv

Gives you info like this:

Bucket_Name, Number_Items, Creation_Date, Est_Last_Modified
find . -type f -name "*.bak" -exec rm -f {} \;
@sblack4
sblack4 / rename_it_all.sh
Created May 26, 2020 20:29
find and replace through all your tfstate (or other) type of file on mac
find . -type f -name "*.tf" -print | xargs sed -i.bak 's/firstName/second_name/g' && rm *.bak
#!/usr/bin/env python
"""
sort terraform variables
it's easy to do, just follow these steps:
python sort_terraform_variables.py variables.tf > sorted_variables.tf
mv sorted_variables.tf variables.tf
"""
from __future__ import print_function
import sys
@sblack4
sblack4 / comparing_file_types.md
Created May 3, 2020 16:02
Compare file types with bash

Compare File Types

Create the following script. The names uat and prod simply refer to the two filesystems this script was developed to test. They can be renamed to anything.

#!/bin/bash
uat=`file -bi "/mnt/my_files/${1}"`
prod=`file -bi "/mnt/my_other_files/${1}"`
########################################
# Group Name
########################################
@sblack4
sblack4 / cleanup.sh
Created January 31, 2020 21:21
Get rid of all the k8s things
#!/bin/bash
# Ensure we only have two parameters
if [ $# -ne 2 ];
then
echo 1>&2 "Usage: $0 project-namespace release-name"
exit 1
fi
@sblack4
sblack4 / .pre-commit-config.yaml
Last active November 6, 2019 17:57
some favorite pre-commit hooks
---
repos:
# =============================================
# helm
- repo: https://github.com/norwoodj/helm-docs
rev: v0.8.0
hooks:
- id: helm-docs # adds an auto-generated README with documentation
# =============================================
@sblack4
sblack4 / azure-pipelines.yml
Created October 7, 2019 15:40
Azure Pipelines Cheatsheet
name: name_of_your_pipeline
trigger:
- master
- other_branches
pool:
vmImage: 'ubuntu-latest'
variables: # variables: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables