Skip to content

Instantly share code, notes, and snippets.

@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-docker.bash
Last active July 16, 2023 18:18
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@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 / 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
.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 / 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");
@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 / diThreeJsViewer.js
Created April 19, 2015 09:18
Angular Js directive that display a three.js model
// usage:
// <di-three-js-viewer three-js-object="device3DModel"></di-three-js-viewer>
app.directive('diThreeJsViewer', [function() {
function createThreeJsCanvas(parentElement, object) {
var width = 400;
var height = 400;
var scene = new THREE.Scene();
@davideicardi
davideicardi / Invoke-AdoNetSqlCmdl.ps1
Created March 23, 2015 18:42
Invoke a T-SQL batch file or string using ADO.NET and Power Shell
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 3.0
<#--------------------------------------------------------------------------
https://gallery.technet.microsoft.com/scriptcenter/The-PowerShell-script-for-2a2456c4
.SYNOPSIS
Script for running T-SQL files in MS SQL Server
Andy Mishechkin
@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."}