Skip to content

Instantly share code, notes, and snippets.

View ReubenBond's full-sized avatar
🌞
building

Reuben Bond ReubenBond

🌞
building
View GitHub Profile
@ReubenBond
ReubenBond / virtual-sync-grain-directory.excalidraw
Last active July 29, 2024 22:49
VirtualSynchronyDirectory
{
"type": "excalidraw",
"version": 2,
"source": "https://marketplace.visualstudio.com/items?itemName=pomdtr.excalidraw-editor",
"elements": [
{
"id": "8ik7kpr0EhXC1TdRAjZhM",
"type": "ellipse",
"x": 500,
"y": 400.42667125531193,
@ReubenBond
ReubenBond / vsync.cs
Created July 20, 2024 02:33
Vsync v2.2.2095 by Ken Birman. Extracted from https://codeplexarchive.org/codeplex/project/vsync
This file has been truncated, but you can view the full file.
// <copyright file="Vsync.cs" company="Kenneth P. Birman">
// Vsync System, V2.2.$Rev: 2095 $, Developed by Kenneth P. Birman, (c) 2010 - 2014. All rights reserved.
// This code is subject to copyright and other intellectual property restrictions and
// may be used only under license from Dr. Birman or his designated agents.
//
// It is a violation of international intellectual property protection laws to remove this notice.
//
// Dr. Birman has elected to grant Cornell University and other researchers the right to experiment with Vsync and
// to create a derived version Vsync V2.2.xxxx (and other future versions, using the same version numbering scheme)
//
@ReubenBond
ReubenBond / FrequencyFilter.cs
Created April 13, 2024 23:07
Filtered Space-Saving
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Orleans.Runtime.Placement.Rebalancing;
// Implementation of "Filtered Space-Saving" from "Finding top-k elements in data streams"
// by Nuno Homem &amp; Joao Paulo Carvalho (https://www.hlt.inesc-id.pt/~fmmb/references/misnis.ref0a.pdf).
internal abstract class FrequencyFilter<TKey>(int capacity) where TKey : notnull
{
@ReubenBond
ReubenBond / ConcurrentLruGrainDirectoryCache.cs
Last active July 24, 2024 14:46
BitFaster.Caching Orleans IGrainDirectoryCache implementation
using BitFaster.Caching;
using BitFaster.Caching.Lru;
using Microsoft.Extensions.Options;
using Orleans.Configuration;
using Orleans.Runtime;
using Orleans.Runtime.GrainDirectory;
using System.Diagnostics.CodeAnalysis;
namespace Orleans.BitFasterCaching.GrainDirectoryCache;
@ReubenBond
ReubenBond / LongRunningReminderGrain.cs
Created January 17, 2024 16:46
Orleans Grain Long Running Reminder
#nullable enable
using Orleans.Runtime;
namespace MyGrains;
public class MyLongRunningReminderGrain : Grain, IRemindable
{
private readonly CancellationTokenSource _shutdownCancellation = new();
private Task? _backgroundTask;
@ReubenBond
ReubenBond / CpuUsage.cs
Created January 17, 2024 16:45
.NET CPU Usage EventCounter
using System.Diagnostics.Tracing;
using System.Security.Cryptography;
using System.Text;
public class Program
{
public static void Main(string[] args)
{
var listener = new SystemRuntimeEventCounterListener();
Task.Run(async () =>
{
"name": "Dactyl Manuform (5x7)",
"vendorProductId": 1145910583,
"macros": [
"{KC_LCTL,KC_LEFT}",
"{KC_LCTL,KC_DOWN}",
"{KC_LCTL,KC_UP}",
"{KC_LCTL,KC_RGHT}",
"",
"",
@ReubenBond
ReubenBond / HostedServiceCommunicationListener.cs
Last active December 1, 2022 21:10
Service Fabric IHostBuilder integration
namespace YOUR_NAMESPACE
{
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.ServiceFabric.Services.Communication.Runtime;
/// <summary>
/// Service Fabric <see cref="ICommunicationListener"/> which integrates with an <see cref="IHost"/> instance.
@ReubenBond
ReubenBond / ObserverWithReturn.csproj
Created March 20, 2022 19:36
Orleans grain observer (IGrainObserver) which returns results
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>ObserverWithReturn</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Ready
****** START compiling Hagar.Buffers.Reader`1[ReadOnlySequence`1][System.Buffers.ReadOnlySequence`1[System.Byte]]:ReadByte():ubyte:this (MethodHash=011f4f14)
Generating code for Windows x64
OPTIONS: compCodeOpt = BLENDED_CODE
OPTIONS: compDbgCode = true
OPTIONS: compDbgInfo = true
OPTIONS: compDbgEnC = false
OPTIONS: compProcedureSplitting = false
OPTIONS: compProcedureSplittingEH = false
IL to import: