Skip to content

Instantly share code, notes, and snippets.

Ayende Rahien ayende

Block or report user

Report or block ayende

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bad.sort.cs
var s = new[]
{
"2015-10-16T23:21:28.5487637+02:00",
"2015-10-16T23:21:28.5487637+02:00",
"2015-10-16T23:21:28.5487637+02:00",
"2015-10-16T23:21:28.5487637+02:00",
"2015-10-16T23:21:28.5487637+02:00",
"2015-10-16T23:21:28.5487637+02:00",
"2015-10-16T23:21:28.5487637+02:00",
"2015-10-16T23:21:28.5487637+02:00",
View metedata.cs
public struct SegmentMetadata
{
public const ulong NumberOfBitsBitmap = 0x7FFF;
public ulong RawValue;
public ulong Start
{
get => RawValue & ~NumberOfBitsBitmap;
set => RawValue = value & ~NumberOfBitsBitmap | RawValue & NumberOfBitsBitmap;
}
View IPostingList.cs
public interface IPostingList<TEnum>
where TEnum: struct, IPostingListEnumerator
{
public ulong FirstValue { get; }
public ulong NumberOfResults { get; }
public TEnum Enumerate(ulong start)
}
View diff.cs
public class DiffBinaryWriter : BinaryWriter
{
long prev;
public DiffBinaryWriter(Stream s, long start) : base(s)
{
prev = start;
WriteValue(prev);
}
public void Diff(long cur)
View full.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MimeKit;
using MimeKit.Text;
View Indexing.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MimeKit;
using MimeKit.Text;
View index-state.cs
var docs = new ConcurrentDictionary<long, DocRef>();
long index = 0;
var fields = new ConcurrentDictionary<string, ConcurrentQueue<long>>[]
{
new ConcurrentDictionary<string, ConcurrentQueue<long>>(), // Body
new ConcurrentDictionary<string, ConcurrentQueue<long>>(), // Subject
new ConcurrentDictionary<string, ConcurrentQueue<long>>(), // Date
new ConcurrentDictionary<string, ConcurrentQueue<long>>(), // From
new ConcurrentDictionary<string, ConcurrentQueue<long>>(), // To
View enron.json
{
"Id": [
"18739556.1075840017471.javamail.evans@thyme"
],
"Date": [
"Sat, 03 Nov 2001 01:24:54 GMT"
],
"From": [
"tim.belden@enron.com"
],
View analysis.cs
static void Analyze(string dir)
{
var spearators = new char[] { ' ', '\t', ',', '!', '\r', '(', ')', '?', '-', '"', '\n', '/' };
var trim = new char[] { '.', };
var blockingCollection = new BlockingCollection<string>(2048);
var tasks = new List<Task>();
var dics = new ConcurrentQueue<Dictionary<string, HashSet<string>>>();
for (int i = 0; i < 16; i++)
{
View try2.cs
uint symbol = 0;
if (dw > 0x000000FF)
{
symbol = 1;
if (dw > 0x0000FFFF)
{
symbol = 2;
if (dw > 0x00FFFFFF)
{
symbol = 3;
You can’t perform that action at this time.