start new:
tmux
start new with session name:
tmux new -s myname
// Import the magic libraries | |
import scala.xml._ | |
import scala.xml.transform._ | |
// Source xml. In Scala, xml is literal. | |
val xml = | |
<user> | |
<email>[email protected]</email> |
require "openssl" | |
require "digest" | |
def aes128_cbc_encrypt(key, data, iv) | |
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize) | |
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize) | |
aes = OpenSSL::Cipher.new('AES-128-CBC') | |
aes.encrypt | |
aes.key = key | |
aes.iv = iv |
var cluster = require('cluster'); | |
if (cluster.isWorker) { | |
console.log('Worker ' + process.pid + ' has started.'); | |
// Send message to master process. | |
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
// Receive messages from the master process. |
# copy items | |
# if you have a zip here: http://myserver.com/my.zip and it contains myFile.txt and myFolder/myOtherFile.txt | |
# you can call this script like so: | |
# .\download_zip.ps1 http://myserver.com/my.zip "myFile.txt|c:\myFileDestination\myFileHere.txt" "myFolder/myOtherFile.txt|c:\myOtherDestination\myOtherFile.txt" | |
# | |
"download script -----------------------------------------" | |
"------" | |
"Downloads from the given url, unzips it then for each string arg, copies the file to the destination" |
function curry(f) { | |
return function(x) { | |
var g = f.bind(this, x); | |
if(g.length == 0) return g(); | |
if(arguments.length > 1) return curry(g).apply(this, [].slice.call(arguments, 1)); | |
return curry(g); | |
}; | |
} | |
var sum = curry(function(x, y) { |
import spray.json._ | |
import reactivemongo.bson._ | |
import reactivemongo.bson.handlers.{ BSONReader, BSONWriter, RawBSONWriter } | |
import scala.util.{ Try, Success, Failure } | |
import org.apache.commons.codec.binary.Hex | |
import org.joda.time.format.ISODateTimeFormat | |
import org.joda.time.{ DateTime, DateTimeZone } | |
import java.nio.ByteBuffer | |
import org.jboss.netty.buffer.ChannelBuffers |
package module.db; | |
import com.mongodb.casbah.Imports._ | |
import java.text.DateFormat | |
import java.util.Date | |
import play.api.data.validation.ValidationError | |
import play.api.libs.json._ | |
object MongoJson { | |
def fromJson(json: JsValue) : JsResult[DBObject] = readDBObject.reads(json) |
import sbt._ | |
import Keys._ | |
import java.net._ | |
import java.io.File | |
import play.PlayRunHook | |
/* | |
Grunt runner should be in project directory to be picked up by sbt | |
*/ | |
object Grunt { |