Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| def benchmark(runs: Long, reps: Long, funct: => Any) = { | |
| // warmup | |
| println("Warming Up") | |
| var i = 0 | |
| while ( i < 25000 ) { funct; i = i + 1 } | |
| // test runs | |
| println("Running Test") | |
| var j = 0 | |
| while ( j < runs ) { | |
| var k = 0 |
| (ns test.core | |
| (:use [overtone.live] | |
| [overtone.inst.synth])) | |
| (def kick (sample "kick.wav")) | |
| (def snare (sample "snare.wav")) | |
| (def hit (sample "hit.wav")) | |
| (def insts {:kick kick | |
| :snare snare | |
| :hit hit}) |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| package com.tapad.util | |
| import akka.dispatch._ | |
| import java.util.concurrent.atomic.{AtomicInteger, AtomicBoolean} | |
| class LogAndDiscardCircuitBreakerPolicy(val maxMailboxSize: Int, loggable: Logging) extends CircuitBreakerPolicy { | |
| def onOverflowStart(mailboxSize: Int) { loggable.log.warn("Mailbox size is above {}. Ignoring messages until size is back below.", maxMailboxSize) } | |
| def onBackToNormal(overflowCount: Int) { loggable.log.info("Mailbox size is back below {}. A total of {} messags were discarded.", maxMailboxSize, overflowCount) } | |
| def replyToOverflow(overflowCount: Int, msg: Any) : Either[Exception, Any] = Left(new IllegalArgumentException("This overflow policy is not configured for request-reply actors.")) |
| import akka.actor.{ Props, ActorSystem, Actor } | |
| import akka.pattern.ask | |
| import akka.util.Timeout | |
| import akka.util.duration._ | |
| import akka.dispatch.Await | |
| import util.Random | |
| object DangerousOpTest extends App { | |
| println("starting system") | |
| val system = ActorSystem("daOp") |
| package akka.unfiltered | |
| import akka.actor._ | |
| import akka.dispatch.Future | |
| import akka.pattern.ask | |
| import akka.util.duration._ | |
| import akka.util.Timeout | |
| import unfiltered.Async | |
| import unfiltered.request._ |
| trait BeeperDevice { | |
| def beep(beepSound: String) | |
| } | |
| trait DependsOnBeeper { | |
| protected val beeper: BeeperDevice | |
| } | |
| class Beeper extends BeeperDevice { |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| var cluster = require('cluster'); | |
| if (cluster.isWorker) { | |
| console.log('Worker ' + process.pid + ' has started.'); | |
| // Send message to master process. | |
| process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
| // Receive messages from the master process. |
| /* | |
| Copyright 2012-2021 Viktor Klang | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |