This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]}`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
invoke-webrequest http://www.lastampa.it/ -DisableKeepAlive -UseBasicParsing | Select -ExpandProperty "StatusCode" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace AsyncThrottledSetSample | |
{ | |
class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $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)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function() { | |
function InvalidEntityError(message) { | |
this.message = message; | |
var last_part = new Error().stack.match(/[^\s]+$/); | |
this.stack = `${this.name} at ${last_part}`; | |
} | |
Object.setPrototypeOf(InvalidEntityError, Error); | |
InvalidEntityError.prototype = Object.create(Error.prototype); | |
InvalidEntityError.prototype.name = "InvalidEntityError"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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) | |
{ |