Skip to content

Instantly share code, notes, and snippets.

using System.Text;
using BenchmarkDotNet.Attributes;
namespace MicroBenchmarks.Strings;
[SimpleJob]
[MemoryDiagnoser]
public class StringBuilderAppend
{
[Benchmark(Baseline = true)]
@danielmarbach
danielmarbach / HashSetComparison.cs
Last active June 26, 2023 09:16
HashSet Discussion
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Extensions;
namespace MicroBenchmarks.Hashing;
[Config(typeof(Config))]
@danielmarbach
danielmarbach / Echo.sh
Created June 1, 2023 11:09
Echo Cancellation Fedora 38
pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2
nano ~/.config/pipewire/pipewire.conf.d/echo-cancel.conf
context.modules = [
{ name = libpipewire-module-echo-cancel
args = {
library.name = aec/libspa-aec-webrtc
monitor.mode = true
aec.args = {
@danielmarbach
danielmarbach / Capstone1.fs
Created May 12, 2020 20:16
Some fiddling around with FSharp
open System
let petrolOfCar = 100
type Destination = Home | Office | Stadium | GasStation
let driveTo destination currentPetrol =
let remainingPetrol =
match destination with
| Home -> currentPetrol - 25
| Office -> currentPetrol - 50
| Stadium -> currentPetrol - 25
@danielmarbach
danielmarbach / nsb_raw_hacks.md
Last active March 10, 2020 07:46 — forked from SzymonPobiega/nsb_raw_hacks.md
Hacks in NServiceBus.Raw

Stuff passed via settings

Things that transport used to require that are passed via settings, not via seam:

Settings.Set("Endpoint.SendOnly", sendOnly);
Settings.Set("TypesToScan", new Type[0]);
Settings.Set("NServiceBus.Routing.EndpointName", endpointName);
Settings.Set<Conventions>(new Conventions()); //Hack for ASB
Settings.Set(new StartupDiagnosticEntries());
public static class TimeboxExtensions
{
public static async Task Timebox(this IEnumerable<Task> tasks, TimeSpan timeoutAfter, string messageWhenTimeboxReached)
{
using (var tokenSource = new CancellationTokenSource())
{
var delayTask = Task.Delay(Debugger.IsAttached ? TimeSpan.MaxValue : timeoutAfter, tokenSource.Token);
var allTasks = Task.WhenAll(tasks);
var returnedTask = await Task.WhenAny(delayTask, allTasks).ConfigureAwait(false);
@danielmarbach
danielmarbach / Tests.cs
Last active June 19, 2018 09:32
Nunit.Samples
using NUnit.Framework;
namespace AllTests
{
[TestFixture]
public class Tests
{
[Test]
public void Success()
{
using System;
using System.Threading;
using System.Threading.Tasks;
namespace test
{
class Program
{
static async Task Main(string[] args)
{
@danielmarbach
danielmarbach / AsyncSandbox.cs
Created September 28, 2017 20:40
Ardalis Blog
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace AsyncSandbox
{
class Program
{
static async Task Main(string[] args)
{
@danielmarbach
danielmarbach / Program.cs
Created February 13, 2017 22:27
RabbitMQ tryouts
class Program
{
private static int numberOfMessages;
static void Main(string[] args)
{
File.Delete("./sync.txt");
File.Delete("./async.txt");
numberOfMessages = 1000;