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
# Create key: | |
openssl genrsa -out DOMAINCOM.com.key 2048 | |
# And the certificate: | |
openssl req -new -x509 -key DOMAINCOM.key -out DOMAINCOM.cert -days 3650 -subj /CN=DOMAIN.COM |
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
#!/usr/bin/env bash | |
C="0" # count | |
while [ $C -lt 20 ] | |
do | |
case "$(($C % 4))" in | |
0) char="/" | |
;; | |
1) char="-" | |
;; |
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
# | |
# Utilities | |
# | |
dot_progress() { | |
while true | |
do | |
echo -n "." | |
sleep 2 | |
done | |
} |
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
import spray.routing._ | |
import spray.routing.directives.LogEntry | |
import spray.http.HttpRequest | |
import spray.httpx.encoding.{Gzip, NoEncoding} | |
import akka.event.Logging._ | |
/** Main class to start up the application */ | |
object Boot extends App with SimpleRoutingApp { |
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
# | |
# Slightly tighter CORS config for nginx | |
# | |
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs | |
# | |
# Despite the W3C guidance suggesting that a list of origins can be passed as part of | |
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox) | |
# don't seem to play nicely with this. | |
# |
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
public class MyPipelineFactory implements ChannelPipelineFactory { | |
private final Timer timer; | |
private final ChannelHandler timeoutHandler; | |
public MyPipelineFactory(Timer timer) { | |
this.timer = timer; | |
this.timeoutHandler = new ReadTimeoutHandler(timer, 30), // timer must be shared. | |
} |
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
akka { | |
actor { | |
provider = "akka.remote.RemoteActorRefProvider" | |
serialize-messages = on | |
serializers { | |
proto = "akka.remote.serialization.ProtobufSerializer" | |
} | |
serialization-bindings { | |
"scala.collection.immutable.List" = proto |
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 UserDaoImpl { | |
object Implicits { | |
implicit object AccountWriter extends BSONDocumentWriter[Account] { | |
def write(acc: Account) = BSONDocument( | |
"email" -> acc.email) | |
} | |
implicit object AccountReader extends BSONDocumentReader[Account] { |
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
Mongo shell command | |
> db.users.update( | |
{ community:'Coomunity1', | |
'users.login': {'$ne': 'Login1'} | |
}, | |
{ $push: | |
{ users: {login:'Login1', pwd:'*****'} } | |
}, | |
{upsert: true}) |
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
Here are a few alternatives you might wish to consider: | |
1. Use a view bound | |
If it's possible to change the function that takes a List of Bs, this would be the simplest solution. Modify it to accept a List of things that can be converted to Bs. That is, | |
def myfun(l: List[B]) = ... | |
would become | |
def myfun[X <% B](l: List[X]) = ... |