Skip to content

Instantly share code, notes, and snippets.

Avatar

Eamon Nerbonne EamonNerbonne

View GitHub Profile
View linqpadMicrobenchValueFromNullalbeSnippet.cs
//timings "on my machine", fixed clockspeed, multiple runs have stable timings with less than 1% variation, x64 .net core 3.0 roslyn 3.3.1-beta4 via linqpad 6.3.0 beta.
//obviously there's some noise, but even the timing differences between 0.66 and 0.68 appear to be reproducible on this machine; not just random happenstance
var arr = Enumerable.Range(1, 10_000).Select(i => i % 2 == 0 ? default(int?) : i).ToArray();
var filteredSeq = arr.Where(o=>o!=null);
var sw = Stopwatch.StartNew();
var sum =0l;
for (int iter = 0; iter < 100_000; iter++)
View Sorts.cs
/*
Results for a 1<<24 size ulong array filled with random data:
Method | Mean | Error | StdDev |
-------------------- |---------:|---------:|---------:|
BottomUpMergeSort | 544.7 ms | 2.119 ms | 1.982 ms |
QuickSort | 242.8 ms | 4.754 ms | 4.669 ms |
TopDownMergeSort | 435.3 ms | 1.393 ms | 1.303 ms |
AltTopDownMergeSort | 452.9 ms | 1.488 ms | 1.392 ms |
SystemArraySort | 263.1 ms | 2.225 ms | 2.081 ms |
@EamonNerbonne
EamonNerbonne / term_kill.sh
Created Jan 15, 2014
Kill processes of current terminal other than bash
View term_kill.sh
#!/bin/bash
# Kills all processes attached to the current terminal.
# This is a helper to workaround https://github.com/ddollar/foreman/issues/357
pkill -t `tty | egrep -o 'pts/[0-9]+'` -x '^([^b]|$|b([^a]|$|a([^s]|$|s([^h]|$)))).*'
sleep 1
pkill -9 -t `tty | egrep -o 'pts/[0-9]+'` -x '^([^b]|$|b([^a]|$|a([^s]|$|s([^h]|$)))).*'
View dabblet.css
#displayBox {
width:666px;
height:715px;
border-top-left-radius:700px;
overflow:hidden;
position:relative;
top:-150px;
left:-10px;
/* fallback */
background: #c07;/*better:image*/