Skip to content

Instantly share code, notes, and snippets.


iury IuryAlves

View GitHub Profile
import boto3
import collections
import datetime
ec = boto3.client('ec2')
def lambda_handler(event, context):
reservations = ec.describe_instances(
{'Name': 'tag-key', 'Values': ['Backup', 'backup']},
rothgar /
Created Feb 3, 2017
Download Google SRE book for offline reading
wget -r -nc -p --html-extension -k -D -np
roylee0704 /
Created Sep 2, 2016 Syntax
"containerDefinitions": [
"command": [ "string" ],
"cpu": number,
"disableNetworking": boolean,
"dnsSearchDomains": [ "string" ],
"dnsServers": [ "string" ],
"dockerLabels": {
"string" : "string"
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created Jun 16, 2016
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
View ansible-bootstrap-ubuntu-16.04.yml
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
- hosts: all
gather_facts: False
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
manicminer /
Last active Nov 1, 2018
RDS Production termination protection

RDS Production Termination Protection

Create a policy like this, substituting your AWS account number, then attach it to all groups and roles. It will prevent deletion of RDS instances containing the string "prod" in their name.

Note: This is intended to prevent accidental deletion, and is easily sidestepped.

fideloper /
Last active Sep 8, 2020
Update curl on Ubuntu 14.04
#! /usr/bin/env bash
# Install any build dependencies needed for curl
sudo apt-get build-dep curl
# Get latest (as of Feb 25, 2016) libcurl
mkdir ~/curl
cd ~/curl
tar -xvjf curl-7.50.2.tar.bz2
rg3915 /
Last active Mar 13, 2019
Shell script to create a simple Django project.
# Shell script for create a simple Django project.
# wget
# Type the following command, you can change the project name.
# source myproject
# Colors
red=`tput setaf 1`
green=`tput setaf 2`
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
dabeaz /
Last active Sep 16, 2019
Live-coded examples from my PyCon Brasil 2015 Keynote
from socket import *
import asyncio
loop = asyncio.get_event_loop()
async def echo_server(address):
sock = socket(AF_INET, SOCK_STREAM)
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
RobertoSchneiders /
Last active Jan 7, 2021
IAM Policy for deploy on Elastic Beanstalk

I am deploying with this IAM using Codeship and Circle CI to Elastic Beanstalk. I had a lot of trouble with this config. I talked to the aws support for about 6 hours until this worked properly, so, I guess it is worth to share.

UPDATE: In the end, I have to use the AWSElasticBeanstalkFullAccess policy. My custom policy keep breaking every week with some new added permission or some EB internal change. Anyway, the IAM I was using is below.

This works for me with CircleCI and EB Cli.

    "Version": "2012-10-17",
    "Statement": [