Skip to content

Instantly share code, notes, and snippets.

@ram-pi
ram-pi / script.sh
Created February 23, 2022 11:58
Keycloak - Disable HTTPS with admin cli
# MOVE TO FOLDER
cd /opt/keycloak/bin/
# LOGIN
./kcadm.sh config credentials --server http://localhost:8080/ --realm master --user your_user --password your_password
# DISABLE SSL
./kcadm.sh update realms/master -s sslRequired=NONE
@ram-pi
ram-pi / GlobalProtect-Portal-Linux.readme
Created March 3, 2022 16:24 — forked from iamdylanngo/GlobalProtect-Portal-Linux.readme
Guide setup GlobalProtect Portal on Linux
# Guide setup GlobalProtect Portal on Linux
## Setup GlobalProtect
sudo apt update
Download GlobalProtect: https://github.com/jundat95/GlobalProtectVPN/raw/master/PanGPLinux-5.0.8-c6.tgz
Go to folder Downloads and Unzip: tar -xvzf PanGPLinux-5.0.8-c6.tgz
@ram-pi
ram-pi / self-signed-certificate-with-custom-ca.md
Last active April 22, 2022 09:01 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@ram-pi
ram-pi / docker-for-mac.md
Created July 27, 2022 14:25 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@ram-pi
ram-pi / json-to-avro.sql
Created August 17, 2022 14:48 — forked from miguno/json-to-avro.sql
Using KSQL to convert a Kafka topic from JSON to Avro format.
CREATE STREAM sensor_events_json (sensor_id VARCHAR, temperature INTEGER, ...)
WITH (KAFKA_TOPIC='events-topic', VALUE_FORMAT='JSON');
CREATE STREAM sensor_events_avro WITH (VALUE_FORMAT='AVRO') AS SELECT * FROM sensor_events_json;
@ram-pi
ram-pi / kafka-3.docker-compose.yaml
Last active August 29, 2022 13:30
Kafka Cluster with 3 brokers and 1 Zookeeper
version: '3.8'
services:
# ZOOKEEPER
zookeeper:
container_name: "zookeeper"
image: confluentinc/cp-zookeeper:${CF_TAG}
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
# ENABLE 4LW COMMANDS FROM EVERYWHERE

Kafka console consumer with Kerberos

1. Create a jaas.conf file with the following contents:

KafkaClient {
   com.sun.security.auth.module.Krb5LoginModule required
   useKeyTab=true
   keyTab="keytabFile.keytab"
   storeKey=true
   useTicketCache=false
   serviceName="kafka"
@ram-pi
ram-pi / how_to_reset_kafka_consumer_group_offset.md
Created September 15, 2022 09:53 — forked from marwei/how_to_reset_kafka_consumer_group_offset.md
How to Reset Kafka Consumer Group Offset

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)
@ram-pi
ram-pi / script.sh
Created October 26, 2022 18:06
Confluent RBAC - MDS APIs based role-bindings counter
#!/bin/bash
MDS_EP=http://localhost:8091
MDS_BA=c3VwZXJVc2VyOnN1cGVyVXNlcg==
KAFKA_CLUSTER_ID=h0r1CE3LQYidma5HR0VhWg
CONNECT=connect-cluster
SR=schema-registry
KSQLDB=ksql-cluster
C3=c3-cluste
@ram-pi
ram-pi / kafka-cheat-sheet.md
Created November 5, 2022 10:59 — forked from filipefigcorreia/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --delete-config retention.ms