Skip to content

Instantly share code, notes, and snippets.

:octocat:
Coding again

David Fowler davidfowl

:octocat:
Coding again
Block or report user

Report or block davidfowl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidfowl
davidfowl / parsingperf.cs
Last active Nov 12, 2019
Trying out various parsing techniques
View parsingperf.cs
using System;
using System.Buffers;
using System.IO;
using System.Text;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Running;
namespace MyBenchmarks
{
View CallbacksVsCode.md
var state = new State();
var queue = new QueueClient();
try
{
    var item = await queue.DequeueAsync();
    state.Item = item;
}
@davidfowl
davidfowl / AsyncEnumerableQueue.cs
Last active Jul 8, 2019
Event loop flipped inside out with IAsyncEnumerable
View AsyncEnumerableQueue.cs
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Azure.ServiceBus;
namespace ConsoleApp60
{
class Program
{
@davidfowl
davidfowl / Program.cs
Last active Nov 7, 2019
A minimal fully asynchronous C# ASP.NET Core 3.0 application with routing (learn more about ASP.NET Core here https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-3.0)
View Program.cs
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Hosting;
public class Program
{
public static void Main(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
View NamedPipeConnectionListener.cs
public class NamedPipeConnectionListener : IConnectionListener
{
private readonly NamedPipeEndPoint _endpoint;
private readonly CancellationTokenSource _listeningSource = new CancellationTokenSource();
public NamedPipeConnectionListener(NamedPipeEndPoint endpoint)
{
_endpoint = endpoint;
ListeningToken = _listeningSource.Token;
}
View DuplexPipe.cs
public class DuplexPipe<TStream> : Stream, IDuplexPipe where TStream : Stream
{
private readonly IDuplexPipe _duplexPipe;
public DuplexPipe(IDuplexPipe duplexPipe, Func<Stream, TStream> wrapper)
{
_duplexPipe = duplexPipe;
Stream = wrapper(this);
Input = PipeReader.Create(Stream);
@davidfowl
davidfowl / bedrock-server.cs
Last active Jul 24, 2019
A sample of the current API usage with bedrock's listener layer
View bedrock-server.cs
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
@davidfowl
davidfowl / FormReaderExtensions.cs
Last active Mar 15, 2019
FormReader prototype
View FormReaderExtensions.cs
public static class FormReaderExtensions
{
public static async ValueTask<IFormCollection> ReadFormAsync2(this HttpRequest request)
{
var reader = request.BodyPipe;
KeyValueAccumulator accumulator = default;
while (true)
{
var result = await reader.ReadAsync();
View deps.json
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.0",
"signature": "22c69940c9b25639e4f75123b23a701826ae1b1a"
},
"compilationOptions": {
"defines": [
"TRACE",
"DEBUG",
"NETCOREAPP",
View ResponseCachingPlaintextCachedDelete.txt
This file has been truncated, but you can view the full file.
[12:04:42.659] Using worker Wrk
[12:04:42.754] Running session '92c5e28c8dec4dab902cd1ff12ccaf9d' with description ''
[12:04:42.754] Starting scenario ResponseCachingPlaintextCachedDelete on benchmark server...
[12:04:42.837] Fetching job: http://10.195.201.248:5001/jobs/31
[12:04:42.917] Job submitted, waiting...
[12:05:16.053] Starting scenario ResponseCachingPlaintextCachedDelete on benchmark client...
[12:05:16.488] Client Job ready: http://10.195.202.5:5002/jobs/1
[12:05:18.654] Scenario ResponseCachingPlaintextCachedDelete completed on benchmark client
[12:05:18.655] Deleting scenario ResponseCachingPlaintextCachedDelete on benchmark client...
You can’t perform that action at this time.