Skip to content

Instantly share code, notes, and snippets.

local hostname="%{$fg_bold[black]%}%m"
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='${hostname} ${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
package spark.examples
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonAST._
object HDFSDeleteExample {
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonAST._
object UserInterestsExample {
def main(args: Array[String]): Unit = {
val sc = new SparkContext("local[8]", "UserInterestsExample")
{
"demographic": {
"gender": "mostly_female"
},
"facebook": {
"application": "Candy Crush Saga",
"author": {
"type": "user",
"hash_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonAST._
import org.json4s.DefaultFormats
object CandyCrushSQL {
def main(args: Array[String]): Unit = {
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonAST._
import org.json4s.DefaultFormats
object CandyCrushExample {
def main(args: Array[String]): Unit = {
@cotdp
cotdp / gist:3062901
Created July 6, 2012 21:40
Mapper for processing ZipFile entries
/**
* This Mapper class checks the filename ends with the .txt extension, cleans
* the text and then applies the simple WordCount algorithm.
*/
public static class MyMapper
extends Mapper<Text, BytesWritable, Text, IntWritable>
{
private final static IntWritable one = new IntWritable( 1 );
private Text word = new Text();
@cotdp
cotdp / gist:3062892
Created July 6, 2012 21:38
Example ZipFile Job
// Standard stuff
Job job = new Job(conf);
job.setJobName(this.getClass().getSimpleName());
job.setJarByClass(this.getClass());
job.setMapperClass(MyMapper.class);
job.setReducerClass(MyReducer.class);
// Hello there ZipFileInputFormat!
job.setInputFormatClass(ZipFileInputFormat.class);
@cotdp
cotdp / gmetric-cpu-temp.sh
Created November 22, 2011 22:09
this script read the core(s) temperature using lm sensors then calculate the average and send it to the ganglia using gmetric
#!/bin/sh
# this script read the core(s) temperature using lm sensors then calculate the average
# and send it to the ganglia using gmetric
# Based on the original from: http://computational.engineering.or.id/LM_Sensors#Integrasi_Dengan_Ganglia
# assumes that the lines reported by lm sensors are formated like this
# Core 0: +48.0°C (high = +90.0°C, crit = +100.0°C)
SENSORS=/usr/bin/sensors
GMETRIC=/usr/bin/gmetric