Skip to content

Commit

Permalink
24/12/31
Browse files Browse the repository at this point in the history
  • Loading branch information
WindRunnerMax committed Dec 31, 2024
1 parent a6fecc0 commit 819f072
Show file tree
Hide file tree
Showing 34 changed files with 233 additions and 138 deletions.
112 changes: 112 additions & 0 deletions .scripts/mv-files.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import fs from "node:fs/promises";
import path from "node:path";
import { glob } from "glob";

const MAP: Record<string, string> = {
__ORIGIN__: "__TARGET__",
cat命令: "cat-输出文件内容",
chmod命令: "chmod-更改文件权限",
chown命令: "chown-更改文件所有者",
cmp命令: "cmp-文件差异状态",
diff命令: "diff-对比文件差异",
diffstat命令: "diffstat-文件差异计量",
file命令: "file-探测文件类型",
find命令: "find-查找文件",
cut命令: "cut-截取文件内容",
ln命令: "ln-创建文件链接",
less命令: "less-分页输出文件内容",
locate命令: "locate-快速查找文件",
lsattr命令: "lsattr-显示文件属性",
chattr命令: "chattr-更改文件属性",
mc命令: "mc-文件管理器",
mktemp命令: "mktemp-创建临时文件",
more命令: "more-分页输出文件内容",
mv命令: "mv-移动文件",
od命令: "od-读取文件内容",
paste命令: "paste-合并文件内容",
patch命令: "patch-修补生成文件",
rcp命令: "rcp-远程文件拷贝",
rm命令: "rm-删除文件",
split命令: "split-分割文件",
tee命令: "tee-文件内容分流",
tmpwatch命令: "tmpwatch-删除未访问文件",
touch命令: "touch-创建空文件",
umask命令: "umask-设置文件权限掩码",
which命令: "which-输出命令路径",
cp命令: "cp-复制文件",
whereis命令: "whereis-查找二进制文件",
scp命令: "scp-安全拷贝文件",
awk命令: "awk-文本处理工具",
read命令: "read-读取用户输入",
updatedb命令: "updatedb-更新文件数据库",
col命令: "col-过滤控制字符",
colrm命令: "colrm-删除文件内容列",
comm命令: "comm-对比文件内容",
csplit命令: "csplit-分割文件",
ed命令: "ed-文本编辑器",
egrep命令: "egrep-正则模式搜索",
ex命令: "ex-文本编辑器",
fgrep命令: "fgrep-固定字符串搜索",
fmt命令: "fmt-格式化输出内容",
fold命令: "fold-折叠文件内容",
grep命令: "grep-模式搜索匹配",
aspell命令: "aspell-拼写检查",
join命令: "join-合并文件内容",
look命令: "look-查找字典单词",
pico命令: "pico-文本编辑程序",
sed命令: "sed-脚本处理文件",
sort命令: "sort-排序文件内容",
tr命令: "tr-转换文件内容",
expr命令: "expr-表达式计算",
ps命令: "ps-进程状态管理",
netstat命令: "netstat-网络状态管理",
ifconfig命令: "ifconfig-网络接口管理",
traceroute命令: "traceroute-网络路由跟踪",
route命令: "route-网络路由管理",
kill命令: "kill-终止进程",
systemctl命令: "systemctl-系统服务管理",
journalctl命令: "journalctl-系统日志管理",
ip命令: "ip-网络接口管理",
curl命令: "curl-网络数据传输",
top命令: "top-系统资源监控",
};

const withSuffix = (fileName?: string) => {
if (!fileName) return null;
return fileName.endsWith(".md") ? fileName : `${fileName}.md`;
};

const removeSuffix = (fileName?: string) => {
if (!fileName) return null;
return fileName.endsWith(".md") ? fileName.slice(0, -3) : fileName;
};

