Skip to content

Instantly share code, notes, and snippets.

View haoel's full-sized avatar
🎯
Focusing

Hao Chen haoel

🎯
Focusing
View GitHub Profile
@haoel
haoel / Replace.md
Last active March 28, 2022 09:45
Replace delimited block of text in file with the contents of another file

Replace Text Block

We have megaease.conf, and want to replace the contents in user.conf between the ######### MEGAEASE-BEGIN ########## and ######### MEGAEASE-END ########## lines.

First time, insert the block

echo "######### MEGAEASE-BEGIN ##########" >> user.conf
cat megaease.conf >> user.conf
echo "######### MEGAEASE-END ##########" >> user.conf

mTLS 配置

对于mTLS的配置的证书来说,有如下的提示。

  • 三个文件。 对于大多数系统,如:MySQL, Redis,PostgreSQL。会需要三个文件:CA证书 + CERT 和 KEY。可以在我的这个开源项目(https://github.com/haoel/mTLS/tree/main/certs )中找到我生成的CA,以及 Server 和 Client的 .crt.key 文件。生成的方法也在我的那个开源项目中了。

  • 两个文件。 对于有的系统,比如:MongoDB,他只要两个文件,一个是CA,一个是 pem 文件,对于pem文件,你可以直接把上面的 .crt 和 .key 合并了就好了。如:cat server.crt server.key > server.pem

  • JKS文件。 对于一些系统,比如:Kafka 和 Zookeeper。他要的不是上面的明文的格式,他要的是一种jks的格式,这是Java的格式。怎么从上面的明文的方式转到jks的文件。需要经过下面几步。

React.js Github Repo Spammed

Background

React's official website makes a banner, which offers visitors a way to provide humanitarian aid to Ukraine.
React的官方网站做了一个横幅,为访问者提供了向乌克兰提供人道主义援助的途径。

telegram-cloud-photo-size-5-6127611897286078767-x

Then, many people went to the React.js Github repository and opened lots of spam issues with anti-US and anti-Ukrainian comments in an apparent form of digital protest. The messages are in English and Mandarin.
然后,很多人到React.js Github 仓库中开了很多带有反美国和反乌克兰 issue,进行一种数字化的抗议。这些信息是用英语和普通话写的。

@haoel
haoel / comparison.md
Created August 24, 2021 08:53
comparison
Subsystem Spring Cloud Ecosystem Service Mesh Ecosystem
Service Registry & Discovery The development is simple and convenient, just a simple annotation. it supports different registries. It is easy for developers to set up a development environment locally to complete coding and debugging. Based on the Service mechanism of K8s, and provides its own Registry to synchronize the Registry. The developer needs to understand Kubernetes and the development environment is not easy to set up.
Resilient & Fault tolerance The official integration of Resilience4j provides a complete fault-tolerant mechanism. But the service needs to be integrated with the SDK. By using the sidecar architecture, it is a non-intrusive fault tolerance mechanism, totally transparent for service.
Observability Spring Cloud build-in, spring micro-meter, Zipkin, etc. All service-inside metrics, tracing, and logs can be collected easily, and through the JavaAetcgent instrument method, it’s completely transparent to develope
from multiprocessing import Pool
def loop()
while True:
pass
Pool().map(loop, range(100))
int main() {
#pragma omp parallel for
for (int i = 0; i < 16; ++i) {
while (true);
}
}