Arch Linux 常用软件

本文部分内容基于manjaro,另外如果喜欢苹果界面,可以试下pearos。理论上基于Arch的发行版都可以使用本文进行安装。如果您安装好了manajro但是又不想重装系统,可以试下这个脚本来将Manjaro自动转换为Arch,。 Arch 安装后必装的软件 通过archinstall 安装以后,是没图形界面的。需要安装下面的一些软件和配置 安装时,声音后端的选择: PulseAudio,历史悠久、最为常用; PipeWire,新生代,采用全新架构,整合多种音频后端(PulseAudio、ALSA和JACK),提供低延迟的音频体验 启用网络 systemctl enable dhcpcd systemctl enable wpa_supplicant systemctl enable NetworkManager 蓝牙 sudo systemctl enable --now bluetooth 如果没这个服务,可能需要通过 paru -S bluetooth进行安装。 如果需要启用蓝牙音频支持,请安装 paru -S pulseaudio-bluetooth 蓝牙高级管理工具 paru -S blueman 打印机 paru -S cups ghostscript gsfont 然后启动服务 sudo systemctl enable --now cups // 可能需要启动 sudo systemctl enable --now cups-browsed 打印机驱动 paru -S foomatic-db foomatic-db-ppds # 基本驱动 paru -S foomatic-db-nonfree foomatic-db-nonfree-ppds # 非自由软件驱动 启用MTP/PTP支持 和Windows一样,Linux也支持MTP、PTP设备,这样就可以方便地与安卓手机、数码相机等外设连接,管理文件。不过对这类设备的支持并非与生俱来,而是有赖于GVFS(Gnome Virtual File System),它把对其他设备或网络环境的访问抽象成一系列I/O接口,意味着可以像平时读写磁盘那样访问它们。...

February 23, 2022 · 21 min · czyt

使用melody来创建正则表达式

melody是一款rust编写的编译输出为正则表达式的语言。Arch用户可以使用 paru -Syu melody 来安装,vscode和jetbrains系的IDE也有插件。 语法 下面是基于官方book的机翻语法。 量词 ... of - 用于表达特定数量的模式。相当于正则表达式 {5} (假设 5 of ... ) ... to ... of - 用于表示模式范围内的数量。相当于正则表达式 {5,9} (假设 5 to 9 of ... ) over ... of - 用于表达多个模式。相当于正则表达式 {6,} (假设 over 5 of ... ) some of - 用于表达 1 个或多个模式。相当于正则表达式 + any of - 用于表达 0 个或多个模式。相当于正则表达式 * option of - 用于表示模式的 0 或 1。相当于正则表达式 ? 所有量词前面都可以添加 lazy 以匹配最少数量的字符而不是最多的字符(贪婪)。相当于正则表达式 +? 、 *?...

December 15, 2023 · 2 min · czyt

使用uber cff进行并发编程

第一个项目 配置相关工具 先决条件 Go 1.18 或更新版本 带有 go.mod 文件的项目 大多数go项目应采取以下步骤建立 cff。 如果项目目录中还没有 “tools.go”,请在其中创建一个。您将在此指定开发时的依赖关系。 cat > tools.go <<EOF //go:build tools package tools // use your project's package name here EOF 确保使用与项目目录相同的软件包名称。 将 import _ "go.uber.org/cff/cmd/cff" 添加到 tools.go 中。 echo 'import _ "go.uber.org/cff/cmd/cff"' >> tools.go 运行 go mod tidy 获取最新版本的 cff,或运行 go get go.uber.org/cff@main 获取当前未发布的分支。 go mod tidy 将 cff CLI 安装到项目的 bin/ 子目录下。 GOBIN=$(pwd)/bin go install go.uber.org/cff/cmd/cff 请随意 gitignore 此目录。 echo '/bin' >> ....

December 14, 2023 · 8 min · czyt

使用gotests生成表驱动测试

使用gotests可以很方便的生成表驱动测试代码,表驱动测试的具体内容,请参考go官方的wiki。下面是具体的使用方法。 安装 使用下面命令进行安装 go install github.com/cweill/gotests/gotests@latest 如果是go1.16之前的版本,可以使用命令 go get -u github.com/cweill/gotests/...来进行安装。 使用 gotests支持的参数如下: Usage of C:\Users\czyt\go\bin\gotests.exe: -all generate tests for all functions and methods -excl string regexp. generate tests for functions and methods that don't match. Takes precedence over -only, -exported, and -all -exported generate tests for exported functions and methods. Takes precedence over -only and -all -i print test inputs in error messages -nosubtests disable generating tests using the Go 1....

July 22, 2022 · 2 min · czyt