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
public static class HopcroftKarpMaxBipartiteMatcher | |
{ | |
public static List<Tuple<int, int>> MaximumMatching(IEnumerable<int> partition1, IEnumerable<int> partition2, List<Tuple<int, int>> edges) | |
{ | |
var unmatchedVertices1 = new HashSet<int>(partition1); | |
var unmatchedVertices2 = new HashSet<int>(partition2); | |
var matching = GreedyMatch(partition1, edges, unmatchedVertices1, unmatchedVertices2); | |
var augmentingPaths = GetAugmentingPaths(matching, edges, unmatchedVertices1, unmatchedVertices2); | |
while (augmentingPaths.Any()) |
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
public class AzureAlertStack : Stack | |
{ | |
public AzureAlertStack() | |
{ | |
var resourceGroup = ResourceGroup.Get(resourceGroupName, resourceGroupId); | |
var redis = Pulumi.AzureNative.Cache.Redis.Get(redisName, redisId); | |
var actionGroup = ActionGroup.Get(actionGroupName, actionGroupId); | |
var redisAlert = CreateRedisMemoryUsageAlert(resourceGroup, redis, actionGroup); | |
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
public sealed class AzureRedisAlerts | |
{ | |
public readonly MewsResource<MetricAlert<RedisCache>> MemoryHigh = MewsResource<MetricAlert<RedisCache>>.CreateManaged( | |
name: "redis-memory-high", | |
resource: new MetricAlert<RedisCache>( | |
resourceGroup: ResourceDependency<ResourceGroup>.Create<AzureResourceGroups>(g => g.Monitoring), | |
actionGroup: ResourceDependency<ActionGroup>.Create<AzureActionGroups>(g => g.Default), | |
targetResource: ResourceDependency<RedisCache>.Create<AzureRedisCaches>(c => c.WestEurope), | |
description: "Redis memory high" | |
) |
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
public class AlertStack : Stack | |
{ | |
public AlertStack() | |
{ | |
var resourceGroup = ResourceGroup.Get(resourceGroupName, resourceGroupId); | |
var redis = Pulumi.AzureNative.Cache.Redis.Get(redisName, redisId); | |
var actionGroup = ActionGroup.Get(actionGroupName, actionGroupId); | |
var redisAlert = CreateRedisMemoryUsageAlert(resourceGroup, redis, actionGroup); | |
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
with RedundantQueries as | |
(select top 20 | |
query_hash as QueryHash, | |
count(query_hash) as PlansCached, | |
count(distinct(query_hash)) as DistinctPlansCached, | |
sum(execution_count) as TotalExecutions, | |
min(creation_time) as FirstPlanCreationTime, | |
max(creation_time) as LastPlanCreationTime, | |
max(s.last_execution_time) as LastExecutionTime, | |
statement_start_offset as StatementStartOffset, |
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="Program"> | |
<Namespace>System.Net.Http</Namespace> | |
<Namespace>Newtonsoft.Json</Namespace> | |
<Namespace>System.Threading.Tasks</Namespace> | |
</Query> | |
void Main() | |
{ | |
} |