Skip to content

Instantly share code, notes, and snippets.

View weyderfs's full-sized avatar
👨‍💻
Keeping Cloud Infrastructure Up!

Weyder Ferreira weyderfs

👨‍💻
Keeping Cloud Infrastructure Up!
  • Brazil
  • 08:35 (UTC -03:00)
View GitHub Profile

Conventional Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@weyderfs
weyderfs / elastic-ilm-policy-delete-after-8d.json
Created October 4, 2022 12:36
Elastic ILM Template Policy to delete Index
{
"policy": {
"description": "Delete index after 8D.",
"default_state": "hot",
"states": [
{
"name": "hot",
"actions": [{
"replica_count": {
"number_of_replicas": 3
@weyderfs
weyderfs / awscli_jq_tricks.sh
Last active June 17, 2024 19:26
AWS CLI JQ Tricks - Outputs likes to export for CSV file
#List ECS Clusters by Name
aws ecs list-clusters --region <region> | jq -r '.clusterArns[]' | cut -d/ -f2
#List ECS List ServiceNames by Cluster
aws ecs list-services --cluster <cluster-name> --region sa-east-1 | jq -r '.serviceArns[]' | cut -d/ -f3
#List EventBridge Event Buses
aws events list-event-buses --region <region> | jq -r '.EventBuses[].Name'
#List EventBridge Rules
@weyderfs
weyderfs / clear-cf-stacks.sh
Last active July 7, 2022 21:00
Delete AWS Cloudformation Stacks
#!/bin/bash
for i in $(aws cloudformation list-stacks |jq -r '.StackSummaries[] | {StackName} | join(" ")')
do echo aws cloudformation delete-stack --stack-name $i #remove echo to delete
done
@weyderfs
weyderfs / clear-iam-policy.sh
Created July 7, 2022 19:07
List and Delete all customer managed AWS IAM Policies
#!/bin/sh
customer_managed_policy_arns=`aws iam list-policies --scope Local --query 'Policies[*].Arn' --output text`
for arn in $customer_managed_policy_arns; do
echo aws iam delete-policy --policy-arn "$arn" #To delete re-run without "echo"
done
@weyderfs
weyderfs / curl-wget-to-github-releases.sh
Created April 11, 2022 13:03 — forked from jwebcat/gist:5122366
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@weyderfs
weyderfs / commands.sh
Last active May 24, 2023 18:30
Terragrunt_Terraform Imports samples from AWS
# Importing a Route53 Record
$ terragrunt import aws_route53_record.record HOSTZONEIDXXXXXXX_my-record.my-domaym_CNAME
# Generate a Random String
$ cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-20} | head -n 1
# Turns your `git log` more Pretty
$ git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
## Examples of use
git lg
@weyderfs
weyderfs / deploymentPodDebug.yaml
Last active September 23, 2021 18:40
Simple deployment K8s Pod Debug - To deploy use the raw link
apiVersion: apps/v1
kind: Deployment
metadata:
name: ubuntu-deployment
labels:
app: ubuntu
spec:
replicas: 1
selector:
matchLabels:
@weyderfs
weyderfs / Dockerfile
Created July 22, 2020 02:26
Container Swiss Army Knife
FROM ubuntu
LABEL Description="A simple network toolkit like a Swiss Army Knife"
RUN apt update && apt install -y curl \
nmap \
netcat \
mtr \
net-tools \
telnet \
@weyderfs
weyderfs / sg_unused.py
Created November 18, 2019 19:34
Listing unused Security Groups
#!/usr/bin/python
import os
import sys
import boto3
ec2 = boto3.resource('ec2')
sgs = list(ec2.security_groups.all())
insts = list(ec2.instances.all())