Skip to content

Instantly share code, notes, and snippets.

@nirajkadam
nirajkadam / KafkaPartitionNumberAndKeys.md
Last active December 1, 2021 05:35
Partition keys to publish messages on partitions 0 to 19 in Apache Kafka's console producer

Following are the keys produced by Apache Kafka's DefaultPartitioner which uses a 32-bit murmur2 hash to compute the partition number for a record (with the key defined) or chooses a partition in a round-robin fashion (per the available partitions of the topic):

Partition Keys Partition Number
21 0
16 1
20 2
3, 9, 30, 35 3
27 4
24 5
@nirajkadam
nirajkadam / sendEmail.gs
Last active December 3, 2020 22:39
Google script to send e-mail
/* ---- Script to send an E-Mail ---- */
function onlyToAddTheDriveScope() {
DriveApp.getRootFolder();
}
function getDate() {
var date = new Date();
var dateofDay = new Date(date.getTime());
return Utilities.formatDate(dateofDay, "GMT+05:30", "dd-MM-yyyy hh:mm:ss a"); // IST
@nirajkadam
nirajkadam / customTab.gs
Created December 29, 2015 09:53
Adding a custom tab to your google spreadsheet to support google's magic script
// Adding a custom Google Analytics menu.
activeSpreadsheet.addMenu(
'Google Analytics', [{
name: 'Find Profile / ids', functionName: 'findIds_'}, {
name: 'Create Core Report', functionName: 'createCoreReport'}, {
name: 'Create MCF Report', functionName: 'createMcfReport'}, {
name: 'Get Data', functionName: 'getData'}, {
name: 'Send Email', functionName: 'sendEmail'
}]);