Skip to content

Instantly share code, notes, and snippets.

View shirhatti's full-sized avatar

Sourabh Shirhatti shirhatti

View GitHub Profile
@shirhatti
shirhatti / index.html
Last active October 18, 2021 23:00 — forked from magjac/index.html
d3-graphviz Demo
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v5.min.js"></script>
<script src="https://unpkg.com/@hpcc-js/wasm@0.3.11/dist/index.min.js"></script>
<script src="https://unpkg.com/d3-graphviz@3.0.5/build/d3-graphviz.js"></script>
<div id="graph" style="text-align: center;"></div>
<script>
var dotIndex = 0;
@shirhatti
shirhatti / ConsoleApp.csproj
Created April 7, 2021 19:07
Activities via EventPipe
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.217401" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.66" />
@shirhatti
shirhatti / Program.cs
Created March 19, 2021 19:25
Mean ≠ Median
using System;
using System.Threading;
namespace ConsoleApp
{
public class Program
{
const int interations = 100;
const int spinWaitIterations = 1000000;
private static Random random = new();
@shirhatti
shirhatti / CounterPayload.cs
Created November 18, 2020 19:20
EventCounters via ETW
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
namespace Microsoft.Diagnostics.Tools.Counters
{
public interface ICounterPayload
@shirhatti
shirhatti / hello-world-deployment.yaml
Created June 19, 2020 08:57
Kubernetes manifest for dotnet-monitor
# This Deployment manifest defines:
# - single-replica deployment of the container image, with label "app: dotnet-hello-world"
# - Pod exposes port 8080
# - specify PORT environment variable to the container process
# Syntax reference https://kubernetes.io/docs/concepts/configuration/overview/
apiVersion: apps/v1
kind: Deployment
metadata:
name: dotnet-hello-world
spec:
@shirhatti
shirhatti / container-azm-ms-agentconfig.yaml
Created June 19, 2020 08:53
Azure Monitor configuration
kind: ConfigMap
apiVersion: v1
data:
schema-version:
#string.used by agent to parse config. supported versions are {v1}. Configs with other schema versions will be rejected by the agent.
v1
config-version:
#string.used by customer to keep track of this config file's version in their source control/repository (max allowed 10 chars, other chars will be truncated)
ver1
log-data-collection-settings: |-
@shirhatti
shirhatti / ConsoleApp.csproj
Last active May 27, 2020 02:40
Consume ILogger logs through EventListener
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.EventSource" Version="5.0.0-preview.4.20251.6" />
@shirhatti
shirhatti / Program.cs
Created February 10, 2020 16:33
MWA Set environment variable on ApplicationPool
using Microsoft.Web.Administration;
namespace MWASample
{
public class Program
{
static void Main(string[] args)
{
var serverManager = new ServerManager();
var config = serverManager.GetApplicationHostConfiguration();
@shirhatti
shirhatti / EphemeralOperation.cs
Last active January 8, 2020 20:51
MemoryLeak
using System.Threading;
namespace MemoryLeak
{
public class EphemeralOperation
{
private Timer _timer;
private int _ticks;
public EphemeralOperation()
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tools.RuntimeClient;
using Microsoft.Diagnostics.Tracing;
namespace Repro
{
class Program