I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from words import words | |
| minionese_to_english = {v: k for k, v in words.items()} | |
| def translate(sentence, minionese=False): | |
| dictionary = words if not minionese else minionese_to_english | |
| result = "" | |
| for word in sentence.split(" "): | |
| if word in dictionary.keys(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import akka.Done | |
| import akka.stream.ActorMaterializer | |
| import akka.stream.alpakka.s3.MemoryBufferType | |
| import akka.stream.alpakka.s3.scaladsl.S3Client | |
| import akka.stream.scaladsl.{Flow, JsonFraming} | |
| import com.typesafe.scalalogging.{LazyLogging, StrictLogging} | |
| import org.backuity.clist.util.Read | |
| import org.backuity.clist.{CliMain, arg, opt} | |
| import org.joda.time.Interval | |
| import org.joda.time.chrono.ISOChronology |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* This code snippet is a part of the blog at | |
| https://github.com/animeshtrivedi/blog/blob/master/post/2017-12-26-arrow.md | |
| */ | |
| import com.google.common.collect.ImmutableList; | |
| import org.apache.arrow.memory.RootAllocator; | |
| import org.apache.arrow.vector.*; | |
| import org.apache.arrow.vector.dictionary.DictionaryProvider; | |
| import org.apache.arrow.vector.types.FloatingPointPrecision; | |
| import org.apache.arrow.vector.types.pojo.ArrowType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| # NOTE: Requires Ruby 2.1 or greater. | |
| # This script can be used to parse and dump the information from | |
| # the 'html/contact_info.htm' file in a Facebook user data ZIP download. | |
| # | |
| # It prints all cell phone call + SMS message + MMS records, plus a summary of each. | |
| # | |
| # It also dumps all of the records into CSV files inside a 'CSV' folder, that is created |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TIME_DURATION_UNITS = ( | |
| ('week', 60*60*24*7), | |
| ('day', 60*60*24), | |
| ('hour', 60*60), | |
| ('min', 60), | |
| ('sec', 1) | |
| ) | |
| def human_time_duration(seconds): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| graph = JanusGraphFactory.open('conf/janusgraph-cassandra-es.properties') | |
| g = graph.traversal() | |
| entityToId = [:] | |
| new File('data/nodes.csv').eachLine { line, count -> | |
| // Skip header | |
| if (count > 1){ | |
| columns = line.split(',', -1) |
- Generated by code-examples-manager release 2.4.9-SNAPSHOT
- 670 published examples
- akka-actors-hello-world.sc : Simple akka hello world example
- akka-capitalize-and-print.sc : dump capitalized string coming from stdin using streams
- akka-http-client-json-stream.sc : Fully asynchronous http client call with json streamed response using akka-http will work in all cases, even with chunked responses !
- akka-http-client-json-with-proxy.sc : Fully asynchronous http client call with json response using akka-http will work in all cases, even with chunked responses, this example add automatic http proxy support.
- [akka-http-client-json.sc](https:/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Copy this into the console of any web page that is interactive and doesn't | |
| do hard reloads. You will hear your DOM changes as different pitches of | |
| audio. | |
| I have found this interesting for debugging, but also fun to hear web pages | |
| render like UIs do in movies. | |
| */ | |
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import threading | |
| import urllib.request | |
| import logging | |
| from time import sleep | |
| __author__ = "Florian Dambrine <android.florian@gmail.com>" | |
| class DatabricksPushgatewayExporter: | |
| """ |