Skip to content

Instantly share code, notes, and snippets.

View gmyrianthous's full-sized avatar

Giorgos Myrianthous gmyrianthous

View GitHub Profile
@gmyrianthous
gmyrianthous / kafkacat-consume-all-messages
Last active March 6, 2021 16:18
kafkacat-consume-all-messages
kafkacat \
-C \
-b localhost:9092 \
-t testTopic \
-o beginning
@gmyrianthous
gmyrianthous / kafkacat-consume-first-n
Created March 6, 2021 16:20
kafkacat-consume-first-n
kafkacat \
-C \
-b localhost:9092 \
-t testTopic \
-o beginning \
-c 10
@gmyrianthous
gmyrianthous / kafkacat-consume-last-n
Created March 6, 2021 16:49
kafkacat-consume-last-n
kafkacat \
-C \
-b localhost:9092 \
-t testTopic \
-c 10
@gmyrianthous
gmyrianthous / kafka-console-consumer-last-n-messages
Created March 6, 2021 17:03
kafka-console-consumer-last-n-messages
bin/kafka-simple-consumer-shell.sh \
--bootstrap-server localhost:9092 \
--topic testTopic \
--partition 1 \
--offset 12873
@gmyrianthous
gmyrianthous / kafkacat-consume-last-n-messages
Created March 6, 2021 17:05
kafkacat-consume-last-n-messages
kafkacat \
-C \
-b localhost:9092 \
-t testTopic \
-o -10 \
-p 1 \
-e
@gmyrianthous
gmyrianthous / kafkacat-consume-between-offsets
Created March 6, 2021 17:31
kafkacat-consume-between-offsets
kafkacat \
-C \
-b localhost:9092 \
-t testTopic \
-o 11 \
-c 10 \
-e
@gmyrianthous
gmyrianthous / fit_example.py
Last active March 9, 2021 15:34
fit_example.py
"""
scikit-learn example to fit a SVC model for recognizing images of hand-written digits.
The images attribute of the dataset stores 8x8 arrays of grayscale values for each image.
We will use these arrays to visualize the first 4 images. To apply a classifier on this data,
we need to flatten the images, turning each 2-D array of grayscale values from
shape (8, 8) into shape (64,).
Reference: https://scikit-learn.org/stable/auto_examples/classification/plot_digits_classification.html
"""
@gmyrianthous
gmyrianthous / fit_parameters.py
Created March 9, 2021 18:11
fit_parameters.py
print(f'Classes: {clf.classes_}')
print(f'Class Weight: {clf.class_weight_}')
print(f'Intercept: {clf.intercept_}')
# Classes: [0 1 2 3 4 5 6 7 8 9]
# Class Weight: [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
# Intercept: [-0.41399582 -0.34935705 -0.26415146 -0.34374548 -0.43664007 -0.15259734
# -0.29982087 -0.33727371 -0.31727775 0.16939161 0.23074142 0.12799678
# 0.09363933 0.30598209 0.13243965 0.33420154 0.20281266 0.09384162
# 0.01898659 -0.0295118 0.22687243 0.00904582 -0.02964941 0.02867172
@gmyrianthous
gmyrianthous / predict_example.py
Created March 9, 2021 21:00
predict_example.py
# Predict the digits in the test data
predictions = clf.predict(X_test)
print(predictions)
# [2 3 4 5 6 7 8 9 0 9 5 5 6 5 0 9 8 9 8 4 1 7 7 3 5 1 0 0 2 2 7 9 2 0 1 2 6
# 3 3 7 3 3 4 6 6 6 4 9 1 5 0 9 5 2 8 2 0 0 1 7 6 3 2 1 7 4 6 3 1 3 9 1 7 6
# 8 4 3 1 4 0 5 3 6 9 6 1 7 5 4 4 7 2 8 2 2 5 7 9 5 4 8 8 4 9 0 8 9 8 0 1 2
# 3 4 5 6 7 1 9 0 1 2 3 4 5 6 9 0 1 2 3 4 5 6 7 8 9 4 9 5 5 6 5 0 9 8 9 8 4
# 1 7 7 3 5 1 0 0 2 2 7 8 2 0 1 2 6 8 3 7 7 3 4 6 6 6 9 9 1 5 0 9 5 2 8 0 1
# 7 6 3 2 1 7 8 6 3 1 3 9 1 7 6 8 4 3 1 4 0 5 3 6 9 6 1 7 5 4 4 7 2 2 5 7 3
@gmyrianthous
gmyrianthous / predict_error
Last active March 9, 2021 21:01
predict_error
sklearn.exceptions.NotFittedError: This SVC instance is not fitted yet.
Call 'fit' with appropriate arguments before using this estimator.