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
  • 20:36 (UTC -03:00)
View GitHub Profile
@weyderfs
weyderfs / whatdistro.md
Last active July 22, 2020 02:25
Checking what distro GNU/Linux you're using

##This file is separate by individuals commands below, using it's you're know what GNU/Linux you're running

$ cat /etc/[A-Za-z]*[_-][rv]e[lr]*

$ cat /etc/issue

$ lsb_release -a

$ uname -a
@weyderfs
weyderfs / ProjectPolicy.yml
Created August 21, 2019 21:47
Rundeck Police User access only Project
description: Admin project level access control. Applies to resources within a specific project.
context:
project: 'MyProjectName' # all projects
for:
resource:
- equals:
kind: job
allow: [run] # allow create jobs
- equals:
kind: node
description: Developer project level access control. Applies to resources within a specific project.
context:
project: 'Your Project Name here' # all projects
for:
job:
- allow: [read] # allow read of all jobs
- match:
group: 'HML/*'
allow: [read,run] # allow run access for jobs within the "HML" top level group
@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())
@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 / 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 / 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 / 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 / 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 / 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