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
import com.typesafe.sbt.packager.Keys._ | |
import sbt.Keys._ | |
import com.typesafe.sbt.SbtNativePackager._ | |
name := "hw" | |
version := "1.0" | |
scalaVersion := "2.10.3" |
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 helloMacro { | |
def impl(c: Context)(annottees: c.Expr[Any]*): c.Expr[Any] = { | |
import c.universe._ | |
import Flag._ | |
val result = { | |
annottees.map(_.tree).toList match { | |
case q"trait $name extends ..$parents { ..$body }" :: Nil => | |
q""" | |
trait $name extends ..$parents { | |
def hello = "hello" |
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 build extends Build { | |
val maestroJar = TaskKey[File]("maestro-jar", "Creates a packaged jar that works for maestro") | |
def allFiles(base: File): Seq[File] = { | |
val finder: PathFinder = PathFinder(base).*** | |
finder.get | |
} | |
val maestroJarSettings: Seq[Project.Setting[_]] = inTask(maestroJar)(Seq( | |
artifactPath <<= artifactPathSetting(artifact), |
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 OpsMain { | |
def main(args : Array[String]) { | |
hadoop.util.ToolRunner.run(new hadoop.mapred.JobConf, new Tool[XXX]({args => new XXX(args)}), args) | |
} | |
} |
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 IncludeInLib = Configurations.config("include-lib") | |
def addSpecifiedDependenciesToLibInAssembly = inConfig(IncludeInLib)(Defaults.configSettings) ++ Seq( | |
(libraryDependencies in IncludeInLib) := Nil, // needed otherwise scala library gets included. | |
(assembledMappings in assembly) <<= (libraryDependencies in IncludeInLib, externalDependencyClasspath in IncludeInLib, assembledMappings in assembly) map ((specified, managed, mappings) => { |
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
import sbt._ | |
import Keys._ | |
import sbtassembly.Plugin._, AssemblyKeys._ | |
object build extends Build { | |
type Sett = Project.Setting[_] | |
lazy val standardSettings: Seq[Sett] = | |
Defaults.defaultSettings ++ Seq[Sett]( |
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
There is a pathing issue with qiBuild. when I run qibuild configure I always get the following error: | |
Current build worktree: xxxx | |
Using toolchain: mytoolchain | |
Build type: Debug | |
[ERROR]: Could not find qibuild cmake framework path | |
Please file a bug report with the details of your installation | |
When I run the command in debug mode I see some paths that don't match my system: | |
Build type: Debug |
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
calc.gini <- function(y) | |
{ | |
num.pos <- sum(y==1) | |
num.neg <- sum(y==0) | |
tpr <- cumsum(y==1)/num.pos | |
fpr <- cumsum(y==0)/num.neg | |
area <- (tpr[-1] + tpr[1:(length(tpr)-1)]) %*% (fpr[-1] - fpr[1:(length(fpr)-1)]) | |
1 - as.numeric(area) | |
} |
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
trait M[A] { | |
def op( a1: A, a2: A): A | |
def zero: A | |
} | |
val sumIntMonoid = new M[Int]{ | |
val zero = 0 | |
def op(a1:Int, a2:Int) = a1 + a2 | |
} |
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
In order to | |
* paste the text from the file in the gist: sudo vim /usr/local/sbin/configure-pat.sh | |
* Make it executable: sudo chmod u+x /usr/local/sbin/configure-pat.sh | |
* Edit /etc/rc.local: "sudo vim /etc/rc.local" and add the following line: "/usr/local/sbin/configure-pat.sh" | |
* Reboot the instance |
NewerOlder