Skip to content

Instantly share code, notes, and snippets.

View xmariopereira's full-sized avatar

Mário Pereira xmariopereira

  • Rotterdam, Netherlands
View GitHub Profile
@darron
darron / gist:811cf41a6ec3dbfcb97a
Created January 5, 2015 23:19
Get IP Ranges from EC2
#!/bin/bash
# You need: curl, jq, and ipcalc to run this.
# You should already have cut, sort and uniq if you're on OS X or Linux.
RANGES=$(curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq .prefixes | jq '.[] | select(.region=="us-east-1")' | jq 'select(.service=="EC2")' | jq .ip_prefix | cut -d '"' -f 2 | sort | uniq)
for range in $RANGES
do
MIN=$(ipcalc -bn $range | grep "HostMin" | cut -d ':' -f 2)
@soarez
soarez / ca.md
Last active May 3, 2024 00:04
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@codepope
codepope / mqtt2mongo.js
Created February 6, 2014 16:28
A simple MQTT to MongoDB bridge for Node
var mqtt=require('mqtt');
var mongodb=require('mongodb');
var mongodbClient=mongodb.MongoClient;
var mongodbURI='mongodb://username:password@server.mongohq.com:port/database';
var deviceRoot="demo/device/";
var collection,client;
mongodbClient.connect(mongodbURI,setupCollection);
function setupCollection(err,db) {