Skip to content

Instantly share code, notes, and snippets.

@TheBuzzSaw
TheBuzzSaw / UnmanagedQueue.cs
Created July 4, 2023 17:20
Pitch for "unmanaged queue"
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Piranha.Jawbone;
file static class UnmanagedQueueExtensions
{
public static Span<byte> Write<T>(
@TheBuzzSaw
TheBuzzSaw / Xxtea.cs
Last active May 24, 2023 17:24
My XXTEA implementation
// https://en.wikipedia.org/wiki/XXTEA#Reference_code
// https://crypto.stackexchange.com/a/12997/50663
public static class Xxtea
{
private const uint Delta = 0x9e3779b9;
private static uint Mx(
ReadOnlySpan<uint> key,
uint z,
uint y,
@TheBuzzSaw
TheBuzzSaw / FileScopeNamespacer.cs
Last active January 8, 2023 23:51
File scope namespace formatter
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace FileScopeNamespacer;
@TheBuzzSaw
TheBuzzSaw / IAnimal.cs
Created November 15, 2022 23:03
Animalz
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Runtime.CompilerServices;
using LanguageExt;
namespace Kelly;
@TheBuzzSaw
TheBuzzSaw / Linux.cs
Last active September 12, 2022 22:47
#define dumper
static void ConvertLine(string line)
{
const string Define = "#define ";
if (!line.StartsWith(Define))
return;
var begin = Define.Length;
var end = begin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Kelly.Digits;
static class Program
{
static string Divide(long dividend, long divisor, int maxCycles = 128)
{
@TheBuzzSaw
TheBuzzSaw / virtual-cards.md
Created January 26, 2022 00:22
Virtual Cards

Virtual Defensive Shields

  • A Useless Gesture (V)
  • Affect Mind (V)
  • Clumsy And Stupid
  • Crossfire (Endor) (V)
  • Crossfire (V)
  • Death Star Sentry (V)
  • Don't Do That Again (Tatooine) (V)
  • Don't Do That Again (V)
@TheBuzzSaw
TheBuzzSaw / patch-gemini-rue.sh
Created November 4, 2021 04:38
Gemini Rue fix for Linux
#!/bin/sh
set -x
if [ 64 = "`getconf LONG_BIT`" ]
then
libdir='lib64'
else
libdir='lib'
fi
@TheBuzzSaw
TheBuzzSaw / profiles.json
Last active April 11, 2020 18:15
Windows Terminal
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{1415b9b5-ffe4-4333-94c5-9b7e93d12c35}",
"profiles":
@TheBuzzSaw
TheBuzzSaw / PipeTest.cs
Last active March 9, 2020 02:35
Working out exactly how pipe inheritance works
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Text;
using System.Threading.Tasks;
namespace PipeDream2020
{
class Program