Skip to content

Instantly share code, notes, and snippets.

iMil iMilnb

Block or report user

Report or block iMilnb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iMilnb
iMilnb / subspam.py
Created Aug 28, 2015
Automatic SpamCop report validation with python mechanize
View subspam.py
import mechanize
br = mechanize.Browser()
br.set_handle_robots(False)
br.open("http://www.spamcop.net/")
br.select_form(nr=0)
br.form['username']='your@spamcop.registered.email'
br.form['password']='yourSpamCopPassword'
@iMilnb
iMilnb / snsread.py
Created Aug 2, 2015
Basic Flask snippet to handle AWS SNS messages and subscription
View snsread.py
from flask import Flask, request
import requests
import json
app = Flask(__name__)
def msg_process(msg, tstamp):
js = json.loads(msg)
msg = 'Region: {0} / Alarm: {1}'.format(
js['Region'], js['AlarmName']
@iMilnb
iMilnb / boto3_hands_on.md
Last active Jul 24, 2019
Programmatically manipulate AWS resources with boto3 - a quick hands on
View boto3_hands_on.md

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's
@iMilnb
iMilnb / userdata.sh
Last active Oct 11, 2016
Transform Debian Jessie AMI to `sysvinit`
View userdata.sh
# Simply add the following to the Userdata script so the
# instance bootstrap sequence transforms the debian jessie
# systemd init to good old sysvinit.
# initial method from
# http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation
# but using a safer and actually working `cat ><<EOF` method
apt-get -y install sysvinit-core sysvinit sysvinit-utils
apt-get remove --purge --auto-remove systemd
cat >/etc/apt/preferences.d/systemd<<EOF
Package: systemd
@iMilnb
iMilnb / grub_default_kernel
Last active Aug 29, 2015
Change the default boot kernel with `grub` 2.0.2beta
View grub_default_kernel
mykern=3.14.43-foo-bar-0.1-baz
dpkg -i linux-image-${mykern}_amd64.deb
sed -i 's/^GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
UUID=`blkid -s UUID -o value /dev/xvda1`
grub-set-default "gnulinux-advanced-$UUID>gnulinux-$mykern-advanced-$UUID"
@iMilnb
iMilnb / gist:ba7b46dfc854544bf3c8
Last active Sep 4, 2018
Dynamic ipsec and racoon configuration generation for AWS EC2 VPN using boto3 and Jinja2
View gist:ba7b46dfc854544bf3c8
#!/usr/bin/env python
# $ cat ipsec_conf.tmpl
# {#
#
# cgw_in_addr: customer_gateway tunnel_inside_address ip_address
# cgw_in_cidr: customer_gateway tunnel_inside_address network_cidr
# vgw_in_addr: vpn_gateway tunnel_inside_address ip_address
# vgw_in_cidr: vpn_gateway tunnel_inside_address network_cidr
# cgw_out_addr: customer_gateway tunnel_outside_address
@iMilnb
iMilnb / vpc_vpn_ec2.py
Last active Jun 16, 2018
Dynamic Troposphere + boto3 template that creates a complete and functional VPC through AWS CloudFormation
View vpc_vpn_ec2.py
#!/usr/bin/env python
from troposphere import Join, Output
from troposphere import Parameter, Ref, Tags, Template
from troposphere.ec2 import PortRange
from troposphere.ec2 import NetworkAcl
from troposphere.ec2 import Route
from troposphere.ec2 import VPCGatewayAttachment
from troposphere.ec2 import SubnetRouteTableAssociation
from troposphere.ec2 import Subnet
@iMilnb
iMilnb / ec2.py
Created May 27, 2015
AWS EC2 simple manipulation script using python and boto3
View ec2.py
#!/usr/bin/env python
# Simple [boto3](https://github.com/boto/boto3) based EC2 manipulation tool
#
# To start an instance, create a yaml file with the following format:
#
# frankfurt:
# - subnet-azb:
# - type: t2.micro
# image: image-tagname
@iMilnb
iMilnb / gist:b09f45e112b226b97a36
Last active Dec 4, 2017
Minimalistic jinja2-based page generator
View gist:b09f45e112b226b97a36
import sys
import markdown
import yaml
import os
from jinja2 import Environment, FileSystemLoader
with open(sys.argv[2], 'r') as f:
content = yaml.safe_load(f.read())
for k in content:
@iMilnb
iMilnb / gist:7604f04223d44a3e13af
Last active Aug 29, 2015
Keep track of Twitter "unfollowers"
View gist:7604f04223d44a3e13af
#!/bin/sh
# track unfollows on twitter using "t" https://github.com/sferik/t
# usage:
#
# to check if any of your followers has stopped following you since the last
# time the script wall called, use:
# $ this_script followers
#
# to check if YOU stopped following someone (it appears many of us witnessed
You can’t perform that action at this time.