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
diff --git a/WORKSPACE b/WORKSPACE | |
index a76b6f6..4c140a2 100644 | |
--- a/WORKSPACE | |
+++ b/WORKSPACE | |
@@ -15,7 +15,14 @@ scala_register_toolchains() | |
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") | |
-scala_repositories() | |
+scala_repositories(( |
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
use tokio::io::AsyncRead; | |
use tokio::io::AsyncWrite; | |
use hyper::client::connect::Connected; | |
use hyper::client::connect::Destination; | |
use http::Uri; | |
use hyper::client::connect::Connect; | |
use futures::Future; | |
use std::io; | |
/// A wrapper around `Proxy`s with a connector. |
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 org.apache.thrift.transport.TIOStreamTransport | |
import org.apache.thrift.protocol.{TProtocol, TProtocolFactory, TSimpleJSONProtocol} | |
val protocolFactory = new TSimpleJSONProtocol.Factory | |
def toJson(t: MYTYPE): String = { | |
val buf = new java.io.ByteArrayOutputStream | |
val proto = protocolFactory.getProtocol(new TIOStreamTransport(buf)) | |
MYTYPE.encode(t, proto) | |
val baseStr = new String(buf.toByteArray, "UTF-8") |
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 os | |
import sublime, sublime_plugin | |
class GithubCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
file = self.view.file_name() | |
dir = "/".join(file.split("/")[:-1]) | |
gitRepo = os.popen('cd %s; git rev-parse --show-toplevel'%(dir)).read()[:-1] | |
branch = os.popen('cd %s; git rev-parse --abbrev-ref HEAD'%(dir)).read()[:-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
import os | |
import subprocess | |
from subprocess import PIPE | |
import sublime, sublime_plugin | |
class FpathCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
file = self.view.file_name() | |
file_dir = "/".join(file.split("/")[:-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
def getTiming(ebScaldVariant:String, idx: Int, runName: String, tp: TypedPipe[_]) = { | |
val ms = System.currentTimeMillis | |
val cntrs = execute(tp.filter(_ => false).toIterableExecution.getAndResetCounters.map(_._2)) | |
val after = System.currentTimeMillis | |
val cpuMS = cntrs.get(StatKey("CPU_MILLISECONDS", "org.apache.hadoop.mapreduce.TaskCounter")).get | |
val gcMS = cntrs.get(StatKey("GC_TIME_MILLIS", "org.apache.hadoop.mapreduce.TaskCounter")).get | |
val millisMap = cntrs.get(StatKey("MILLIS_MAPS", "org.apache.hadoop.mapreduce.JobCounter")).get | |
(ebScaldVariant, idx, runName, cpuMS, gcMS, millisMap, after - ms) | |
} |
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 qualified Turtle as T | |
main :: IO () | |
main = do | |
ln <- T.readline | |
putStrLn $ show ln |
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 qualified Turtle as T | |
import qualified System.IO as IO | |
import Control.DeepSeq | |
mergeUntilTwoBlankLines :: (() -> IO (Maybe String)) -> IO [String] | |
mergeUntilTwoBlankLines fn = do | |
rd <- fn () | |
processFunc [] rd | |
where processFunc ("" : existing) (Just "") = return existing | |
processFunc existing (Just nxt) = do |
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.twitter.algebird.{Aggregator, Semigroup} | |
import com.twitter.scalding._ | |
import scala.util.Random | |
/** | |
* This job is a tutorial of sorts for scalding's Execution[T] abstraction. | |
* It is a simple implementation of Lloyd's algorithm for k-means on 2D data. | |
* | |
* http://en.wikipedia.org/wiki/K-means_clustering |
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 exp { | |
sealed trait ExprTpe[T] | |
sealed trait ExprPrimitiveTpe[T] extends ExprTpe[T] | |
sealed trait ExprContainerTpe[T] extends ExprTpe[T] { | |
def mapping: List[(String, ExprTpe[_])] | |
} | |
case class ContainerTpe2[A, B](_1: ExprTpe[A], nme1: String, _2: ExprTpe[B], nme2: String) extends ExprContainerTpe[(A, B)] { | |
override def toString = s"""Type container of ${_1} and ${_2}""" |
NewerOlder