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
Index: src/main/scala/sbt/DefaultProject.scala | |
=================================================================== | |
--- src/main/scala/sbt/DefaultProject.scala (revision 1129) | |
+++ src/main/scala/sbt/DefaultProject.scala (working copy) | |
@@ -445,7 +445,7 @@ | |
{ | |
log.warn("No Main-Class attribute will be added automatically added:") | |
log.warn("Multiple classes with a main method were detected. Specify main class explicitly with:") | |
- log.warn(" override mainClass = Some(\"className\")") | |
+ log.warn(" override def mainClass = Some(\"className\")") |
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 Merge { | |
def m_way_merge(out: List[Int], xs: List[List[Int]]): List[Int] = { | |
val arrays = xs.remove(_ == Nil) | |
if (arrays.isEmpty) { | |
out | |
} else { | |
val idx: Int = arrays.findIndexOf((xs: List[Int]) => xs.head == arrays.map(_.head).sort(_ < _).head) | |
m_way_merge(out ::: List(arrays(idx).head), arrays.slice(0, idx) ::: arrays.slice(idx + 1, arrays.length) ::: List(arrays(idx).tail)) | |
} | |
} |
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
# Used in conjuction with mysqlbinlog, this awk script will print out | |
# the SQL operation and the table being modified. | |
# Collate with sort | uniq -c | sort -rn | |
/^UPDATE/{ print $1, $2 } | |
/^INSERT|^DELETE/{ print $1, $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
#!/usr/bin/ruby | |
# | |
# Testing whether sorting then reversing is faster than sorting "the right way". | |
# Short answer: sort/reverse are written in C, your own sort function will be written in Ruby. | |
require 'benchmark' | |
n = 1_000 | |
ids = (0..10_000).to_a.sort_by { rand } |
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
scala> def foo!@$# = null | |
<console>:1: error: '=' expected but identifier found. | |
def foo!@$# = null | |
^ | |
scala> def foo_!@$# = null | |
<console>:1: error: '=' expected but identifier found. | |
def foo_!@$# = null | |
^ | |
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
# These are the results of running bonnie64 on my old MacBook Pro (Model 2,2) 2.3Ghz, 3G RAM, and 5400 RPM drive. | |
$ ./Bonnie -m lambdaold -s 8192 | |
File './Bonnie.628', size: 8589934592 | |
Writing with putc()...done | |
Rewriting...done | |
Writing intelligently...done | |
Reading with getc()...done | |
Reading intelligently...done | |
Seeker 2...Seeker 3...Seeker 1...start 'em...done...done...done... | |
-------Sequential Output-------- ---Sequential Input-- --Random-- |
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
# This machine is a new MacBook Pro, 2.8Ghz Intel Core 2 Duo, 7200RPM drive with 4G RAM. | |
$ ./Bonnie -m lambdanew -s 8192 | |
File './Bonnie.13603', size: 8589934592 | |
Writing with putc()...^C | |
lambda:bonnie-64-read-only stevej$ ./Bonnie -m lambdanew -s 8192 | |
File './Bonnie.13604', size: 8589934592 | |
Writing with putc()...done | |
Rewriting...done | |
Writing intelligently...done | |
Reading with getc()...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
#!/usr/bin/ruby | |
# usage: ./atom_timeseries.rb file | |
# For a big file filled with atom entries, spit out | |
# the epoch of each atom entry's updated timestamp. | |
# Output to stdout. so pipe it to your file. | |
require 'Time' | |
file = File.new(ARGV[0], "r") | |
while (line = file.gets) |
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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'json' | |
dir = ARGV.shift | |
def readfile(filename) | |
return '[]' if File.directory?(filename) | |
body = '' |
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
class Foo { | |
type Bar = Map[String, Map[String, Any]] | |
def bar(): Bar = Map() | |
} | |
class Baz { | |
val foo = new Foo() | |
import foo._ | |