Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Setting status

Rocky Madden rockymadden

:octocat:
Setting status
View GitHub Profile
@rockymadden
rockymadden / bcrypt-cost-guidelines-moores-law.md
Last active Aug 27, 2015
bcrypt cost guidelines based upon moose's law
View bcrypt-cost-guidelines-moores-law.md
Date Iterations Cost
1/1/2000 64 6
7/1/2001 128 7
1/1/2003 256 8
7/1/2004 512 9
1/1/2006 1,024 10
6/1/2007 2,048 11
1/1/2009 4,096 12
6/1/2010 8,192 13
View EntityV3.scala
import scala.collection.immutable.ListMap
sealed abstract class Validated[+T]
case class Valid[+T](value:T) extends Validated[T]
case class Error(message:String) extends Validated[Nothing]
class ValidationException(s:String) extends Exception(s)
View Functional.scala
case class Score(p1: Int, p2: Int)
// Alles ist eine Expression
val score = Score(5, 1)
val winner = if (score.p1 > score.p2) "Player 1" else "Player 2"
val looser = if (score.p1 > score.p2) "Player 2" else "Player 1"
// Tupel
val winnerLooser =
View conwaydef.scala
/**
* A functional Conway's game of life.
*/
package object conwaydef {
type Coord[A] = (Int, Int) => A
type Calculator = Coord[Coord[Boolean] => Boolean]
type Size = Int
def nextCell(old: Boolean)(mates: Int) = if (mates > 3) false else if (mates == 3) true else (old && mates == 2)
View Functor.scala
trait Functor[T[_]]{
def fmap[A,B](f:A=>B)(ta:T[A]):T[B]
}
trait Applicative[T[_]] extends Functor[T]{
def pure[A](a:A):T[A]
def <*>[A,B](tf:T[A=>B])(ta:T[A]):T[B]
}
trait Monad[M[_]] extends Applicative[M]{
View gist:9557687
trait Pointed[F[_]] {
def point[A](a: => A): F[A]
}
trait Functor[F[_]] {
def fmap[A, B](fa: F[A])(f: A => B): F[B]
}
trait Show[A] {
def shows(a: => A): String
View ImperativePong.scala
package pong.imperative
sealed trait Event
class PongConnection {
def isConnected(): Boolean = sys.error("not implemented")
def readEvent(): Event = sys.error("not implemented")
def moveUp(): Unit = sys.error("not implemented")
def moveDown(): Unit = sys.error("not implemented")
def shootMissile(): Unit = sys.error("not implemented")
View Json.scala
package argonaut
import scalaz.{Each => _, Index => _, _}, Scalaz._
/**
* A data type representing possible <a href="http://www.json.org/">JSON</a> values.
*
* @author Tony Morris
* @author Dylan Just
* @author Mark Hibberd
@rockymadden
rockymadden / comodo-positivessl-wildcard-chain-aws.pem
Last active Aug 29, 2015
Comodo PositiveSSL wildcard chain for AWS.
View comodo-positivessl-wildcard-chain-aws.pem
-----BEGIN CERTIFICATE-----
MIIGCDCCA/CgAwIBAgIQKy5u6tl1NmwUim7bo3yMBzANBgkqhkiG9w0BAQwFADCB
hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV
BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQwMjEy
MDAwMDAwWhcNMjkwMjExMjM1OTU5WjCBkDELMAkGA1UEBhMCR0IxGzAZBgNVBAgT
EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
Q09NT0RPIENBIExpbWl0ZWQxNjA0BgNVBAMTLUNPTU9ETyBSU0EgRG9tYWluIFZh
bGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBAI7CAhnhoFmk6zg1jSz9AdDTScBkxwtiBUUWOqigwAwCfx3M28Sh
@rockymadden
rockymadden / aws-upload-server-certificate-cloudfront.sh
Last active Aug 29, 2015
Upload a wildcard certificate to AWS for use on CloudFront.
View aws-upload-server-certificate-cloudfront.sh
aws iam upload-server-certificate \
--server-certificate-name rockymadden.com \
--certificate-body file://rockymadden.com.crt \
--private-key file://rockymadden.com.key \
--certificate-chain file://comodo-positivessl-wildcard-chain-aws.crt \
--path /cloudfront/