Skip to content

Instantly share code, notes, and snippets.

View echeipesh's full-sized avatar

Eugene Cheipesh echeipesh

  • Umbra
  • Philadelphia, PA
View GitHub Profile
@echeipesh
echeipesh / Reader.scala
Created March 7, 2014 22:09
Reader Monad
case class Reader[C, A](g: C => A) {
def apply(c: C) = g(c)
def map[B](f: A => B): Reader[C, B] = {
Reader{ c => f(g(c)) }
}
def flatMap[B](f: A => Reader[C, B]): Reader[C, B] = {
Reader{ c => f(g(c))(c) }
}
@echeipesh
echeipesh / insert-copyright-header.py
Created March 11, 2014 17:05
script to walk down the file tree and selectively add/update copyright comment at the top of the file
@echeipesh
echeipesh / CrudComponent
Last active August 29, 2015 14:00
Slick 2.0 CRUD Trait
trait Unique {
val id: String
}
/**
* Abstraction over a standard "Indexed" table.
*/
trait CrudComponent{ this: Profile =>
import profile.simple._
@echeipesh
echeipesh / masters.yml
Created June 3, 2014 13:49
Ansible template over all host variables in a group
{% for host in groups['master'] %}
{{ hostvars[host]['private_ip'] }}
{% endfor %} 
@echeipesh
echeipesh / .bashrc
Created June 3, 2014 17:03
Color PS1
export PS1="[ ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] ]$ "

ROOT: /scenarios/:scenarioId

Connects the request to app to approrpriate scenario database

GET/routes

  • 200: [route.json]

GET /routes/:routeId/trips

returns

  • 200: [[tripId]]
@echeipesh
echeipesh / gdal.rb
Created November 25, 2014 19:20
gdal jni
cd 'swig/java' do
system "echo JAVA_HOME=`/usr/libexec/java_home` >> java.opt"
system "sed -i.bak s/linux/darwin/g java.opt"
system "make"
system "make install"
end
@echeipesh
echeipesh / annual-tasmax-fixed-scale.html
Last active August 29, 2015 14:11
Summary of IPCC5 Models
<html class="no-js" lang=""><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Climate Change</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<style>
@echeipesh
echeipesh / gist:81adb50a6afb358e219a
Created February 18, 2015 20:29
RDDPersistProblem
Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: Task 7 in stage 2.0 failed 4 times, most recent failure: Lost task 7.3 in stage 2.0 (TID 253, ec2-??-???-??-???.compute-1.amazonaws.com): java.lang.IllegalArgumentException: Size exceeds Integer.MAX_VALUE
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:829)
at org.apache.spark.storage.DiskStore.getBytes(DiskStore.scala:123)
at org.apache.spark.storage.DiskStore.getBytes(DiskStore.scala:132)
at org.apache.spark.storage.BlockManager.doGetLocal(BlockManager.scala:517)
at org.apache.spark.storage.BlockManager.getLocal(BlockManager.scala:432)
at org.apache.spark.storage.BlockManager.get(BlockManager.scala:618)
at org.apache.spark.CacheManager.getOrCompute(CacheManager.scala:44)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:228)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:61)
@echeipesh
echeipesh / implicitReflection.scala
Last active August 29, 2015 14:19
Using scala reflection to debug implicit resolution
//Source: http://virtuslab.com/blog/debugging-implicits/
import scala.reflect.runtime.universe._
def tree = reify{ list.sorted }.tree
//tree: reflect.runtime.universe.Tree
show(tree)
// Predef.refArrayOps($read.list).sorted(Ordering.ordered(Predef.$conforms))