Skip to content

Instantly share code, notes, and snippets.

function Average(left, right) {
var result = new Array();
if (left instanceof Array && right instanceof Array) {
for (var i=0; i<left.length || i<right.length; i++) {
result[i] = Average((i<left.length ? left[i] : 0.0), (i<right.length ? right[i] : 0.0));
}
} else if (left instanceof Array) {
for (var i=0; i<left.length; i++) {
result[i] = Average(left[i], (i==0 ? right : 0.0));
@ankurcha
ankurcha / spark-config.json
Last active December 17, 2015 18:49
Spark configuration options
{
"home": null,
"local_dir": null,
"buffer_size": 65536,
"kryo": {
"buffer_size_mb": 10,
"registrator": null
},
"parallelism": null,
"test": {
@ankurcha
ankurcha / mesos.md
Last active December 17, 2015 18:19

App/Framework development guide

Note: In this document (and also in the Mesos code base, at least as of Feb 14, 2012), we refer to Mesos Applications as "Frameworks".

See one of the example framework schedulers in MESOS_HOME/src/examples/ to get an idea of what a Mesos framework scheduler and executor in the language of your choice looks like.

Create your Framework Scheduler

You can write a framework scheduler in C, C++, Java/Scala, or Python. Your framework scheduler should inherit from the Scheduler class (see API below). Your scheduler should create a SchedulerDriver (which will mediate communication between your scheduler and the Mesos master) and then call SchedulerDriver.run()

#!/bin/bash
cd /home/hadoop/
wget http://elasticmapreduce.s3.amazonaws.com/samples/spark/0.7/hive-0.9-bin.tgz
wget http://elasticmapreduce.s3.amazonaws.com/samples/spark/0.7/shark-0.3-bin.tgz
wget http://elasticmapreduce.s3.amazonaws.com/samples/spark/0.7/spark-0.7-bin.tgz
wget http://www.scala-lang.org/downloads/distrib/files/scala-2.9.2.tgz
tar -xvzf scala-2.9.2.tgz
@ankurcha
ankurcha / micro_bosh.yml
Created March 28, 2013 16:01
microbosh deployment manifest
---
name: micro01 #the same name as your folder name
#XXX using micro01
network:
ip: 10.118.72.144 #define ip for micro BOSH
netmask: 255.255.255.0
gateway: 10.118.72.253 #10.20.145.1
dns:
- 10.20.145.1
- 10.20.144.1
#!/bin/bash
if [[ $# -eq 0 ]]; then
echo "Schedules a command to be run after the next reboot."
echo "Usage: $(basename $0) <command>"
echo " $(basename $0) -p <path> <command>"
echo " $(basename $0) -r <command>"
else
REMOVE=0
COMMAND=${!#}
#!/bin/bash
source _variables.sh
### stage bosh_ruby
apt-get -y update
apt-get -y autoremove
apt-get -y install build-essential libssl-dev libcurl4-openssl-dev libreadline-gplv2-dev zlib1g-dev libxslt1-dev libxml2-dev
# install ruby
@ankurcha
ankurcha / micro_bosh.yml
Last active December 11, 2015 04:09 — forked from Justin-Yu/Micro_bosh.yml
A working instance of the micro_bosh.yml specification file.
---
name: bosh_micro01
network:
ip: 192.168.83.60
netmask: 255.255.255.0
gateway: 192.168.83.2
dns:
- 192.168.83.2
cloud_properties:
{
"job": {
"thumbnails": [
{
"url": "https://zencoder-live.s3.amazonaws.com/t/20120927/7864415da5e07890d7da419447547352/frame_0000.png?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=xWP6gj81QibkLYdwP2kUWGuqZ%2FE%3D&Expires=1348870033",
"height": 360,
"group_label": "forth",
"id": 511104899,
"created_at": "2012-09-27T18:07:13-04:00",
"format": "png",
@ankurcha
ankurcha / gist:2919203
Created June 12, 2012 18:24
Getting pushstate <a> tags to work with Emberjs

I am generating urls as

           {{#each Em.subNav.options}}
                <li {{bindAttr class="isActive:active"}}>
                    {{#if isActive}}
                        <div class="active"><a {{bindAttr href="href"}}>{{label}}</a></div>
                    {{else}}
                        <a {{bindAttr href="href"}}>{{label}}</a>
                    {{/if}}