Skip to content

Instantly share code, notes, and snippets.

View fwqaaq's full-sized avatar
🤡
be nice

fwqaaq fwqaaq

🤡
be nice
View GitHub Profile
@fwqaaq
fwqaaq / config.md
Last active April 22, 2024 07:40
一些日常遇到的配置问题

Arch Linux

Caution

在使用 Arch Linux 的时候会有很多问题,例如更新的时候出现:PKGBUILD Does not exist

需要先更新 gpg 密钥再去更新

sudo pacman -S archlinux-keyring
sudo pacman -Syu
@fwqaaq
fwqaaq / rust_interface.md
Last active November 9, 2023 08:13
Rust 接口设计原则
@fwqaaq
fwqaaq / Rust 常用概念.md
Last active January 9, 2024 14:52
Rust 常用概念

零成本抽象

Rust 的抽象是零成本的,Rust 的抽象并不会存在运行时性能开销,这一切都是在编译期完成的。(零成本抽象的基石是范型和 trait)

孤儿规则

当你为某类型实现某 trait 的时候,必须要求类型或者 trait 至少有一个是在当前 crate 中定义的。 你不能为第三方的类型实现第三方的 trait 。

鸭子类型

@fwqaaq
fwqaaq / Rust FFI.md
Last active April 1, 2024 16:14
Rust 利用 FFI 对接 C 语言
@fwqaaq
fwqaaq / Rust 常用示例.md
Last active June 26, 2024 07:37
Rust 常用示例

Send 和 Sync

这两个类型有一定联系,但是并不是由谁决定谁。

  • 仅实现 Send:Cell 以及 RefCell,可以在线程之间移动所有权,但是不能共享,也就是不能多个线程同时修改其内部值
  • 仅实现 Sync:MutexGuard(各种锁的 guard),它们的共享引用可以在线程之间解锁(lock),但是所有权不能直接被转移
  • 实现 Send 和 Sync:大多数类型都设置了 Send 和 Sync

参考:https://zhuanlan.zhihu.com/p/24142191异步中的 Send 和 Sync

@fwqaaq
fwqaaq / icons.json
Last active July 16, 2024 02:49
vscode-material-icon-theme
{"fileIcons":{"defaultIcon":{"name":"file"},"icons":[{"name":"html","fileExtensions":["htm","html","xhtml","html_vm","asp"]},{"name":"pug","fileExtensions":["jade","pug"],"fileNames":[".pug-lintrc",".pug-lintrc.js",".pug-lintrc.json"]},{"name":"markdown","fileExtensions":["md","markdown","rst"]},{"name":"blink","fileExtensions":["blink"],"light":true},{"name":"css","fileExtensions":["css"]},{"name":"sass","fileExtensions":["scss","sass"]},{"name":"less","fileExtensions":["less"]},{"name":"json","fileExtensions":["json","jsonc","tsbuildinfo","json5","jsonl","ndjson"],"fileNames":[".jscsrc",".jshintrc","composer.lock",".jsbeautifyrc",".esformatter","cdp.pid",".lintstagedrc"]},{"name":"jinja","fileExtensions":["jinja","jinja2","j2","jinja-html"],"light":true},{"name":"proto","fileExtensions":["proto"]},{"name":"playwright","fileNames":["playwright.config.js","playwright.config.mjs","playwright.config.ts","playwright.config.base.js","playwright.config.base.mjs","playwright.config.base.ts","playwright-ct.config.js
@fwqaaq
fwqaaq / custom.ini
Last active June 9, 2024 04:14
解决 Clash DNS 泄漏
[custom]
; AI
ruleset=🤖️ 人工智能,[]DOMAIN-SUFFIX,openai.com
ruleset=🤖️ 人工智能,[]DOMAIN,cdn.oaistatic.com
ruleset=🤖️ 人工智能,[]DOMAIN-SUFFIX,claude.ai
ruleset=🤖️ 人工智能,[]DOMAIN-SUFFIX,chatgpt.com
;解决 DNS 泄露,无分流群组
ruleset=✅ 自定义,[]DOMAIN-SUFFIX,xn--ngstr-lra8j.com
ruleset=✅ 自定义,[]DOMAIN-SUFFIX,services.googleapis.cn
ruleset=✅ 自定义,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/GoogleCNProxyIP.list
@fwqaaq
fwqaaq / qemu.md
Last active December 1, 2023 10:09
Qemu 基本操作

下载 qemu

# Ubuntu
apt install qemu-kvm qemu-utils
# Fedora
dnf install qemu-system-x86-core qemu-ui-gtk qemu-audio-pa qemu-device-usb-host qemu-img

qemu-img