Skip to content

Instantly share code, notes, and snippets.

View hsaputra's full-sized avatar

Henry Saputra hsaputra

View GitHub Profile
@hsaputra
hsaputra / gist:329669ddf72827db3fd2
Last active August 29, 2015 14:18
Apache Flink Execution Local Stack
Apache Flink Execution Messages (local)
========================
Executing WordCount example with built-in default data.
Provide parameters to read input data from a file.
Usage: WordCount <text path> <result path>
16:46:47,454 INFO org.apache.flink.api.java.ExecutionEnvironment - The job has 0 registered types and 0 default Kryo serializers
16:46:48,042 INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
16:46:48,060 INFO org.apache.flink.runtime.blob.BlobServer - Created BLOB server storage directory /var/folders/nv/nsr_3ysj0wgfq93fqp0rdt3w0000gp/T/blobStore-e2b96f68-ebdd-450a-b385-759f70f1b33e
16:46:48,061 INFO org.apache.flink.runtime.blob.BlobServer - Started BLOB server at 0.0.0.0:58364 - max concurrent requests: 50 - max backlog: 1000
@hsaputra
hsaputra / gist:96997ab2f50b0a454986
Last active January 26, 2021 06:25
Apache Flink Job execution Flow Sequence
Apache Flink Job Flow from client API to JobGraph
https://cwiki.apache.org/confluence/display/FLINK/Data+exchange+between+tasks
=============================================
WordCount
ExecutionEnvironment#getExecutionEnvironment
ExecutionEnvironment#readTextFile => DataSet<String>
DataSet#flatMap(FlatMapFunction) => FlatMapOperator<T, R>
@hsaputra
hsaputra / gist:98a8c6c57b7733082d2f
Last active August 29, 2015 14:09
Every possible permutation of a string or combination including repeated character use java
public static String[] getAllLists(String[] elements, int lengthOfList)
{
//initialize our returned list with the number of elements calculated above
String[] allLists = new String[(int)Math.pow(elements.length, lengthOfList)];
//lists of length 1 are just the original elements
if (lengthOfList == 1) {
return elements;
}
else {
@hsaputra
hsaputra / gist:1112a33c68dd895c52c6
Created November 12, 2014 18:23
Reverse Linked List
public class Node {
public Node next;
public Object data;
}
public static void reverseList ( Node head) {
if (head == null || head.next == null) {
return;
}
@hsaputra
hsaputra / gist:b78fd3a3320b88dd1b29
Last active August 29, 2015 14:08
Find words in patter of ${keyword}. So in "This is a small ${world}" the function will find and replace ${word} with "foundone"
def lookup(base: String, found: Map[String, String]): String = {
var resolved = base
val pattern = Pattern.compile("(\\$\\{([^{}]*)\\})")
val matcher = pattern.matcher(base)
while (matcher.find()) {
val a = matcher.group(2)
if (!found.containsKey(a)) {
val b = lookup("foundone", found)
found.put(a, b)
print("Found " + b)