KAFKA

KAFKA is in all mouths these days. So I share here, also as a reminder for me, a couple of #KAFKA ressources that looked helpful to me.

TLDR:

Do not use KAFKA for:

-“Little” Data flows (overkill)

-Streaming ETL (handling transformation is a hassle)

-Store and process large files (images, videos, proprietary files, etc.)

https://www.kai-waehner.de/blog/2020/08/07/apache-kafka-handling-large-messages-and-files-for-image-video-audio-processing/

https://www.upsolver.com/blog/apache-kafka-use-cases-when-to-use-not

https://kafka.apache.org/intro

https://docs.confluent.io/kafka-clients/librdkafka/current/overview.html

https://docs.confluent.io/platform/current/clients/librdkafka/html/md_INTRODUCTION.html

Why gettimeofday() is bad at timing things

I was reading a changelog from a library I love (unrelated but here is the link: https://liballeg.org/ ) and I stumble upon that change:


“Use clock_gettime with CLOCK_MONOTONIC instead of gettimeofday (check-switch-26)”

Then I did a bit of research on the topic, and found a good explanation here:

https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time.html

TLDR: if you use gettimeofday to time things then your program may be affected by time shift, because gettimeofday is not monotonic. if you do not care about the date and only about elapsed time, use clock_gettime.

HackRF Portapack Mayhem Firmware, Search/Freqman evolution branch

On top of the existing ‘search and stay X seconds after a match’ the SearchApp have been updated with a ‘search and stay’ mode: stay while matching, leave after X seconds of inactivity, reset counters on activity during the wait. mode,
To use it just specify a negative value in the ‘wait’ field using the rotary encoder.

As some have some problems getting the bin back from discord, here you are:

The documentation is on the wiki, here:

https://github.com/GullCode/portapack-mayhem/wiki/Search

Github page:

https://github.com/GullCode/portapack-mayhem

CSS trick for rowspan and nth-child matching

If ever you try to make a table with a single <td> matching more than one line using rowspan, your css that was using nth-child to customize each column is working badly. Only the first line of each rowspan is correctly recognized by the nth-child. All other lines are all shifted by one.

That’s because the css engine is not taking in accound the rowspan attribute.

Solution:

In my case it was to add all the <td> hidden by the rowspan like <td style=”display:none”> so they are here for the css engine to count properly, but not displayed at all.

grep: retain colors when piping

By default grep -color is not producing color symbols if it detects that the output is not a terminal.

grep -color=auto is doing the same, that is not producing color symbols if it detects that the output is not a terminal.

The solution is to use “grep -color=always“ in the place that need it.

Do not put it in an alias of grep as it would break some code somewhere else. Color symbols are strings like “ESC[35m” and they will be inserted in the text.

Recursive grep FTW

In case you’re trying to search recursively for a specific file type and data mask, grep -r is not enough to bring the desired result.
You’ll have to use –include ‘type’ and then, even if the directory does not contain any of the given filetype in root, it’s still working.

Example;

grep -r --include '*.extension' 'Text to match' directory
grep -r --include '*.cpp' 'Audio' .