Skip to content

Instantly share code, notes, and snippets.

View LamGC's full-sized avatar
🧐
I may be slow to respond.

LamGC LamGC

🧐
I may be slow to respond.
View GitHub Profile
@LamGC
LamGC / Readme.md
Created March 15, 2022 02:01
HttpClient 通过 AuthorityInformationAccess 自动修复证书链缺失的信任策略实现

当 Https 网站没有传回完整证书链时,HttpClient 将无法认证网站安全性,所以开发了这个 TrustStrategy 实现。

通过逐层验证证书,在证书验证失败后,假定其中存在中间证书缺失,通过获取下级证书的 AIA 信息,下载中间证书后插入证书链,继续检查。
例如原本的证书链为:

D(C) -> C(B) -> B(A) -> A(-)

而 Https 服务器只传回了:

D(C) -> A(-)
@LamGC
LamGC / Problems-to-be-considered-when-developing-functions.md
Created November 28, 2020 07:02
Problems to be considered when developing functions

When you want to implement a feature in your bot, you start asking these questions:

The WHO?

  • Who is going to use this feature? Should they be allowed to use all the features?

The WHAT?

  • Under what conditions should I allow this feature?
  • Should the message have a photo? A document? Oh, maybe a callback query?

>The HOW?

@LamGC
LamGC / Create_a_simple_virtual_file_system_using_'jnr-fuse'.md
Last active September 12, 2023 14:14
通过 'jnr-fuse' 实现一个目录映射的虚拟文件系统

通过 'jnr-fuse' 实现一个目录映射的虚拟文件系统

前提概要

说实话,jnr-fuse 官方自带的示例真的有些难看懂,而且 ErrorCodes 的命名属实降智(不是很懂某软的命名缩写习惯)。
不过至少能用了不是吗?

指路:

jnr-fuse 项目中自带一个 HelloWorld 示例 HelloFuse 和一个内存盘实现示例 MemoryFS(千万不要真拿去用了,性能较为低下且没有持久化功能),
看这示例真的懵了半天,中途也是遇到了不少 bug,不过总之是把一个目录映射的示例做出来了,来分享一下经验。

Keybase proof

I hereby claim:

  • I am lamgc on github.
  • I am lamgc (https://keybase.io/lamgc) on keybase.
  • I have a public key ASCFlHrI6cVo22ZT1w1N0QeZY6BZALzn2k2_e7inCksDxAo

To claim this, I am signing this object: