Skip to content

Instantly share code, notes, and snippets.

View bxb100's full-sized avatar
🥲
R.I.P, My friend

Lemon bxb100

🥲
R.I.P, My friend
View GitHub Profile
@bxb100
bxb100 / SearchImageByGoogle.sh
Last active November 6, 2022 09:39
DropOver 脚本
#!/usr/bin/env bash
regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
for var in "$@"
do
files="encoded_image=@$var"
# if this is a gif, get the first frame
if [[ $var =~ \.(gif|mp4)$ ]]; then
tempfile="$TMPDIR$(uuidgen).jpg";
@bxb100
bxb100 / EmbySetting.css
Last active February 8, 2022 17:17
simple beautify
.cardImageContainer {
background-size: cover;
}
.paper-icon-button-img {
object-fit: cover;
max-height: 1.72em;
}
.fldImage img {
height: 103px;
object-fit: cover;
@bxb100
bxb100 / log.md
Last active May 23, 2022 14:18
记一次 windows docker 安装 ES 8.x 问题汇总

max_map_count 过小无法启动

  • 使用 .wslconfig 来控制 wsl 的内存大小[^1]
  • 然后 wsl --shutdown 使其生效
  • 进入 wsl 容器后调整 vm.max_map_count=262144, 详细命令是 sudo sysctl -w vm.max_map_count=262144 注意不要 sudo vim 那是没用的.[^3]

8.x 默认 ssl

  • Docker 中使用 cp 复制 /usr/share/elasticsearch/config/certs/http_ca.crt 然后移入受信任的根证书颁发机构[^2]
@bxb100
bxb100 / execute.cmd
Last active March 13, 2022 17:12
Parse html page gets m3u8 link then using N_m3u8DL-CLI to download video
@echo off
setlocal EnableDelayedExpansion
echo ================[ Getting web page ]================
set URL=%1
if NOT "%URL:~-1%" == "/" (
set URL="%URL%/"
)
echo 'url: %URL%'
for /f "tokens=4 delims=/" %%a in ("%URL%") do (
@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

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 / 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;
@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