Skip to content

Instantly share code, notes, and snippets.


Martin Krasser krasserm

View GitHub Profile
krasserm /
Created Jun 23, 2022 — forked from squadbox/
A script to control Nvidia GPU fan speed on headless (non-X) linux nodes
# This script will enable or disable fixed gpu fan speed
# Description: A script to control GPU fan speed on headless (non-X) linux nodes
# Original Script by Axel Kohlmeyer <>
# Modified for newer drivers and removed old work-arounds
krasserm / MonadTransformerExamples.scala
Created Jul 14, 2011
Scalaz 7 monad transformer examples
View MonadTransformerExamples.scala
import scalaz._
import Scalaz._
object MonadTransformerExamples {
def main(args: Array[String]) = run
def run {
// ------------------------------------------------------
// Combined Option/Option
// ------------------------------------------------------
krasserm /
Last active Mar 27, 2017
Akka Persistence Plugins
krasserm / BoundedMailboxDirectConsumer.scala
Created Feb 19, 2011
Akka consumer actors best practices
View BoundedMailboxDirectConsumer.scala
class BoundedMailboxDirectConsumer extends Actor with Consumer {
import akka.dispatch._
import akka.util.duration._
// Create a bounded mailbox for this consumer actor with a capacity of 10
self.dispatcher = Dispatchers.newThreadBasedDispatcher(self, 5, 100.milliseconds)
// instruct how the route should be customized during route creation (definition)
onRouteDefinition { rd: RouteDefinition =>
// on exception attempt max 3 redeliveries with a delay of 1000 ms
View gist:9c9651a9423f9d8e2381d1922f9d88ed
import java.nio.ByteBuffer
import java.util.concurrent.TimeUnit
import org.apache.kafka.clients._
import org.apache.kafka.common.metrics.{MetricConfig, Metrics, MetricsReporter}
import org.apache.kafka.common.protocol.ApiKeys
import org.apache.kafka.common.record.{CompressionType, MemoryRecords}
import org.apache.kafka.common.requests.{ProduceRequest, RequestSend}
import org.apache.kafka.common.utils.SystemTime
View akka-persistence-es.scala
import akka.persistence._
object EventsourcingExample extends App {
class EventsourcedProcessor extends Processor {
var events: List[Any] = Nil
var awaitStack: List[Actor.Receive] = Nil
def receive = {
case Persistent(event, _) if recoveryRunning update(event)
krasserm / example1.scala
Last active Dec 17, 2015
Eventsourced processors in a parent-child relationship
View example1.scala
import scala.concurrent.duration._
import akka.util.Timeout
import org.eligosource.eventsourced.core._
import org.eligosource.eventsourced.journal.leveldb.LeveldbJournalProps
krasserm / parwrite.scala
Created Feb 3, 2013
Journal parallel writes prototype
View parwrite.scala
package example
import scala.concurrent._
import scala.concurrent.duration._
import akka.pattern.ask
import akka.util.Timeout
object Parwrite extends App {
krasserm / es-ext-01.scala
Last active Dec 12, 2015
Event sourcing and external servce integration (blog post snippets)
View es-ext-01.scala
case class Order(id: Int = -1, details: String,
creditCardNumber: String,
creditCardValidation: Validation = Validation.Pending)
sealed trait Validation
object Validation {
case object Pending extends Validation
case object Success extends Validation
case object Failure extends Validation