Skip to content

Instantly share code, notes, and snippets.

@davideicardi
davideicardi / install-graphite.md
Created June 26, 2014 23:12
Install graphite on Ubuntu 14.04
@davideicardi
davideicardi / getAzureWebSitePublishingFile.ps1
Created November 16, 2014 20:01
Get an azure website publising xml file using PowerShell
Function Get-AzureWebSitePublishXml
{
Param(
[Parameter(Mandatory = $true)]
[String]$WebsiteName
)
# Get the current subscription
$s = Get-AzureSubscription -Current
if (!$s) {throw "Cannot get Windows Azure subscription."}
@davideicardi
davideicardi / cleanRequire.js
Created August 13, 2015 23:25
Clean up node js require cache
function cleanRequireCache(){
Object.keys(require.cache).forEach(function(key) {
delete require.cache[key];
});
}
function cleanRequire(path){
delete require.cache[require.resolve(path)];
return require(path);
@davideicardi
davideicardi / script.js
Created August 13, 2015 23:27
Create promise from node async function
function denodifyMethod(funcName){
return function(){
return Q.npost(this, funcName, arguments);
}
}
serviceBusService.createTopicIfNotExistsQ = denodifyMethod("createTopicIfNotExists");
.myClass.ng-enter, .myClass.ng-leave {
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 5s;
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 5s;
}
.myClass.ng-enter,
.myClass.ng-leave.ng-leave-active {
opacity:0;
}
@davideicardi
davideicardi / index.json
Last active November 18, 2015 16:01
Json-ld experiments
{
"@context": {
"@vocab": "http://schema.org/",
"myCustomProperty": null,
"@base": "https://gist.github.com/davideicardi/94e9f338a11328061e42",
"slug": "@id",
"type": "@type"
},
"slug": "people",
"type": "DataFeed",
@davideicardi
davideicardi / azureServceBus.js
Last active January 26, 2016 08:38
RabbitMq and Azure Service Bus Node.js class wrappers (RabbitMqChannel, AzureSubscription)
"use strict";
const debug = require("debug")("azureServiceBus");
const events = require("events");
const azure = require("azure");
/*
Class wrapper around Azure Service Bus Topic/Subscription API.
Usage:
@davideicardi
davideicardi / mongo.aspx
Last active September 1, 2016 15:21
MongoDb diagnostic page
<!-- directives -->
<% @Page Language="C#" %>
<%@ Import namespace="MongoDB.Bson.Serialization" %>
<%@ Import namespace="MongoDB.Bson.Serialization.Conventions" %>
<%@ Import namespace="MongoDB.Driver" %>
<%@ Import namespace="MongoDB.Bson" %>
<!-- call example:
https://server/_diagnostics/mongo.aspx?connectionString=mongodb%3A%2F%2Fserver%3A27017%2Ftest&collectionName=logs
@davideicardi
davideicardi / dns.aspx
Last active September 1, 2016 15:22
Host name resolution diagnostic page
<!-- directives -->
<% @Page Language="C#" %>
<%@ Import namespace="System.Net" %>
<!-- call example:
https://server/_diagnostics/dns.aspx?hostName=microsoft.com
-->
<script runat="server">
private string HostName2IP(string hostname)
{
@davideicardi
davideicardi / install.bash
Last active January 6, 2017 00:37
Installing graphite and statsd within an Azure Docker
sudo docker run -d \
--name graphite \
--restart=always \
-v /home/webplu/graphite/storage:/opt/graphite/storage \
-v /home/webplu/log:/var/log \
-p 80:80 \
-p 2003:2003 \
-p 8125:8125/udp \
hopsoft/graphite-statsd