Skip to content

Instantly share code, notes, and snippets.

View ola's full-sized avatar

Ola Håkansson ola

View GitHub Profile
@daggerrz
daggerrz / MemoryMappedFile.scala
Created June 11, 2012 21:00
Memory mapping files larger than Integer.MAX_VALUE
import java.io.RandomAccessFile
import java.nio.channels.FileChannel
import org.jboss.netty.buffer.{ByteBufferBackedChannelBuffer, ChannelBuffer, ChannelBuffers}
/**
* Maps a the filename to a memory mapped random access file across 1 or more buffers.
* Support files up to Long.MAX_VALUE.
*
* @param filename the file to map
* @param maxBufferSize the maximum number of bytes to map per buffer
@derekwyatt
derekwyatt / broker.py
Created August 30, 2011 23:35
This is an ENSIME broker to be used for Vim integration to ENSIME... just a prototype at this point
#!/usr/bin/python
import socket
import re
from time import sleep
from os import system
from threading import Thread
from optparse import OptionParser
parser = OptionParser()
anonymous
anonymous / .ctags
Created May 12, 2011 00:19
--langdef=Scala
--langmap=Scala:.scala
--regex-Scala=/^[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/
--regex-Scala=/^[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\1/o,objects/
--regex-Scala=/^[ \t]*trait[ \t]*([a-zA-Z0-9_]+)/\1/t,traits/
--regex-Scala=/^[ \t]*case[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/r,cclasses/
--regex-Scala=/^[ \t]*abstract[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/a,aclasses/
--regex-Scala=/^[ \t]*def[ \t]*([a-zA-Z0-9_=]+)[ \t]*.*[:=]/\1/m,methods/
--regex-Scala=/[ \t]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/
--regex-Scala=/[ \t]*var[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/v,variables/
@viktorklang
viktorklang / CQRS_ES_Actor.scala
Created February 1, 2011 15:05
CQRS and EventSourcing using Akka Actors
import scala.collection.mutable.ListBuffer
import akka.actor.{Actor,ActorRef}
import akka.actor.Actor._
import akka.routing.{ Listeners, Listen }
//Represents a domain event
trait Event
//A builder to create domain entities
trait EntityBuilder[Entity] {
@momania
momania / gist:653276
Created October 29, 2010 10:14
HeartMonitor using Akka FSM
import akka.actor.{Actor, FSM}
import java.util.concurrent.TimeUnit
sealed trait Health
case object Stale extends Health
case object Alive extends Health
case object Dead extends Health
case object HeartBeat