Skip to content

Instantly share code, notes, and snippets.

View cheewaphat's full-sized avatar
🏠
Working from home

cheewaphat cheewaphat

🏠
Working from home
View GitHub Profile
@cheewaphat
cheewaphat / JKS to PEM
Created September 10, 2021 12:18 — forked from after-the-sunrise/JKS to PEM
Python SSL socket with PEM from JKS
# Check the alias
keytool -list -keystore ${MYKEY}.jks
# Export to PKCS12
keytool -importkeystore -srckeystore ${MYKEY}.jks -destkeystore ${MYKEY}.pkcs -srcstoretype JKS -deststoretype PKCS12 -alias ${MYALIAS}
# Convert to PEM
openssl pkcs12 -in ${MYKEY}.pkcs -out ${MYKEY}.pem
[root@kafka-a-01 /]# /opt/kafka_current/bin/kafka-console-consumer.sh
The console consumer is a tool that reads data from Kafka and outputs it to standard output.
Option Description
------ -----------
--blacklist <blacklist> Blacklist of topics to exclude from
consumption.
--bootstrap-server <server to connect REQUIRED (unless old consumer is
to> used): The server to connect to.
--consumer-property <consumer_prop> A mechanism to pass user-defined
properties in the form key=value to
@cheewaphat
cheewaphat / self-signed-certificate-with-custom-ca.md
Created December 4, 2020 08:17 — 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
@cheewaphat
cheewaphat / generate-ssh-key.sh
Created October 27, 2020 11:47 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
import org.apache.spark.sql.SparkSession
import org.apache.spark.SparkContext
import org.apache.spark.SparkConf
import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.types.{StructType,ArrayType}
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.Column
import org.apache.spark.sql.functions.col
import org.apache.spark.sql.functions.explode_outer