Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Check if partition and offset are provided
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <partition> <offset> [topic]"
echo " partition: The partition number to read from"
echo " offset: The offset to start reading from"
echo " topic: Optional topic name (defaults to 'test')"
exit 1
fi
@ram-pi
ram-pi / App.java
Created May 13, 2025 15:39
dek-generator
package com.github.rampi.encryption;
import com.azure.core.credential.TokenCredential;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.security.keyvault.keys.KeyClient;
import com.azure.security.keyvault.keys.KeyClientBuilder;
import com.azure.security.keyvault.keys.cryptography.CryptographyClient;
import com.azure.security.keyvault.keys.cryptography.CryptographyClientBuilder;
import com.azure.security.keyvault.keys.cryptography.models.EncryptResult;
import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm;
@ram-pi
ram-pi / verify_rf_and_min_isr.sh
Last active April 30, 2025 12:41
This script checks Kafka topics for their replication factor and min.insync.replicas settings.
#!/usr/bin/env bash
# Help function
show_help() {
echo "Usage: $0 [bootstrap-server] [command-config]"
echo ""
echo "This script checks Kafka topics for their replication factor and min.insync.replicas settings."
echo "It will warn if the difference between these values is not 1 and suggest fixes."
echo ""
echo "Parameters:"
@ram-pi
ram-pi / docker-compose.yaml
Last active September 26, 2024 12:04
Connect on Docker with Kafka on CCloud
---
services:
kafka-connect:
image: confluentinc/cp-server-connect:7.7.1
hostname: kafka-connect
container_name: kafka-connect
healthcheck:
test: curl -fail --silent http://kafka-connect-1:8083/connectors --output /dev/null || exit 1
interval: 10s
@ram-pi
ram-pi / pom.xml
Created September 24, 2024 12:41
Kafka Client - pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.rampi</groupId>
<artifactId>kafka-client-example</artifactId>
<version>1.0-SNAPSHOT</version>
@ram-pi
ram-pi / change_replication_factor.sh
Last active November 21, 2024 13:36
Change replication factor script
#!/usr/bin/env bash
# Usage: change_replication_factor.sh <bootstrap-server> <broker-list> <topic-file> <replication-factor> <min-isr> <extra-var>
# Example: ./change_replication_factor.sh localhost:9092 1,2,3 /tmp/topic.txt 3 2 --command-config client.properties
# Example: export PATH=$PATH:/path/to/kafka/cli/bin ; ./change_replication_factor.sh localhost:9092 1,2,3 /tmp/topic.txt 3 2 --command-config client.properties
# Requires: jq, kafka-topics, kafka-reassign-partitions, kafka-configs
# Author: @ram-pi
# Version: 0.3
# Date: 2024-11-21
# Description: Change replication factor and min.insync.replicas for topics defined in a file
@ram-pi
ram-pi / ca_validation.md
Created July 16, 2024 11:28 — forked from genaromadrid/ca_validation.md
Validate a Certificate against a Certificate Authority using OpenSSL

Certificate CA Validation

The easy way

To validate a certificate agains a certificate authority you just have to run

openssl verify -trusted ca_root.pem -untrusted intermediate_ca.pem certificate.pem

You'll see a 'OK' message at the end of the output

@ram-pi
ram-pi / offsets_mover.sh
Created March 29, 2024 14:49
Script for moving offset from one cluster to another
#!/usr/bin/env bash
# example usage: ./offsets_mover.sh localhost:9092 client.1.properties localhost:9093 client.2.properties
# get bootstrap servers from args
BOOTSTRAP_SERVER=$1
# get properties file location from args
PROPERTIES_FILE=$2
@ram-pi
ram-pi / ips.sh
Created March 29, 2024 08:27
Get IPs from all groups with kafka-consumer-group cli
#!/usr/bin/env bash
# example usage: ./ips.sh localhost:9092 /etc/kafka/consumer.properties
# get bootstrap servers from args
BOOTSTRAP_SERVER=$1
# get properties file location from args
PROPERTIES_FILE=$2
@ram-pi
ram-pi / README.md
Created February 23, 2024 15:06 — forked from dnozay/README.md
Enable memberOf attribute on an openldap server.