Skip to content

Instantly share code, notes, and snippets.

View hpcsc's full-sized avatar

David Nguyen hpcsc

View GitHub Profile
@hpcsc
hpcsc / handlers.go
Created July 11, 2021 22:47 — forked from dstroot/handlers.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"io"
"net/http"
"sync/atomic"
)
func index() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@hpcsc
hpcsc / AUsage.cs
Created January 24, 2020 10:01 — forked from davidfowl/AUsage.cs
Header propagation HttpClientFactory middleware
public void ConfigureServices(IServiceCollection services)
{
services.AddHttpClient("myclient");
// Global header propagation for any HttpClient that comes from HttpClientFactory
services.AddHeaderPropagation(options =>
{
options.HeaderNames.Add("Correlation-Id");
});
}
@hpcsc
hpcsc / Example1.cs
Created August 24, 2016 07:33 — forked from davidfowl/Example1.cs
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)