Skip to content

Instantly share code, notes, and snippets.

⚡️
/-/

Marc Duiker marcduiker

⚡️
/-/
Block or report user

Report or block marcduiker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@marcduiker
marcduiker / FunctionNameExtractor
Created Aug 21, 2019
Use reflection to obtain the function names and group them per function role.
View FunctionNameExtractor
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Reflection;
using Microsoft.Azure.WebJobs;
// ReSharper disable once CheckNamespace
namespace DurableFunctions.Demo.DotNetCore.Reflection
{
public class FunctionNameExtractor
@marcduiker
marcduiker / FunctionAppInstanceProperties.sql
Created Aug 16, 2019
Log Analytics query to get various properties of Function App instances.
View FunctionAppInstanceProperties.sql
requests |
project timestamp, id, operation_Id, operation_Name, duration, cloud_RoleName, cloud_RoleInstance |
where cloud_RoleName =~ 'FUNCTION_APP_NAME' |
order by timestamp desc |
take 100
@marcduiker
marcduiker / FunctionExceptions.sql
Created May 1, 2019
Log Analytics query to get the latest 100 exceptions for a given FUNCTION_NAME in FUNCTION_APP_NAME.
View FunctionExceptions.sql
requests | project timestamp, id, operation_Id, operation_Name, success, resultCode, duration, cloud_RoleName | join kind=inner (exceptions | project operation_Id, message, outerMessage, innermostMessage) on operation_Id | where cloud_RoleName =~ '<FUNCTION_APP_NAME>' and operation_Name == '<FUNCTION_NAME>' | order by timestamp desc | take 100
@marcduiker
marcduiker / PostTweetUsingTweetInvi_Snippet.cs
Created Mar 3, 2019
Post a new Tweet using the Tweetinvi client library.
View PostTweetUsingTweetInvi_Snippet.cs
var creds = new TwitterCredentials(
consumerApiKey,
consumerApiSecret,
accessToken,
accessTokenSecret);
var tweetMessage = CreateMessage(newRelease);
var tweet = Auth.ExecuteOperationWithCredentials(creds, () =>
{
@marcduiker
marcduiker / GetLatestGitHubRelease_Snippet.cs
Created Mar 3, 2019
Using the Octokit.Net client library to get the latest release for a public GitHub repository.
View GetLatestGitHubRelease_Snippet.cs
var client = new GitHubClient(new ProductHeaderValue("SomeApplicationIdentifier"));
var latestRelease = await client.Repository.Release.GetLatest(
repoConfiguration.RepositoryOwner,
repoConfiguration.RepositoryName);
@marcduiker
marcduiker / FunctionName.cs
Last active Sep 4, 2019
Example of using string constants in a static class in order to use these in the [FunctionName] attribute (activity function) and in the CallActivityAsync() method (orchestration function).
View FunctionName.cs
namespace DurableFunctions.Demo.DotNetCore.Basics
{
public static class FunctionName
{
public const string HelloNameActivity = "HelloNameActivity";
public const string HelloNameOrchestration = "HelloNameOrchestration";
}
}
@marcduiker
marcduiker / HelloNameActivity.cs
Last active Sep 4, 2019
Example of using nameof() in order to use the class name in the [FunctionName] attribute (activity function) and in the CallActivityAsync() method (orchestration function).
View HelloNameActivity.cs
namespace DurableFunctions.Demo.DotNetCore.Basics.Activities
{
public static class HelloNameActivity
{
[FunctionName(nameof(HelloNameActivity))]
public static string Run(
[ActivityTrigger] string name,
ILogger logger)
{
logger.LogInformation($"Name: {name}");
@marcduiker
marcduiker / CollectNames.cs
Last active Nov 8, 2017
Durable Functions: 'eternal' orchestration function which waits for either an 'addname' or 'iscompleted' event.
View CollectNames.cs
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace DurableFunctionsDemo.OrchestrationFunctions
{
public static class CollectNames
{
[FunctionName("CollectNames")]
@marcduiker
marcduiker / local.settings.json
Created Nov 7, 2017
Durable Functions: local.settings.json with connection strings for local development.
View local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1:10002/",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1:10002/"
}
}
@marcduiker
marcduiker / HelloWorld.cs
Created Nov 5, 2017
Durable Functions: Extremely basic implementation of an orchestration function (which actually doesn't do any orchestration).
View HelloWorld.cs
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace DurableFunctionsDemo.Functions
{
public static class HelloWorld
{
[FunctionName("HelloWorld")]
public static string Run(
[OrchestrationTrigger]DurableOrchestrationContext context,
You can’t perform that action at this time.