Skip to content

Instantly share code, notes, and snippets.

View gmyrianthous's full-sized avatar

Giorgos Myrianthous gmyrianthous

View GitHub Profile
@gmyrianthous
gmyrianthous / text_classification.py
Last active November 12, 2017 13:17
Classification of movie reviews
# 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
@gmyrianthous
gmyrianthous / bobp-python.md
Created February 1, 2019 08:50 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
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
@gmyrianthous
gmyrianthous / kafka-console-consumer-top-n-messages
Last active March 5, 2021 21:05
kafka-console-consumer-top-n-messages
bin/kafka-console-consumer.sh \
--bootstrap-server localhost:9092 \
--topic testTopic \
--from-beginning \
--max-messages 10
@gmyrianthous
gmyrianthous / kafka-console-consumer-next-n-messages
Created March 5, 2021 21:13
kafka-console-consumer-next-n-messages
bin/kafka-console-consumer.sh \
--bootstrap-server localhost:9092 \
--topic test \
--max-messages 10
@gmyrianthous
gmyrianthous / kafka-console-consumer-all-messages.sh
Last active March 6, 2021 15:00
kafka-console-consumer-all-messages
bin/kafka-console-consumer.sh \
--bootstrap-server localhost:9092 \
--topic test \
--from-beginning
@gmyrianthous
gmyrianthous / kafkacat-consume-between-timestamps.sh
Created March 5, 2021 21:41
kafkacat-consume-between-timestamps
kafkacat \
-b localhost:9092 \
-C \
-t mytopic \
-o s@1568276612443 \
-o e@1568276617901
@gmyrianthous
gmyrianthous / kafka-console-consumer-help
Last active March 5, 2021 22:26
kafka-console-consumer-help
$ 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
@gmyrianthous
gmyrianthous / install-kafkacat
Created March 5, 2021 22:25
install-kafkacat
# Debian
$ apt-get install kafkacat
# OSX - homebrew
$ brew install kafkacat
@gmyrianthous
gmyrianthous / kafkacat-help
Created March 6, 2021 16:06
kafkacat-help
$ 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: