Skip to content

Instantly share code, notes, and snippets.

View ezhulenev's full-sized avatar
🏠
Working from home

Eugene Zhulenev ezhulenev

🏠
Working from home
View GitHub Profile
@ezhulenev
ezhulenev / gist:7602364
Created November 22, 2013 16:09
Datomic Schema
object DatomicPricing {
object Schema extends VersionedSchemaComponent("0.0.1") {
object ns {
val pricing = new Namespace("Pricing")
}
val isIndexed = true
val isComponent = true
val quoteId = Attribute(ns.pricing / "QuoteId", SchemaType.string, Cardinality.one).withUnique(Unique.identity)
import com.google.common.util.concurrent.ThreadFactoryBuilder
import java.io.ByteArrayInputStream
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicInteger
import scala.util.Random
import scalaz.concurrent.Task
object GatherApp extends App {
lazy val executor = {
import com.google.common.util.concurrent.ThreadFactoryBuilder
import java.io.ByteArrayInputStream
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicInteger
import scala.util.Random
import scalaz.concurrent.Task
import scalaz.stream._
import scalaz.stream.io._
object ChannelApp extends App {
package pellucid.data.util
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicInteger
import org.joda.time.format.DateTimeFormat
import scala.util.Random
import scalaz.concurrent.Task
import java.io.ByteArrayInputStream
import scalaz.stream.io
import scalaz.std.map._
import scalaz.std.vector._
object CsvParsing extends App {
val csv =
@ezhulenev
ezhulenev / fromCallback.scala
Created April 12, 2014 19:41
scalaz-stream equivalent to Play Framework's Enumerator.fromCallback
import java.util.concurrent.atomic.AtomicInteger
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.concurrent.future
import scala.util.{Failure, Success}
import scalaz.concurrent.Task
import scalaz.stream.Process.End
import scalaz.stream._
import scalaz.{-\/, \/-}
@ezhulenev
ezhulenev / gist:5755eb559aad55c97425
Created June 5, 2014 15:51
Thread Pool Executors
package pellucid.dataloader.datascope
import com.google.common.util.concurrent.ThreadFactoryBuilder
import java.util.concurrent._
import java.util.concurrent.atomic.AtomicInteger
import org.slf4j.LoggerFactory
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
import scala.util.Random
/**
* Mention of focus company
*
* @param ticker ticker of focus company
* @param source source of this mention (Twitter, RSS, etc...)
* @param sourceId source specific id
* @param time time
* @param mentions set of other tickers including focus ticker itself
*/
case class Mention(ticker: Ticker, source: String, sourceId: String, time: DateTime, mentions: Set[Ticker])
@ezhulenev
ezhulenev / svm.scala
Created November 11, 2014 02:51
SVM MLLib
object SVM extends App {
import org.apache.spark.mllib.classification.SVMWithSGD
import org.apache.spark.mllib.evaluation.BinaryClassificationMetrics
import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.{SparkContext, SparkConf}
import scala.util.Random
@ezhulenev
ezhulenev / gist:329efd28da8ca51d9f5f
Last active September 2, 2016 01:50 — forked from munhitsu/gist:1034876
Python on Mac OS + virtualenvwrapper
# In case you had some strange python installation
# NOTE: .pydistutils.cfg seems to be not compatible with brew install python
# areas I needed to clean before installation
# clean up ~/Library/Python
# clean up .local
# preconditions:
# xcode with command line tools installed
xcode-select --install