Skip to content

Instantly share code, notes, and snippets.

View sandeepkv93's full-sized avatar

Sandeep Vishnu sandeepkv93

  • Snowflake
  • Bellevue, WA
  • 21:33 (UTC -07:00)
View GitHub Profile
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

Comparison of ASP.NET and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.
@kamranayub
kamranayub / 1_TestingContext.cs
Last active July 12, 2024 16:08
Example using Ninject and Moq to create a TestingImpersonationContext. All it does is replace the bound dependency with a new impersonated mock and then replaces it once disposed. Relies on a testing context that is available to any test class (could also be a test base class). `UserRepository` is just an example of code that retrieves a user fr…
public class TestingContext {
private IKernel _kernel;
public TestingContext() {
// create initial Strict mock that can always be setup outside impersonation context
UserContext = new Mock<IUserContext>(MockBehavior.Strict);
// register dependencies
_kernel = CreateKernel();
@acamino
acamino / HttpClientApproach.cs
Last active May 25, 2024 20:52
4 Ways to Parse a JSON API with C#
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
namespace HttpClientApproach
{
internal class Contributor
{
public string Login { get; set; }
@fataltes
fataltes / GCModel
Created October 10, 2017 20:40
A helper class to read the binary files related to bias model and exact model for project 4.
import pandas as pd
import numpy as np
class GCModel:
def __init__(self):
self.obs_weights_ = None
self.exp_weights_ = None
self.obs_ = None
self.exp_ = None
self.dims_ = None
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Stream;
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;