Skip to content

Instantly share code, notes, and snippets.

Avatar

Bhuridech Sudsee Aorjoa

View GitHub Profile
@Aorjoa
Aorjoa / helloworld.json
Last active Jan 19, 2019
Simple Spark Task
View helloworld.json
{"paragraphs":[{"text":"%spark\nsc.version","user":"anonymous","dateUpdated":"2019-01-19T02:05:18+0000","config":{"editorSetting":{"language":"scala","editOnDblClick":false,"completionKey":"TAB","completionSupport":true},"colWidth":12,"editorMode":"ace/mode/scala","fontSize":9,"results":{},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1547863518098_-1385869494","id":"20190117-204650_193106845","dateCreated":"2019-01-19T02:05:18+0000","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"focus":true,"$$hashKey":"object:959"},{"text":"%spark\nimport org.apache.commons.io.IOUtils\nimport java.net.URL\nimport java.nio.charset.Charset\n\n// Word count with RDD\nval fileFromURL = IOUtils.toString(\n new URL(\"https://raw.githubusercontent.com/apache/spark/master/README.md\"),\n Charset.forName(\"utf8\")).split(\"\\n\")\nval textFile = sc.parallelize(fileFromURL)\nval counts = textFile.flatMap(line => line.split(\" \")).map(word => (word, 1)).reduceByKe
View gist:ef8b66625ee3cfbbe34ccade96791612
package oot.lab8;
public class Calculator implements MathCalculator {
private double operand1;
private double operand2;
public Calculator(double operand1, double operand2){
this.operand1 = operand1;
this.operand2 = operand2;
}
public double add() {
return operand1 + operand2;
View gist:c89c9952a7a870cc3db17a889a7097d4
import java.io.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Bhuridech Sudsee.
*/
View gist:4fa0deaf0f9c02352f644532aa1894b1
import java.io.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Bhuridech Sudsee.
*/
View gist:0151a6a48fc1dba4b4a7e23d8acf45dd
import java.io.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Bhuridech Sudsee.
*/
@Aorjoa
Aorjoa / .gitignore
Created Dec 24, 2017
Git ignore file for SE 60
View .gitignore
build/
node_modules/
src/main/resources/static/built/
*.class
# Package Files #
*.jar
*.war
*.ear
@Aorjoa
Aorjoa / owncoin.sol
Last active Oct 29, 2017
this original source code come from https://ethereum.org/token
View owncoin.sol
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 0;
// 18 decimals is the strongly suggested default, avoid changing it
View Mongkol99.sol
pragma solidity ^0.4.15;
// -----------------------------------------
// Mongkol 99, M99C
// (c) Bhuridech Sudsee, Under MIT License
// Thanks BokkyPooBah for original version.
// -----------------------------------------
contract ERC20Interface {
function balanceOf(address _owner) constant returns (uint256 balance);
View gist:8dd4962b680e548b31b3b429458e8113
#!/bin/bash
echo "rdd-WordCount-sparktest-sha256-java-checkpoint-with-cache-in-one-test"
testname="rdd-WordCount-sparktest-sha256-java-checkpoint-with-cache-in-one-test"
echo -e '''
package th.ac.sut.aiyara.sparktest
import org.apache.spark.cprdd.{ImplicitDatasetCheckpoint, ImplicitRDDCheckpoint}
import com.bloomberg.sparkflow
import org.scalatest.FunSuite
import th.ac.sut.aiyara.sparktest.utils.{ConfigSpark, MathFunc}
View gist:e13b16e1330179b0c99ab14f6b42a3f3
#!/bin/bash
echo "rdd-WordCount-sparktest-sha256-java-checkpoint-with-cache-in-one-test"
testname="rdd-WordCount-sparktest-sha256-java-checkpoint-with-cache-in-one-test"
echo -e '''
package th.ac.sut.aiyara.sparktest
import org.apache.spark.cprdd.{ImplicitDatasetCheckpoint, ImplicitRDDCheckpoint}
import com.bloomberg.sparkflow
import org.scalatest.FunSuite
import th.ac.sut.aiyara.sparktest.utils.{ConfigSpark, MathFunc}
You can’t perform that action at this time.