Skip to content

Instantly share code, notes, and snippets.

@fbrnc
fbrnc / cw_exp.js
Created Mar 4, 2016
AWS Lambda function that collects relevant metrics from CloudWatch and pushes them to ElasticSearch
View cw_exp.js
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 Jan 15, 2016
AWS CloudFormation Events Visualization
View index.php
<?php
/**
* AWS CloudFormation Events Visualization
*
* @author Fabrizio Branca
*/
/**
* Create an 'events.json' via using the AWS CLI Tool (or one of the SDKs...)
*
View .config_fish_functions_dotenv.fish
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
View gist:f6a19ce59b5fcd889870
Verifying that +fabrizio is my blockchain ID. https://onename.com/fabrizio
@fbrnc
fbrnc / AjaxLoader.ino
Last active May 3, 2018
Hardware AJAX Loader using an Attiny85, 3 potentiometers and a 24 RGB LED ring
View AjaxLoader.ino
#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 Mar 5, 2017
X2GO PHPStorm Demo
View setup.sh
#!/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
View cfn-response.js
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 Nov 17, 2015
PhantomJS snippet that lists (and counts) all domains that are being accessed during a request
View resources.js
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 Oct 31, 2015
CloudFormation File Helper
View file2cfn.php
<?php
echo '{"Fn::Base64": {"Fn::Join": ["\n", ' . json_encode(file($argv[1], FILE_IGNORE_NEW_LINES), JSON_PRETTY_PRINT) . ']}}';
@fbrnc
fbrnc / gist:616c94e4e463d50dd49f
Created Sep 29, 2015
OroCommerce Composer Packages
View gist:616c94e4e463d50dd49f
# /var/www/orocommerce/devbox/releases/current/vendor: tree -d -L 2
.
├── a2lix
│ └── translation-form-bundle
├── akeneo
│ └── batch-bundle
├── ass
│ └── xmlsecurity
├── behat
│ └── transliterator