(async () => {
const root = path.resolve(__dirname, `..`);
// 处理 docs 文件
const docsPath = path.resolve("./docs.ts");
let docsFile = await fs.readFile(docsPath, "utf-8");
for (const [key, value] of Object.entries(MAP)) {
docsFile = docsFile.replaceAll(key, value);
}
await fs.writeFile(docsPath, docsFile);
// 处理 Timeline 文件
const timelinePath = path.join(root, "Timeline.md");
let timelineFile = await fs.readFile(timelinePath, "utf-8");
for (const [key, value] of Object.entries(MAP)) {
timelineFile = timelineFile.replaceAll(key, value);
}
await fs.writeFile(timelinePath, timelineFile);
// 处理文件名
const files = await glob(path.join(root, "**", "*.md"));
for (const file of files) {
const group = file.split("/");
const fileName = removeSuffix(group.pop());
const origin = withSuffix(fileName);
const target = withSuffix(MAP[fileName]);
if (origin && target) {
fs.rename([...group, origin].join("/"), [...group, target].join("/"));
return;
}
}
})();
19 changes: 7 additions & 12 deletions Backup/BGF处理Git历史Blob文件.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,13 @@ git push

## Blog

```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>

## 参考

```
https://api.github.com/repos/user/repo
https://bbs.huaweicloud.com/blogs/343828
https://github.com/newren/git-filter-repo
https://rtyley.github.io/bfg-repo-cleaner/
https://www.cnblogs.com/sowler/p/17550629.html
https://api.github.com/search/commits?q=author:user
```
- <https://api.github.com/repos/user/repo>
- <https://bbs.huaweicloud.com/blogs/343828>
- <https://github.com/newren/git-filter-repo>
- <https://rtyley.github.io/bfg-repo-cleaner/>
- <https://www.cnblogs.com/sowler/p/17550629.html>
- <https://api.github.com/search/commits?q=author:user>
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,10 @@ private onPaste = (e: ClipboardEvent) => {

## 每日一题

```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>

## 参考

```
https://github.com/WindRunnerMax/CanvasEditor
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
```
- <https://github.com/WindRunnerMax/CanvasEditor>
- <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas>
- <https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D>
12 changes: 4 additions & 8 deletions Backup/Canvas简历编辑器-Monorepo+Rspack工程实践.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,10 @@ jobs:

## 每日一题

```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>

## 参考

```
https://github.com/WindRunnerMax/CanvasEditor
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
```
- <https://github.com/WindRunnerMax/CanvasEditor>
- <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas>
- <https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D>
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,10 @@ class ElementNode extends Node {

## 每日一题

```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>

## 参考

