Tutorial on how to create a development mongodb cluster. Based on: https://docs.mongodb.com/manual/tutorial/deploy-replica-set-for-testing/
mongod --config d:\data\mongodb\mongod-cluster1.cfg
# $deployCredentials = d3-CreateCredential | |
# d3-AzureMsDeployWebSite -deployCredentials $deployCredentials -siteName "webplu-test-distribution" -packageDeployCmd "./Deltatre.Forge.DistributionApi.deploy.cmd" | |
Function d3-AzureMsDeployWebSite | |
{ | |
param( | |
[Parameter(Mandatory = $true)] | |
[PSCredential]$deployCredentials, | |
[Parameter(Mandatory = $true)] |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace AsyncThrottledSetSample | |
{ | |
class Program | |
{ |
invoke-webrequest http://www.lastampa.it/ -DisableKeepAlive -UseBasicParsing | Select -ExpandProperty "StatusCode" |
'use latest'; | |
import express from 'express'; | |
import { fromExpress } from 'webtask-tools'; | |
import bodyParser from 'body-parser'; | |
import request from 'request'; | |
import cheerio from 'cheerio'; | |
import escapeHtml from 'escape-html'; | |
const app = express(); |
// Javascript helper functions for parsing and displaying UUIDs in the MongoDB shell. | |
// This is a temporary solution until SERVER-3153 is implemented. | |
// To create BinData values corresponding to the various driver encodings use: | |
// var s = "{00112233-4455-6677-8899-aabbccddeeff}"; | |
// var uuid = UUID(s); // new Standard encoding | |
// var juuid = JUUID(s); // JavaLegacy encoding | |
// var csuuid = CSUUID(s); // CSharpLegacy encoding | |
// var pyuuid = PYUUID(s); // PythonLegacy encoding | |
// To convert the various BinData values back to human readable UUIDs use: | |
// uuid.toUUID() => 'UUID("00112233-4455-6677-8899-aabbccddeeff")' |
const express = require("express"); | |
const app = express(); | |
app.all("/*", (req, res) => { | |
console.log(`${req.method} ${req.originalUrl}`); | |
for (const h in req.headers) { | |
console.log(`\t ${h}:${req.headers[h]}`); | |
} |
/// <summary> | |
/// A Timer that execute an async callback after a due time and repeating it after a period (interval). | |
/// Callback is a non reentrant timer (ie. callbacks never overlaps). Dispose method wait for the current callback to finish. | |
/// Timer can be cancelled using a CancellationToken or by calling StopAsync or by calling Dispose. | |
/// Exception inside callbacks are ignored and just traced. | |
/// Callback is invoked at each interval (period) after the end of the previous invocation. | |
/// </summary> | |
public sealed class TimerAsync : IDisposable | |
{ | |
private readonly Func<CancellationToken, Task> _callback; |
Tutorial on how to create a development mongodb cluster. Based on: https://docs.mongodb.com/manual/tutorial/deploy-replica-set-for-testing/
mongod --config d:\data\mongodb\mongod-cluster1.cfg
Steps to convert .csproj to new VS 2017 format (.NET 4.5 to .NET Core)
// This method convert a json to a valid string json | |
// It should handle all mongodb data types correctly (Date, ObjectId, ...) thanks to the | |
// Newtonsoft.Json.Bson.BsonReader serializer | |
public string ToJson(BsonDocument bson) | |
{ | |
using (var stream = new MemoryStream()) | |
{ | |
using (var writer = new BsonBinaryWriter(stream)) | |
{ |