对于Linux命令参数中被误解析成-xxx的参数问题,如

1
2
[root@HBSpy extreme]# rename -mib
rename: invalid option -- 'm'

可以在参数前加–

1
[root@HBSpy extreme]# rename -- -mib .mib extreme-*

参考: https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean

More precisely, a double dash (–) is used in most bash built-in commands and many other commands to signify the end of command options, after which only positional arguments are accepted.
Example use: lets say you want to grep a file for the string -v - normally -v will be considered the option to reverse the matching meaning (only show lines that do not match), but with – you can grep for string -v like this:
grep – -v file

从CentOS-7-x86_64-Minimal编译安装Vim8

依赖

1
2
3
yum install python3 python3-devel
yum install ncurses ncurses-devel
yum install perl-devel perl-ExtUtils-Embed

configure参考

1
2
3
4
5
6
7
8
9
10
11
12
13
./configure --enable-pythoninterp=yes --enable-python3interp=yes --enable-multibyte --enable-luainterp=yes --enable-perlinterp=yes --enable-rubyinterp=yes --with-python3-command=python3 --enable-cscope

--with-features=TYPE tiny, small, normal, big or huge (default: huge)
# 默认就是huge了

--enable-python3interp=OPTS Include Python3 interpreter. default=no OPTS=no/yes/dynamic
# 这些interp根据说明应该是=yes

--with-python3-config-dir=PATH Python's config directory (deprecated)
# 这个已经deprecated了,改用--with-python3-command=python3

--enable-perlinterp=OPTS
# 启用就是事多,注意要装上面的依赖

make

1
2
3
4
cd src 			# 官方推荐你去src目录make
make distclean # if you build Vim before
make # 可以加-jN并行
sudo make install

XXX

enable了不等于装上了,之后最好vim --version查看下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[root@localhost vim]# vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 22 2021 14:47:31)
Included patches: 1-2541
Compiled by root@localhost.localdomain
Huge version without GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 +perl +title
-clientserver +job +persistent_undo -toolbar
-clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall -python +visual
+conceal +linebreak +python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape -lua -ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
-dnd +mouse -sound -xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval -mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save

你看这个lua和ruby的interp其实就没装上

UI Recorder jWebDriver 不支持括号开头的XPath, 如

