This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val src = Source.actorRef[ByteString](1000, OverflowStrategy.dropHead) | |
FlowGraph.closed(src) { implicit builder => | |
byteStringSource => | |
import FlowGraph.Implicits._ | |
// for junctions / fan-in / fan-out shapes we need to builder.add explicitly | |
val broadcaster = builder.add(Broadcast[String](2)) | |
// for Flows builder.add is implicit, if I'm not mistaking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val src = Source.actorRef[ByteString](1000, OverflowStrategy.dropHead) | |
FlowGraph.closed(src) { implicit builder => | |
byteStringSource => | |
import FlowGraph.Implicits._ | |
// for junctions / fan-in / fan-out shapes we need to builder.add explicitly | |
// val broadcaster = builder.add(Broadcast[String](2)) | |
val broadcaster: UniformFanOutShape[String,String] = Broadcast[String](2) // builder.add is done implicitly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ~>[Out](junction: UniformFanInShape[T, Out])(implicit b: Builder[_]): PortOps[Out, Unit] = { | |
def bind(n: Int): Unit = { | |
if (n == junction.inSeq.length) | |
throw new IllegalArgumentException(s"no more inlets free on $junction") | |
else if (b.module.upstreams.contains(junction.in(n))) bind(n + 1) // it's already part of the graph | |
else b.addEdge(importAndGetPort(b), junction.in(n)) // b.add(), add it to the graph | |
} | |
bind(0) | |
junction.out | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Boot extends App { | |
val extractor = new SentenceAnalyzer | |
with NGramExtraction | |
with Unigrams | |
with Bigrams | |
with Trigrams | |
val sentences = Source.fromInputStream(getClass.getResourceAsStream("/input.txt")).getLines().toIterable | |
println(extractor.analyze(sentences)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Config for Vagrant using Puppet provisioning. Requires 0.9.5 or higher ### | |
# Configuration | |
hostname = "elmar-test-jero" | |
puppet_manifests = "~/Projects/Puppet/manifests/" | |
puppet_modules = "~/Projects/Puppet/modules/" | |
## ================================ | |
# Don't edit below unless you know what you're doing | |
## ================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Use template from module 'elmar' | |
class repo-nonfree { | |
file { "/etc/apt/sources.list.d/non-free.list": | |
ensure => present, | |
content => $operatingsystem ? { | |
"ubuntu" => template("elmar/apt/sources.list.d/ubuntu-partner.list.erb"), | |
"debian" => template("elmar/apt/sources.list.d/non-free.list.erb"), | |
default => template("elmar/apt/sources.list.d/non-free.list.erb"), | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file { "/etc/apt/trusted.gpg.d/mozilla.gpg": | |
ensure => present, | |
source => $operatingsystem ? { | |
"ubuntu" => "puppet:///elmar/apt/trusted.gpg.d/mozilla_ubuntu.gpg", | |
"debian" => "puppet:///elmar/apt/trusted.gpg.d/mozilla_debian.gpg", | |
}, | |
notify => Exec["aptgetupdate"], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
task :setup, :except => { :no_release => true } do | |
dirs = [deploy_to, releases_path, shared_path] | |
dirs += shared_children.map { |d| File.join(shared_path, d.split('/').last) } | |
run "mkdir -p #{dirs.join(' ')}" | |
run "chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Elmar configuration file for Vagrant. Requires 0.9.5 or higher ### | |
## ================================ | |
# Don't edit below unless you know what you're doing | |
## ================================ | |
Vagrant::Config.run do |config| | |
config.vm.define :frontend do |frontend_config| | |
## Provisioning | |
frontend_config.vm.provision :puppet do |puppet| | |
puppet.module_path = "modules" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uuid' | |
module Vagrant | |
module Action | |
module VM | |
class Import | |
def initialize(app, env) | |
@app = app | |
end |
OlderNewer