Skip to content

Instantly share code, notes, and snippets.

View aliostad's full-sized avatar
🐒
I may be slow to respond.

Ali Kheyrollahi aliostad

🐒
I may be slow to respond.
View GitHub Profile
@jboner
jboner / latency.txt
Last active July 21, 2024 22:51
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@beyond-code-github
beyond-code-github / gist:5142264
Last active December 14, 2015 20:09
Very simple example of hierarchical route generation in asp.net web api
// Base route
config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", new { id = RouteParameter.Optional });
// Nested route (must be distinguishable by param names from above) - Deisgnated by leading _
config.Routes.MapHttpRoute("NestedRoute", "_/{controller}/{rootId}");
// Root controller signature:
public class AppDataController : ApiController
{
@gregoryyoung
gregoryyoung / gist:5917423
Last active December 19, 2015 07:18
Proof that httplistener does not use http.sys kernel caching
From HttpListener source code
http://www.dotnetframework.org/default.aspx/DotNET/DotNET/8@0/untmp/whidbey/REDBITS/ndp/fx/src/Net/System/Net/HttpListenerResponse@cs/2/HttpListenerResponse@cs
line 525
UnsafeNclNativeMethods.HttpApi.HttpSendHttpResponse(
HttpListenerContext.RequestQueueHandle,
HttpListenerRequest.RequestId,
(uint)flags,
@mugli
mugli / install-java7.sh
Created January 30, 2014 21:51
Silently install Oracle Java 7 on Ubuntu (without license agreement step)
#!/bin/bash
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
# Enable silent install
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections