Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Sam Bessalah samklr

🎯
Focusing
Block or report user

Report or block samklr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@samklr
samklr / MixedTweets.md
Created Aug 5, 2012 — forked from loicdescotte/MixedTweets.md
How to push 2 mixed searches from twitter with Scala, Play2, Iteratee and Comet
View MixedTweets.md

##MixedTweets

We will see how to mix 2 twitter searches and push the results to the browser in real time.

First, checkout this mini project

To try it, you need to install Play 2.0

###Controller

@samklr
samklr / ExtremeStartup.scala
Created Sep 7, 2012 — forked from mikkelbd/ExtremeStartup.scala
BEKK kodekveld - Extreme Startup - refac
View ExtremeStartup.scala
import util.matching.Regex
object ExtremeStartup {
def answer(q: String): Any = {
if (q.contains("what is your name"))
return "Mikkel"
if (q.contains("which city is the Eiffel tower in"))
return "Paris"
View MovieSimilarities.scala
import spark.SparkContext
import SparkContext._
/**
* A port of [[http://blog.echen.me/2012/02/09/movie-recommendations-and-more-via-mapreduce-and-scalding/]]
* to Spark.
* Uses movie ratings data from MovieLens 100k dataset found at [[http://www.grouplens.org/node/73]]
*/
object MovieSimilarities {
View ProductRecommendationJob.scala
package com.mansur.scalding
import com.twitter.scalding._
import org.apache.lucene.search.spell._
import org.apache.mahout.common.distance.TanimotoDistanceMeasure
import org.apache.mahout.math.DenseVector
import org.apache.commons.math.util.MathUtils
/**
View product_catalog.csv
women jeans Levi's 512 512 Perfectly Slimming Bootcut, Midnight Star Wash jeans 54.00 39.00
women jeans Tommy Hilfiger Jeans Hope Boot Cut, Caroline Original Wash jeans 69.50 54.00
women jeans Lauren Jeans Co. Jeans Slimming Bootcut, Rinse Wash jeans 80.00 65.00
women jeans INC International Concepts Jeans Curvy-Fit Skinny Ankle-Length jeans 69.00 48.99
women jeans MICHAEL Michael Kors Jeans Skinny Colored Denim jeans 89.50 69.99
women tops Karen Scott Top Short-Sleeve Boat-Neck top 29.00 12.99
women tops Cable & Gauge Top Three-Quarter-Sleeve Solid Twist Front top 24.98 19.99
women tops Style&co. Top Long-Sleeve Striped Button-Down Shirt top 39.98 29.99
women tops Style&co. Top Bell-Sleeve Printed Tunic top 49.98 35.99
women tops INC International Concepts Top Short-Sleeve Ruched Tee top 29.50 24.99
View hadoop1.0.3.java
public synchronized int read() throws IOException {
int result = in.read();
if (result != -1) {
pos++;
}
return result;
}
View EMR log
bash-3.2$ elastic-mapreduce --create --name "Sample Recommender" \
> --jar s3n://temp.cascading.org/sample/recommender.jar \
> --arg s3n://temp.cascading.org/sample/en.stop \
> --arg s3n://temp.cascading.org/sample/tweets/ \
> --arg s3n://temp.cascading.org/sample/out/token \
> --arg s3n://temp.cascading.org/sample/out/similarity
Created job flow j-2HA2BVCBJGMVX
bash-3.2$ elastic-mapreduce --list
j-2HA2BVCBJGMVX STARTING Sample Recommender
PENDING Example Jar Step
View Dojo-ml.fs
// This F# dojo is directly inspired by the Digit Recognizer
// competition from Kaggle.com:
// http://www.kaggle.com/c/digit-recognizer
// The datasets below are simply shorter versions of
// the training dataset from Kaggle.
// 0. Load data files from the following location:
// http://brandewinder.blob.core.windows.net/public/digitssample.csv
// http://brandewinder.blob.core.windows.net/public/digitscheck.csv
View exercises.scala
This is how we create an inclusive/exclusive range of Ints:
val ie = 0 until 500
//1. Fill in the missing item to create a range of Ints from 1 to 100 inclusive
val ints = 1 ??? 100
//2. Find the sum of the integers in this range
View lens-example-tradingday.scala
object TradingDays extends App {
import scalaz._
import Scalaz._
case class Trade(sym: String, trader: String, qty: Int)
case class TradingDay(symbols: Map[String, SymDay] = Map.empty)
object TradingDay {
You can’t perform that action at this time.