Skip to content

Instantly share code, notes, and snippets.

View ValterAndrei's full-sized avatar
🏠
Working from home

Valter Andrei ValterAndrei

🏠
Working from home
  • Poços de Caldas - MG, Brasil
View GitHub Profile
@ValterAndrei
ValterAndrei / start‐stop-instances.md
Last active July 11, 2024 14:03
Automating Instance Start/Stop - AWS, Lambda, EC2, RDS and Ruby

Automating Instance Start/Stop with AWS Lambda

  • Ruby 3.3
  • EC2 Instances
  • RDS DB Instance

Create Policy

IAM > Policies > Create policy > JSON > [copy + paste] > Next > Policy name: start-stop-instance-policy

# Stop all containers
docker stop $(docker ps -qa)
# Remove all containers
docker rm $(docker ps -qa)
# Remove all images
docker rmi -f $(docker images -qa)
# Remove all volumes
@ValterAndrei
ValterAndrei / cpf_cnpj_regex.md
Last active July 27, 2022 12:29
Regex for CPF and CNPJ
  • CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
  • CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/