1
(//input)[2]

原因在于jWebDriver错误的认为括号开头的是css selector

修改lib/elements.js

1
2
// using = /^\.?\//.test(value)?'xpath':'css selector';
using = /^(\.|\()?\//.test(value)?'xpath':'css selector';

1
$input = shell_exec($cmd = '/usr/bin/python3 ' . APP_PATH . "/library/OpsKG/input_jieba.py $input");

无输出,python其实并没有收到正确的中文输入,exec的中文编码问题

需要先设置exec的环境变量

1
2
putenv('LC_ALL=en_US.UTF-8');
$input = shell_exec($cmd = '/usr/bin/python3 ' . APP_PATH . "/library/OpsKG/input_jieba.py $input");

或在命令前export LANG=en_US.UTF-8;

Win10 内置的MD5 sum

1
2
3
4
$ CertUtil -hashfile /d/BaiduYunDownload/绳缚本事高清PDF版.pdf
SHA1 的 D:/BaiduYunDownload/绳缚本事高清PDF版.pdf 哈希:
253fab6e0318a28e4e49b5e776663397e253d7a1
CertUtil: -hashfile 命令成功完成。

lrzsz在tmux下并不可用,但有方法取消rz/sz的卡死状态

rz: 5次ctrl+x
sz: 4次ctrl+x

  • ctrl+a: 光标移到行首
  • ctrl+b: 光标左移一个字母
  • ctrl+c: 杀死当前进程
  • ctrl+d: 删除光标所在字母; 注意和backspace以及ctrl+h的区别,这2个是删除光标前的字符
  • ctrl+d: 退出当前 Shell
  • ctrl+e: 光标移到行尾
  • ctrl+f: 光标右移
  • ctrl+h: 删除光标前一个字符,同 backspace 键相同
  • ctrl+k: 清除光标后至行尾的内容
  • ctrl+l: 清屏,相当于clear
  • ctrl+r: 搜索之前打过的命令。会有一个提示,根据你输入的关键字进行搜索bash的history
  • ctrl+t: 交换光标位置前的两个字符
  • ctrl+u: 清除光标前至行首间的所有内容
  • ctrl+w: 移除光标前的一个单词
  • ctrl+y: 粘贴或者恢复上次的删除
  • ctrl+z: 把当前进程转到后台运行,使用fg命令恢复。比如top -d1 然后ctrl+z,到后台,然后fg,重新恢复

源自https://mariadb.com/kb/en/library/group-by/#group-by-examples

Use the GROUP BY clause in a SELECT statement to group rows together that have the same value in one or more column, or the same computed value using expressions with any functions and operators except grouping functions. When you use a GROUP BY clause, you will get a single result row for each group of rows that have the same value for the expression given in GROUP BY.

于是

  1. group by 一个字段
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
mysql> select count(*), channel from wlan_client group by channel;
+----------+---------+
| count(*) | channel |
+----------+---------+
| 24 | 0 |
| 39767 | 1 |
| 37896 | 6 |
| 48757 | 11 |
| 17398 | 36 |
| 9076 | 40 |
| 13223 | 44 |
| 10594 | 48 |
| 13582 | 52 |
| 5804 | 56 |
| 13966 | 60 |
| 6515 | 64 |
| 19984 | 149 |
| 14560 | 153 |
| 19113 | 157 |
| 21748 | 161 |
| 31 | 165 |
+----------+---------+
17 rows in set (0.41 sec)

这是最常见的操作,没毛病,channel的每一个值都会get a single result row

  1. group by channel > 15
1
2
3
4
5
6
7
8
mysql> select count(*), channel from wlan_client group by channel > 15;
+----------+---------+
| count(*) | channel |
+----------+---------+
| 126444 | 11 |
| 165594 | 44 |
+----------+---------+
2 rows in set (0.41 sec)

说实话我并没有找到有明确的文档说明此用法,但从上面引用的文档原文来看,也能说通,所有channel > 15的被归为了一类,其它的归为更一类,所以结果有两行

可以用简单的count验证

1
2
3
4
5
6
7
mysql> select count(*), channel from wlan_client where channel > 15;
+----------+---------+
| count(*) | channel |
+----------+---------+
| 165594 | 44 |
+----------+---------+
1 row in set (0.30 sec)
  1. group by 整数

You can also use a single integer as the grouping expression. If you use an integer n, the results will be grouped by the nth column in the select expression.

这里是另一种用法,N代表select中的第N项,如上面的select count(), channel from wlan_client group by channel就可写成select count(), channel from wlan_client group by 2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
mysql> select count(*), channel from wlan_client group by 2;
+----------+---------+
| count(*) | channel |
+----------+---------+
| 24 | 0 |
| 39767 | 1 |
| 37896 | 6 |
| 48757 | 11 |
| 17398 | 36 |
| 9076 | 40 |
| 13223 | 44 |
| 10594 | 48 |
| 13582 | 52 |
| 5804 | 56 |
| 13966 | 60 |
| 6515 | 64 |
| 19984 | 149 |
| 14560 | 153 |
| 19113 | 157 |
| 21748 | 161 |
| 31 | 165 |
+----------+---------+
17 rows in set (0.40 sec)
  1. group by 1+1 或者 2 > 15

恩,此时mysql不会认为1+1=2,然后同[3], 也不会认为2是channel然后同[2],而是只返回了一条

1
2
3
4
5
6
7
mysql> select count(*), channel from wlan_client group by 2 > 15;
+----------+---------+
| count(*) | channel |
+----------+---------+
| 292038 | 44 |
+----------+---------+
1 row in set (0.30 sec)

这里的count(*)的确是该表的总行数,那么这又是什么意思呢

猜测,这里并没有可以分组的列维度,所以结果应该跟直接count(*)没有group by一样,但既然有group by,又没有找到可以用来计算分组维度的列,mysql竟然没有报错,很是神奇

明明这样是会报错的

1
2
mysql> select count(*), channel from wlan_client group by 0;
ERROR 1054 (42S22): Unknown column '0' in 'group statement'

  1. 在目前macOS Catalina(10.15)上已失效

由于目前的Catalina安全策略

在macOS Catalina中,Apple推出了一种新的文件系统分区结构。新的文件系统分区结构将一个分区作为包含操作系统本身的专用“只读”系统卷,并且与所有用户数据完全分开。除了经过Apple签名的代码(例如:系统更新)之外的任何内容都无法覆盖操作系统文件。这样的机制,基本上使系统完整性保护到达了一个新的水平。现在,整个分区都是封闭的,而不再仅仅是在未受保护的分区中仅仅保护特定位置的内容。

由于在改动后,安装路径不再像之前那么明显,因此可能会存在一些初步的混淆。例如,用户数据位于何处?在此前版本中,用户数据位于/Users/。但在Catalina新版本中,用户数据将位于/System/Volumes/Data/Users/。传统意义上的根目录/,现在将作为一个系统专用的卷。

对于企业来说,最开始要习惯修改后的路径命名约定可能会有一些困难,但从安全性原则上来看,将系统和用户数据的分区之间划分出明确的界限可能是一个良好的举措。这样一来,会使系统恢复和备份变得更加直接。Apple在先前的展示中表示,如果在安装第三方更新后出现问题,macOS Recovery将能够更轻松地从快照恢复。我们可以肯定,这一功能是依赖于新的磁盘分区方案。

/System/Library/LaunchDaemons/ssh.plist 已变的完全不可修改,或者修改方法未知,实测csrutil enable/disable都改不了

  1. 关闭保护机制(System Integrity Protection (SIP))

重启 command + r 进入 Recovery Mode

在终端中输入

1
csrutil disable
  1. 修改ssh.plist
1
vim /System/Library/LaunchDaemons/ssh.plist

1
2
<key>SockServiceName</key>
<string>ssh</string>

把ssh修改为要使用的端口号

1
2
<key>SockServiceName</key>
<string>2333</string>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
:1,10g/{pattern}/{cmd}

:g/{pattern}/d "删除匹配行
:v/{pattern}/d "保留匹配行


:g/{pattern}/m$ "移动匹配行
m0 第一行
m$ 最后一行

:sort
:g/^\(.*\)$\n\1$/d "去除重复行

:sort u "还有这种玩法,为什么不用这种玩法呢

:v/./.,/./-1join "压缩空行
:g/^$/,/./-j "压缩空行
0%