Skip to content

Instantly share code, notes, and snippets.

View MishaelRosenthal's full-sized avatar

Mishael Rosenthal MishaelRosenthal

View GitHub Profile
@MishaelRosenthal
MishaelRosenthal / IncrementalStatistics.scala
Created March 4, 2014 17:43
A Scala implementation and testing of incremental mean and variance calculation. Also includes a pimp my library implementation for general Iterable collection.
package com.liveperson.predictivedialer.common.utils
/**
* Created with IntelliJ IDEA.
* User: mishaelr
* Date: 3/4/14
* Time: 7:18 PM
*
* This object contains static methods that can be used for calculating mean in variance incrementally.
* Based on the following:
package com.liveperson.predictivedialer.examples.misc
/**
* Created with IntelliJ IDEA.
* User: mishaelr
* Date: 3/23/14
* Time: 11:50 AM
*
* A two pass implementation
* http://www.cs.yale.edu/homes/el327/datamining2011aFiles/ASimpleAlgorithmForFindingFrequentElementsInStreamsAndBags.pdf
@MishaelRosenthal
MishaelRosenthal / BinarySearch.scala
Last active August 29, 2015 13:57
Binary search on a sorted array
package com.liveperson.predictivedialer.examples.misc
import scala.math.Ordering
import scala.annotation.tailrec
/**
* Created with IntelliJ IDEA.
* User: mishaelr
* Date: 3/26/14
* Time: 2:47 PM
@MishaelRosenthal
MishaelRosenthal / private_keys.pl
Last active August 29, 2015 13:58
A (not so good) perl script that sets ssh keys in host.
#!/usr/bin/perl
use Getopt::Long;
#use File::chdir;
use Cwd;
GetOptions ('host=s' => \$host, 'user=s' => \$user)
or die("Usage: perl private_keys.pl --user <user name> --host <host name>\n");
print "user $user, host $host\n";
my $originDir = getcwd;
package com.liveperson.lpbt.research.hadoop.scripts.EligibilityExperiment.auc.aucCalculators
import com.twitter.scalding._
/**
* Created with IntelliJ IDEA.
* User: mishaelr
* Date: 4/17/14
* Time: 1:21 PM
*
package com.liveperson.predictivedialer.examples.misc
import spray.json._
import spray.json.DefaultJsonProtocol._
import java.io.{PrintWriter, FileWriter}
import scala.concurrent.duration._
/**
* Created with IntelliJ IDEA.
* User: mishaelr
@MishaelRosenthal
MishaelRosenthal / Sampling.scala
Last active August 29, 2015 14:02
Reservoir sampling and exponentially decaying sampling.Contains a batch and incremental version.Programmed in functional non object oreinted style.
package com.liveperson.mishael.misc
import scala.collection.immutable.SortedMap
import scala.util.Random
/**
* Created by mishaelr on 6/15/2014.
*
*/
object Sampling {
@MishaelRosenthal
MishaelRosenthal / RegExpAlgebra.scala
Created December 16, 2014 14:31
An algebra on regular expressions.
package core.misc
/**
* Created by mishael on 12/11/14.
*
*/
object RegExpAlgebra {
case class Singleton(regExp: String) extends RegExpAlgebra
case class ~!(inner: RegExpAlgebra) extends RegExpAlgebra
case class And(l: RegExpAlgebra, r: RegExpAlgebra) extends RegExpAlgebra
@MishaelRosenthal
MishaelRosenthal / MergeSortMonoid.scala
Created March 24, 2015 08:24
An exercise for learning Algebird, Monoid, Monads, ScalaCheck, etc...
package core.sparkTest.examples
import com.twitter.algebird.Monoid
import scala.annotation.tailrec
import scala.collection.GenSeq
import scala.collection.immutable.Queue
/**
* Created by mishael on 3/23/15.
package core.misc
import scala.util.Random
/**
* Created by mishael on 5/6/15.
*
*/
object SudokuSolver {