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
from __future__ import division | |
def trapezium(f, n, a, b): | |
''' | |
f- function [f(x)] | |
n- number of trapeziums | |
a- lower limit | |
b- upper limit | |
Returns definite integral of f(x) from range a to b | |
''' |
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
import com.google.gson.Gson | |
import java.util.{Map => JMap, LinkedHashMap} | |
type GenericDecoder = String => JMap[String, Object] | |
val decoder: GenericDecoder = { | |
// Gson instances are apparently thread-safe, so curry... | |
val gson: Gson = new Gson() | |
// LinkedHashMap preserves ordering. use HashMap if not required. | |
x => gson.fromJson(x, (new LinkedHashMap[String, Object]()).getClass) |
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
import kafka.common.TopicAndPartition | |
import kafka.message.MessageAndMetadata | |
import kafka.serializer.StringDecoder | |
import com.samsung.sami.common.Curator | |
import org.apache.spark.streaming._ | |
import org.apache.spark.streaming.kafka._ | |
import org.apache.spark.{Logging, SparkConf} | |
import org.scalactic.{One, Bad, Good} | |
import scala.util.control.NonFatal |
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
import kafka.common.TopicAndPartition | |
import kafka.message.MessageAndMetadata | |
import kafka.serializer.StringDecoder | |
import com.samsung.sami.common.Curator | |
import org.apache.spark.streaming._ | |
import org.apache.spark.streaming.kafka._ | |
import org.apache.spark.{Logging, SparkConf} | |
import org.scalactic.{One, Bad, Good} | |
import scala.util.control.NonFatal |
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
import akka.NotUsed | |
import akka.stream.scaladsl.Source | |
import redis.clients.jedis.{Jedis, JedisCluster, ScanParams} | |
import scala.collection.JavaConverters._ | |
import scala.concurrent.Future | |
class RedisStream(maxNodeParallelism: Int) | |
(implicit jedisCluster: JedisCluster, | |
blockingEC: RedisBlockingEC) { |
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
import java.io._ | |
@SerialVersionUID(15L) | |
class Animal(name: String, age: Int) extends Serializable { | |
override def toString = s"Animal($name, $age)" | |
} | |
case class Person(name: String) | |
// or fork := true in sbt |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#+BEGIN | |
#+UPDATE_TIME 2014-09-04 16:30:00 | |
#+MESSAGE | |
####################################################################### | |
# | |
# imouto.host | |
# | |
# 主页:https://plus.google.com/100484131192950935968/posts | |
# | |
# #Ver : 2.11.0468 Sakura Chiyo |