Skip to content

Instantly share code, notes, and snippets.

View filipenf's full-sized avatar
☮️

Filipe Felisbino filipenf

☮️
  • Udemy
  • San Francisco, CA
View GitHub Profile
#!/bin/bash
export https_proxy="127.0.0.1:3333"
for i in `seq 1 2000` ; do
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.12.tar.xz bluez-5.1-$i.tar.xz
sleep 0.3
done
@filipenf
filipenf / gist:b75761dbef109baa2be5
Last active August 29, 2015 14:07
Test hosts by name
#!/bin/bash
zonefile=$1
zone=$2
test_hosts() {
for host in "$@"; do
host_=$(echo $host|awk -F ':' '{print $1}')
port_=$(echo $host|awk -F ':' '{print $2}')
echo | timeout 3 openssl s_client -connect $host_:$port_ >/dev/null 2>&1;
@filipenf
filipenf / fullscreen-rotating-browser.py
Created April 20, 2015 13:59
A full screen webkit browser that rotates between URLs
#!/usr/bin/env python
import sys
import gobject
import gtk
import webkit
from itertools import cycle
class WebBrowser(gtk.Window):
@filipenf
filipenf / aws-s3-buckets-with-tags.sh
Created April 22, 2015 18:46
Print a list of aws buckets along with their tags
#!/bin/bash
# lists all buckets along with their tags in the following format:
# bucket_name | { tag_name: tag_value }
# depends on AWS CLI and JQ
for bucket in `aws s3api list-buckets | jq .Buckets[].Name | tr -d \"`; do
tags=$(aws s3api get-bucket-tagging --bucket $bucket | jq -c '.[][] | {(.Key): .Value}' | tr '\n' '\t')
echo $bucket '|' $tags
done
@filipenf
filipenf / aws_saml_access.py
Last active July 7, 2021 05:39
Script to authenticate with SAML and write the security token to aws credentials file
#!/usr/bin/env python
"""
Prerequisites:
- keyring ( optional )
- argh
- beautifulsoup4
- requests-ntlm
This scripts authenticates you to your SAML provider and writes the
@filipenf
filipenf / flatten_list.py
Created December 4, 2015 12:01
Ansible's filter that receives a list of dicts and merges all of them in one single dict
# Receives a list of dicts and merges all
# sub-dicts into one
def flatten_list(l):
result = {}
for item in l:
result.update(item)
return result
class FilterModule(object):
#!/usr/bin/env python
#quick and dirty script to find any untagged and detached volumes,
#take a snapshot and delete it.
import json
import boto3
def get_detached_untagged_volumes(ec2_conn):
volumes = ec2_conn.describe_volumes()
return [ volume['VolumeId'] for volume in volumes['Volumes']
if (len(volume['Attachments'])==0 and
@filipenf
filipenf / ansible_nested.yml
Created January 20, 2016 12:48
Ansible with_nested example
---
- hosts: localhost
connection: local
vars:
all_networks:
- 10.80.128.0/20
- 10.80.144.0/20
- 10.80.208.0/20
- 10.10.5.0/24
@filipenf
filipenf / ec2.coffee
Created January 29, 2016 19:53
Simple hubot script to get information about an instance
util = require 'util'
init_aws = () ->
aws = require 'aws-sdk'
return aws
module.exports = (robot) ->
robot.respond /ec2 get-instance (.*)$/i, (msg) ->
ins_id = msg.match[1].trim()
if ins_id.match /i-.*/
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: "Create project VPC"
ec2_vpc:
state: present
region: "{{ project_region }}"