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
#/bin/sh | |
# kubeadm | |
sudo apt-get update && sudo apt-get install -y apt-transport-https | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
sudo bash -c "echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' > /etc/apt/sources.list.d/kubernetes.list" | |
sudo apt-get update | |
sudo apt-get install -y kubelet kubeadm | |
# docker |
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
set nocompatible | |
set background=dark | |
syntax on | |
set ruler | |
set nu | |
set t_Co=256 | |
filetype plugin indent on | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab |
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
umask 022 | |
export ZGEN_RESET_ON_CHANGE=(/home/jimmy/.zshrc) | |
# load zgen | |
source "/home/jimmy/.zgen/zgen.zsh" | |
# if the init scipt doesn't exist | |
if ! zgen saved; then | |
echo "Creating a zgen save" |
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
import org.apache.kafka.streams.kstream.KStreamBuilder; | |
import org.apache.kafka.streams.kstream.KStream; | |
import org.apache.kafka.streams.kstream.KTable; | |
KStreamBuilder builder = new KStreamBuilder(); | |
// Create a stream of page view events from the PageViews topic, where the key of | |
// a record is assumed to be the user id (String) and the value an Avro GenericRecord | |
// that represents the full details of the page view event. | |
KStream<String, GenericRecord> pageViews = builder.stream("PageViews"); |
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
KStream<String, String> source = builder.stream("streams-file-input"); | |
KTable<String, Long> counts = source | |
.flatMapValues(new ValueMapper<String, Iterable<String>>() { | |
@Override | |
public Iterable<String> apply(String value) { | |
return Arrays.asList(value.toLowerCase(Locale.getDefault()).split(" ")); | |
} | |
}).map(new KeyValueMapper<String, String, KeyValue<String, String>>() { | |
@Override |
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
TopologyBuilder builder = new TopologyBuilder(); | |
builder.addSource("SOURCE", "src-topic") | |
.addProcessor("PROCESS1", () -> new MyProcessor1(), "SOURCE") | |
.addProcessor("PROCESS2", () -> new MyProcessor2(), "PROCESS1") | |
.addProcessor("PROCESS3", () -> new MyProcessor3(), "PROCESS1") | |
.addSink("SINK1", "sink-topic1", "PROCESS1") | |
.addSink("SINK2", "sink-topic2", "PROCESS2") | |
.addSink("SINK3", "sink-topic3", "PROCESS3"); |
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
public class MyProcessor extends Processor<String, String> { | |
private ProcessorContext context; | |
private KeyValueStore<String, Long> kvStore; | |
@Override | |
@SuppressWarnings("unchecked") | |
public void init(ProcessorContext context) { | |
// keep the processor context locally because we need it in punctuate() and commit() | |
this.context = context; |
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
public class HourlyPayCalculator { | |
private int tenthRate; | |
private int tenthsWorked; | |
private HourlyPayCalculator(CalculatorBuilder builder) { | |
this.tenthRate = builder.tenthRate; | |
this.tenthsWorked = builder.tenthsWorked; | |
} |
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
@SpringBootApplication | |
@EnableDiscoveryClient | |
public class DiscoveryClientApp { | |
public static void main(String[] args) { | |
SpringApplication.run(DiscoveryClientApp.class, args); | |
} | |
} |
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
@SpringBootApplication | |
@EnableEurekaServer | |
public class ServiceRegistryApp { | |
public static void main(String[] args) { | |
SpringApplication.run(ServiceRegistryApp.class, args); | |
} | |
} |
NewerOlder