Skip to content

Instantly share code, notes, and snippets.

@EgorBo
EgorBo / SSE4.1 and AVX2 in .NET Core 2.1.cs
Last active November 18, 2019 19:09
SSE4.1 and AVX2 in .NET Core 2.1.cs
using System;
using System.Linq;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace ConsoleApp29
{
public class Program
@Gutek
Gutek / C# Version Cheat Sheet.md
Last active February 8, 2022 09:33
Short cheat sheet of changes in C# language from version 6 to 9

CS 6

read-only auto properties

Small help with immutable types...

// private readonly int _age;
// public int Age { get { return _age; } }
public int Age { get; }
@jaredpar
jaredpar / is-reproducible.cs
Created January 13, 2021 22:32
Program to check if files were compiled with the determinism flag
using System;
using System.IO;
using System.Linq;
using System.Reflection.PortableExecutable;
foreach (var filePath in args)
{
using var stream = File.OpenRead(filePath);
var peReader = new PEReader(stream);
var any = peReader.ReadDebugDirectory().Any(x => x.Type == DebugDirectoryEntryType.Reproducible);
@davidfowl
davidfowl / MinimalAPIs.md
Last active April 10, 2024 04:24
Minimal APIs at a glance
@davidfowl
davidfowl / TimeHttpEvents.cs
Last active April 6, 2024 20:17
Using Yarp.Telemetry.Consumption to track outbound network events (this package isn't tied to YARP)
using System.Diagnostics;
using System.Net.Sockets;
using System.Security.Authentication;
using Yarp.Telemetry.Consumption;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddTelemetryConsumer<TelemetryConsumer>();
var app = builder.Build();