Skip to content

Instantly share code, notes, and snippets.

View rajeshpv's full-sized avatar

Rajesh Rao rajeshpv

  • Consultant
  • Cary NC
  • 16:24 (UTC -04:00)
View GitHub Profile
@chrisjacob
chrisjacob / README.md
Created February 18, 2011 03:44
Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

@joa
joa / go.scala
Created June 1, 2011 11:12
Go Channels in Scala
package go
import java.util.concurrent.{
BlockingQueue => JBlockingQueue,
ArrayBlockingQueue => JArrayBlockingQueue
}
object Channel {
def empty[A]: Channel[A] = new BlockingChannel()
def make[A]: Channel[A] = make(1)
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@teamon
teamon / Application.scala
Created February 19, 2012 21:51
Play router
package controllers
// import play.api._
import play.api.mvc._
object Application extends Controller {
def index: Action[_] = Action {
@leon
leon / play.conf
Created March 26, 2012 12:27
Upstart script for Play Framework 2.0
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/play.conf
#
# This could be the foundation for pushing play apps to the server using something like git-deploy
# By calling service play stop in the restart command and play-start in the restart command.
#
# Usage:
# start play
# stop play
# restart play
@mixin arrow-box($direction, $color, $size)
&:after, &:before
@if $direction == top
bottom: 100%
@if $direction == bottom
top: 100%
@if $direction == left
right: 100%
@if $direction == right
left: 100%
@jboner
jboner / latency.txt
Last active July 23, 2024 14:12
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
@igm
igm / HttpServer.scala
Created June 15, 2012 11:53
Simple HTTP Server in Scala & Java 7 (async I/O)
import java.lang.Character.{ LETTER_NUMBER => CR,LINE_SEPARATOR => LF }
import java.net.InetSocketAddress
import java.nio.channels.AsynchronousChannelGroup._
import java.nio.channels.AsynchronousServerSocketChannel._
import java.nio.channels.{ AsynchronousSocketChannel => ASC }
import java.nio.channels.CompletionHandler
import java.nio.ByteBuffer._
import java.util.concurrent.Executors._
import scala.annotation.implicitNotFound
import scala.collection.mutable.ListBuffer
@guillaumebort
guillaumebort / Procfile
Created June 22, 2012 16:04
Configuration for a blocking Play 2.0 application
web: target/start -Dhttp.port=${PORT} -Dconfig.resource=prod.conf ${JAVA_OPTS}
@kevinwright
kevinwright / ZeeingEvent.scala
Created July 10, 2012 12:19
Typesafe conversion from List[Any] to a case class, via shapeless
case class ZeeingEvent(
zid: String,
kind: String,
showId: String,
show_name: Option[String],
time: DateTime
) {
require (kind == "StartedZeeing" || kind == "EndedZeeing")
}