Skip to content

Commit cd97872

Browse files
committed
something note
1 parent b2192c8 commit cd97872

File tree

2,542 files changed

+312717
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,542 files changed

+312717
-0
lines changed

_drafts/API设计原则.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# API 设计评审清单
2+
3+
* URI 命名是否通过聚合根和实体统一
4+
* URI 命名是否采用名词复数和连接线
5+
* URI 命名是否都是单词小写
6+
* URI 是否暴露了不必要的信息,例如/cgi-bin
7+
* URI 规则是否统一
8+
* 资源提供的能力是否彼此独立
9+
* URI 是否存在需要编码的字符
10+
* 请求和返回的参数是否不多不少
11+
* 资源的 ID 参数是否通过 PATH 参数传递
12+
* 认证和授权信息是否暴露到 query 参数中
13+
* 参数是否使用奇怪的缩写
14+
* 参数和响应数据中的字段命名统一
15+
* 是否存在无意义的对象包装 例如{"data":{}'}
16+
* 出错时是否破坏约定的数据结构
17+
* 是否使用合适的状态码
18+
* 是否使用合适的媒体类型
19+
* 响应数据的单复是否和数据内容一致
20+
* 响应头中是否有缓存信息
21+
* 是否进行了版本管理
22+
* 版本信息是否作为 URI 的前缀存在
23+
* 是否提供 API 服务期限
24+
* 是否提供了 API 返回所有 API 的索引
25+
* 是否进行了认证和授权
26+
* 是否采用 HTTPS
27+
* 是否检查了非法参数
28+
* 是否增加安全性的头部
29+
* 是否有限流策略
30+
* 是否支持 CORS
31+
* 响应中的时间格式是否采用ISO 8601标准
32+
* 是否存在越权访问
33+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2.4. Reference Types and Values
2+
3+
There are three kinds of reference types: class types, array types, and interface types
4+
5+
6+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
这个交换参数控制内核从物理内存移出进程,移到交换空间。该参数从0到100,当该参数=0,表示只要有可能就尽力避免交换进程移出物理内存;该参数=100,这告诉内核疯狂的将数据移出物理内存移到swap缓存中。
2+
文件地址:
3+
/proc/sys/vm/swappiness
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: 设置Linux文件默认桌面程序
3+
category: Linux
4+
tags: linux mime
5+
---
6+
7+
## mimeapps.list
8+
9+
Path | Usage
10+
------------------------|----------
11+
~/.config/mimeapps.list |user overrides
12+
/etc/xdg/mimeapps.list |system-wide overrides
13+
~/.local/share/applications/mimeapps.list |(deprecated) user overrides
14+
/usr/local/share/applications/mimeapps.list |distribution-provided defaults
15+
/usr/share/applications/mimeapps.list |distribution-provided defaults
16+
17+
## 查看现在桌面程序应用的desktop文件
18+
19+
> desktop 文件的位置:~/.local/share/applications /usr/share/applications
20+
21+
## 查看文件类型
22+
23+
```shell
24+
$ xdg-mime query filetype <文件路径>
25+
```
26+
27+
## 设置文件类型
28+
29+
```shell
30+
$ xdg-mime default <application.desktop> <filetype>
31+
```
32+
33+
34+
<!-- more -->
35+
36+
## 参考的文件
37+
38+
[XDG MIME Applications](https://wiki.archlinux.org/index.php/XDG_MIME_Applications)
39+
[Desktop entries](https://wiki.archlinux.org/index.php/Desktop_entries)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: 设置Linux文件默认桌面程序
3+
category: Linux
4+
tags: linux mime
5+
---
6+
7+
## 修改中文字符映射
8+
修改文件:/usr/share/fcitx5/punctuation/punc.mb.zh_CN

_posts/java/2020-06-15-Lambda_java.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "函数式编程和Lambda表达式"
3+
categories: java
4+
tags: java
5+
comments: true
6+
---
7+
8+
# 引用链接地址
9+
[github地址](https://github.com/CarpenterLee/JavaLambdaInternals)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: 解决Linux安装过程中不能安装Grub的问题
3+
category: linux
4+
tags: linux grub
5+
comments: true
6+
---
7+
8+
## 问题
9+
10+
在grub-install的时候,具体问题如下:
11+
12+
> zl-arch# grub-install /dev/sdb
13+
> Installing for i386-pc platform.
14+
> grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
15+
> grub-install: error: embedding is not possible, but this is required for cross-disk install.
16+
17+
18+
## 解决方法
19+
20+
21+
在分区前面加上一个2MB大小的分区,设定它的标志为“bios_grub”。
22+
如果你是Arch,那么可以在安装过程中下载:
23+
24+
```shell
25+
zl-arch# pacman -S parted
26+
```
27+
然后执行:
28+
29+
```shell
30+
# 这里的“1”就是那个2MB大小的分区位置
31+
zl-arch# parted /dev/sdb set 1 bios_grub on
32+
Information: You may need to update /etc/fstab.
33+
34+
<!-- more -->
35+
36+
zl-arch# parted /dev/sdb print
37+
Model: ATA WDC WD20EZRX-00D (scsi)
38+
Disk /dev/sdb: 2000GB
39+
Sector size (logical/physical): 512B/4096B
40+
Partition Table: gpt
41+
42+
Number Start End Size File system Name Flags
43+
1 17.4kB 3049kB 3032kB ext4 bios_grub
44+
sh-4.3# grub-install /dev/sdb
45+
Installing for i386-pc platform.
46+
Installation finished. No error reported.
47+
```
48+
这样就可以正常安装Grub了。
49+
50+
```shell
51+
# 安装grub
52+
zl-arch# grub-mkconfig -o /boot/grub/grub.cfg
53+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yay -s perl-goo-canvas
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: 获取Bash之前命令的参数
3+
category: linux
4+
tags: linux bash
5+
---
6+
7+
## Bash中有没有一种方法可以调出前一个命令的参数?
8+
例如要执行`vi file`然后执行`ls file`
9+
10+
## 1
11+
如果您知道历史记录中特定命令的编号,则可以使用以下术语在该命令中使用几乎任何参数。
12+
13+
```
14+
#使用以下命令从历史记录中的第三个命令获取第二个参数,
15+
!3:2
16+
#使用以下命令从历史记录中的倒数第五个命令中提取第三个参数,使用减号,要求它从历史记录的最后一个命令开始遍历。
17+
!-5:3
18+
#如果前面的命令有两个参数而你想要第一个,可以输入
19+
!:1
20+
#如果想要多个
21+
!:1-2
22+
```
23+
## 2
24+
您可以使用`$_``!$`调用上一个命令的最后一个参数。
25+
26+
## 3
27+
Alt + . 或 ESC - . 可用于调用任何先前命令的最后一个参数。
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
title: Arch Linux pacman 软件包管理
3+
category: linux
4+
tags: linux arch pacman
5+
---
6+
7+
## 软件包基础搜索及安装卸载
8+
```bash
9+
$ pacman -Ss 软件名称 //(搜索软件包)
10+
$ pacman -S 软件名称 //(安装软件包)
11+
$ pacman -Rs 软件名称 //(卸载软件包)
12+
$ pacman -Syu (更新)
13+
```
14+
15+
## 包的查询及清理
16+
```bash
17+
#列出所有本地软件包(-Q,query查询本地;-q省略版本号)
18+
$ pacman -Qq (列出有904个包)
19+
20+
#列出所有显式安装(-e,explicitly显式安装;-n忽略外部包AUR)
21+
$ pacman -Qqe (列出222个包)
22+
23+
#列出自动安装的包(-d,depends作为依赖项)
24+
$ pacman -Qqd (列出682个)
25+
26+
#列出孤立的包(-t不再被依赖的"作为依赖项安装的包")
27+
$ pacman -Qqdt (列出0个)
28+
#注意:通常这些是可以妥妥的删除的。
29+
$ sudo pacman -Qqdt | sudo pacman -Rs -
30+
```
31+
32+
## 软件包和文件的查询
33+
```bash
34+
#列出包所拥有的文件
35+
$ sudo pacman -Ql i3-gaps
36+
iw /usr/
37+
iw /usr/bin/
38+
iw /usr/bin/iw
39+
iw /usr/share/
40+
iw /usr/share/man/
41+
iw /usr/share/man/man8/
42+
iw /usr/share/man/man8/iw.8.gz
43+
44+
#check 检查包文件是否存在(-kk用于文件属性)
45+
$ sudo pacman -Qk iw
46+
iw: 7 total files, 0 missing files
47+
48+
#查询提供文件的包
49+
$ sudo pacman -Qo /usr/share/man/man8/iw.8.gz
50+
/usr/share/man/man8/iw.8.gz is owned by iw 5.0.1-1
51+
```
52+
53+
## 查询包详细信息
54+
```bash
55+
#查询包详细信息(-Qi;-Qii[Backup Files])(-Si[Repository,Download Size];-Sii[Signatures,])
56+
$ pacman -Qi 包名
57+
Repository 仓库名称(要联网用pacman -Si或Sii才能看到这一栏;)
58+
Name 名称
59+
Version 版本
60+
Description 描述
61+
Architecture 架构
62+
URL 网址
63+
Licenses 许可证
64+
Groups 组
65+
Provides 提供
66+
Depends On 依赖于(依赖那些包)
67+
Optional Deps 可选项
68+
Required By 被需求的(被那些包需求)
69+
Optional For 可选项
70+
Conflicts With 与...发生冲突
71+
Replaces 替代对象
72+
Download Size 下载大小(要联网用pacman -Si或Sii才能看到这一栏;)
73+
Installed Size 安装尺寸
74+
Packager 包装者
75+
Build Date 包装日期
76+
Install Date 安装日期
77+
Install Reason 安装原因(主动安装,还是被依赖自动安装)
78+
Install Script 安装脚本
79+
Validated By 验证者
80+
```
81+
82+
## 卸载不再被需要的软件包
83+
```bash
84+
#删除不再被需要的(曾经被依赖自动安装的程序包)
85+
$ sudo pacman -Qqdt | sudo pacman -Rs -
86+
$ sudo pacman -Q |wc -l
87+
905
88+
$ sudo pacman -Qe |wc -l
89+
223
90+
$ sudo pacman -Qd |wc -l
91+
682
92+
$ sudo pacman -Qdt |wc -l
93+
0
94+
```
95+
96+
## 清除多余的安装包缓存(pkg包)
97+
使用pacman安装的软件包会缓存在这个目录下 /var/cache/pacman/pkg/ ,可以清理如下2种。
98+
-k (-k[n])保留软件包的n个最近的版本,删除比较旧的软件包。
99+
-u (-u)已卸载软件的安装包(pkg包)。
100+
101+
```bash
102+
#删除,默认保留最近的3个版本,-rk3
103+
$ paccache -r
104+
==> finished: 6 packages removed (disk space saved: 194.11 MiB)
105+
#删除,默认保留最近的2个版本
106+
$ paccache -rk2
107+
#删除,默认保留最近的1个版本
108+
$ paccache -rk1
109+
```
110+
111+
112+
## 通过日志查看安装历史
113+
```bash
114+
#查看软件管理所操作日志。
115+
$ cat /var/log/pacman.log |wc -l
116+
4650
117+
$ cat /var/log/pacman.log |grep installed |wc -l
118+
1045
119+
$ cat /var/log/pacman.log |grep running |wc -l
120+
693
121+
$ cat /var/log/pacman.log |grep Running |wc -l
122+
693
123+
$ cat /var/log/pacman.log |grep removed |wc -l
124+
87
125+
$ cat /var/log/pacman.log |grep upgraded |wc -l
126+
821
127+
128+
通过系统日志查看安装记录(速度可能较慢)
129+
$ sudo journalctl |grep irssi
130+
Jul 11 21:04:46 tompc sudo[11619]: toma : TTY=pts/2 ; PWD=/home/toma ; USER=root ; COMMAND=/usr/bin/pacman -Ss irssi
131+
Jul 11 21:06:11 tompc sudo[11841]: toma : TTY=pts/2 ; PWD=/home/toma ; USER=root ; COMMAND=/usr/bin/pacman -S irssi
132+
Jul 11 21:06:11 tompc pacman[11842]: Running 'pacman -S irssi'
133+
Jul 11 21:06:27 tompc pacman[11842]: installed irssi (1.2.1-1)
134+
135+
$ sudo journalctl |grep pidgin
136+
Jul 11 21:04:55 tompc sudo[11662]: toma : TTY=pts/2 ; PWD=/home/toma ; USER=root ; COMMAND=/usr/bin/pacman -Ss pidgin
137+
Jul 11 21:06:57 tompc sudo[12000]: toma : TTY=pts/2 ; PWD=/home/toma ; USER=root ; COMMAND=/usr/bin/pacman -S pidgin
138+
Jul 11 21:06:57 tompc pacman[12001]: Running 'pacman -S pidgin'
139+
140+
系统日志筛选更新记录
141+
$ sudo journalctl |grep 'upgraded chromium'
142+
Jun 15 06:39:47 tompc pacman[5551]: upgraded chromium (75.0.3770.80-1 -> 75.0.3770.90-2)
143+
Jun 19 10:20:45 tompc pacman[1904]: upgraded chromium (75.0.3770.90-2 -> 75.0.3770.90-3)
144+
Jun 23 17:18:33 tompc pacman[7079]: upgraded chromium (75.0.3770.90-3 -> 75.0.3770.100-1)
145+
```
146+
147+
## 链接
148+
[参考链接](https://www.cnblogs.com/sztom/p/10652624.html)

0 commit comments

Comments
 (0)