Skip to content

Instantly share code, notes, and snippets.


Sam Bessalah samklr

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
PatrickCallaghan /
Last active Aug 29, 2015
Creating a custom index table from an existing table with Apache Spark

The default is to put this on its own node so you will need to start DSE with dse cassandra -k to create a spark analytics node.

First run the project to populate the Cassandra cluster (follow instructions in README). Use this project to populate the Cassandra db with hundreds of thousands user interactions. The idea is to have users interacting with multiple apps and we can model this by user in Cassandra.

We have an existing table that has all the data for user interactions with certain applications on the appropriate date. Now, for some other requirements, we need the unique users that visited a certain page within an app on a certain day.

So the first requirement was - show me the user interactions with a certain app

Now, we have a new requirement - show me all the users that interacted with a certain app on a particular day.

#! /bin/bash
sudo apt-key adv --keyserver --recv E56151BF
DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
CODENAME=$(lsb_release -cs)
echo "deb${DISTRO} ${CODENAME} main" | sudo tee /etc/apt/sources.list.d/mesosphere.list
sudo apt-get -y update --fix-missing
sudo apt-get -y install mesosphere
ezhulenev / deeptreemap.scala
Created Dec 4, 2014
Deep TreeMap conversion
View deeptreemap.scala
import scala.collection.immutable.TreeMap
trait ToTreeMap[A] {
type Result
def treeMap(x: A): Result
trait LowerPriorityToTreeMap {
implicit def plainMap[K, V](implicit ord: Ordering[K]): ToTreeMap[Map[K, V]] =
miguno / CMSHashingBenchmark.scala
Created Jan 7, 2015
Benchmark for hashing implementations for CMS[BigInt] in Algebird
View CMSHashingBenchmark.scala
package com.twitter.algebird.caliper
import{ Param, SimpleBenchmark }
import{ HashFunction, Hashing }
* Benchmarks the hashing algorithms used by Count-Min sketch for CMS[BigInt].
* The input values are generated ahead of time to ensure that each trial uses the same input (and that the RNG is not
* influencing the runtime of the trials).
takei-shg / FutureWithOptionT
Created Mar 5, 2015
com.twitter.util.Future Chain with OptionT
View FutureWithOptionT
import scalaz._
import Scalaz._
import scalaz.OptionT._
import com.twitter.util.Future
* Simple example of Future chain, which only shows type level consistency.
* Future chain can be implemented with optionT or simple flatMap chain.
object Main extends App {
View ctrlpkw cluster
"id": "/ctrlpkw",
"groups": [
"id": "/ctrlpkw/db",
"apps": [
"id": "/ctrlpkw/db/cassandra-seed",
"constraints": [["hostname", "UNIQUE"]],
"ports": [7199, 7000, 7001, 9160, 9042],

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
philipithomas / docker_knapsack.jl
Last active Aug 29, 2015
Docker Container Scheduling as a Knapsack Problem in Julia/JuMP
View docker_knapsack.jl
using JuMP
using Cbc
We pass in the variable "pools" in this format that goes through a separate
pre-processing script that pipes JSON to a Julia JSON loader.
"awesome-pool-prod": {
View dump-music
#!/usr/bin/env ruby
require 'sequel'
require 'fileutils'
require 'uri'
require 'pp'
def home
You can’t perform that action at this time.