Skip to content
0

Rust

Rust 为主语言的开源软件

mise ---> 管理工具版本

可以理解为类似 fnm、volta 这样的工具,方便在同一设备上,管理不同版本的工具。它有个一次性执行的功能很酷。

$ mise exec node@22 -- node -v
# mise node@22.14.0 ✓ installed
# v22.14.0
$ node -v
# bash: node: command not found

当然也具备全局安装的功能

harper ---> 语法检查器

可以通过 vscode 插件的形式安装,会检查 markdown 文件中的语法错误,并给出建议

ripgrep ---> 正则搜索内容

由 rust 编写的高性能搜索工具, 尊重 .gitignore 文件,可以在结果中,通过 CMD + 鼠标左键可以跳转到对应的文件或者所在行

$ brew install ripgrep
$ rg hello\w

输出结果:

communication/grpc.md
61:const PROTO_PATH = './protos/helloworld.proto';
75:  ```proto [helloworld.proto]
79:  option java_package = "io.grpc.examples.helloworld";
83:  package helloworld;
105:  const PROTO_PATH = __dirname + './helloworld.proto';
116:  const hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
140:  const PROTO_PATH = __dirname + './helloworld.proto';
151:  const hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
206:$ mkdir dist && protoc --cpp_out=./dist src/rpc/helloworld.proto # 生成 c++ 版本的
207:$ protoc --java_out=./dist src/rpc/helloworld.proto # 生成 Java 版本的
214:$ protoc --ts_out=./dist src/rpc/helloworld.proto --ts_opt=no_namespace # 设置无 namespace
217:我们将会得到 `dist/src/rpc/helloworld.ts` 文件:
219::::details dist/src/rpc/helloworld.ts
228:export namespace helloworld {
390:                path: "/helloworld.Greeter/SayHello",
419:  import { HelloReply, HelloRequest, UnimplementedGreeterService } from './dist/src/rpc/helloworld.ts'
436:  import { HelloRequest, GreeterClient } from './dist/src/rpc/helloworld.ts'

nodeRaw/child_process.md
229:  console.log('helloworld')
238:当执行 `index.js` 的时候,可以,子进程的输出会输出到父进程中(因为是用的父进程的 `stdout`),所以我们能看到控制台中打印了 `helloworld`:
242:helloworld

onefetch ---> 命令行查看项目 Git 信息

$ brew install onefetch

在项目根目录下直接执行 onefetch 命令,会输出对应项目的信息,例如当前网站项目的输出结果:

TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   lsh ~ git version 2.39.3 (Apple Git-145)
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   ----------------------------------------
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   Project: fe-book (3 branches)
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   HEAD: 732d489 (main, origin/main)
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   Pending: 1+- 3+
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   Created: a year ago
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   Languages:                            
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS TypeScript (94.9 %) Dockerfile (4.3 %)
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS JavaScript (0.8 %) 
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTTSTSTSTST   Authors: 51% lsh 202
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS            49% peterroe 193
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   Last change: 5 days ago
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   URL: git@github.com:peterroe/fe-book.git
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTTST   Commits: 395
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   Churn (6): .vitepress/config.ts 2
TSTSTSTSTSTSTSTSTSTSTSTSSTSTSTSTSTSTST              …/components/PersonProfile.vue 1
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS              packages/nodejs.md 1
TSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTS   Lines of code: 255
                                         Size: 6.16 MiB (238 files)
                                         License: MIT

just ---> 命令运行工具

在前端领域,我们有 package.jsonscripts 来保存和快速运行一些命令。just 的功能类似

它是 makefile 的替代品,但是 just 脚本更加灵活。可以将脚本关联起来,不限于当前项目的技术选型,正如它的简介:just a command runner

但是它有自己的一套语法,有一定学习成本

scrape:
 cd _scraper && cargo build
 _scraper/target/debug/scraper _data/crates.yaml

clean:
  rm _data/crates_generated.yaml
  rm -rf _tmp
$ just scrape
$ just clean

monolith ---> 保存网页为 HTML

非常好用的一个命令行工具,可以将一个网页打包成一个单独的 html 文件,将里面的静态资源(css/js/图片)都使用 base64 代替。不支持JS 动态加载的内容,官方文档中有解决方案:配合 chromium 使用

$ monolith https://dev.peterroe.me -o index.html
$ chromium --headless --window-size=1920,1080 --run-all-compositor-stages-before-draw --virtual-time-budget=9000 --incognito --dump-dom https://github.com | monolith - -I -b https://github.com -o github.html

dioxus ---> 全栈应用框架

与其他框架(Tauri、Leptos、Yew)的不同点:

  • 类似 React:我们依靠组件、props 和 hooks 等概念来构建 UI,我们的状态管理更接近 Svelte,而不是 SolidJS。
  • HTML 和 CSS:我们完全依赖于 HTML 和 CSS 等等。
  • 与渲染器无关:借助快速的 VirtualDOM,您可以将渲染器替换为您想要的任何平台

FireDBG.for.Rust ---> Rust 的可视化调试器

可视化 rust 程序的执行过程,建议观看官网视频:https://firedbg.sea-ql.org

dufs ---> 静态文件托管

界面还算比较美观,提供了查看,下载编辑等功能,还有权限控制

$ brew install dufs # MacOS 下的安装和启动
$ dufs -p 5000

Docker 中可以使用如下命令,admin 和 admin 为账号和密码,自行修改,并运行所有游客访问

$ docker run -v `pwd`:/data -p 8265:5000 --detach sigoden/dufs /data -A  -a admin:admin@/:rw -a @/

此外,Vercel 家也有提供一个文件简单轻便的自托管服务:vercel/serve

delta ---> 高亮语法分页器

适用于 git、diff、grep 或者 blame 命令

$ brew install delta # 安装

例如搭配 diff 使用,使用管道的方式,在当前项目执行:

$ git --no-pager diff | delta --paging never

得到了我在编写此段落的时候的高亮 diff 输出:

───────────────────
 6: outline: deep 
───────────────────
  6   6 
  7   7 Rust 为主语言的开源软件 <GitHubStar repo="dandavison/delta" no-git /> <OSSupport macos linux windows />
  8   8 
  9 ### delta ---> 高亮语法分页器
 10 
 11 适用于 git、diff、grep 或者 blame 命令
 12 
 13 ```bash
 14 $ brew install delta # 安装
 15 ```
 16 
 17 例如搭配 diff 使用
 18 
  9  19 ### fd ---> 现代的文件查找器 <GitHubStar repo="sharkdp/fd" no-git /> <OSSupport macos linux windows />
 10  20 
 11  21 简单、快速且用户友好的 `find` 替代方案。
%

fd ---> 现代的文件查找器

简单、快速且用户友好的 find 替代方案。

$ apt install fd-find # Debian/Ubuntu 安装
$ brew install fd # MacOS 安装
$ npm install -g fd-find # NodeJs 安装

warp ---> 内置 AI 的终端

Warp 是一个基于 Rust 的现代化终端,内置 AI,因此您和您的团队可以更快地构建出色的软件。

Released under the MIT License.