Skip to content

Instantly share code, notes, and snippets.

import scala.collection.immutable.List
import spark.SparkContext._
import spark.streaming._
import spark.streaming.StreamingContext._
import spark.streaming.dstream._
object DataStream extends App {
val reportHeader = """----------------------------------------------

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?
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.charset.Charset;
import java.util.Random;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
#!/bin/sh
#
# Automatic configuration of a VPN on GCE debian-7-wheezy server.
# Tested only on debian-7-wheezy.
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License: http://creativecommons.org/licenses/by-sa/3.0/
#
# Thx to: https://github.com/sarfata/voodooprivacy/blob/master/voodoo-vpn.sh for the code/idea
#
@samklr
samklr / tutorial.md
Last active August 29, 2015 14:23 — forked from winhamwr/tutorial.md

Creating a dynamic site-to-site VPN with OpenSwan on Ubuntu 10.04 on EC2

Wes Winham winhamwr@gmail.com

There are many tutorials floating around the web that almost get you a dynamic VPN in EC2. The goal of this tutorial is to be a one-stop-shop for this specific setup.

@samklr
samklr / init.pp
Last active August 29, 2015 14:23 — forked from tzachz/init.pp
# sets up a dropwizard-based service packaged as debian
# requires: puppetlabs-apt, puppetlabs-stdlib
class sample-dw-service (
$version='latest', # you can pass a specified version, default is latest
$db_url='' # this is how you pass environment-specific configuration - in this case, a DB URL
) {
# refresh apt
notify { "refreshing apt":
notify => Class['apt::update'],
author "Your Name"
description "upstart script for sample-dw-service"
# respawn the job up to 5 times within a 10 second period.
# If the job exceeds these values, it will be stopped and
# marked as failed.
respawn
respawn limit 5 10
# move to this service's working directory

Introduction to scalaz-stream

Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.

The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca

import com.twitter.conversions.time._
import com.twitter.finagle.client._
import com.twitter.finagle.dispatch.SerialClientDispatcher
import com.twitter.finagle.util.DefaultTimer
import com.twitter.util.{Await, Future}
trait ExampleClient {
def client: Service[String, String]
def sa = new java.net.InetSocketAddress("localhost", 8080)