Skip to content

Instantly share code, notes, and snippets.

View manjuraj's full-sized avatar

Manju Rajashekhar manjuraj

View GitHub Profile
@manjuraj
manjuraj / nginx-proxy-cache.txt
Created June 8, 2016 03:55 — forked from yanmhlv/gist:5612256
nginx proxy_cache
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:5m max_size=1000m;
server {
listen 80;
server_name cache.example.ru;
# кешируемый адрес
location / {
# кеш включен по умолчанию
set $no_cache "";
# отключаем кеш для всех методов, кроме GET и HEAD
if ($request_method !~ ^(GET|HEAD)$) {
@manjuraj
manjuraj / Monad.scala
Last active December 29, 2015 20:49 — forked from johnynek/Monad.scala
// (1). Simplified - A Thing[A] to compute another Thing[B]
// Thing[A] is like a simplest posssible container for a value and the
// pattern, given a Thing[A], and a function flatMap, pulls a value of
// type A out of the Thing[A] and applies the function flatMap() on this
// value of type A and returns another new Thing[B] with a value of
// type B injected into it by the constructor (apply() method here)
// encapsulates a monad in loose sense
case class Thing[+A](value: A) {
def flatMap[B](f: A => Thing[B]) = f(value)
}
// my response to https://groups.google.com/forum/?fromgroups#!searchin/play-framework/cake/play-framework/LQ2y40QNZaE/qvRFw5of-rQJ
import play.api._
import play.api.mvc._
// Domain object
case class User(id: String, name: String)
// Trait defining the service component
trait UserServiceComponent {
@manjuraj
manjuraj / latency.txt
Created May 31, 2012 17:35 — forked from jboner/latency.txt
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
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns