val sc = new SparkContext(new SparkConf()
.setAppName("word-count-rdd").setMaster("local[1]")
.set("spark.driver.ip", "127.0.0.1")
)
sc.textFile(path).flatMap(line => line.toLowerCase().split(" "))
.map(w => (w, 1))
.reduceByKey((v1, v2) => v1 + v2)
This file contains 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
plugins { | |
id("java") | |
} | |
java { | |
sourceCompatibility = JavaVersion.VERSION_17 | |
targetCompatibility = JavaVersion.VERSION_17 | |
} | |
buildscript { |
This file contains 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
#create CA cert and self sign | |
if [[ ! -d ca ]]; | |
then | |
mkdir ca | |
openssl genrsa -out ca/ca.key 2048 | |
openssl req -new -x509 -key ca/ca.key -out ca/ca.crt -subj "/C=AU/ST=NSW/L=Sydney/O=Software Company/OU=IT/CN=ca" | |
fi; | |
cert=${1:-localhost} |
This file contains 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
def getDependencyList(org.gradle.api.Project proj, String configName) { | |
def dep = [] | |
def dd = new HashSet<String>() | |
proj.configurations.all { cf -> | |
if (cf.canBeResolved && cf.name == configName) { | |
cf.incoming.each { p -> | |
p.dependencies.each { dt -> | |
dd.add("$dt.group:$dt.name:$dt.version".toString()) | |
dep << [group: dt.group, name: dt.name, version: dt.version, transitive: false] | |
} |
This file contains 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
create keyspace pokedex with replication = { | |
'class': 'NetworkTopologyStrategy', | |
'dc1': 1 | |
}; | |
drop table if exists pokedex.pokemons; | |
create table pokedex.pokemons( | |
name text, | |
primary_type text, |
This file contains 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
gradle.taskGraph.whenReady { tg -> | |
configurations.all { cf -> | |
if (cf.canBeResolved && cf.name == "runtimeClasspath") { | |
cf.incoming.each { p -> | |
println(p.name) | |
//resolved artifact dependency | |
p.artifacts.each { at -> | |
println(at.id.componentIdentifier) | |
} | |
//direct dependency |
This file contains 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 main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
func main() { | |
rand.Seed(time.Now().UnixNano()) |
This file contains 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
FROM tensorflow/tensorflow:latest-gpu-jupyter | |
RUN python3 -m pip install --upgrade pip && pip3 install graphviz pandas sklearn && echo '{"NotebookApp": {"nbserver_extensions": {"jupyter_http_over_ws": true},"password": "sha1:92cf1ff5134d:eecd093c46b3b5b98285ab0238ebe929e640b2a8"}}' |tee /root/.jupyter/jupyter_notebook_config.json |
This file contains 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
FROM azul/zulu-openjdk-alpine:11.0.7 | |
LABEL base=alpine engine=jvm version=java11 timezone=UTC port=8080 dir=/opt/app user=app | |
RUN apk update && apk add --no-cache tzdata curl bash && rm -rf /var/cache/apk/* | |
ENV TZ=UTC | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
EXPOSE 8080 | |
RUN mkdir -p /opt/app && ln -s /opt/app /lib |
This file contains 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
FROM registry.access.redhat.com/ubi8/ubi-minimal | |
LABEL base=ubi8 engine=jvm version=java11 timezone=UTC port=8080 dir=/opt/app user=app | |
RUN microdnf install java-11-openjdk-headless openssl hostname bash curl tzdata shadow-utils && microdnf clean all | |
ENV JAVA_HOME=/usr/lib/jvm/jre-11 | |
ENV TZ=UTC | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
EXPOSE 8080 |
NewerOlder