View design-patterns-anti-corruption-action.java
String action(String param) {
Mess mess = new Mess();
if (mess.contains(param, "something")) {
return mess.concat(param, "-has");
}
if (mess.isEmpty(param)) {
return mess.concat(param, "-empty");
}
if (mess.matches(param, "[something]")) {
return mess.concat(param, "-matches");
View design-patterns-anti-corruption-mess.java
class Mess {
String concat(String param, String str) { }
boolean contains(String param, String s) { }
boolean isEmpty(String param) { }
boolean matches(String param, String regex) { }
boolean startsWith(String param, String prefix) { }
}
View Kafka-Producer-head.java
/**
* Page: 44-45
*/
private Properties kafkaProps = new Properties();
kafkaProps.put("bootstrap.severs", "broker1:9092,broker2:9092");
kafkaProps.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
kafkaProps.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
producer = new KafkaProducer<String, String>(kafkaProps);
View Kafka-Consumer-head.java
/**
* Page: 69
*/
Properties props = new Properties();
props.put("bootstrap.servers", "broker1:9092,broker2:9092");
props.put("group.id", "CountryCounter");
props.put("key.deserializer", "org.apache.kafka.common.seriaization.StringDeserializer");
props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props);
View Kafka-Create-Messages.sh
/usr/local/kafka/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
Test Message 1
Test Message 2
# ^D
# Test
/usr/local/kafka/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
# Test Message 1
# Test Message 2
# ^C
View Kafka-Create-Topic.sh
/usr/local/kafka/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
# Test
/usr/local/kafka/bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic "test"
# Topic:test PartitionCount:1 ReplicationFactor:1 Configs:
# Topic: test Partition: 0 Leader: 0 Replicas: 0 Isr: 0
View Install-Kafka.sh
# p.20
tar -zxf kafka_*.tgz
mv kafka_* /usr/local/kafka
mkdir /tmp/kafka-logs
export JAVA_HOME=/usr/java/jdk[...version]
/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
View Install-Zookeeper.sh
tar -zxf zookeeper-*.tar.gz
mv zookeeper-* /usr/local/zookeeper
cat > /usr/local/zookeeper/conf/zoo.cfg << EOF
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
EOF
export JAVA_HOME=/usr/java/jdk[...]
#
# If you don't want to use root: https://stackoverflow.com/questions/19295978/failed-to-write-pid-installing-zookeeper
View install-latex.sh
# Takes a long time to install (a lot to download too)
sudo apt-get install texlive-full
wget http://www.xm1math.net/texmaker/assets/files/texmaker_5.0.2_ubuntu_17_10_amd64.deb
# or sudo apt-get install texmaker
View GoogleChrome-User-Data-file-table.csv
File Name Type Description
blob_storage Dir Unknown
Bookmarks JSON Bookmarks.
Cookies SQLite Cookies from websites. (Tables: cookies, meta)
Cookies-journal Unknown Unknown
Current Session Unknown Websites sessions.
Current Tabs Unknown Open tabs.
databases Dir Stores website SQLite databses. Inside you have a Databases.db (SQLite) that containes a list of websites that use the browser SQLite db. You also have directories with the DBs of each websites that have a DB.
data_reduction_proxy_leveldb Dir Unknown
DownloadMetadata Unknown Urls of files that were downloaded.