Skip to content

Instantly share code, notes, and snippets.

View Esl1h's full-sized avatar
🌎
Quem não tem cUrl, caça com get.

Esli Silva Esl1h

🌎
Quem não tem cUrl, caça com get.
View GitHub Profile
@Esl1h
Esl1h / AWS_tags-EC2-to-volumeEBS.py
Created September 21, 2020 19:51
AWS. Adiciona no volume EBS as mesmas tags da EC2. Adds the same EC2 tags to the EBS volume.
import boto3
ec2 = boto3.client('ec2')
tags = None
def getVolumesId(filters):
global tags
instances = getInstances(filters)
volumes = []
for instance in instances['Reservations']:
# recupera as tags adicionadas na EC2
@Esl1h
Esl1h / AWS_tags-EC2-to-volumeEBS.py
Created September 21, 2020 19:50
AWS.Adiciona no volume EBS as tags da EC2.
import boto3
ec2 = boto3.client('ec2')
tags = None
def getVolumesId(filters):
global tags
instances = getInstances(filters)
volumes = []
for instance in instances['Reservations']:
# recupera as tags adicionadas na EC2
@Esl1h
Esl1h / dec_to_ipv4.py
Created August 18, 2020 01:20
Python converting decimal to IPv4 using ipaddress module (in databases IPv4 are recorded as decimal, mostly.
#!/usr/bin/python3.8
import ipaddress
decip = 2887123457 # Example for 172.22.2.1
ip = str(ipaddress.IPv4Address(decip))
print(ip)
#!/bin/bash
#
# ## BEGIN INIT INFO
# Provides: Firewall
# Required-Start: $all
# Required-Stop:
# Should-Start: S
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@Esl1h
Esl1h / sysctl.conf
Last active May 31, 2023 14:10
A hardening/tunning to sysctl.conf to Linux servers (tested on Debian, CentOS, Amazon Linux and Ubuntu). Otimização para o sysctl.conf em servidores linux
#CONTEUDO PARA O SYSCTL.CONF
# Aumentar o num. max de conex tcp orfans
# Conexões que foram encerrados e já não têm um identificador de arquivo anexado a eles
net.ipv4.tcp_max_orphans = 262144
# Aumentar o número de conexões
net.core.somaxconn = 16384
# Aumentar o número de conexões de entrada backlog
@Esl1h
Esl1h / policy.json
Last active April 29, 2019 22:50
AWS S3 bucket policy example - one bucket (public, to a cloudfront distribution) and restrict permissions on some folders by username.
{
"Version": "2012-10-17",
"Id": "Policy1556318075116",
"Statement": [
{
"Sid": "Stmt1556317630862",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::cdn.example/videos/*"