(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
import scala.concurrent.Await | |
import scala.concurrent.ExecutionContext | |
import scala.concurrent.Future | |
import scala.concurrent.blocking | |
import scala.concurrent.duration.Deadline | |
import scala.concurrent.duration.Duration | |
import scala.concurrent.duration.DurationInt | |
import scala.concurrent.duration.DurationLong | |
import scala.concurrent.future | |
import scala.concurrent.promise |
/* We've run into a few common pitfalls when dealing with Futures in Scala, so I wrote these three helpful | |
* classes to give some baked-in functionality. | |
* | |
* I'd love to hear about other helpers you're using like these, or if you have improvement suggestions. | |
* github@andrewconner.org / @connerdelights | |
*/ | |
import scala.concurrent.{ExecutionContext, CanAwait, Awaitable, Future, Promise} | |
import scala.concurrent.duration.Duration | |
import scala.util.Try |
import com.twitter.scalding._ | |
import com.twitter.algebird.{ MinHasher, MinHasher32, MinHashSignature } | |
/** | |
* Computes similar items (with a string itemId), based on approximate | |
* Jaccard similarity, using LSH. | |
* | |
* Assumes an input data TSV file of the following format: | |
* | |
* itemId userId |
# | |
# A fatal error has been detected by the Java Runtime Environment: | |
# | |
# SIGSEGV (0xb) at pc=0x000000010ff99024, pid=21513, tid=20739 | |
# | |
# JRE version: Java(TM) SE Runtime Environment (8.0-b123) (build 1.8.0-ea-b123) | |
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b65 mixed mode bsd-amd64 compressed oops) | |
# Problematic frame: | |
# V [libjvm.dylib+0x399024] | |
# |
#!/bin/bash | |
# Check out the blog post at: | |
# | |
# http://www.philipotoole.com/influxdb-and-grafana-howto | |
# | |
# for full details on how to use this script. | |
AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname | |
INFLUXDB_DATABASE=test1 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Suppose you have a key like (page, geo, day) and you want to make rollups/datacube so you can query for all pages, or all geos or all days.
Here is how you do it:
def opts[T](t: T): Seq[Option[T]] = Seq(Some(t), None)
val p: TypedPipe[(String, String, Int)] = ...
p.sumByLocalKeys
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 |
# | |
# Build configuration for Circle CI | |
# | |
general: | |
artifacts: | |
- /home/ubuntu/your-app-name/app/build/outputs/apk/ | |
machine: | |
environment: |
/** | |
* To get started: | |
* git clone https://github.com/twitter/algebird | |
* cd algebird | |
* ./sbt algebird-core/console | |
*/ | |
/** | |
* Let's get some data. Here is Alice in Wonderland, line by line | |
*/ |