A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| # Text Classification with Perceptron | |
| # Dataset: Review polarity - Cornell University | |
| # Author: Giorgos Myrianthous | |
| # February, 2017 | |
| import sys, os, random | |
| import numpy as np | |
| # np.set_printoptions(threshold=np.inf) | |
| from collections import Counter |
| from sklearn.datasets import load_wine | |
| from sklearn.model_selection import train_test_split | |
| from sklearn.decomposition import PCA | |
| from sklearn.preprocessing import StandardScaler | |
| from sklearn.naive_bayes import GaussianNB | |
| from sklearn.metrics import accuracy_score | |
| import matplotlib.pyplot as plt | |
| bin/kafka-console-consumer.sh \ | |
| --bootstrap-server localhost:9092 \ | |
| --topic testTopic \ | |
| --from-beginning \ | |
| --max-messages 10 |
| bin/kafka-console-consumer.sh \ | |
| --bootstrap-server localhost:9092 \ | |
| --topic test \ | |
| --max-messages 10 |
| bin/kafka-console-consumer.sh \ | |
| --bootstrap-server localhost:9092 \ | |
| --topic test \ | |
| --from-beginning |
| kafkacat \ | |
| -b localhost:9092 \ | |
| -C \ | |
| -t mytopic \ | |
| -o s@1568276612443 \ | |
| -o e@1568276617901 |
| $ kafka/bin/kafka-console-consumer.sh | |
| Option Description | |
| ------ ----------- | |
| --blacklist <String: blacklist> Blacklist of topics to exclude from | |
| consumption. | |
| --bootstrap-server <String: server to REQUIRED (unless old consumer is | |
| connect to> used): The server to connect to. | |
| --consumer-property <String: A mechanism to pass user-defined | |
| consumer_prop> properties in the form key=value to |
| # Debian | |
| $ apt-get install kafkacat | |
| # OSX - homebrew | |
| $ brew install kafkacat |
| $ kafkacat -h | |
| Usage: kafkacat <options> [file1 file2 .. | topic1 topic2 ..]] | |
| kafkacat - Apache Kafka producer and consumer tool | |
| https://github.com/edenhill/kafkacat | |
| Copyright (c) 2014-2019, Magnus Edenhill | |
| Version 1.6.0 (JSON, Avro, Transactions, librdkafka 1.6.1 builtin.features=gzip,snappy,ssl,sasl,regex,lz4,sasl_gssapi,sasl_plain,sasl_scram,plugins,zstd,sasl_oauthbearer) | |
| General options: |