```
https://github.com/WindRunnerMax/CanvasEditor
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
```
- <https://github.com/WindRunnerMax/CanvasEditor>
- <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas>
- <https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D>
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,11 @@ export class Root extends Node {
## 每日一题
```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>
## 参考
```
https://github.com/WindRunnerMax/CanvasEditor
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
```
- <https://github.com/WindRunnerMax/CanvasEditor>
- <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas>
- <https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D>
Original file line number Diff line number Diff line change
Expand Up @@ -442,14 +442,10 @@ export class SelectNode extends Node {

## 每日一题

```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>

## 参考

```
https://github.com/WindRunnerMax/CanvasEditor
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
```
- <https://github.com/WindRunnerMax/CanvasEditor>
- <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas>
- <https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D>
5 changes: 5 additions & 0 deletions Backup/JavaScript常见面试题目总结.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,3 +543,8 @@ const add = (...args) => {

add(1, 2, 4, 5, 6).then((res) => console.log(res));
```

## Blog

- <https://github.com/WindRunnerMax/EveryDay>

12 changes: 4 additions & 8 deletions Backup/Slate文档编辑器-Decorator装饰器.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,10 @@ for (let i = 0; i < leaves.length; i++) {

## 每日一题

```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>

## 参考

```
https://docs.slatejs.org/
https://github.com/ianstormtaylor/slate
https://github.com/WindRunnerMax/DocEditor
```
- <https://docs.slatejs.org/>
- <https://github.com/ianstormtaylor/slate>
- <https://github.com/WindRunnerMax/DocEditor>
12 changes: 4 additions & 8 deletions Backup/Slate文档编辑器-Node节点与Path路径映射.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,10 @@ export const WithContext: FC<{ editor: EditorKit }> = props => {

## 每日一题

```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>

## 参考

```
https://docs.slatejs.org/
https://github.com/ianstormtaylor/slate
https://github.com/WindRunnerMax/DocEditor
```
- <https://docs.slatejs.org/>
- <https://github.com/ianstormtaylor/slate>
- <https://github.com/WindRunnerMax/DocEditor>
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,10 @@ export const isTextBlock = (editor: Editor, node: Node): node is TextBlockElemen
## 每日一题
```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>
## 参考
```
https://docs.slatejs.org/
https://github.com/ianstormtaylor/slate
https://github.com/WindRunnerMax/DocEditor
```
- <https://docs.slatejs.org/>
- <https://github.com/ianstormtaylor/slate>
- <https://github.com/WindRunnerMax/DocEditor>
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,10 @@ const editor = el[key].child.memoizedProps.node;

## 每日一题

```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>

## 参考

```
https://docs.slatejs.org/
https://github.com/ianstormtaylor/slate
https://github.com/WindRunnerMax/DocEditor
```
- <https://docs.slatejs.org/>
- <https://github.com/ianstormtaylor/slate>
- <https://github.com/WindRunnerMax/DocEditor>
2 changes: 1 addition & 1 deletion Backup/du命令.md → Backup/du-磁盘占用管理.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# du命令
# du-磁盘占用管理
`du`命令是`Disk Usage`的缩写,用于估算和显示文件系统中的文件和目录的磁盘使用情况。

## 语法
Expand Down
18 changes: 7 additions & 11 deletions Backup/初探富文本之序列化与反序列化.md
Original file line number Diff line number Diff line change
Expand Up @@ -969,17 +969,13 @@ it("deserialize", () => {
## 每日一题
```
https://github.com/WindRunnerMax/EveryDay
```
- <https://github.com/WindRunnerMax/EveryDay>
## 参考
```
https://quilljs.com/docs/modules/clipboard
https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand
https://github.com/slab/quill/blob/ebe16ca/packages/quill/src/modules/clipboard.ts
https://github.com/ianstormtaylor/slate/blob/dbd0a3e/packages/slate-dom/src/utils/dom.ts
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard
```
- <https://quilljs.com/docs/modules/clipboard>
- <https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API>
- <https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand>
- <https://github.com/slab/quill/blob/ebe16ca/packages/quill/src/modules/clipboard.ts>
- <https://github.com/ianstormtaylor/slate/blob/dbd0a3e/packages/slate-dom/src/utils/dom.ts>
- <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard>
12 changes: 4 additions & 8 deletions Backup/基于React的虚拟滚动方案.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,10 @@ cache: 10 30 60 100 150 210 ...
## 每日一题
```
https://github.com/WindrunnerMax/EveryDay
```
- <https://github.com/WindrunnerMax/EveryDay>
## 参考
```
https://juejin.cn/post/7232856799170805820
https://developer.mozilla.org/zh-CN/docs/Web/API/IntersectionObserver
https://arco.design/react/components/list#%E6%97%A0%E9%99%90%E9%95%BF%E5%88%97%E8%A1%A8
```
- <https://juejin.cn/post/7232856799170805820>
- <https://developer.mozilla.org/zh-CN/docs/Web/API/IntersectionObserver>
- <https://arco.design/react/components/list#%E6%97%A0%E9%99%90%E9%95%BF%E5%88%97%E8%A1%A8>
9 changes: 9 additions & 0 deletions Backup/浏览器扩展开发的相关问题与解决方案.md
Original file line number Diff line number Diff line change
Expand Up @@ -822,4 +822,13 @@ export class I18n {
## 最后
浏览器扩展的开发还是比较复杂的一件事,特别是在需要兼容`v2``v3`的情况下,很多设计都需要思考是否能够正常在`v3`上实现,在`v3`的浏览器扩展上失去了很多灵活性,但是相对也获取了一定的安全性。不过浏览器扩展本质上的权限还是相当高的,例如即使是`v3`我们仍然可以在`Chrome`上使用`CDP - Chrome DevTools Protocol`来实现很多事情,扩展能做的东西实在是太多了,如果不了解或者不开源的话根本不敢安装,因为扩展权限太高可能会造成很严重的例如用户信息泄漏等问题,即使是比如像`Firefox`那样必须要上传源代码的方式来加强审核,也很难杜绝所有的隐患。

## 每日一题

- <https://github.com/WindRunnerMax/EveryDay>


## 参考

- <https://github.com/scriptscat/scriptcat>
- <https://github.com/violentmonkey/violentmonkey>
- <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/extension>
Loading

0 comments on commit 819f072

Please sign in to comment.