Skip to content

Instantly share code, notes, and snippets.

View nadberezny's full-sized avatar

Juliusz Nadbereżny nadberezny

  • Getindata
  • Warsaw
View GitHub Profile
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.formats.avro.AvroToRowDataConverters;
import org.apache.flink.formats.avro.typeutils.AvroSchemaConverter;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.types.DataType;
import org.apache.flink.table.types.logical.LogicalType;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.formats.avro.AvroToRowDataConverters;
import org.apache.flink.formats.avro.typeutils.AvroSchemaConverter;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.types.DataType;
import org.apache.flink.table.types.logical.LogicalType;
@nadberezny
nadberezny / bash_associative_array.sh
Created November 17, 2023 08:56
Bash associative array from string
#!/bin/bash
declare -A myArr
SHARDS_AND_HOSTS="shard=0&host=host0,shard=1&host=host1"
for SHARD_AND_HOST in $(tr "," " " <<< "$SHARDS_AND_HOSTS"); do
while IFS='&' read shardKey hostKey; do
shard="${shardKey##*=}"
host="${hostKey##*=}"

Assigning Static IP Addresses in WSL2

WSL2 uses Hyper-V for networking. The WSL2 network settings are ephemeral and configured on demand when any WSL2 instance is first started in a Windows session. The configuration is reset on each Windows restart and the IP addresses change each time. The Windows host creates a hidden switch named "WSL" and a network adapter named "WSL" (appears as "vEthernet (WSL)" in the "Network Connections" panel). The Ubuntu instance creates a corresponding network interface named "eth0".

Assigning static IP addresses to the network interfaces on the Windows host or the WSL2 Ubuntu instance enables support for the following scenarios:

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@nadberezny
nadberezny / fedora.citrix.workspace.sh
Created December 13, 2020 09:06 — forked from Thermionix/fedora.citrix.workspace.sh
Install Citrix Workspace App on Fedora 32
#!/bin/sh
#Install Citrix Workspace App on Fedora 32
#Download Client From https://www.citrix.com/en-au/downloads/workspace-app/linux/workspace-app-for-linux-latest.html
sudo dnf install -y ICAClientWeb-rhel-20.04.0.21-0.x86_64.rpm
sudo dnf install -y compat-openssl10.x86_64
# Update libcrypto reference in desktop file
sudo sed -i '/Exec=/d' /usr/share/applications/wfica.desktop
@nadberezny
nadberezny / kafka_kv.scala
Created August 27, 2019 12:46
Kafka KV Store [not working[
import java.time.Duration
import java.util
import java.util.Properties
import org.apache.kafka.clients.consumer.KafkaConsumer
import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord}
trait KVStore[K, V] {
def get(key: K): Option[V]
@nadberezny
nadberezny / KaczkaAux.scala
Created April 10, 2019 14:05
Aux dependent
import cats.Monoid
object t42 extends App {
import cats.data._
import cats.implicits._
object Kaczka {
type Aux[A, B] = Kaczka[A] { type Out = B }
}
package nadberezny
object Pure {
sealed trait IO[A] {
def flatMap[B](f: A => IO[B]): IO[B] =
Suspend(() => f(this.run))
def map[B](f: A => B): IO[B] =
@nadberezny
nadberezny / win10-dev.md
Created February 3, 2019 06:26 — forked from wsargent/win10-dev.md
Windows Development Environment for Scala

Windows 10 Development Environment for Scala

This is a guide for Scala and Java development on Windows, using Windows Subsystem for Linux, although a bunch of it is applicable to a VirtualBox / Vagrant / Docker subsystem environment. This is not complete, but is intended to be as step by step as possible.

Sadly, much of this pertains to Git, GPG, SSH, and Windows all not working, rather than Windows Subsystem for Linux. There is no unified command line experience for native Windows still -- instead, there's a bunch of different conflicting programs which all bring along their own environment and need to be told about each other.

Harden Windows 10

Read the entire Decent Security guide, and follow the instructions, especially: