Skip to content

Instantly share code, notes, and snippets.

@yulewei
yulewei / jmm-cookbook.md
Last active Jul 18, 2021
Java内存模型Cookbook
View jmm-cookbook.md
@yulewei
yulewei / jmm-faq.md
Last active Jul 21, 2021
Java内存模型FAQ
View jmm-faq.md
@yulewei
yulewei / ApplicationContextHolder.java
Last active Mar 19, 2021
Utility bean for getting Spring beans from static context
View ApplicationContextHolder.java
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
View +mqadmin管理工具.md
@yulewei
yulewei / gen-rsa-keys.sh
Last active Mar 5, 2020
生成 pkcs8 格式的 RSA 公钥和私钥
View gen-rsa-keys.sh
# 生成私钥,默认 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 / ali-kubernetes-course.md
Last active Mar 2, 2021
从零开始入门 K8s
View ali-kubernetes-course.md

从零开始入门 K8s:

@yulewei
yulewei / docker-commands-restructure.md
Last active Mar 15, 2020
Docker通用命令映射管理命令
View docker-commands-restructure.md
@yulewei
yulewei / kafka-acls
Last active Jun 26, 2020
kafka 2.2.0 help
View kafka-acls
$ 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