This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"demographic": { | |
"gender": "mostly_female" | |
}, | |
"facebook": { | |
"application": "Candy Crush Saga", | |
"author": { | |
"type": "user", | |
"hash_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]%})" |