Skip to content

Instantly share code, notes, and snippets.

View shirhatti's full-sized avatar

Sourabh Shirhatti shirhatti

View GitHub Profile
@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
@shirhatti
shirhatti / Program.cs
Created June 27, 2019 01:33
Dynamic Proxy for gRPC
using Google.Protobuf;
using Google.Protobuf.Reflection;
using Grpc.Core;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
  • Open proto file

    • Talk about syntax highlighting
  • Connected Services

    • Add new proto file (with streaming)
  • Click on show all files and show generated code

  • Introduce an error in proto file. Show go to error

  • Show off the "override" flow with design time build

using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.Net.Http;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Grpc.Core;
namespace Sample.Clients
@shirhatti
shirhatti / ancminstall.ps1
Created December 7, 2018 02:13
Powershell script to work around shared config block in ANCM
Import-Module IISAdministration
# Stop WAS/W3SVC
Stop-Service -Name WAS -Force
# Disable shared config
$sm = Get-IISServerManager
$sm.GetRedirectionConfiguration().GetSection("configurationRedirection").Attributes["enabled"].Value = $false
$sm.CommitChanges()
app.Run(async (context) =>
{
var processName = Process.GetCurrentProcess().ProcessName;
await context.Response.WriteAsync($"Hello World from {processName}");
});
@shirhatti
shirhatti / config.xml
Created February 27, 2018 22:58
pubxml snippet
<PropertyGroup>
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
</PropertyGroup>
@shirhatti
shirhatti / config.xml
Created February 27, 2018 22:55
Csproj snippet
<PropertyGroup>
<AspNetCoreModuleHostingModel>inprocess</AspNetCoreModuleHostingModel>
</PropertyGroup>
@shirhatti
shirhatti / ancm.ps1
Last active March 1, 2018 01:44
Install ANCM
Invoke-WebRequest -Uri https://raw.githubusercontent.com/shirhatti/ANCM-ARMTemplate/b13de5f65b8c524d9ce72da5fd8df774e0eb76da/install-ancm.ps1 -OutFile install-ancm.ps1
.\install-ancm.ps1