This file contains hidden or 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
// Sketch of an immutable domain model in Scala | |
// We used this scheme together with this JPA module: | |
// http://github.com/jboner/skalman/blob/d1e03a85be3964b9012f9e79dd726b0546342b2b/core/src/main/scala/JPA.scala | |
// ...and this GenericRepository: | |
// http://github.com/jboner/skalman/blob/d1e03a85be3964b9012f9e79dd726b0546342b2b/core/src/main/scala/GenericRepository.scala | |
abstract class Entity[T](val id: Int) | |
object User { |
This file contains hidden or 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
case class Word(word: String, count: Long) { | |
override def toString = word + ": " + count | |
def +(n: Long): Word = Word(word, count + n) | |
} | |
private def showWordCloud { | |
val words = statusTableModel.filteredStatuses.flatMap(_.text.split("\\s")) | |
val emptyMap = immutable.Map.empty[String, Word].withDefault(w => Word(w, 0)) | |
val counts = words.foldLeft(emptyMap)((map, word) => map(word) += 1) | |
val countList = counts.values.toList.sort(_.count > _.count) |
This file contains hidden or 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 Nginx to act as a front-end for Riak | |
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc) | |
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_) | |
# Config is in /etc/nginx/sites-available/default or somewhere like that | |
# Set up load-balancing to send requests to all nodes in the Riak cluster | |
# Replace these IPs/ports with the locations of your Riak nodes | |
upstream riak_hosts { | |
server 127.0.0.1:8098; |
This file contains hidden or 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
// import for MongoDB Scala Driver | |
import com.osinka.mongodb._ // <- this replaces Preamble | |
import com.osinka.mongodb.shape._ | |
import com.mongodb.{Mongo,DBObject} | |
// Scala complains you are using "case class" here and I understand it. "class" is more | |
// appropriate as you have no arguments | |
class User extends MongoObject { | |
var id: Int = _ | |
var name: String = _ |
This file contains hidden or 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
trait PostStart { actor: Actor => | |
def postStart: Unit | |
override def preStart { | |
super.preStart | |
actor.become { | |
case "PostStart" => try { postStart } finally { actor.unbecome } | |
} | |
actor.self ! "PostStart" | |
} |
This file contains hidden or 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 des = scala.concurrent.ExecutionContext.global | |
import scala.concurrent._ | |
import duration._ | |
def ct = Thread.currentThread.getName | |
val n = Runtime.getRuntime.availableProcessors | |
def hogThread(sec:Int) = future { |
This file contains hidden or 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 strict'; | |
function* readLine(stream) { | |
const EOL = require('os').EOL; | |
const Fs = require('fs'); | |
const buf = new Buffer(1024); | |
stream.resume(); | |
stream.setEncoding('ascii'); |
This file contains hidden or 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
us.rdx2.lgtvsdp.com | |
us.info.lgsmartad.com | |
us.ibs.lgappstv.com | |
us.lgtvsdp.com | |
ad.lgappstv.com | |
smartshare.lgtvsdp.com | |
ibis.lgappstv.com | |
# added after fork | |
# from https://www.reddit.com/r/pihole/comments/6qmpv6/blacklists_for_lg_webos_tvs/ and others |