Skip to content

Instantly share code, notes, and snippets.

Davide Icardi davideicardi

Block or report user

Report or block davideicardi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
davideicardi /
Last active Sep 16, 2019
Package a Python Lambda for AWS

Package a Python Lambda for AWS

Python virtual env

Create Python virtual env

python3 -m venv v-env


davideicardi /
Created Aug 6, 2019
Read kinesis data from aws cli

aws kinesis get-shard-iterator --stream-name YOUR_STREAM_NAME --shard-id 0 --shard-iterator-type TRIM_HORIZON

aws kinesis get-records --shard-iterator YOUR_SHARD_ITERATOR

davideicardi / markdown-merge.js
Last active Nov 10, 2018
Node.js script to merge markdown files and processing it. Using node.js streams.
View markdown-merge.js
const fs = require("fs");
const { Transform, PassThrough } = require('stream');
function concatStreams(streams) {
let pass = new PassThrough();
let waiting = streams.length;
for (let stream of streams) {
pass = stream.pipe(pass, {end: false});
stream.once('end', () => --waiting === 0 && pass.emit('end'));
davideicardi /
Last active May 20, 2019
Scala AES-CTR encryption, MAC, HMAC, ... with Bouncy Castle example

Scala AES-CTR encryption Bouncy Castle example

Add the following library:

libraryDependencies += "org.bouncycastle" % "bcprov-jdk16" % "1.46"


davideicardi /
Last active Oct 7, 2019
Write and read Avro records from bytes array

Avro serialization

There are 4 possible serialization format when using avro:

davideicardi /
Last active Jan 21, 2019
VerneMq Kubernetes StatefulSet + LoadBalancer

Deploy VerneMq inside Kubernetes

Allow the default service account to read pods data, by adding a role binding:

TODO: Now the yaml works only for the dev1 namespace, how can I make it more generic?

kubectl apply -f ./add-read-pods-binding.yaml
davideicardi /
Created Jul 5, 2018
Gradle minimal multi-projects scala build

Gradle multi-projects scala build

Assume that you have the following directory structure:

  • your-app
    • project1
      • src
        • main
          • scala
            • App.scala
davideicardi / ConditionalFlow.scala
Created Jun 29, 2018
Conditional Akka Stream Flow
View ConditionalFlow.scala
import akka._
// WARNING: Ordering is not guaranteed.
// The problem with this Graph is that when splitting the flow
// we obtain 2 concurrent flows.
// The result of conditionalFlow can returns after another messages is processed in the brodcast.
// ie. If you have 10 messages from 0 to 9. Let's say that we run a conditional flow only for element 0.
View PassThroughFlow.scala
(old version:
Use PassThroughFlow when you have a message that should be used in a
flow that trasform it but you want to maintain the original message for
another following flow.
For example if you consume messages from Kafka (CommittableMessage).
You process the message (transform, save it inside a database, ...) and then you need again the original message
to commit the offset.
davideicardi /
Last active Jun 26, 2018
Alpakka HBase connector, write Akka messages to HBase
You can’t perform that action at this time.