Skip to content

Instantly share code, notes, and snippets.

@igagankalra
igagankalra / producer.py
Last active January 21, 2021 08:30
Produce Load on a Kafka Server -- Need to install the kafka-python library before running the script. Can use `pip install kafka-python` command
from time import sleep
from kafka import KafkaProducer
def generate_logs(topic_name, log_count):
producer = KafkaProducer(
bootstrap_servers=['localhost:9092'],
)
data = b'''{
"Beat_name": "kafkabeat_automation",
"protocol": "Logrhythm",
"sub-protocol": "Globallogic",
@igagankalra
igagankalra / operators.py
Last active May 20, 2020 08:54
Hacker Rank -- 30 Days of Code -- Day 2: Operators
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the solve function below.
@igagankalra
igagankalra / bruteforce.py
Created May 28, 2018 04:48
Python BruteForce Hello World
import random
import sys
import time
targetArray = ["H",'e','l',"l","o"," ", "W", "o", "r","l","d" ]
stringArray = ["","","","","","","","","","",""]
i=0
count = 0
while i < len(targetArray):
if stringArray[i] != targetArray[i]: