Skip to content

Instantly share code, notes, and snippets.

View shirhatti's full-sized avatar

Sourabh Shirhatti shirhatti

View GitHub Profile
@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
@shirhatti
shirhatti / web.config
Created February 27, 2018 21:35
ANCM inprocess
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyWebApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</configuration>
@shirhatti
shirhatti / boxstarter.ps1
Last active August 15, 2019 23:08 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Sourabh Shirhatti <shirhatti@outlook.com>
# Last Updated: 2017-12-21
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt: