Skip to content

Instantly share code, notes, and snippets.

@mattwarren
mattwarren / veh_hook.cpp
Created January 5, 2018 10:24 — forked from ReubenBond/veh_hook.cpp
INT3 Vectored Exception Handler hooking
/**
veh_hook Vectored Exception Handler hooking library
Version: 24-March-2008
**/
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include "veh_hook.h"
static veh_list_t* list = NULL;
@mattwarren
mattwarren / gist:1369941
Created November 16, 2011 12:12
Querying dictionaries in RavenDB
private static void DictionaryTest()
{
var store = new EmbeddableDocumentStore
{
RunInMemory = true
};
store.Configuration.TempIndexPromotionMinimumQueryCount = 1;
store.Initialize();
var entry1 = new ClassWithDictionary { Name = "With test", Dictionary = new Dictionary<string, string> { { "test", "value" } } };
var entry2 = new ClassWithDictionary { Name = "Without test", Dictionary = new Dictionary<string, string> { { "nottest", "value" } } };
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace ConsoleApplication3.Test
{
static class EntityPtr
{
private static readonly IEntityPtr converter = CreateConverter();
using NodaTime;
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace JITterOptimisations
{
public static class Extensions
@mattwarren
mattwarren / UnsafeWithoutKeyword.cs
Created September 4, 2019 20:52 — forked from nguerrera/UnsafeWithoutKeyword.cs
Absence of 'unsafe' C# keyword/switch does not guarantee type or memory safety.
/*
The absence of the C# unsafe keyword and switch does not guarantee code
is type or memory safe. It merely prevents the use of pointer types and
fixed size buffers.
The only thing that can guarantee type and memory safety is
verification and CAS/transparency enforcement.
In particular, the absence of unsafe C# blocks does NOT:
@mattwarren
mattwarren / on-tail-recursion.md
Created July 4, 2018 10:36 — forked from mrange/on-tail-recursion.md
On the topic of tail calls in .NET

On the topic of tail calls in .NET

Let's say you have implemented a small data pipeline library to replace LINQ.

module TrivialStream =
  type Receiver<'T> = 'T            -> unit
  type Stream<'T>   = Receiver<'T>  -> unit

  module Details =
@mattwarren
mattwarren / ValueLinqBenchmarks.cs
Created June 15, 2018 08:47 — forked from benaadams/ValueLinqBenchmarks.cs
Value Linq Benchmarks
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;