Skip to content

Instantly share code, notes, and snippets.

View filipeandre's full-sized avatar

Filipe Ferreira filipeandre

View GitHub Profile
@seansummers
seansummers / inventory-global.template.yml
Last active September 15, 2023 11:21
AWS Configuration Tracking
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Global assets needed for Inventory Discovery
Metadata:
AWS::CloudFormation::Interface:
@hoangvx
hoangvx / schedule_rds.py
Created August 29, 2018 00:34
Create a lambda function for auto start and stop rds instance by add tags into instance. Then, schedule it by cloudwatch event
import boto3
import time
# Example RDS Instance tags:
#
# Scheduled : True
# ScheduleStart : 06:00
# ScheduleStop : 18:00
##
@repodevs
repodevs / macOS.sh
Created December 12, 2018 14:56
gpg: signing failed: Inappropriate ioctl for device macOS
❱ git config user.signingKey 38AF394C
❱ git config commit.gpgSign true
echo "test" | gpg --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
test
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
@ariesmcrae
ariesmcrae / resources.yaml
Last active March 19, 2024 20:01
Cloudformation AWS::Include parser is very strict. Must put quotes everywhere. Otherwise, you'll get "InvalidAttributeValue". Here's a correct example.
S3Bucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName:
Fn::Sub: "${TagProduct}-${TagEnvironment}-${TagEnvironmentNumber}-audit-${AWS::AccountId}-${AWS::Region}"
NotificationConfiguration:
QueueConfigurations:
- Event: "s3:ObjectCreated:*"
Queue:
Fn::GetAtt: [ "ObjectCreatedQueueAudit", "Arn" ]
@14kw
14kw / AWSControlTowerBP-BASELINE-CLOUDTRAIL.yml
Created August 7, 2019 01:15
Control Tower created default CloudFormation StackSets
AWSTemplateFormatVersion: 2010-09-09
Description: Configure AWS CloudTrail
Parameters:
ManagedResourcePrefix:
Type: 'String'
Description: 'Prefix for the managed resources'
EnableLogFileValidation:
Type: String
@pmarques
pmarques / s3-destination.yaml
Last active March 31, 2025 16:39
AWS CloudFormation files with S3 buckets and resources needed for Cross-Account / Region replication with Owner[ship] override
---
Description: >
Create a simple encrypted S3 bucket
Parameters:
BucketName:
Type: String
Default: pmarques1234567890-x-account-replication
SourceAccount:
Type: String
Resources:
@kichik
kichik / KeepDbStopped.yml
Last active June 18, 2025 06:12
CloudFormation template that stops RDS from automatically starting back up
# aws cloudformation deploy --template-file KeepDbStopped.yml --stack-name stop-db --capabilities CAPABILITY_IAM --parameter-overrides DB=arn:aws:rds:us-east-1:XXX:db:XXX
Description: Automatically stop RDS instance every time it turns on due to exceeding the maximum allowed time being stopped
Parameters:
DB:
Description: ARN of database that needs to be stopped
Type: String
AllowedPattern: arn:aws:rds:[a-z0-9\-]+:[0-9]+:db:[^:]*
MaxStartupTime:
Description: Maximum number of minutes to wait between database is automatically started and the time it's ready to be shut down. Extend this limit if your database takes a long time to boot up.
Type: Number
@kirilkirkov
kirilkirkov / DER vs. CRT vs. CER vs. PEM Certificates and How To Convert Them
Created March 17, 2020 15:21
DER vs. CRT vs. CER vs. PEM Certificates and How To Convert Them
https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them
Certificates and Encodings
At its core an X.509 certificate is a digital document that has been encoded and/or digitally signed according to RFC 5280.
In fact, the term X.509 certificate usually refers to the IETF’s PKIX Certificate and CRL Profile of the X.509 v3 certificate standard, as specified in RFC 5280, commonly referred to as PKIX for Public Key Infrastructure (X.509).
X509 File Extensions
@avoidik
avoidik / README.md
Last active June 23, 2025 16:16
Enable cgroup memory limits on AWS EC2 instance

There are two grub configuration files, one is provided by OS maintainers, and another one is applied as a part of the cloud integration configuration process.

  1. /etc/default/grub
  2. /etc/default/grub.d/50-cloudimg-settings.cfg

Where any changes to the latter rewrites any changes made to the former file.

Change the latter file /etc/default/grub.d/50-cloudimg-settings.cfg

@qdm12
qdm12 / README.md
Last active October 27, 2025 17:44
Wireguard and iptables restrictions for multiple users

Wireguard and iptables restrictions for multiple users

If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.

Assumptions

This should fit most setups (not mine though 😉)