Skip to content

Instantly share code, notes, and snippets.

// Reference https://github.com/DamianEdwards/MinimalApiPlayground/blob/main/src/MinimalApiPlayground/Program.cs
// Example 1: Document database mapping
// Documents.cs
public static class MapDocuments
{
public static ActionResult<Task<T>> MapDocument<T>(this IEndpointRouteBuilder app)
where T : IDocument
{
app.MapGet(typeof(T).Name + "/{id}", async (string id, IDocumentRepository repository) =>
  • ½ cup sugar
  • 3 Tbsp cocoa powder
  • 2 Tbsp cornstarch
  • 2 egg yolks
  • ½ cup heavy cream
  • 2 ½ cups whole milk
  • 4 oz chopped dark chocolate
  • 5 Tbsp unsalted butter
  • ½ tsp espresso powder
  • 1 tsp vanilla extract
@Entroper
Entroper / ThreadPool.cs
Created July 26, 2017 16:31
Shows how the .NET Threadpool creates new threads.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
/* Checks if the issuer of a certificate is a
* Certificate Authority, or if the certificate is the same
* as the issuer (and therefore it doesn't need to be a CA).
*
* Returns true or false, if the issuer is a CA,
* or not.
*/
static bool
check_if_ca(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer,
unsigned int *max_path, unsigned int flags)
@Entroper
Entroper / SHA-512 Hash Challenge
Last active August 29, 2015 13:56
Just something I wrote in 30 minutes to solve this challenge: http://www.h11e.com/ It does about 1 million inputs/sec on a quad-core i5-750.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace HashChallenge
{