Skip to content

Instantly share code, notes, and snippets.

View thakursaurabh1998's full-sized avatar
Getting Better

Saurabh Thakur thakursaurabh1998

Getting Better
View GitHub Profile
{
"meta": {
"cta": {
"primary": {
"text": "See smallcases",
"action": "DISCOVER",
"query": "scids=SCAW_0001&scids=SCSB_0001&scids=SCSB_0003&scids=SCSB_0004",
"path": "/discover/all"
},
"secondary": {
const _ = require('underscore');
const { query, model, operation } = offer.eligibility;
// the query is parsed because the query string in
// the offer document is an undercore string template where
// the variables can be replaced with the provided value
const parsedQuery = JSON.parse(
_.template(query)({
brokeruserId: event.data.brokeruserId,
})
@thakursaurabh1998
thakursaurabh1998 / sha256-hmac.md
Created July 14, 2020 13:39 — forked from jasny/sha256-hmac.md
Hashing examples in different languages

Example inputs:

Variable Value
key the shared secret key here
message the message to hash here

Reference outputs for example inputs above:

| Type | Hash |

@thakursaurabh1998
thakursaurabh1998 / throttle1.js
Last active August 9, 2020 15:26
Kafka Throttle
const { ConsumerGroup } = require('kafka-node');
const options = {
kafkaHost: 'broker:9092',
groupId: 'order-service',
};
const consumer = new ConsumerGroup(options, 'OrderTopic');
consumer.on('message', (data) => {
const { ConsumerGroup } = require('kafka-node');
const options = {
kafkaHost: 'broker:9092',
groupId: 'order-service',
fetchMaxBytes: 100 * 1024, // 100 KB
};
const consumer = new ConsumerGroup(options, 'OrderTopic');
const { ConsumerGroup } = require('kafka-node');
const options = {
kafkaHost: 'broker:9092',
groupId: 'order-service',
fetchMaxBytes: 100 * 1024, // 100 KB
autoCommit: false,
};
const consumer = new ConsumerGroup(options, 'OrderTopic');
const { ConsumerGroup } = require('kafka-node');
const options = {
kafkaHost: 'broker:9092',
groupId: 'order-service',
fetchMaxBytes: 100 * 1024, // 100 KB
autoCommit: false,
};
const consumer = new ConsumerGroup(options, 'OrderTopic');
consumer.on('message', (data) => {
consumer.pause();
const async = require('async');
const { ConsumerGroup } = require('kafka-node');
const consumerConfig = {
kafkaHost: 'broker:9092',
groupId: 'order-service',
fetchMaxBytes: 100 * 1024, // 100 KB
autoCommit: false,
};
const async = require('async');
const { ConsumerGroup } = require('kafka-node');
const consumerConfig = {
kafkaHost: 'broker:9092',
groupId: 'order-service',
fetchMaxBytes: 100 * 1024, // 100 KB
autoCommit: false,
};
const async = require('async');
const { ConsumerGroup } = require('kafka-node');
const consumerConfig = {
kafkaHost: 'broker:9092',
groupId: 'order-service',
fetchMaxBytes: 100 * 1024, // 100 KB
autoCommit: false,
};