Skip to content

Instantly share code, notes, and snippets.

View void666's full-sized avatar
🛠️
building and breaking things

Sushim Mukul Dutta void666

🛠️
building and breaking things
View GitHub Profile
@void666
void666 / how_to_reset_kafka_consumer_group_offset.md
Created September 23, 2018 15:04 — forked from marwei/how_to_reset_kafka_consumer_group_offset.md
How to Reset Kafka Consumer Group Offset

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@void666
void666 / Instructions.txt
Last active October 17, 2017 21:40
Reform Strings.
download and save file `reformStrings.js`.
Install Node. https://nodejs.org/en/
run `node reformStrings.js`
var findPairs = function(arr, x){
//edge case handling, if number of elements in the arr is odd, then can't be paired.
if(arr.length %2 !== 0 ){
return console.log('No');
}
//store the frequency of each remainder (element % x) of each number instead of the number itself.
var map = {};
for(var i =0 ;i < arr.length; i++){
var rem = arr[i] % x;
map[rem] = map[rem]? map[rem] + 1 : 1;
C:\Users\Sushim\AppData\Local\Programs\Python\Python35-32\python.exe C:/Users/Sushim/Documents/GitHub/random/Search/main.py
Input read from file :
P Ford Car Review
P Review Car
P Review Ford
P Toyota Car
P Honda Car
P Testing Car Donald Trump Donald
P Testing Donald Trump
P Car
@void666
void666 / Output
Last active June 25, 2016 23:23
output for sample input.txt
C:\Users\Sushim\AppData\Local\Programs\Python\Python35-32\python.exe C:/Users/Sushim/PycharmProjects/SimpleSearch/main.py
Input read from file :
P Ford Car Review
P Review Car
P Review Ford
P Toyota Car
P Honda Car
P Car
Q Ford
Q Car
@void666
void666 / main.py
Created June 24, 2016 17:24
This is good
__author__ = 'Sushim'
from collections import OrderedDict
max_weight = 0
global_word_list = {}
global_list_of_pages = {}
global_list_of_queries = []
class factory:
"""
__author__ = 'Sushim'
from collections import Set as set
from collections import OrderedDict
max_weight = 0
global_word_list = {}
global_list_of_pages = {}
global_list_of_queries = []
class LastUpdatedOrderedDict(OrderedDict):
__author__ = 'Sushim'
from collections import Set as set
from collections import OrderedDict
max_weight = 0
global_word_list = {}
global_list_of_pages = {}
global_list_of_queries = []
class LastUpdatedOrderedDict(OrderedDict):
__author__ = 'Sushim'
from collections import Set as set
from collections import OrderedDict
max_weight = 0
global_word_list = {}
global_list_of_pages = {}
global_list_of_queries = []
class LastUpdatedOrderedDict(OrderedDict):
@void666
void666 / main.py
Created June 23, 2016 01:22
this works 2!!
__author__ = 'Sushim'
from collections import Set as set
from collections import OrderedDict
global_word_list = {}
global_list_of_pages = {}
global_list_of_queries = []
class factory: