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
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 | |
} |
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 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 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 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 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 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 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
body { | |
font-family: sans serif; | |
background-color: white; | |
font-family: georgia; | |
font-size: 15px; | |
margin: 20px; | |
} | |
ul { | |
list-style-type: square; |
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
require "benchmark" | |
require "mongoid" | |
require "bloomfilter-rb" | |
module BloomFilter | |
class Native | |
def self.unpack(str) | |
bitstring = str.unpack("B*").first | |
bytes = [] |
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
// ------------------------------------------------------------------------------------------------------------------// | |
// vWorkApp Core Library | |
// ------------------------------------------------------------------------------------------------------------------// | |
var vWorkAppScript = vWorkAppScript || {}; | |
vWorkAppScript.host = "api.vworkapp.com"; | |
vWorkAppScript.apiToken = "PUT YOUR API KEY HERE" | |
(function() { |
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
require 'eventmachine' | |
require 'evma_httpserver' | |
class MyHttpServer < EventMachine::Connection | |
include EventMachine::HttpServer | |
def post_init | |
super | |
ssl_dir = File.join(File.dirname(__FILE__), "ssl") | |
server_key = File.join(ssl_dir, "server.key") |
NewerOlder