Skip to content

Instantly share code, notes, and snippets.

View tstephansen's full-sized avatar

Tim Stephansen tstephansen

View GitHub Profile
@tstephansen
tstephansen / RateLimitingHandler.cs
Created February 28, 2024 18:03
Rate Limiting Handler
using System.Collections.Concurrent;
namespace MyProject.Handlers;
/// <summary>
/// A handler for limiting the number of requests made per minute.
/// </summary>
public class RateLimitingHandler : DelegatingHandler
{
private readonly ConcurrentQueue<DateTimeOffset> _callQueue = new();
@tstephansen
tstephansen / Example.cs
Created January 17, 2023 17:42
Controlling System Volume on macOS in Maui Blazor
using System.Runtime.InteropServices;
namespace ControlExample;
public class Example
{
public float GetMainVolume() => getMainVolume();
public void SetMainVolume(float volume) => setMainVolume(volume);
public bool IsMainVolumeMuted() => isMainVolumeMuted();
public void MuteMainVolume() => muteMainVolume();
@tstephansen
tstephansen / ContainerRegistryExtensions.cs
Created December 19, 2018 17:26
IContainerRegistry Extensions for Prism
using System;
using Prism.Ioc;
using Prism.Unity;
using Unity;
using Unity.Lifetime;
using Unity.Registration;
namespace MyProject.PrismExtensions
{
/// <summary>

This was copied from here. I added the 0-255 values as a quick reference.

All decimal, hex, little endian value from 100% to 0%:

  • 100% — FF — 255
  • 99% — FC — 252
  • 98% — FA — 250
  • 97% — F7 — 247
  • 96% — F5 — 245
  • 95% — F2 — 242
  • 94% — F0 — 240

Keybase proof

I hereby claim:

  • I am tstephansen on github.
  • I am tstephansen (https://keybase.io/tstephansen) on keybase.
  • I have a public key ASChXnNqN0SED7U2b-rdMPnllM506alKyepT6rLWkZmoAwo

To claim this, I am signing this object: