Skip to content

Instantly share code, notes, and snippets.

View mr-calvert's full-sized avatar

Scott Calvert mr-calvert

  • Splunk
  • El Cerrito, CA
View GitHub Profile
@pchiusano
pchiusano / queues.markdown
Created December 22, 2013 19:43
Binding to asynchronous processes using scalaz-stream

When creating streams from an asynchronous process, the idiomatic thing is to create a stream from that process at the earliest possible stage, rather than using a queue to invert control after the fact. See the creating streams examples - generally, you just use the Process.eval and Process.repeatEval functions to build a stream by running some asynchronous task repeatedly.

That said, if you have some existing logic that you need to bind to that's already based on callbacks and side effects, you can use the functions in scalaz.stream.async. Here's an example, using a queue to invert control:

import scalaz.stream.async

val (q, src) = async.queue[Int]

// Thread 1
@dennisschneider
dennisschneider / gist:5907959
Created July 2, 2013 09:33
VirtualBox migration workaround: v4.2.14 ( "Progress object failure: NS_ERROR_CALL_FAILED") just replace "BaseBoxName" with your box, tested with precise32 + precise64
cd ~/.vagrant.d/boxes/BaseBoxName/virtualbox
openssl sha1 *.vmdk *.ovf > box.mf