Skip to content

Instantly share code, notes, and snippets.

View miller45's full-sized avatar
🙂

Ramon Klein miller45

🙂
View GitHub Profile
@miller45
miller45 / csharp1.cs
Created March 6, 2024 16:47
base64encode in different languages
var cleartext = "Hello World";
var b64encoded = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(cleartext));
// b64encoded now contains SGVsbG8gV29ybGQh
@miller45
miller45 / inv-data-gen.json
Last active November 17, 2023 10:48
julie ops cloud connect example
{
"connector.class": "DatagenSource",
"name": "inv-data-gen",
"kafka.auth.mode": "SERVICE_ACCOUNT",
"kafka.service.account.id": "sa-affe",
"kafka.topic": "inventory",
"schema.context.name": "default",
"output.data.format": "JSON",
"json.output.decimal.format": "BASE64",
"quickstart": "INVENTORY",

https://docs.confluent.io/platform/current/connect/transforms/overview.html

Cast|Cast fields or the entire key or value to a specific type (for example, to force an integer field to a smaller width).
Drop|Drop either a key or a value from a record and set it to null.
DropHeaders|Not currently available for managed connectors. Drop one or more headers from each record.
EventRouter|Only available for managed Debezium connectors. Route Debezium outbox events using a regex configuration option.
ExtractField|Extract the specified field from a Struct when schema present, or a Map in the case of schemaless data. Any null values are passed through unmodified.
ExtractTopic|Replace the record topic with a new topic derived from its key or value.
Filter (Apache Kafka)|Drop all records. Designed to be used in conjunction with a Predicate.
Filter (Confluent)|Include or drop records that match a configurable filter.condition.
@miller45
miller45 / serializers.txt
Created June 23, 2023 19:15
kafka constants
org.apache.kafka.connect.storage.StringConverter
io.confluent.connect.avro.AvroConverter
io.confluent.connect.protobuf.ProtobufConverter
org.apache.kafka.connect.json.JsonConverter
io.confluent.connect.json.JsonSchemaConverter
org.apache.kafka.connect.converters.ByteArrayConverter
#inserting unix timestamps ms sql datetime fields in jdbc-sink (kafka-connect) leads SQLException Arithmetic Overflow
#converting it to a ISO8601 timestamp works. here is a transform example for kafka-connect-json
"transforms": "dateToIso",
"transforms.dateToIso.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
"transforms.dateToIso.format": "yyyy-MM-dd'T'HH:mm:ss'Z'",
"transforms.dateToIso.target.type": "string",
"transforms.dateToIso.field": "CreateDate",
@miller45
miller45 / producewithcurl.sh
Last active May 30, 2023 13:19
least friction commands to access topic data on kafka
curl \
-X POST \psot
-H "Content-Type: application/json" \
-H "Authorization: Basic <yourbase64encodedapikeyandapisecret>" \
https://pkc-zpjg0.eu-central-1.aws.confluent.cloud:443/kafka/v3/clusters/lkc-vrxdop/topics/myproxytest/records \
-d '{"value":{"type":"JSON","data": { "PrimaryId":1000, "Name":"Ramon Klein" } }}'
# you have to adapt the url if you not generated it via confluent cloud "new client"
# also then you have to encode you api key like this:
# prompt> echo "<apikey>:<apisecret>" | base64 -w0
@miller45
miller45 / modbus.yaml
Last active April 21, 2022 20:09
Working SMA homeassistant config for modbus
# found in this forum https://community.home-assistant.io/t/modbus-data-from-sma-inverter/122425/79
- name: PV_Gesamtertrag
unit_of_measurement: kWh
slave: 3
address: 30531
input_type: input
count: 2
- name: PV_Leistung
unit_of_measurement: W
slave: 3
--- ./tls.c.orig 2020-04-29 03:50:32.700402228 +0100
+++ ./tls.c 2020-04-29 03:51:18.758402228 +0100
@@ -186,7 +186,7 @@
if (!initialized)
{
- SSL_library_init();
+// SSL_library_init();
if (!RAND_status())
--- ./configure.orig 2021-04-29 21:56:27.626359584 +0200
+++ ./configure 2015-04-30 02:53:36.000000000 +0200
@@ -4003,11 +4003,11 @@
#ifdef __cplusplus
extern "C"
#endif
-char OPENSSL_init_ssl ();
+char SSL_library_init ();
int
main ()
--- ./tls.c.orig 2020-04-29 03:50:32.700402228 +0100
+++ ./tls.c 2020-04-29 03:51:18.758402228 +0100
@@ -186,7 +186,7 @@
if (!initialized)
{
- SSL_library_init();
+// SSL_library_init();
if (!RAND_status())