This file contains hidden or 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/env awk -f | |
| BEGIN { | |
| SEP="\t" | |
| FS="\"" SEP "\"|^\""; | |
| } | |
| { | |
| out=$2; | |
| for (i=3;i<=NF-1;i++) { | |
| gsub(/\t/, "_", $i); |
This file contains hidden or 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
| select regexp_extract(date_time,'[^T]*T([0-9][0-9])', 1), count(*) | |
| from single_search | |
| group by regexp_extract(date_time,'[^T]*T([0-9][0-9])', 1) |
This file contains hidden or 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
| package union | |
| /** | |
| * Much magic. Very Lambda. Wow! | |
| * | |
| * These types provide union types (i.e. val a = (String or Int) within Scala. See here for good discussion on | |
| * how to represent union types in Scala (hat tip Miles Sabin) | |
| * http://stackoverflow.com/a/37450446/1591351 | |
| * | |
| * Core idea is to adapt Demorgan's Law: |
This file contains hidden or 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
| * Actively supported linear alg library ;) | |
| * Good optimization libraries. | |
| * Better low-level GPU libaries. JCuda, but better. | |
| * A feature-rich plotting library. | |
| * Richer MCMC libaries. |
This file contains hidden or 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 EnumMap[A, B] { | |
| def apply(a: A): B | |
| } | |
| // Quick sketch, untested. | |
| final class ArrayEnumMap[A, @spec B : ClassTag](xs: Seq[(A,B)]) extends EnumMap[A,B] { | |
| val (keys, values) = mkEntries(xs) | |
| val size = keys.length |
This file contains hidden or 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
| implicit val listIntRead: scopt.Read[List[Int]] = | |
| scopt.Read.reads { str => | |
| val parts = str.split(",").map(_.trim).toList | |
| parts.flatMap { p => | |
| if (p.contains("-")) { | |
| val (start :: end :: Nil) = p.split("-").map(_.trim.toInt).toList | |
| Range(start, end + 1).toList | |
| } | |
| else p.toInt :: Nil | |
| } |
OlderNewer