Skip to content

Instantly share code, notes, and snippets.

@ktheory
ktheory / dd.log
Last active November 10, 2023 23:41
EC2 EBS-SSD vs instance-store performance on an EBS-optimized m3.2xlarge
# /tmp/test = EBS-SSD
# /mnt/test = instance-store
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 3.26957 s, 82.1 MB/s
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
@mguillermin
mguillermin / generated_jsRoutes.js
Last active May 24, 2016 21:57
Submitting Ajax POST with PlayFramework 2.x and the Javascript Router
...
_nS('controllers.admin.Products'); _root.controllers.admin.Products.search =
function() {
return _wA({method:"POST", url:"/" + "admin/product/search"})
}
...
@ramn
ramn / Deserialization.scala
Last active October 18, 2023 17:42
Object serialization example in Scala
import java.io._
@SerialVersionUID(15L)
class Animal(name: String, age: Int) extends Serializable {
override def toString = s"Animal($name, $age)"
}
case class Person(name: String)
// or fork := true in sbt
@(field:Field, min:Int=1)(f: (Field, Int) => Html)
@{
(0 until math.max(if (field.indexes.isEmpty) 0 else field.indexes.max + 1, min)).map(i => f(field("[" + i + "]"),i))
}
@amscotti
amscotti / md5.coffee
Last active January 18, 2021 12:54
MD5 hashing
crypto = require('crypto');
#Quick MD5 of text
text = "MD5 this text!"
md5hash1 = crypto.createHash('md5').update(text).digest("hex")
#MD5 of text with updates
m = crypto.createHash('md5')
m.update("MD5 ")
m.update("this ")
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}