Skip to content

Instantly share code, notes, and snippets.

View fbrnc's full-sized avatar

Fabrizio Branca fbrnc

  • AOE
  • Wiesbaden, Germany
  • X @fbrnc
View GitHub Profile
@fbrnc
fbrnc / cw_exp.js
Created March 4, 2016 06:29
AWS Lambda function that collects relevant metrics from CloudWatch and pushes them to ElasticSearch
var AWS = require('aws-sdk');
var cloudwatch = new AWS.CloudWatch({ region: 'us-east-1'});
exports.handler = function (event, context) {
var ElasticSearchHost = 'elasticsearch.example:9200';
var Environment = 'int';
var EndTime = new Date;
var StartTime = new Date(EndTime - 15*60*1000);
var Metrics = {
@fbrnc
fbrnc / index.php
Last active January 15, 2016 17:24
AWS CloudFormation Events Visualization
<?php
/**
* AWS CloudFormation Events Visualization
*
* @author Fabrizio Branca
*/
/**
* Create an 'events.json' via using the AWS CLI Tool (or one of the SDKs...)
*
function dotenv --description 'Load environment variables from .env file'
set -l envfile ".env"
if [ (count $argv) -gt 0 ]
set envfile $argv[1]
end
if test -e $envfile
for line in (cat $envfile | grep -v '^#' | grep -v '^$')
set -xg (echo $line | cut -d = -f 1) (echo $line | cut -d = -f 2-)
end
Verifying that +fabrizio is my blockchain ID. https://onename.com/fabrizio
@fbrnc
fbrnc / AjaxLoader.ino
Last active May 3, 2018 00:22
Hardware AJAX Loader using an Attiny85, 3 potentiometers and a 24 RGB LED ring
#include <FastLED.h>
#define NUM_LEDS 24
#define NUM_DOTS 3
#define DATA_PIN 0
#define MAX_SPEED 60
using namespace std;
CRGB leds[NUM_LEDS];
@fbrnc
fbrnc / setup.sh
Last active March 5, 2017 01:53
X2GO PHPStorm Demo
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y install software-properties-common
# X2Go
add-apt-repository -y ppa:x2go/stable && apt-get update
apt-get -y install x2goserver
# Download PHPStorm
@fbrnc
fbrnc / cfn-response.js
Created December 9, 2015 16:23
cfn-response
exports.SUCCESS = "SUCCESS";
exports.FAILED = "FAILED";
exports.send = function(event, context, responseStatus, responseData, physicalResourceId) {
var responseBody = JSON.stringify({
Status: responseStatus,
Reason: "See the details in CloudWatch Log Stream: " + context.logStreamName,
PhysicalResourceId: physicalResourceId || context.logStreamName,
@fbrnc
fbrnc / resources.js
Created November 17, 2015 20:47
PhantomJS snippet that lists (and counts) all domains that are being accessed during a request
var page = require('webpage').create();
function extractDomain(url) {
var domain = (url.indexOf("://") > -1) ? url.split('/')[2] : url.split('/')[0];
domain = domain.split(':')[0];
return domain;
}
var domains = {};
@fbrnc
fbrnc / file2cfn.php
Created October 31, 2015 05:07
CloudFormation File Helper
<?php
echo '{"Fn::Base64": {"Fn::Join": ["\n", ' . json_encode(file($argv[1], FILE_IGNORE_NEW_LINES), JSON_PRETTY_PRINT) . ']}}';
@fbrnc
fbrnc / gist:616c94e4e463d50dd49f
Created September 29, 2015 05:34
OroCommerce Composer Packages
# /var/www/orocommerce/devbox/releases/current/vendor: tree -d -L 2
.
├── a2lix
│ └── translation-form-bundle
├── akeneo
│ └── batch-bundle
├── ass
│ └── xmlsecurity
├── behat
│ └── transliterator