Skip to content

Instantly share code, notes, and snippets.

Working from home

Ronnie Overby ronnieoverby

Working from home
  • Olo
  • Lexington, NC
View GitHub Profile
ronnieoverby / channels.cs
Last active Mar 11, 2020
An example when `Task.Yield()` is useful
View channels.cs
var ch = Channel.CreateUnbounded<int>();
var producer = Task.Run(() =>
for (int i = 0; i < 500_000; i++)
View gist:06d0db3fa40a44af9effe4a56c19fbd8
### Keybase proof
I hereby claim:
* I am ronnieoverby on github.
* I am ronnieoverby ( on keybase.
* I have a public key ASCXPI6o5jpbNT7RowJ7h_vBeGh0pzcksHwfhqWFQNVxUgo
To claim this, I am signing this object:
ronnieoverby / gist:416183f553bc8a2399339742057ab220
Created Apr 23, 2019
Reading references on value types vs. reference types.
View gist:416183f553bc8a2399339742057ab220
ronnieoverby / gist:5d67fc7b4e18ad0c3e2d6c2e140ddddd
Created Apr 23, 2019
Reading references on value types vs. reference types.
View gist:5d67fc7b4e18ad0c3e2d6c2e140ddddd
View BlockingStreams.cs
class BlockingStreams
public Stream WriteableStream { get; }
public Stream ReadableStream { get; }
private readonly CancellationToken _ct;
private readonly BlockingCollection<MemoryStream> _blocks;
public BlockingStreams(int? maxWrites = null, CancellationToken ct = default)
View BlockingCollectionExample.cs
var queue = new BlockingCollection<object>();
// ... meanwhile some other thread is adding to the queue
Task.Run(() =>
for (int i = 0; i < 10; i++)
View GetQueryResult.linq
<Query Kind="Program">
<Namespace>static LINQPad.Util</Namespace>
<Namespace>static System.IO.Path</Namespace>
<Namespace>static System.Reflection.Assembly</Namespace>
<Namespace>static System.Reflection.BindingFlags</Namespace>
View alig.cs
void Main()
var a = new BigDecimal(
BigInteger.Parse("9999999999999999999999999999999999999999999999999"), 0);
var b = new BigDecimal(
View AttachmentExtensions.cs
public static class AttachmentExtensions
private static readonly ConditionalWeakTable<object, ConcurrentDictionary<string, object>> _attachmentTable =
new ConditionalWeakTable<object, ConcurrentDictionary<string, object>>();
/// <summary>
/// Atomically gets or sets an attached value if it's found.
/// </summary>
public static AttachmentResult<T> GetOrSetAttached<T>(this object host, Func<T> factory, string key = null)
ronnieoverby / MyExtensions.cs
Created Oct 21, 2016
Mitigates Linqpad DumpContainer MemoryDump
View MyExtensions.cs
public static class MyExtensions
public static void UpdateContentOccasionally(this DumpContainer dc, object newContent, int intervalMilliseconds = 1000) =>
UpdateContentOccasionally(dc, newContent, TimeSpan.FromMilliseconds(intervalMilliseconds));
public static void UpdateContentOccasionally(this DumpContainer dc, object newContent, TimeSpan interval)
var swAttachment = dc.GetOrSetAttached(() => Stopwatch.StartNew());