Skip to content

Instantly share code, notes, and snippets.

View bxb100's full-sized avatar
😭
R.I.P, My friends

Lemon bxb100

😭
R.I.P, My friends
View GitHub Profile
@bxb100
bxb100 / CodoFormatRef.md
Last active July 31, 2022 03:39
代码格式引用

rust

不过,过长的代码行难以阅读,所以最好拆开来写。通常来说,当使用 .method_name() 语法调用方法时引入换行符和空格将长的代码行拆开是明智的。现在来看看这行代码干了什么。[^1]

@bxb100
bxb100 / mac_reset_privacy.md
Last active June 24, 2022 10:58
MAC 无法授权时重设 Accessibility 的常见做法
  • tccutil reset Accessibility
  • 直接使用 - icon 按钮移出

image

@bxb100
bxb100 / wireshark.md
Created May 21, 2022 09:26 — forked from EddiG/wireshark.md
How to decrypt SSL/TLS traffic in Wireshark on MacOS

The main point is to save the SSL/TLS keys those used by the web browser (SSLKEYLOGFILE=/tmp/tmp-google/.ssl-key.log).
In the example below we run brand new instance of Google Chrome (--user-data-dir=/tmp/tmp-google do the trick):
SSLKEYLOGFILE=/tmp/tmp-google/.ssl-key.log /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/tmp-google
Then run the Wireshark and open the Preferences -> Protocols -> SSL, where we put the path to the SSL keys log file into the (Pre)-Master-Secret log filename field.
Now all SSL/TLS traffic from this browser instance will be decrypted.

@bxb100
bxb100 / StringDemo.java
Created May 8, 2022 08:57
Best way to join the String
import java.util.StringJoiner;
import java.util.stream.Stream;
public class StringDemo {
public static void main(String[] args) {
StringJoiner sj = new StringJoiner(",", "[", "]");
Stream.of("1", "2", "3").forEach(sj::add);
System.out.println(sj.toString());
/*
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
if you want to view the source visit the plugins github repository
*/
'use strict';
var obsidian = require('obsidian');
var child_process = require('child_process');
var util = require('util');
@bxb100
bxb100 / fluent-bit.conf
Created April 17, 2022 04:34
Fluent Bit config
[SERVICE]
flush 1
log_level info
parsers_file parsers_multiline.conf
[INPUT]
name tail
path /var/log/brewery-monolith.log
read_from_head true
multiline.parser multiline-regex-test
@bxb100
bxb100 / BeanModifier.java
Created April 11, 2022 05:59
Spring boot post process 后置处理器以及 Scope 代码
package com.pers.test.post;
import java.util.concurrent.atomic.AtomicInteger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

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的文件。需要经过下面几步。

@bxb100
bxb100 / execute.ps1
Last active April 4, 2022 03:21
Parse html page gets m3u8 link then using N_m3u8DL-CLI to download video
#!/usr/bin/env pwsh
param ($URI, $Proxy, $Extra)
$ErrorActionPreference = 'Stop'
$SaveName = 'notFoundName'
function isURI($address) {
$null -ne ($address -as [System.URI]).AbsoluteURI
}
function getExe {
return (Get-Item N_*.exe -Exclude '*SimpleG*').fullname