Skip to content

Instantly share code, notes, and snippets.

View HussainAliAkbar's full-sized avatar

Hussain Ali Akbar HussainAliAkbar

View GitHub Profile
@HussainAliAkbar
HussainAliAkbar / kafkajs-consumer-broken.js
Created August 17, 2020 16:32
Kafka.js - Create a consumer to listen to topics (broken)
const { Kafka } = require('kafkajs');
const kafka = new Kafka({
clientId: 'my-app',
brokers: ['localhost:9092']
});
const topicName = 'orderCreated';
const consumerNumber = process.argv[2] || '1';
@HussainAliAkbar
HussainAliAkbar / kafkajs-producer.js
Last active August 15, 2020 16:33
Kafka.js - Create a producer to publish to topics
const { Kafka } = require('kafkajs');
const kafka = new Kafka({
clientId: 'my-app',
brokers: ['localhost:9092']
});
const topicName = 'orderCreated';
const msg = JSON.stringify({customerId: 1, orderId: 1});
@HussainAliAkbar
HussainAliAkbar / kafkajs-consumer.js
Last active August 15, 2020 11:53
Kafka.js - Create a consumer to subscribe to topics
const { Kafka } = require('kafkajs');
const kafka = new Kafka({
clientId: 'my-app',
brokers: ['localhost:9092']
});
const topicName = 'orderCreated';
const consumerNumber = process.argv[2] || '1';
@HussainAliAkbar
HussainAliAkbar / kafkajs-admin.js
Last active July 26, 2020 11:12
Kafka.js - Create a new topic through admin
const { Kafka } = require('kafkajs');
const kafka = new Kafka({
clientId: 'my-app',
brokers: ['localhost:9092']
});
const topicName = 'orderCreated';
const process = async () => {
@HussainAliAkbar
HussainAliAkbar / pythonFips.md
Last active February 13, 2021 02:35
Add support for FIPS_mode() and FIPS_mode_set() in Python 3.6.0

Add support for FIPS_mode() and FIPS_mode_set() in Python 3.6.0

Python by default, does not have support for the two major functions, namely FIPS_mode() and FIPS_mode_set() needed to activate the FIPS mode of the system's OpenSSL through the SSL Module. So, for the purpose fulfilling the requirement of a project and using this patch as an inspiration, add the following lines of code to the source code of Python 3.6.0 and then build Python from source.

Python-3.6.0/Lib/ssl.py:
     # LibreSSL does not provide RAND_egd
     pass