Skip to content

Instantly share code, notes, and snippets.

Ronnie Overby ronnieoverby

Block or report user

Report or block ronnieoverby

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
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());
ronnieoverby / Global.asax.cs
Last active Oct 20, 2016
It's REALLY easy to create a Reverse HTTP Server with Web API
View Global.asax.cs
private void SetupRouting(HttpConfiguration config)
config.Routes.MapHttpRoute("proxy_else", "{*uri}", new
controller = "Proxy",
uri = RouteParameter.Optional
View md5.cs
void Main()
var bytes = Encoding.UTF8.GetBytes("Anything you want");
var hash1 = new MD5().ComputeHash(bytes);
var hash2 = System.Security.Cryptography.MD5.Create().ComputeHash(bytes);
You can’t perform that action at this time.