For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
import scala.collection.mutable.ListBuffer | |
import akka.actor.{Actor,ActorRef} | |
import akka.actor.Actor._ | |
import akka.routing.{ Listeners, Listen } | |
//Represents a domain event | |
trait Event | |
//A builder to create domain entities | |
trait EntityBuilder[Entity] { |
/** | |
* Creates a build properties file resource and packages it into the JAR, | |
* which can be read for various information such as version and build time. | |
* */ | |
trait BuildPropertiesResource extends BasicScalaProject { | |
/** | |
* Specifies the name of the resource file. This is put [by default] | |
* in the top level directory of the jar. | |
* */ | |
def buildPropertiesResourceFile = "build.properties" |
trait Enum { //DIY enum type | |
import java.util.concurrent.atomic.AtomicReference //Concurrency paranoia | |
type EnumVal <: Value //This is a type that needs to be found in the implementing class | |
private val _values = new AtomicReference(Vector[EnumVal]()) //Stores our enum values | |
//Adds an EnumVal to our storage, uses CCAS to make sure it's thread safe, returns the ordinal | |
private final def addEnumVal(newVal: EnumVal): Int = { import _values.{get, compareAndSet => CAS} | |
val oldVec = get |
import scalaz._ | |
import Scalaz._ | |
object MonadTransformerExamples { | |
def main(args: Array[String]) = run | |
def run { | |
// ------------------------------------------------------ | |
// Combined Option/Option | |
// ------------------------------------------------------ |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: carbon-cache | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: carbon-cache init script | |
# Description: An init script for Graphite's carbon-cache daemon. | |
### END INIT INFO |
object Format { | |
import com.typesafe.sbtscalariform.ScalariformPlugin | |
import ScalariformPlugin._ | |
lazy val settings = scalariformSettings ++ Seq( | |
ScalariformKeys.preferences := formattingPreferences | |
) | |
lazy val formattingPreferences = { | |
import scalariform.formatter.preferences._ |
For more information, you can read a related blog post on this topic
You can now simply do:
# (turn on full debian repo; turn on ssh)
# be root
sudo su
## Server configuration for nginx to host Atlassian Jira / Jetbrain TeamCity or any other Tomcat web application | |
# | |
# author cedric.walter, www.waltercedric.com | |
# to be saved for ex in /etc/nginx/sites-available/example | |
server { | |
listen 80; | |
server_name jira.example.com; | |
access_log off; | |
location / { |
import scala.util.continuations._ | |
object AskMe { | |
def sleep(delay: Long) = shift[Unit,Int,Unit]{ k: (Unit => Int) => | |
val runnable = new Runnable { | |
var leave = false | |
def run = { | |
while( ! leave ) { | |
Thread.sleep(delay) | |
val res = k() |