Skip to content

Instantly share code, notes, and snippets.

static IEnumerable<(int pos, int size)> Ranges(ulong[] bitmap, int pos, int required)
{
while (!is_at_end())
{
if (is_bit_zero())
{
var spos = pos;
var c = 0;
do
{
@ryanheath
ryanheath / program.cs
Created April 20, 2020 20:35
Find an md5 collision from one string to another
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Security.Cryptography;
public class Program
{
public static void Main()
{
@ryanheath
ryanheath / gist:1376107
Created November 18, 2011 10:26
Get average of last n-values
using System;
using System.Linq;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
using Raven.Client.Linq;
namespace ConsoleApplication
{
class Program
{
@ryanheath
ryanheath / tax.cs
Created September 22, 2011 15:49 — forked from flq/tax.cs
the tax thingy
public decimal GetTaxes(decimal salary)
{
var taxBrackets = new[]
{
new {UpperLimit = 5070m, Taxation = 0.10m},
new {UpperLimit = 8660m, Taxation = 0.14m},
new {UpperLimit = 14070m, Taxation = 0.23m},
new {UpperLimit = 21240m, Taxation = 0.30m},
new {UpperLimit = 40230m, Taxation = 0.33m},
new {UpperLimit = decimal.MaxValue, Taxation = 0.45m},