Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Batum paulbatum

View GitHub Profile
@paulbatum
paulbatum / sensors.proto
Created Sep 14, 2017
Protocol buffers example
View sensors.proto
syntax = "proto3";
package sensors;
import "google/protobuf/timestamp.proto";
option csharp_namespace = "EventHubsThroughput.Models.Protobuf";
enum SensorType {
UNKNOWN = 0;
SEISMIC = 1;
WEATHER = 2;
@paulbatum
paulbatum / results.md
Last active Jul 19, 2017
Functions min threads fix results
View results.md

HTTP latency in milliseconds @ 50 RPS

Each row is a 5 minute run at constant load of 50 RPS.

Scenario Min Median P95 P99 Max
Dedicated without fix 154 158.1 999.6 2128 3341.9
Dedicated without fix 154.2 158.8 1204.8 2058.8 3845.8
Dedicated without fix 154 158.6 941 2430.4 4618.1
Dedicated without fix 154.2 158.8 882.1 2089.3 3515.9
@paulbatum
paulbatum / run.csx
Created Dec 27, 2016
Functions parallelism
View run.csx
using System.Net;
using System.Threading.Tasks.Dataflow;
public enum Mode
{
Sequential,
Batches,
Dataflow
}
@paulbatum
paulbatum / template.json
Created Dec 1, 2016
Consumption function app from github repo ARM template
View template.json
{
"parameters": {
"name": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "[parameters('name')]",
View synctriggerarmtemplate
{
"parameters": {
"name": {
"type": "string",
"defaultValue": "pbsynctest4"
},
"storageName": {
"type": "string",
"defaultValue": "pbsynctest4"
},
View runnerapp-function.json
{
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "*/10 * * * * *"
},
{
"type": "table",
View MemoryEater.csx
using System;
using System.Threading.Tasks;
using System.Diagnostics;
static Dictionary<int,byte[]> Allocations = new Dictionary<int,byte[]>();
public static async Task Run(string id, int message, TraceWriter log)
{
log.Verbose($"Machine: {Environment.MachineName}");
@paulbatum
paulbatum / gist:7f0927307f40a10aae85
Created Mar 16, 2016
function to disable a function
View gist:7f0927307f40a10aae85
var fs = require('fs');
var path = require('path');
module.exports = function (context, req) {
if (typeof req.query.name == 'undefined') {
context.res = {
status: 400,
body: "Please specify the name of the function to enable"
}
}
View Functions.cs
public class Functions
{
public static void ProcessQueueMessage([QueueTrigger("queue")] string message, TextWriter log)
{
log.WriteLine(message);
}
public static void CronJob([TimerTrigger("00:01:00")] TimerInfo timer, [Queue("queue")] out string outputQueueMessage)
{
outputQueueMessage = new Random().NextDouble().ToString();
View GetIdentityExample.js
var request = require('request');
module.exports = {
"post": function (req, res, next) {
req.azureMobile.user.getIdentity("google").then(function(result) {
request.get('https://www.googleapis.com/plus/v1/people/me', {
headers: {
"Authorization": "Bearer " + result.google.access_token
}
}, function(err, apiResult) {
You can’t perform that action at this time.