Skip to content

Instantly share code, notes, and snippets.

@yulewei
yulewei / kafka-acls
Last active June 26, 2020 10:29
kafka 2.2.0 help
$ kafka-acls --help
This tool helps to manage acls on kafka.
Option Description
------ -----------
--add Indicates you are trying to add ACLs.
--allow-host <String: allow-host> Host from which principals listed in --
allow-principal will have access. If
you have specified --allow-principal
then the default for this option
will be set to * which allows access
@yulewei
yulewei / SpringContextHolder.java
Last active August 14, 2022 05:19
Utility bean for getting Spring beans from static context
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
/**
* Utility bean for getting Spring beans from static context
@yulewei
yulewei / martinfowler-microservices-zh-cn.md
Last active July 21, 2023 09:55
微服务 | Martin Fowler
@yulewei
yulewei / gen-rsa-keys.sh
Last active August 10, 2023 09:38
生成 pkcs8 格式的 RSA 公钥和私钥
# 生成私钥,默认 pkcs1 格式
openssl genrsa -out private_key_pkcs1.pem 1024
# 生成公钥,默认 pkcs8 格式
openssl rsa -pubout -in private_key_pkcs1.pem -out public_key_pkcs8.pem
# 私钥转 pkcs8 格式
openssl pkcs8 -topk8 -in private_key_pkcs1.pem -inform pem -out private_key_pkcs8.pem -outform pem -nocrypt
# 只保留 pem 文件中的 base64 内容
cat private_key_pkcs8.pem | sed '1d;$d' | tr -d '\n' > private_key.txt
cat public_key_pkcs8.pem | sed '1d;$d' | tr -d '\n' > public_key.txt
@yulewei
yulewei / introduction-tcpdump.md
Last active August 23, 2023 11:19
在 Linux 命令行中使用 tcpdump 抓包
@yulewei
yulewei / jmm-cookbook.md
Last active August 23, 2023 11:20
Java内存模型Cookbook
@yulewei
yulewei / jmm-faq.md
Last active August 23, 2023 11:20
Java内存模型FAQ
@yulewei
yulewei / elasticsearch-rest-api-cheatsheet.md
Last active August 23, 2023 11:22
Elasticsearch 7.6 REST API 速查表