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
string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; | |
string SizeSuffix(long value, int decimalPlaces = 0) | |
{ | |
if (value < 0) | |
{ | |
throw new ArgumentException("Bytes should not be negative", "value"); | |
} | |
var mag = (int)Math.Max(0, Math.Log(value, 1024)); | |
var adjustedSize = Math.Round(value / Math.Pow(1024, mag), decimalPlaces); | |
return $"{adjustedSize} {SizeSuffixes[mag]}"; |
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
<Query Kind="Statements"> | |
<Namespace>System.Collections.Concurrent</Namespace> | |
<Namespace>System.Threading.Tasks</Namespace> | |
<Namespace>System.Threading.Tasks.Dataflow</Namespace> | |
</Query> | |
var produceSpeed = TimeSpan.FromSeconds(0.5); | |
var produceCount = 20; | |
var consumeSpeed = TimeSpan.FromSeconds(2); | |
var maxParallelConsume = 4; |
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
$location = "West Europe" | |
$resGroupName = "RunFromPackageDemo" | |
az group create -n $resGroupName -l $location | |
$random = Get-Random -Minimum 10000 -Maximum 99999 | |
$storageAccountName = "runfrompackage$random" | |
az storage account create -n $storageAccountName -g $resGroupName --sku "Standard_LRS" | |
$connectionString = az storage account show-connection-string -n $storageAccountName -g $resGroupName --query "connectionString" -o tsv | |
$env:AZURE_STORAGE_CONNECTION_STRING = $connectionString |
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
{ | |
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"voteReplicaCount":{ | |
"defaultValue": "1", | |
"type": "string", | |
"metadata": { | |
"description": "The number of service replicas for the vote service." | |
} |
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
version: '2.2' | |
services: | |
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.1 | |
container_name: elasticsearch | |
environment: | |
- cluster.name=docker-cluster | |
- bootstrap.memory_lock=true | |
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |
ulimits: |
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
void Main() | |
{ | |
int outRate = 16000; | |
var inFile = @"E:\example input file.mp3"; | |
var outFile = @"E:\Input Driven Resampled.wav"; | |
using (var reader = new AudioFileReader(inFile)) | |
using (var writer = new WaveFileWriter(outFile, WaveFormat.CreateIeeeFloatWaveFormat(outRate, reader.WaveFormat.Channels))) | |
{ | |
var read = 0; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title></title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link href="style.css" rel="stylesheet"> | |
</head> | |
<body> | |
<div class="container"> |
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
{ | |
"bindings": [ | |
{ | |
"name": "inputBlob", | |
"type": "blobTrigger", | |
"direction": "in", | |
"path": "samples-workitems/input/{name}", | |
"connection": "AzureWebJobsDashboard" | |
}, | |
{ |
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
// (created in LINQPad with the following references and namespaces) | |
// <Query Kind="Statements"> | |
// <Reference><RuntimeDirectory>\System.Runtime.Serialization.dll</Reference> | |
// <NuGetReference>WindowsAzure.ServiceBus</NuGetReference> | |
// <Namespace>Microsoft.ServiceBus</Namespace> | |
// <Namespace>Microsoft.ServiceBus.Messaging</Namespace> | |
// </Query> | |
string connectionString = Util.GetPassword("Test Azure Service Bus Connection String"); | |
const string queueName = "MarkHeathTestQueue"; |
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
let highestRepeated dice minRepeats = | |
let repeats = dice |> List.countBy id |> List.filter (fun (_,n) -> n >= minRepeats) |> List.map fst | |
match repeats with | [] -> 0 | _ -> List.max repeats | |
let ofAKind n dice = | |
n * highestRepeated dice n | |
let sumOfSingle selected dice = | |
dice |> Seq.filter ((=) selected) |> Seq.sum |
NewerOlder