Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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();
@mattjohnsonpint
mattjohnsonpint / LICENSE
Last active April 2, 2024 02:54
Unified global Unhandled Exception event for .NET MAUI
MIT License
Copyright (c) 2022 Matt Johnson-Pint
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@valorad
valorad / Export-UntrustedGuardian.ps1
Last active February 28, 2024 03:15
Hyper-V TPM Migration (To solve error: "The key protector could not be unwrapped" that causes VM startup failure)
$GuardianName = 'UntrustedGuardian'
$CertificatePassword = Read-Host -Prompt 'Please enter a password to secure the certificate files' -AsSecureString
$guardian = Get-HgsGuardian -Name $GuardianName
if (-not $guardian)
{
throw "Guardian '$GuardianName' could not be found on the local system."
}
@RealDotNetDave
RealDotNetDave / .editorConfig
Last active April 11, 2024 13:36
.editorConfig by David (dotNetDave) McCarter - dotNetTips.com
# dotNetDave's (David McCarter) Editor Config - dotNetTips.com
# Updates to this file are posted quarterly at: https://bit.ly/EditorConfig5
# Updated February 14, 2024
# dotNetDave's NEW coding standards book is available at: https://bit.ly/CodingStandards8
# Rockin' the Code World with dotNetDave (weekly live show): https://bit.ly/RockinCodeWorldShows
root = true
# All Files
[*]
@Zekfad
Zekfad / conventional-commits.md
Last active April 21, 2024 17:50
Conventional Commits Cheatsheet

Quick examples

  • feat: new feature
  • fix(scope): bug in scope
  • feat!: breaking change / feat(scope)!: rework API
  • chore(deps): update dependencies

Commit types

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Changes which doesn't change source code or tests e.g. changes to the build process, auxiliary tools, libraries
@tpeczek
tpeczek / CloudFlareConnectingIpExtensions.cs
Last active March 2, 2023 12:42
ASP.NET Core middleware for CloudFlare Connecting IP support
using System;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.HttpOverrides;
using Lib.AspNetCore.CloudFlareConnectingIp;
namespace Microsoft.AspNetCore.Builder
{
public static class CloudFlareConnectingIpExtensions
{
public static IApplicationBuilder UseCloudFlareConnectingIp(this IApplicationBuilder app)
@ayende
ayende / LetsEncryptClient.cs
Created January 11, 2018 22:26
ACME v2 client for Let's Encrypt
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@waf
waf / ArrayDeconstructionExtensions.cs
Created January 1, 2017 01:14
Add deconstruction (i.e. destructuring) syntax support for arrays for C# 7
using System;
using System.Linq;
namespace Extensions
{
/// <summary>
/// Allow the up to the first eight elements of an array to take part in C# 7's destructuring syntax.
/// </summary>
/// <example>
/// (int first, _, int middle, _, int[] rest) = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
@jcansdale
jcansdale / ExpressionUtilities.cs
Created September 9, 2016 17:31
Helper methods to quickly evaluate simple expressions
using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq.Expressions;
public static class ExpressionUtilities
{
public static object GetValue(Expression expression)
{
return getValue(expression, true);