#Outstanding FP, CS, and other books we like.
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
# pushd /opt/local/var/macports/registry | |
# mv registry.db registry.db.old | |
# sqlite3 registry.db.old | |
sqlite> .load /opt/local/var/macports/sources/rsync.macports.org/release/base/src/cregistry/macports.sqlext | |
sqlite> .mode insert | |
sqlite> .output dump_all.sql | |
sqlite> .dump | |
sqlite> .exit |
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
#!/bin/bash | |
rm -vrf /System/Library/Extensions/zfs.kext | |
rm -vrf /System/Library/Filesystems/zfs.fs | |
rm -vf /usr/lib/libzfs.dylib | |
rm -vrf /usr/lib/libzfs.dylib.dSYM | |
rm -vf /usr/lib/libzpool.dylib | |
rm -vrf /usr/lib/libzpool.dylib.dSYM | |
rm -vf /usr/local/bin/zoink | |
rm -vrf /usr/local/bin/zoink.dSYM |
...perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
-- Antoine de Saint-Exupéry
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
!/bin/sh | |
count=0 | |
interval=60 | |
while true | |
do | |
echo -ne "$(date +%Y-%m-%dT%H:%M:%S) | $((count/interval)) mins : $1"'\r' | |
let count+=interval | |
sleep $interval | |
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
val scalacFlags = Seq( | |
"-deprecation", | |
"-encoding", "UTF-8", | |
"-feature", | |
"-language:existentials", | |
"-language:experimental.macros", | |
"-language:higherKinds", | |
"-language:implicitConversions", | |
"-unchecked", | |
"-Xfatal-warnings", |
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 Main extends App { | |
def toOpt(s: Set[String]): Option[String] = s match { | |
case x if !x.isEmpty => Some(x.mkString(" ")) | |
case _ => None | |
} | |
val a: Set[String] = Set() | |
val b: Set[String] = Set("a", "b") | |
println(s"a = ${toOpt(a)}") | |
println(s"b = ${toOpt(b)}") |
A type constructor F[_]
together with an operation forall A, B. (A => B) => F[A] => F[B]
that satisfies FunctorLaw,
i.e. that a series of maps may be freely rewritten as a single map on a composed function, and that the identity function, lifted, is a no-op.
A good example from scalaz
def map[A, B](fa: F[A])(f: (A) ⇒ B): F[B]
NewerOlder