From 59cc228e77cfce51d16082b302017748ed86dbcf Mon Sep 17 00:00:00 2001 From: hj24 Date: Sun, 8 Dec 2019 22:12:41 +0800 Subject: [PATCH 001/676] updated 1/2 --- .../20191127 How to write a Python web API with Flask.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sources/tech/20191127 How to write a Python web API with Flask.md b/sources/tech/20191127 How to write a Python web API with Flask.md index ef42cf5dbb..e20b2b4f4e 100644 --- a/sources/tech/20191127 How to write a Python web API with Flask.md +++ b/sources/tech/20191127 How to write a Python web API with Flask.md @@ -7,14 +7,18 @@ [#]: via: (https://opensource.com/article/19/11/python-web-api-flask) [#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) -How to write a Python web API with Flask +如何使用Flask编写Python Web API ====== Use Flask, one of the fastest-growing Python frameworks, to fetch data from a server, in this quick tutorial. + +这是一个快速教程,用来展示如何通过Flask(目前发展最迅速的Python框架之一)来从服务器获取数据。 ![spiderweb diagram][1] [Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs. +[Python][2]是一个以语法简洁著称的高级的,面向对象的程序语言。它一直都是一个用来构建RESTful API的顶级编程语言。 + [Flask][3] is a customizable Python framework that gives developers complete control over how users access data. Flask is a "micro-framework" based on Werkzeug's [WSGI][4] toolkit and Jinja 2's templating engine. It is designed as a web framework for RESTful API development. Flask is one of the fastest-growing Python frameworks, and popular websites, including Netflix, Pinterest, and LinkedIn, have incorporated Flask into their development stacks. Here's an example of how Flask can permit users to fetch data from a server using the HTTP GET method. From ad4735f417a6bc7e31b92e44f62a08fa617fb21b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Dec 2019 06:54:44 +0800 Subject: [PATCH 002/676] PRF @lxbwolf --- ...et sorted with sort at the command line.md | 61 ++++++++----------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/translated/tech/20191024 Get sorted with sort at the command line.md b/translated/tech/20191024 Get sorted with sort at the command line.md index 85d1e816e9..570902586b 100644 --- a/translated/tech/20191024 Get sorted with sort at the command line.md +++ b/translated/tech/20191024 Get sorted with sort at the command line.md @@ -1,27 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get sorted with sort at the command line) [#]: via: (https://opensource.com/article/19/10/get-sorted-sort) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -命令行用 sort 进行排序 +在命令行用 sort 进行排序 ====== -按自己的需求重新整理数据 — 用 Linux,BSD 或 Mac 的 terminal — 使用 sort 命令。 -![Coding on a computer][1] -如果你曾经用过数据表应用程序,你就会知道可以按列的内容对行进行排序。例如,如果你有一列价格,你可能希望对它们进行按日期或升序抑或按类别进行排序。如果你熟悉 terminal 的使用,你不会仅为了排序文本数据就去使用庞大的办公软件。这正是 [**sort**][2] 命令的用处。 +> 在 Linux、BSD 或 Mac 的终端中使用 sort 命令,按自己的需求重新整理数据。 + +![](https://img.linux.net.cn/data/attachment/album/201912/09/065444f42xl2lddxillz09.jpg) + +如果你曾经用过数据表应用程序,你就会知道可以按列的内容对行进行排序。例如,如果你有一个费用列表,你可能希望对它们进行按日期或价格升序抑或按类别进行排序。如果你熟悉终端的使用,你不会仅为了排序文本数据就去使用庞大的办公软件。这正是 [sort][2] 命令的用处。 ### 安装 -你不必安装 **sort** ,因为它包含在任意 [POSIX][3] 系统里。在大多数 Linux 系统中,**sort** 命令被 GNU 组织捆绑在实用工具集合中。在其他的 POSIX 系统中,像 BSD 和 Mac,默认的 **sort** 命令不是 GNU 提供的,所以有一些选项可能不一样。本文中我尽量对 GNU 和 BSD 两者的实现都进行说明。 +你不必安装 `sort` ,因为它向来都包含在 [POSIX][3] 系统里。在大多数 Linux 系统中,`sort` 命令来自 GNU 组织打包的实用工具集合中。在其他的 POSIX 系统中,像 BSD 和 Mac,默认的 `sort` 命令不是 GNU 提供的,所以有一些选项可能不一样。本文中我尽量对 GNU 和 BSD 两者的实现都进行说明。 ### 按字母顺序排列行 -**sort** 命令默认会读取文件每行的第一个字符并对每行按字母升序排序后输出。两行中的第一个字符相同的情况下,对下一个字符进行对比。例如: - +`sort` 命令默认会读取文件每行的第一个字符并对每行按字母升序排序后输出。两行中的第一个字符相同的情况下,对下一个字符进行对比。例如: ``` $ cat distro.list @@ -46,7 +47,7 @@ Slackware Ubuntu ``` -使用 **sort** 不会改变原文件。sort 仅起到过滤的作用,所以如果你希望按排序后的格式保存数据,你需要用 **>** 或 **tee** 进行重定向。 +使用 `sort` 不会改变原文件。`sort` 仅起到过滤的作用,所以如果你希望按排序后的格式保存数据,你需要用 `>` 或 `tee` 进行重定向。 ``` @@ -64,8 +65,7 @@ Debian ### 按列排序 -复杂的数据有时候不止需要对每行的第一个字符进行排序。例如,假设有一个动物列表,用可预见的分隔符分隔每一个「字段」(数据表中的「单元格」)。这类由数据表导出的格式很常见,CSV(comma-separated values,以逗号分隔的数据)后缀可以标识这些文件(虽然 CSV 文件不一定用逗号分隔,有分隔符的文件也不一定用 CSV 后缀)。以下数据作为示例: - +复杂数据集有时候不止需要对每行的第一个字符进行排序。例如,假设有一个动物列表,每个都有其种和属,用可预见的分隔符分隔每一个“字段”(即数据表中的“单元格”)。这类由数据表导出的格式很常见,CSV(以逗号分隔的数据comma-separated values)后缀可以标识这些文件(虽然 CSV 文件不一定用逗号分隔,有分隔符的文件也不一定用 CSV 后缀)。以下数据作为示例: ``` Aptenodytes;forsteri;Miller,JF;1778;Emperor @@ -77,8 +77,7 @@ Eudyptes;chrysocome;Viellot;1816;Southern Rockhopper Torvaldis;linux;Ewing,L;1996;Tux ``` -对于这组示例数据,你可以用 **--field-separator** (在 BSD 和 Mac 用 **-t**,或 GNU 上可以用简写 **-t** )设置分隔符为分号(以为示例数据中是用分号而不是逗号,理论上分隔符可以是任意字符),用 **--key**( 在 BSD 和 Mac 上用 **-k**,或 GNU 上可以用简写 **-k**)选项指定哪个字段被排序。例如,对每行第二个字段进行排序(以 1 开头而不是 0): - +对于这组示例数据,你可以用 `--field-separator` (在 BSD 和 Mac 用 `-t`,在 GNU 上也可以用简写 `-t` )设置分隔符为分号(因为该示例数据中是用分号而不是逗号,理论上分隔符可以是任意字符),用 `--key`(在 BSD 和 Mac 上用 `-k`,在 GNU 上也可以用简写 `-k`)选项指定哪个字段被排序。例如,对每行第二个字段进行排序(计数以 1 开头而不是 0): ``` sort --field-separator=";" --key=2 @@ -91,13 +90,11 @@ Eudyptula;minor;Bonaparte;1867;Little Blue Pygoscelis;papua;Wagler;1832;Gentoo ``` -结果有点不容易读,但是 Unix 以构造命令的 **pipe** 方法而闻名,所以你可以使用 **column** 命令美化输出结果。使用 GNU **column**: - +结果有点不容易读,但是 Unix 以构造命令的管道方式而闻名,所以你可以使用 `column` 命令美化输出结果。使用 GNU `column`: ``` $ sort --field-separator=";" \ -\--key=2 penguins.list | \ -column --table --separator ";" +\--key=2 penguins.list | column --table --separator ";" Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper Spheniscus   demersus    Brisson        1760  African @@ -109,7 +106,6 @@ Pygoscelis   papua       Wagler         1832  Gentoo 对于初学者可能有点不好理解(但是写起来简单),BSD 和 Mac 上的命令选项: - ``` $ sort -t ";" \ -k2 penguins.list | column -t -s ";" @@ -122,12 +118,11 @@ Eudyptula    minor       Bonaparte      1867  Little Blue Pygoscelis   papua       Wagler         1832  Gentoo ``` -当然 **key** 不一定非要设为 **2**。任意存在的字段都可以被设为排序的 key。 +当然 `-k` 不一定非要设为 `2`。任意存在的字段都可以被设为排序的键。 ### 逆序排列 -你可以用 **--reverse**(BSD/Mac 上用 **-r**, GNU 也可以用简写 **-r**)选项来颠倒已经排好序的列表。 - +你可以用 `--reverse`(BSD/Mac 上用 `-r`,GNU 上也可以用简写 `-r`)选项来颠倒已经排好序的列表。 ``` $ sort --reverse alphabet.list @@ -140,12 +135,11 @@ w 你也可以把输出结果通过管道传给命令 [tac][4] 来实现相同的效果。 -### 按月排序 (仅 GNU 支持) +### 按月排序(仅 GNU 支持) -理想情况下,所有人都按照 ISO 8601 标准来写日期:年,月,日。这是一种合乎逻辑的指定精确日期的方法,也可以很容易地被计算机理解。也有很多情况下,人类用其他的方式标注日期,用很随意的名字表示月份。 - -幸运的是,GNU **sort** 命令能识别这种写法,并可以按月份的名称正确排序。使用 **--month-sort (-M)** 选项: +理想情况下,所有人都按照 ISO 8601 标准来写日期:年、月、日。这是一种合乎逻辑的指定精确日期的方法,也可以很容易地被计算机理解。也有很多情况下,人类用其他的方式标注日期,包括用很名字随意的月份。 +幸运的是,GNU `sort` 命令能识别这种写法,并可以按月份的名称正确排序。使用 `--month-sort`(`-M`)选项: ``` $ cat month.list @@ -169,8 +163,7 @@ December ### 人类可读的数字排序(仅 GNU 支持) -另一个广泛的人类和计算机的混淆点是数字的组合。例如,人类通常把 ”1024 kilobytes“ 写成 “1KB”,因为人类解析 ”1 KB“ 比 ”1024“ 要容易且更快(数字越大,这种差异越明显)。对于计算机来说,一个 9 KB 的字符串要比诸如 1 MB 的字符串大(尽管 9 KB 是 1 兆的很小一部分)。GNU **sort** 命令提供了**--human-numeric-sort (-h)** 选项来帮助正确解析这些值。 - +另一个人类和计算机的常见混淆点是数字的组合。例如,人类通常把 “1024 kilobytes” 写成 “1KB”,因为人类解析 “1 KB” 比 “1024” 要容易且更快(数字越大,这种差异越明显)。对于计算机来说,一个 9 KB 的字符串要比诸如 1 MB 的字符串大(尽管 9 KB 是 1 MB 很小一部分)。GNU `sort` 命令提供了`--human-numeric-sort`(`-h`)选项来帮助正确解析这些值。 ``` $ cat sizes.list @@ -189,8 +182,7 @@ $ sort --human-numeric-sort 12MB ``` -有一些情况例外。例如,16000 bytes 比 1 KB 大,但是 **sort** 识别不了。 - +有一些情况例外。例如,“16000 bytes” 比 “1 KB” 大,但是 `sort` 识别不了。 ``` $ cat sizes0.list @@ -205,14 +197,13 @@ $ sort -h sizes0.list 12MB ``` -逻辑上来说,这个示例中16000 应该写成 16 KB,所以也不应该全部归咎于GNU **sort** 。只要你确保数字的一致性,**--human-numeric-sort** 可以用一种计算机友好的方式解析成人类可读的数字。 +逻辑上来说,这个示例中 16000 应该写成 16 KB,所以也不应该全部归咎于GNU `sort`。只要你确保数字的一致性,`--human-numeric-sort` 可以用一种计算机友好的方式解析成人类可读的数字。 ### 随机排序(仅 GNU 支持) -有时候工具也提供了一些与设计初衷相悖的选项。某种程度上说,**sort** 命令提供了对一个文件进行随机排序的能力没有任何意义。这个命令的工作流让这个特性变得很方便。你可以用其他的命令,像 [**shuf**][5] ,或者你可以用现在的命令添加一个选项。不管你认为它是一个臃肿的还是极具创造力的 UX 设计,GNU **sort** 命令提供了对文件进行随机排序的功能。 - -最纯粹的随机排序格式选项是 **--random-sort** 或 **-R**(不要跟 **-r** 混淆,**-r** 是 **--reverse** 的简写)。 +有时候工具也提供了一些与设计初衷相悖的选项。某种程度上说,`sort` 命令提供对一个文件进行随机排序的能力没有任何意义。这个命令的工作流让这个特性变得很方便。你*可以*用其他的命令,像 [shuf][5] ,或者你可以用现在的命令添加一个选项。不管你认为它是一个臃肿的还是极具创造力的用户体验设计,GNU `sort` 命令提供了对文件进行随机排序的功能。 +最纯粹的随机排序格式选项是 `--random-sort` 或 `-R`(不要跟 `-r` 混淆,`-r` 是 `--reverse` 的简写)。 ``` $ sort --random-sort alphabet.list @@ -227,7 +218,7 @@ a ### 结语 -GNU 和 BSD 命令 **sort** 还有很多功能,所以花点时间去了解这些选项。你会惊异于 **sort** 的灵活性,尤其是当它和其他的 Unix 工具一起使用时。 +GNU 和 BSD 的 `sort` 命令还有很多功能,所以花点时间去了解这些选项。你会惊异于 `sort` 的灵活性,尤其是当它和其他的 Unix 工具一起使用时。 -------------------------------------------------------------------------------- @@ -236,7 +227,7 @@ via: https://opensource.com/article/19/10/get-sorted-sort 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7e8d0c408f960e3fdda15a794b9fb2571738290e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Dec 2019 06:55:09 +0800 Subject: [PATCH 003/676] PUB @lxbwolf https://linux.cn/article-11657-1.html --- .../20191024 Get sorted with sort at the command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191024 Get sorted with sort at the command line.md (99%) diff --git a/translated/tech/20191024 Get sorted with sort at the command line.md b/published/20191024 Get sorted with sort at the command line.md similarity index 99% rename from translated/tech/20191024 Get sorted with sort at the command line.md rename to published/20191024 Get sorted with sort at the command line.md index 570902586b..55916bdcad 100644 --- a/translated/tech/20191024 Get sorted with sort at the command line.md +++ b/published/20191024 Get sorted with sort at the command line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11657-1.html) [#]: subject: (Get sorted with sort at the command line) [#]: via: (https://opensource.com/article/19/10/get-sorted-sort) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 6253c432103fded67f0be5d4c73dc1e82223d455 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Dec 2019 07:04:28 +0800 Subject: [PATCH 004/676] PRF @LuuMing --- .../tech/20191125 The many faces of awk.md | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/translated/tech/20191125 The many faces of awk.md b/translated/tech/20191125 The many faces of awk.md index 7eff1e9883..23679566f7 100644 --- a/translated/tech/20191125 The many faces of awk.md +++ b/translated/tech/20191125 The many faces of awk.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (luuming) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The many faces of awk) @@ -9,7 +9,8 @@ 千面 awk ====== -`awk` 命令不仅提供了简单的输入字符串筛选功能,还包含提取数据列,打印简单文本,筛选内容——甚至做一些数学计算。 + +> `awk` 命令不仅提供了简单的输入字符串筛选功能,还包含提取数据列、打印简单文本、筛选内容——甚至做一些数学计算。 ![Thinkstock][6] @@ -18,6 +19,7 @@ ### 提取数据列 `awk` 所提供的最简单与最常用的功能便是从文件或管道传输的数据中选取特定的内容。默认使用空格当做分隔符,这非常简单。 + ``` $ echo one two three four five | awk ‘{print $4}’ four @@ -26,26 +28,30 @@ jdoe fhenry ``` -空格指的是一系列的 `space` 或 `tab`。在下面所展示的命令里,`awk` 从提供的数据中筛选第一和第四项。 +空格指的是一系列的 `space` 或 `tab` 字符。在下面所展示的命令里,`awk` 从提供的数据中筛选第一和第四项。 -`awk` 命令也可以通过在其后增加文件名的方式从文本文件中获取数据。 +`awk` 命令也可以通过在其后增加文件名参数的方式从文本文件中获取数据。 ``` $ awk '{print $1,$5,$NF}' HelenKellerQuote The beautiful heart. -(LCTT 译注:“The best and most beautiful things in the world can not be seen or even touched , they must be felt with heart.” ——海伦凯勒) ``` + +(LCTT 译注:“The best and most beautiful things in the world can not be seen or even touched , they must be felt with heart.” ——海伦凯勒) + 在这个例子中,`awk` 挑选了一行中的第一个、第五个和最后一个字段。 -命令中的`$NF` 指定选取每行的最后一个字段。这是因为`NF`代表一行中的字段数量Number of Field,也就是 23,而 `$NF` 就代表着那个字段的值,也就是`heart`。最后的句号也包含进去了,因为它是最后一个字符串的一部分。 +命令中的 `$NF` 指定选取每行的最后一个字段。这是因为 `NF` 代表一行中的字段数量Number of Field,也就是 23,而 `$NF` 就代表着那个字段的值,也就是`heart`。最后的句号也包含进去了,因为它是最后一个字符串的一部分。 字段能以任何有用的形式打印。在这个例子中,我们将字段以日期的格式进行打印输出。 + ``` $ date | awk '{print $4,$3,$2}' 2019 Nov 22 ``` 如果你省略了 `awk` 命令中字段指示符之间的逗号,输出将会挤成一个字符串。 + ``` $ date | awk '{print $4 $3 $2}' 2019Nov21 @@ -58,7 +64,7 @@ $ date | awk '{print $4-$3-$2}' 1997 ``` -在这个例子中,它将年“2019”和日期“22”相减,并忽略了中间的“Nov”。 +在这个例子中,它将年 “2019” 和日期 “22” 相减,并忽略了中间的 “Nov”。 如果你想要空格之外的字符作为输出分隔符,你可以通过 `OFS`(输出分隔符output field separator)指定分隔符,就像这样: @@ -153,7 +159,7 @@ dory:x:1002:1002:Dory,,,:/home/dory:/bin/bash `awk` 提供了惊人的数学计算能力,并且可以开平方,算 `log`,算 `tan` 等等。 -这里有一对例子: +这里有一对例子: ``` $ awk 'BEGIN {print sqrt(2019)}' @@ -205,7 +211,7 @@ via: https://www.networkworld.com/article/3454979/the-many-faces-of-awk.html 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[LuuMing](https://github.com/LuuMing) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -216,4 +222,4 @@ via: https://www.networkworld.com/article/3454979/the-many-faces-of-awk.html [3]: https://www.networkworld.com/article/2974753/doing-math-with-awk.html [4]: https://www.facebook.com/NetworkWorld/ [5]: https://www.linkedin.com/company/network-world -[6]:https://images.techhive.com/images/article/2015/09/thinkstockphotos-512100549-100611755-large.jpg \ No newline at end of file +[6]:https://images.techhive.com/images/article/2015/09/thinkstockphotos-512100549-100611755-large.jpg From 241f20b64e78a885c892ba29b28e2855f6428efe Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Dec 2019 07:05:51 +0800 Subject: [PATCH 005/676] PUB @LuuMing https://linux.cn/article-11658-1.html --- .../tech => published}/20191125 The many faces of awk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191125 The many faces of awk.md (99%) diff --git a/translated/tech/20191125 The many faces of awk.md b/published/20191125 The many faces of awk.md similarity index 99% rename from translated/tech/20191125 The many faces of awk.md rename to published/20191125 The many faces of awk.md index 23679566f7..53ac02c910 100644 --- a/translated/tech/20191125 The many faces of awk.md +++ b/published/20191125 The many faces of awk.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (luuming) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11658-1.html) [#]: subject: (The many faces of awk) [#]: via: (https://www.networkworld.com/article/3454979/the-many-faces-of-awk.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From fdee5d841f5bb0a7d3e958eacf0eef5d7e6511c7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 9 Dec 2019 09:01:55 +0800 Subject: [PATCH 006/676] translated --- ...antheon desktop for Linux Elementary OS.md | 72 ------------------- ...antheon desktop for Linux Elementary OS.md | 70 ++++++++++++++++++ 2 files changed, 70 insertions(+), 72 deletions(-) delete mode 100644 sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md create mode 100644 translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md diff --git a/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md deleted file mode 100644 index e1b1fc16c8..0000000000 --- a/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md +++ /dev/null @@ -1,72 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why use the Pantheon desktop for Linux Elementary OS) -[#]: via: (https://opensource.com/article/19/12/pantheon-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Why use the Pantheon desktop for Linux Elementary OS -====== -This article is part of a special series on Linux desktops. Get a -much-loved Mac OS feature on Linux with the Pantheon desktop for -Elementary OS. -![A person programming][1] - -Would you pay $20 for a Linux desktop? I would, and in fact, I regularly choose to pay more than that when I download free software! The reason I do this is that open source is worth it. For a copy of [Elementary OS][2], US$ 20 happens to be the default asking price (you can download it for $1 or even $0 if you can't afford anything more). What you get in return is an excellent and heavily curated distribution that ships with its own Pantheon desktop design. - -You may find Pantheon included in a software repository, as it is open source, but more likely, you'll have to download and install [Elementary][3] Linux to experience it. If you're not ready to install Elementary on your computer as the main OS, you can install it into a virtual machine, like [GNOME Boxes][4]. - -The Pantheon desktop is clean, attractive, and features many of the little things many users want in a desktop but could never quite get from the usual Linux desktops. - -### Pantheon desktop tour - -At first glance, the Pantheon desktop looks a little like Cinnamon or Budgie or the Classic mode of GNOME 3. However, the most exciting features of Pantheon are the smallest touches. It excels in all the places you notice the very least, until that place is the only thing you're looking at one day, and you realize that the way it works has literally improved your quality of life, to say nothing of making your day a lot nicer. - -The clearest example of this is **file name highlighting**. For decades, Mac OS has had a much-loved feature whereby you can highlight the displayed name of an important file. People use this feature as a quick visual indicator to tell themselves which file is the "best" version of several, or which file should be sent to a friend, or which file still needs work. They're arbitrary colors and can mean whatever the user wants them to mean. Most importantly, it's noticeable visual metadata. - -Users switching from Mac OS tend to miss this feature in GNOME and KDE and every other desktop option Linux has on offer. Pantheon quietly and casually solves that problem. - -![A highlighted file in the Pantheon desktop][5] - -Of course, that's just one example of many. Pantheon is filled with small features that you don't think about until you need them. - -The desktop is refined and attractive, with all the intuitive parts that have disappeared from many other desktops. In many ways, it has taken the best of the good ideas of many different interfaces and refrained from implementing the excesses. - -![Pantheon desktop on Elementary OS][6] - -### Customizing the Pantheon desktop - -The Pantheon desktop represents a pretty clear vision of how a computer ought to be operated. The "problem" with this kind of design (outside of open source, at least) is that one person's preference may not be another person's efficiency. - -But this is open source. Things can be changed, and whatever can't be changed can be discarded for a different option. Pantheon is definitely a desktop for a specific set of users, but even those of us with our own expectations of how a desktop ought to work might find Pantheon refreshingly more flexible than it first appears. There are overrides for many built-in designs, and when you can't adjust something to your liking, you can easily choose an alternative application. The theme engine ensures that your replacement application looks integrated with the rest of your desktop, and the usual Linux system buses ensure that all of your chosen applications communicate with one another as expected. - -![Which one is the guest?][7] - -As compromises go, this one does a lot to meet you halfway. - -### A welcome addition - -Etymology aside, this desktop truly is an answer to the prayers of many Linux users. Whether it's your style or not, the Pantheon desktop is an important and welcome addition to the Linux user experience. Try it for yourself and see if it's the good news you've been waiting for. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/pantheon-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) -[2]: https://elementary.io/ -[3]: http://elementary.io -[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization -[5]: https://opensource.com/sites/default/files/uploads/advent-pantheon-highlight.jpg (A highlighted file in the Pantheon desktop) -[6]: https://opensource.com/sites/default/files/uploads/advent-pantheon.jpg (Pantheon desktop on Elementary OS) -[7]: https://opensource.com/sites/default/files/uploads/advent-pantheon-pcmanfm.jpg (Which one is the guest?) diff --git a/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md new file mode 100644 index 0000000000..8ec91c5c62 --- /dev/null +++ b/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why use the Pantheon desktop for Linux Elementary OS) +[#]: via: (https://opensource.com/article/19/12/pantheon-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +为何在 Elementary OS 中使用 Pantheon 桌面 +====== +本文是 Linux 桌面特别系列的一部分。通过 Pantheon 在 Elementary OS 上获得受喜爱的 Mac OS 特性。 +![A person programming][1] + +你愿意为 Linux 桌面支付 20 美元吗?事实上,我会在下载免费软件时选择支付更多!我这样做的原因是开源是值得的。对于 [Elementary OS][2]的拷贝,默认价格是 20 美元(你可以用 1 美元,如果你无法负担,你甚至可以用 0 美元下载)。作为回报,你将获得一个出色且精心制作的发行版,同时拥有 Pantheon 桌面设计。 + +你可能会发现 Pantheon 已包含在软件仓库中,因为它是开源的,但你更可能需要下载并安装 [Elementary][3] Linux 才能体验它。如果你还不准备在计算机上将 Elementary 作为主操作系统安装,那么可以将其安装到虚拟机中,例如 [GNOME Boxes][4] 中。 + +Pantheon 桌面整洁、吸引人,并有许多用户希望在桌面中获得的东西,但在普通的 Linux 桌面上却无法获得。 + +### Pantheon 桌面之旅 + +乍一看,Pantheon 桌面看起来有点像 Cinnamon 或 Budgie 或 GNOME 3 的经典模式。但是,Pantheon 最令人兴奋的功能是最小的触摸。它在你最少注意到的地方都表现出色,直到有一天这里成为了你一天都会看的地方,并且意识到它的工作方式确实改善了你的生活质量,更不用说让你过得愉快了好多了。 + +最明显的例子是“文件名高亮”。几十年来,Mac OS 一直有一个广受欢迎的功能,你从而可以高亮显示重要文件的名称。人们使用此功能作为快速的视觉指示器,来告诉自己哪个文件是这几个的“最佳”版本,或者哪个文件应该发送给朋友,或者哪个文件仍然需要处理。它们可以是任意颜色,可以表示用户想要的任何含义。最重要的是,它是引人注目的视觉元数据。 + +从 Mac OS 切换过来用户往往会错过 GNOME 和 KDE 以及其他 Linux 桌面提供的这个功能。Pantheon 悄悄和随意地就解决了这个问题。 + +![A highlighted file in the Pantheon desktop][5] + +当然,那只是其中一个例子。Pantheon 有很多你直到用才会想到的小功能。 + +桌面精致而吸引人,有所有其他很多桌面缺少的直观组件。在许多方面,它充分吸取了其他桌面好的想法,并避免实现多余的东西。 + +![Pantheon desktop on Elementary OS][6] + +### 自定义 Pantheon 桌面 + +Pantheon 桌面表达了如何操作计算机的清晰愿景。这种设计的“问题”(至少在开源之外)是,一个人的偏好可能无法满足另一个人的效率。 + +但它是开源的。它可以更改,任何不能改变的东西都可以被丢弃。Pantheon 绝对是针对特定用户的桌面,但是即使对于那些对桌面应该如何工作抱有自己期望的人,Pantheon 也会比初次出现时更加灵活。许多内置设计都具有替代选项,当你无法根据自己的喜好进行调整时,你可以轻松选择其他应用。主题引擎可确保你的替换应用看起来与桌面的其他部分集成在一起,而平常的 Linux 系统总线可确保你选择的所有应用都能按预期相互通信。 + +![Which one is the guest?][7] + +随着折衷的进行,这一过程在中途会做很多事情。 + +### 受欢迎的补充 + +除开词源,此桌面确实是许多 Linux 用户祈祷的答案。无论它是否是你的风格,Pantheon 桌面都是 Linux 用户体验中重要且受欢迎的补充。自己尝试一下,看看它是否是你一直期待的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/pantheon-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://elementary.io/ +[3]: http://elementary.io +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://opensource.com/sites/default/files/uploads/advent-pantheon-highlight.jpg (A highlighted file in the Pantheon desktop) +[6]: https://opensource.com/sites/default/files/uploads/advent-pantheon.jpg (Pantheon desktop on Elementary OS) +[7]: https://opensource.com/sites/default/files/uploads/advent-pantheon-pcmanfm.jpg (Which one is the guest?) From 52782e2c0b495a499827ce9a7835a622159a6699 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 9 Dec 2019 09:05:22 +0800 Subject: [PATCH 007/676] translating --- sources/tech/20191206 Pekwm- A lightweight Linux desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191206 Pekwm- A lightweight Linux desktop.md b/sources/tech/20191206 Pekwm- A lightweight Linux desktop.md index 86bffe3042..ce4e527911 100644 --- a/sources/tech/20191206 Pekwm- A lightweight Linux desktop.md +++ b/sources/tech/20191206 Pekwm- A lightweight Linux desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9d3bf5a5105a26ede7f45f45586ac5325a5d5394 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Mon, 9 Dec 2019 09:32:32 +0800 Subject: [PATCH 008/676] translated over translated over --- ...ternet security works- TLS, SSL, and CA.md | 126 ----------------- ...ternet security works- TLS, SSL, and CA.md | 128 ++++++++++++++++++ 2 files changed, 128 insertions(+), 126 deletions(-) delete mode 100644 sources/tech/20191118 How internet security works- TLS, SSL, and CA.md create mode 100644 translated/tech/20191118 How internet security works- TLS, SSL, and CA.md diff --git a/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md b/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md deleted file mode 100644 index ab1b44f408..0000000000 --- a/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md +++ /dev/null @@ -1,126 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hopefully2333) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How internet security works: TLS, SSL, and CA) -[#]: via: (https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority) -[#]: author: (Bryant Son https://opensource.com/users/brson) - -How internet security works: TLS, SSL, and CA -====== -What's behind that lock icon in your web browser? -![Lock][1] - -Multiple times every day, you visit websites that ask you to log in with your username or email address and password. Banking websites, social networking sites, email services, e-commerce sites, and news sites are just a handful of the types of sites that use this mechanism. - -Every time you sign into one of these sites, you are, in essence, saying, "yes, I trust this website, so I am willing to share my personal information with it." This data may include your name, gender, physical address, email address, and sometimes even credit card information. - -But how do you know you can trust a particular website? To put this a different way, what is the website doing to secure your transaction so that you can trust it? - -This article aims to demystify the mechanisms that make a website secure. I will start by discussing the web protocols HTTP and HTTPS and the concept of Transport Layer Security (TLS), which is one of the cryptographic protocols in the internet protocol's (IP) layers. Then, I will explain certificate authorities (CAs) and self-signed certificates and how they can help secure a website. Finally, I will introduce some open source tools you can use to create and manage certificates. - -### Securing routes through HTTPS - -The easiest way to understand a secured website is to see it in action. Fortunately, it is far easier to find a secured website than an unsecured website on the internet today. But, since you are already on Opensource.com, I'll use it as an example. No matter what browser you're using, you should see an icon that looks like a lock next to the address bar. Click on the lock icon, and you should see something similar to this. - -![Certificate information][2] - -By default, a website is not secure if it uses the HTTP protocol. Adding a certificate configured through the website host to the route can transform the website from an unsecured HTTP site to a secured HTTPS site. The lock icon usually indicates that the site is secured through HTTPS. - -Click on Certificate to see the site's CA. Depending on your browser, you may need to download the certificate to see it. - -![Certificate information][3] - -Here, you can learn something about Opensource.com's certificate. For example, you can see that the CA is DigiCert, and it is given to Red Hat under the name Opensource.com. - -This certificate information enables the end user to check that the website is safe to visit. - -> WARNING: If you do not see a certificate sign on a website—or if you see a sign that indicates that the website is not secure—please do not log in or do any activity that requires your private data. Doing so is quite dangerous! - -If you see a warning sign, which is rare for most publicly facing websites, it usually means that the certificate is expired or uses a self-signed certificate instead of one issued through a trusted CA. Before we get into those topics, I want to explain the TLS and SSL. - -### Internet protocols with TLS and SSL - -TLS is the current generation of the old Secure Socket Layer (SSL) protocol. The best way to understand this is by examining the different layers of the IP. - -![IP layers][4] - -There are six layers that make up the internet as we know it today: physical, data, network, transport, security, and application. The physical layer is the base foundation, and it is closest to the actual hardware. The application layer is the most abstract layer and the one closest to the end user. The security layer can be considered a part of the application layer, and TLS and SSL, which are the cryptographic protocols designed to provide communications security over a computer network, are in the security layer. - -This process ensures that communication is secure and encrypted when an end user consumes the service. - -### Certificate authorities and self-signed certificates - -A CA is a trusted organization that can issue a digital certificate. - -TLS and SSL can make a connection secure, but the encryption mechanism needs a way to validate it; this is the SSL/TLS certificate. TLS uses a mechanism called asymmetric encryption, which is a pair of security keys called a private key and a public key. (This is a very complex topic that is beyond the scope of this article, but you can read "[An introduction to cryptography and public key infrastructure][5]" if you would like to learn about it.) The essential thing to know is that CAs, like GlobalSign, DigiCert, and GoDaddy, are the external trusted vendors that issue certificates that are used to validate the TLS/SSL certificate used by the website. This certificate is imported to the hosted server to secure the website. - -However, a CA might be too expensive or complicated when you're just trying to test a website or service in development. You must have a trusted CA for production purposes, but developers and website administrators need a simpler way to test websites before they're deployed to production; this is where self-signed certificates come in. - -A self-signed certificate is a TLS/SSL certificate that is signed by the person who creates it rather than a trusted CA. It's easy to generate a self-signed certificate from a computer, and it can enable you to test a secure website without buying an expensive CA-signed certificate right away. While the self-signed certificate is definitely risky to put into production use, it is an easy and flexible option for developing and testing in pre-production stages. - -### Open source tools for generating certificates -Several open source tools are available for managing TLS/SSL certificates. The most well-known one is OpenSSL, which is included in many Linux distributions and on macOS. However, other open source tools are also available. - -| Tool Name | Description | License | -| --------- | ------------------------------------------------------------------------------ | --------------------------------- | -| OpenSSL | The most well-known open source tool for implementing TLS and crypto libraries | Apache License 2.0 | -| EasyRSA | Command-line utility for building and managing a PKI CA | GPL v2 | -| CFSSL | PKI/TLS "Swiss Army Knife" from Cloudflare | BSD 2-Clause "Simplified" License | -| Lemur | TLS creation tool from Netflix | Apache License 2.0 | - -Netflix's Lemur is a particularly interesting option when you consider its goals of scaling and being user friendly. You can read more about it on [Netflix's tech blog][6]. - -### How to create an OpenSSL certificate - -e have the power to create certificates on our own. This example generates a self-signed certificate using OpenSSL. - -1. Create a private key using the openssl command: -``` -openssl genrsa -out example.key 2048 -``` -![](https://opensource.com/sites/default/files/uploads/4_openssl_generatekey.jpg) - -2. Create a certificate signing request (CSR) using the private key generated in step 1: -``` -openssl req -new -key example.key -out example.csr \ --subj "/C=US/ST=TX/L=Dallas/O=Red Hat/OU=IT/CN=test.example.com" -``` - -![](https://opensource.com/sites/default/files/uploads/5_openssl_generatecsr.jpg) - -3. Create a certificate using your CSR and private key: - -``` -openssl x509 -req -days 366 -in example.csr \ --signkey example.key -out example.crt -``` - -![](https://opensource.com/sites/default/files/uploads/6_openssl_generatecert.jpg) - -### Learn more on internet security -If you'd like to learn more about the internet and website security, watch the companion YouTube video I made for this article. - - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority - -作者:[Bryant Son][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/brson -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum -[2]: https://opensource.com/sites/default/files/uploads/1_certificatecheckwebsite.jpg -[3]: https://opensource.com/sites/default/files/uploads/2_certificatedisplaywebsite.jpg -[4]: https://opensource.com/sites/default/files/uploads/3_internetprotocol.jpg -[5]: https://opensource.com/article/18/5/cryptography-pki -[6]: https://medium.com/netflix-techblog/introducing-lemur-ceae8830f621 diff --git a/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md b/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md new file mode 100644 index 0000000000..6850c03e2d --- /dev/null +++ b/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How internet security works: TLS, SSL, and CA) +[#]: via: (https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +互联网的安全是如何保证的:TLS,SSL,和 CA +====== +你的浏览器里的锁的图标的后面是什么? +![Lock][1] + +每天你都会重复这件事很多次,你访问网站,这个网站需要你用用户名或者电子邮件地址,和你的密码来进行登录。银行网站,社交网站,电子邮件服务,电子商务网站,和新闻网站。这里只在使用了这种机制的网站中列举了其中一小部分。 + +每次你登陆进一个这种类型的网站时,你实际上是在说:“是的,我信任这个网站,所以我愿意把我的个人信息共享给它。”这些数据可能包含你的姓名,性别,实际地址,电子邮箱地址,有时候甚至会包括你的信用卡信息。 + +但是你怎么知道你可以信任这个网站?换个方式问,为了让你可以信任它,网站应该如何保护你的交易? + +本文旨在阐述使网站变得安全的机制。我会首先论述 web 协议 http 和 https,以及传输层安全(TLS)的概念,后者是互联网协议(IP)层中的加密协议之一。然后,我会解释证书颁发机构和自签名证书,以及它们如何帮助保护一个网站。最后,我会介绍一些开源的工具,你可以使用它们来创建和管理你的证书。 + +### 通过 https 保护路由 + +了解一个受保护的网站的最简单的方式就是在交互中观察它,幸运的是,在今天的互联网上,发现一个安全的网站远远比找到一个不安全的网站要简单。但是,因为你已经在 Opensource.com 这个网站上了,我会使用它来作为案例,无论你使用的是哪个浏览器,你应该在你的地址栏旁边看到一个像锁一样的图标。点击这个锁图标,你应该会看见一些和下面这个类似的东西。 + +![Certificate information][2] + +默认情况下,如果一个网站使用的是 http 协议,那么它是不安全的。通过网站主机配置一个证书并添加到路由,可以把这个网站从一个不安全的 http 网站变为一个安全的 https 网站。那个锁图标通常表示这个网站是受 https 保护的。 + +点击证书来查看网站的 CA,根据你的浏览器,你可能需要下载证书来查看它。 + +![Certificate information][3] + +点击证书来查看网站的 CA,根据你的浏览器,你可能需要下载证书来查看它。 + +这个证书信息可以让终端用户检查该网站是否可以安全访问。 + +> 警告:如果你没有在网站上看到证书标志,或者如果你看见的标志显示这个网站不安全——请不要登录或者做任何需要你个人数据的操作。这种情况非常危险! + +如果你看到的是警告标志,对于大多数面向公众开放的网站来说,这很少见,它通常意味着该证书已经过期或者是该证书是自签名的,而非通过一个受信任的第三方来颁发。在我们进入这些主题之前,我想解释一下 TLS 和 SSL。 + +### 带有 TLS 和 SSL 的互联网协议 + +TLS 是旧版安全套接字层协议(SSL)的最新版本。理解这一点的最好方法就是仔细理解 IP 的不同协议层。 + +![IP layers][4] + +我们知道当今的互联网是由6个层面组成的:物理层,数据链路层,网络层,传输层,安全层,应用层。物理层是基础,这一层是最接近实际的硬件设备的。应用层是最抽象的一层,是最接近终端用户的一层。安全层可以被认为是应用层的一部分,TLS 和 SSL,是被设计用来在一个计算机网络中提供通信安全的加密协议,它们位于安全层中。 + +这个过程可以确保终端用户使用网络服务时,通信的安全性和保密性。 + +### 证书颁发机构和自签名证书 + +CA 是受信任的组织,它可以颁发数字证书。 + +TLS 和 SSL 可以使连接更安全,但是这个加密机制需要一种方式来验证它;这就是 SSL/TLS 证书。TLS 使用了一种叫做非对称加密的加密机制,这个机制有一对称为私钥和公钥的安全密钥。(这是一个非常复杂的主题,超出了本文的讨论范围,但是如果你想去了解这方面的东西,你可以阅读“密码学和公钥密码基础体系简介”)你要知道的基础内容是,证书颁发机构们,比如 GlobalSign, DigiCert,和 GoDaddy,它们是受人们信任的可以颁发证书的供应商,它们颁发的证书可以用于验证网站使用的 TLS/SSL 证书。网站使用的证书是导入到主机服务器里的,用于保护网站。 + +然而,如果你只是要测试一下正在开发中的网站或服务,CA 证书可能对你而言太昂贵或者是太复杂了。你必须有一个用于生产目的的受信任的证书,但是开发者和网站管理员需要有一种更简单的方式来测试网站,然后他们才能将其部署到生产环境中;这就是自签名证书的来源。 + +自签名证书是一种 TLS/SSL 证书,是由创建它的人而非受信任的 CA 机构颁发的。用电脑生成一个自签名证书很简单,它可以让你在无需购买昂贵的 CA 颁发的证书的情况下测试一个安全网站。虽然自签名证书肯定不能拿到生产环境中去使用,但对于开发和测试阶段来说,这是一种简单灵活的方法。 + +### 生成证书的开源工具 + +有几种开源工具可以用来管理 TLS/SSL 证书。其中最著名的就是 openssl,这个工具包含在很多 Linux 发行版中和 macos 中。当然,你也可以使用其他开源工具。 + +| Tool Name | Description | License | +| --------- | ------------------------------------------------------------------------------ | --------------------------------- | +| OpenSSL | 实现 TLS 和加密库的最著名的开源工具 | Apache License 2.0 | +| EasyRSA | 用于构建 PKI CA 的命令行实用工具 | GPL v2 | +| CFSSL | 来自 cloudflare 的 PKI/TLS 瑞士军刀 | BSD 2-Clause "Simplified" License | +| Lemur | 来自网飞的 TLS创建工具 | Apache License 2.0 | + +如果你的目的是扩展和对用户友好,网飞的 Lemur 是一个很有趣的选择。你在网飞的技术博客上可以查看更多有关它的信息。 + +### 如何创建一个 Openssl 证书 + +你可以靠自己来创建证书,下面这个案例就是使用 Openssl 生成一个自签名证书。 + +1. 使用 openssl 命令行生成一个私钥: +``` +openssl genrsa -out example.key 2048 +``` +![](https://opensource.com/sites/default/files/uploads/4_openssl_generatekey.jpg) + +2. 使用在第一步中生成的私钥来创建一个证书签名请求(CSR): +``` +openssl req -new -key example.key -out example.csr \ +-subj "/C=US/ST=TX/L=Dallas/O=Red Hat/OU=IT/CN=test.example.com" +``` + +![](https://opensource.com/sites/default/files/uploads/5_openssl_generatecsr.jpg) + +3. 使用你的 CSR 和私钥创建一个证书: + +``` +openssl x509 -req -days 366 -in example.csr \ +-signkey example.key -out example.crt +``` + +![](https://opensource.com/sites/default/files/uploads/6_openssl_generatecert.jpg) + +### 了解更多关于互联网安全的知识 +如果你想要了解更多关于互联网安全和网站安全的知识,请看我为这篇文章一起制作的 Youtube 视频。 + + + +你有什么问题?发在评论里让我们知道。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum +[2]: https://opensource.com/sites/default/files/uploads/1_certificatecheckwebsite.jpg +[3]: https://opensource.com/sites/default/files/uploads/2_certificatedisplaywebsite.jpg +[4]: https://opensource.com/sites/default/files/uploads/3_internetprotocol.jpg +[5]: https://opensource.com/article/18/5/cryptography-pki +[6]: https://medium.com/netflix-techblog/introducing-lemur-ceae8830f621 From db0389a5ed013043e68c6b646dfff05323f2fb58 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Dec 2019 22:32:49 +0800 Subject: [PATCH 009/676] PRF @geekpi --- ...antheon desktop for Linux Elementary OS.md | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md index 8ec91c5c62..0963892604 100644 --- a/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md +++ b/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Why use the Pantheon desktop for Linux Elementary OS) @@ -9,22 +9,24 @@ 为何在 Elementary OS 中使用 Pantheon 桌面 ====== -本文是 Linux 桌面特别系列的一部分。通过 Pantheon 在 Elementary OS 上获得受喜爱的 Mac OS 特性。 + +> 本文是 Linux 桌面特别系列的一部分。通过在 Elementary OS 上运行 Pantheon 桌面获得广受喜爱的 Mac OS 特性。 + ![A person programming][1] -你愿意为 Linux 桌面支付 20 美元吗?事实上,我会在下载免费软件时选择支付更多!我这样做的原因是开源是值得的。对于 [Elementary OS][2]的拷贝,默认价格是 20 美元(你可以用 1 美元,如果你无法负担,你甚至可以用 0 美元下载)。作为回报,你将获得一个出色且精心制作的发行版,同时拥有 Pantheon 桌面设计。 +你愿意为 Linux 桌面支付 20 美元吗?事实上,我会在下载自由软件时选择支付更多的钱!我这样做的原因是开源是值得的。对于 [Elementary OS][2] 的拷贝,默认价格是 20 美元(你可以选择 1 美元,如果你无法负担,你甚至可以用 0 美元下载)。作为回报,你将获得一个出色且精心制作的发行版,同时拥有它自己的 Pantheon 桌面设计。 -你可能会发现 Pantheon 已包含在软件仓库中,因为它是开源的,但你更可能需要下载并安装 [Elementary][3] Linux 才能体验它。如果你还不准备在计算机上将 Elementary 作为主操作系统安装,那么可以将其安装到虚拟机中,例如 [GNOME Boxes][4] 中。 +你可能会发现 Pantheon 已包含在软件仓库中,因为它是开源的,但你更可能需要下载并安装 [Elementary][3] Linux 才能体验它。如果你还不准备在计算机上将 Elementary 作为主操作系统,那么可以将其安装到虚拟机中,例如 [GNOME Boxes][4] 中。 -Pantheon 桌面整洁、吸引人,并有许多用户希望在桌面中获得的东西,但在普通的 Linux 桌面上却无法获得。 +Pantheon 桌面整洁、吸引人,并且有许多用户希望在桌面中获得的东西,但在普通的 Linux 桌面上却无法获得。 ### Pantheon 桌面之旅 -乍一看,Pantheon 桌面看起来有点像 Cinnamon 或 Budgie 或 GNOME 3 的经典模式。但是,Pantheon 最令人兴奋的功能是最小的触摸。它在你最少注意到的地方都表现出色,直到有一天这里成为了你一天都会看的地方,并且意识到它的工作方式确实改善了你的生活质量,更不用说让你过得愉快了好多了。 +乍一看,Pantheon 桌面看起来有点像 Cinnamon、Budgie 或 GNOME 3 的经典模式。但是,Pantheon 最令人兴奋的功能是极小的接触。它在你很少注意到的地方都表现出色,直到有一天这里成为了你一天都会看的地方,并且会意识到它的工作方式确实改善了你的生活质量,更不用说让你过得愉快多了。 -最明显的例子是“文件名高亮”。几十年来,Mac OS 一直有一个广受欢迎的功能,你从而可以高亮显示重要文件的名称。人们使用此功能作为快速的视觉指示器,来告诉自己哪个文件是这几个的“最佳”版本,或者哪个文件应该发送给朋友,或者哪个文件仍然需要处理。它们可以是任意颜色,可以表示用户想要的任何含义。最重要的是,它是引人注目的视觉元数据。 +最明显的例子是“文件名高亮”。几十年来,Mac OS 一直有一个广受欢迎的功能,你可以高亮显示重要文件的名称。人们使用此功能作为快速视觉指示器,来告诉自己哪个文件是这几个的“最佳”版本,或者哪个文件应该发送给朋友,或者哪个文件仍然需要处理。它们可以是任意颜色,可以表示用户想要的任何含义。最重要的是,它是引人注目的视觉元数据。 -从 Mac OS 切换过来用户往往会错过 GNOME 和 KDE 以及其他 Linux 桌面提供的这个功能。Pantheon 悄悄和随意地就解决了这个问题。 +从 Mac OS 切换过来用户往往会错过 GNOME 和 KDE 以及其他 Linux 桌面提供的这个功能。Pantheon 悄悄地随手解决了这个问题。 ![A highlighted file in the Pantheon desktop][5] @@ -38,15 +40,15 @@ Pantheon 桌面整洁、吸引人,并有许多用户希望在桌面中获得 Pantheon 桌面表达了如何操作计算机的清晰愿景。这种设计的“问题”(至少在开源之外)是,一个人的偏好可能无法满足另一个人的效率。 -但它是开源的。它可以更改,任何不能改变的东西都可以被丢弃。Pantheon 绝对是针对特定用户的桌面,但是即使对于那些对桌面应该如何工作抱有自己期望的人,Pantheon 也会比初次出现时更加灵活。许多内置设计都具有替代选项,当你无法根据自己的喜好进行调整时,你可以轻松选择其他应用。主题引擎可确保你的替换应用看起来与桌面的其他部分集成在一起,而平常的 Linux 系统总线可确保你选择的所有应用都能按预期相互通信。 +但它是开源的。它可以更改,任何不能改变的东西都可以被丢弃。Pantheon 绝对是针对特定用户群的桌面,但是即使对于那些对桌面应该如何工作抱有自己期望的人,Pantheon 也会比初看上去更加灵活。许多内置设计都具有替代选项,当你无法根据自己的喜好进行调整时,你可以轻松选择其他应用。主题引擎可确保你的替换应用看起来与桌面的其它部分和谐一致,而通常的 Linux 系统兼容性可确保你选择的所有应用都能按预期相互配合。 ![Which one is the guest?][7] -随着折衷的进行,这一过程在中途会做很多事情。 +这些替代品,可使你事半功倍。 ### 受欢迎的补充 -除开词源,此桌面确实是许多 Linux 用户祈祷的答案。无论它是否是你的风格,Pantheon 桌面都是 Linux 用户体验中重要且受欢迎的补充。自己尝试一下,看看它是否是你一直期待的。 +撇开这个桌面的词源不说,此桌面确实是许多 Linux 用户祈祷的答案(LCTT 译注:Pantheon 的意思是“万神庙”)。无论它是否是你的风格,Pantheon 桌面都是 Linux 用户体验中重要且受欢迎的补充。自己尝试一下,看看它是否是你一直期待的。 -------------------------------------------------------------------------------- @@ -55,7 +57,7 @@ via: https://opensource.com/article/19/12/pantheon-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8b5f98526e0cda506d0385c16e641da9e5ecf165 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 10 Dec 2019 00:27:44 +0800 Subject: [PATCH 010/676] APL: 20191022 How to program with Bash- Logical operators and shell expansions.md --- ...program with Bash- Logical operators and shell expansions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md index 024af38122..5cfef23305 100644 --- a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md +++ b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ccdb799e5f2a7833abad700db27c5354d386306d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 10 Dec 2019 00:54:29 +0800 Subject: [PATCH 011/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191210=20App=20?= =?UTF-8?q?Highlight:=20Open=20Source=20Video=20Transcoder=20Handbrake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191210 App Highlight- Open Source Video Transcoder Handbrake.md --- ... Open Source Video Transcoder Handbrake.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 sources/tech/20191210 App Highlight- Open Source Video Transcoder Handbrake.md diff --git a/sources/tech/20191210 App Highlight- Open Source Video Transcoder Handbrake.md b/sources/tech/20191210 App Highlight- Open Source Video Transcoder Handbrake.md new file mode 100644 index 0000000000..d6e239c3eb --- /dev/null +++ b/sources/tech/20191210 App Highlight- Open Source Video Transcoder Handbrake.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Open Source Video Transcoder Handbrake) +[#]: via: (https://itsfoss.com/handbrake/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +App Highlight: Open Source Video Transcoder Handbrake +====== + +_**Brief: HandBrake is a free and open-source video conversion tool that is quite useful. Let’s see what are its main features and how to use them for converting videos from one format to another.**_ + +### HandBrake: An Open Source Video Transcoder + +![][1] + +[HandBrake][2] is a quite useful tool which helps you to convert a video from one format to some of the widely supported codecs (**.mp4/.m4v/.mkv/.webm**) + +It can support any video format and help you convert it. In addition to that, you have several features on board to customize the video attributes while converting. + +If you are looking for a [Format Factory alternative][3], this is your best bet. + +I shall highlight the key features to help you know more. + +![HandBrake][4] + +### Features of HandBrake + +When you start using the video transcoder, you will find a lot of tiny features for video conversion. However, here, I’ll highlight the important things you need to know about HandBrake: + +#### Video Conversion Presets + +![HandBrake Presets][5] + +Suppose you want to convert a full HD video to play on a mobile which was originally tailored for desktop viewing, what do you do? + +Would you test various dimensions and convert them repeatedly to get the perfect mobile port? Or, would you rather prefer to have pre-defined settings for such conversions? + +If you opt for a preset, you just have to select the target device (or type of device) from the list of available presets. + +It even features presets for PS4 Pro (4K) and Discord. So, you can expect a big list of presets available. + +#### Input Sources Support + +Unless the file has some sort of copy protection, HandBrake can help you convert it. You will have no problems whatsoever even if you have an Ultra HD Blu-ray disc as the source with no copyright protection. + +All the available video encoding formats should work fine as an input source file. + +#### Basic Video Manipulation + +![HandBrake Screenshot][6] + +In addition to the ability of video conversion, it also lets you tweak the video to suit your requirements. + +You can change the dimensions, crop it, add a filter, change the frame rate settings, and a lot more things. + +If that wasn’t enough, you also get the ability to add subtitles and chapter markers. + +#### Live Video Preview + +This may not be a big deal to have – but I haven’t seen any video converter tool featuring video previews while being able to convert/tweak the video. It could come in handy for someone specific. + +### Installing HandBrake on Ubuntu and other Linux distributions + +HandBrake is a cross-platform application and you can install it on all different platforms like Linux, macOS and Windows. Just head over to heir website and download it from there. + +[Download HandBrake for any platform][7] + +On It’s FOSS, our focus is on Linux so I am going to show the steps to install it on Linux. + +**Installing HandBrake on Ubuntu** + +HandBrake is available in the [universe repository in Ubuntu][8]. If you have it enabled, you should find it in the software center. Just search for the name and install it from there. + +![HandBrake in Ubuntu Software Center][9] + +You can also use terminal for installing HandBrake with apt or [apt-get command][10]: + +``` +sudo apt-get install handbrake +``` + +However, the software center might feature the older version. If you want to install the latest version of HandBrake on Ubuntu and other Ubuntu-based distributions, you can [use its official PPA][11]. It’s better to uninstall any existing version of HandBrake beforehand. + +``` +sudo apt remove handbrake +sudo add-apt-repository ppa:stebbins/handbrake-releases +sudo apt update +sudo apt install handbrake-gtk +``` + +You can [learn more about using PPA here][12]. It will help you to [remove PPA][13], if you ever need to uninstall HandBrake installed via the PPA. + +If you want to install the CLI version of Handbrake, simply use this command: + +``` +sudo apt install handbrake-cli +``` + +Quite honestly, HandBrake should be used as a GUI application. If you want command line, you can always [use ffmpeg][14] that is more powerful and HandBrake uses it underneath anyways. + +**Installing HandBrake on other Linux distributions** + +HandBrake is one of the [popular Linux software][15] and it should be available in the official repositories of almost all Linux distributions. + +Just use the software center or package manager of your distribution to install HandBrake. + +But again, your distribution might not have the latest version of HandBrale. So, if you want the latest version installed, you can try installing the [Flatpak package][16] available. If you are not sure how to use Flatpak, refer to our guide on [using Flatpak on Linux][17]. + +[HandBrake][2] + +**Wrapping Up** + +A free and open-source video conversion tool that gets the job done. I’m quite satisfied with it personally. + +If you use HandBrake extensively, mention at least one feature that you like the most about it. + +If you use some other application for converting video formats, do share it with us in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/handbrake/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/handbrake_software_logo.png?ssl=1 +[2]: https://handbrake.fr/ +[3]: https://itsfoss.com/format-factory-alternative-linux/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake-presets.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake-screenshot.png?ssl=1 +[7]: https://handbrake.fr/downloads.php +[8]: https://itsfoss.com/ubuntu-repositories/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake_ubuntu_software_center.png?ssl=1 +[10]: https://itsfoss.com/apt-get-linux-guide/ +[11]: https://launchpad.net/~stebbins/+archive/ubuntu/handbrake-releases +[12]: https://itsfoss.com/ppa-guide/ +[13]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[14]: https://itsfoss.com/ffmpeg/ +[15]: https://itsfoss.com/essential-linux-applications/ +[16]: https://flathub.org/apps/details/fr.handbrake.ghb +[17]: https://itsfoss.com/flatpak-guide/ From 780d2db0086830ad458d4e9dd2dd5a9112b770b0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 10 Dec 2019 00:55:10 +0800 Subject: [PATCH 012/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191208=20Dynami?= =?UTF-8?q?cally=20scoped=20variables=20in=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191208 Dynamically scoped variables in Go.md --- ...1208 Dynamically scoped variables in Go.md | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 sources/tech/20191208 Dynamically scoped variables in Go.md diff --git a/sources/tech/20191208 Dynamically scoped variables in Go.md b/sources/tech/20191208 Dynamically scoped variables in Go.md new file mode 100644 index 0000000000..959799f89e --- /dev/null +++ b/sources/tech/20191208 Dynamically scoped variables in Go.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Dynamically scoped variables in Go) +[#]: via: (https://dave.cheney.net/2019/12/08/dynamically-scoped-variables-in-go) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Dynamically scoped variables in Go +====== + +This is a thought experiment in API design. It starts with the classic Go unit testing idiom: + +``` +func TestOpenFile(t *testing.T) { + f, err := os.Open("notfound") + if err != nil { + t.Fatal(err) + } + + // ... +} +``` + +What’s the problem with this code? The assertion. `if err != nil { ... }` is repetitive and in the case where multiple conditions need to be checked, somewhat error prone if the author of the test uses `t.Error` not `t.Fatal`, eg: + +``` +f, err := os.Open("notfound") +if err != nil { + t.Error(err) +} +f.Close() // boom! +``` + +What’s the solution? DRY it up, of course, by moving the repetitive assertion logic to a helper: + +``` +func TestOpenFile(t *testing.T) { +       f, err := os.Open("notfound") +       check(t, err) + +       // ... +} + +func check(t *testing.T, err error) { +       if err != nil { +                t.Helper() +               t.Fatal(err) +        } +} +``` + +Using the `check` helper the code is a little cleaner, and clearer, _check the error_, and hopefully the indecision between `t.Error` and `t.Fatal` has been solved. The downside of abstracting the assertion to a helper function is now you need to pass a `testing.T` into _each and every invocation_. Worse, you need to pass a `*testing.T` to everything that needs to call `check`, transitively, just in case. + +This is ok, I guess, but I will make the observation that the `t` variable is only needed _when the assertion fails_ — and even in a testing scenario, most of the time, most of the tests pass, so that means reading, and writing, all these `t`‘s is a constant overhead for the relatively rare occasion that a test fails. + +What about if we did something like this instead? + +``` +func TestOpenFile(t *testing.T) { +       f, err := os.Open("notfound") +        check(err) + +       // ... +} + +func check(err error) { +        if err != nil { +                panic(err.Error()) +        } +} +``` + +Yeah, that’ll work, but it has a few problems + +``` +% go test +--- FAIL: TestOpenFile (0.00s) +panic: open notfound: no such file or directory [recovered] +        panic: open notfound: no such file or directory + +goroutine 22 [running]: +testing.tRunner.func1(0xc0000b4400) +        /Users/dfc/go/src/testing/testing.go:874 +0x3a3 +panic(0x111b040, 0xc0000866f0) +        /Users/dfc/go/src/runtime/panic.go:679 +0x1b2 +github.com/pkg/expect_test.check(...) +        /Users/dfc/src/github.com/pkg/expect/expect_test.go:18 +github.com/pkg/expect_test.TestOpenFile(0xc0000b4400) +        /Users/dfc/src/github.com/pkg/expect/expect_test.go:10 +0xa1 +testing.tRunner(0xc0000b4400, 0x115ac90) +        /Users/dfc/go/src/testing/testing.go:909 +0xc9 +created by testing.(*T).Run +        /Users/dfc/go/src/testing/testing.go:960 +0x350 +exit status 2 +``` + +Let’s start with the good; we didn’t have to pass a `testing.T` every place we call `check`, the test fails immediately, and we get a nice message in the panic — albeit twice. But _where_ the assertion failed is hard to see. It occurred on `expect_test.go:11` but you’d be forgiven for not knowing that. + +So `panic` isn’t really a good solution, but there’s something in this stack trace that is — can you see it? Here’s a hint, `github.com/pkg/expect_test.TestOpenFile(0xc0000b4400)`. + +`TestOpenFile` has a `t` value, it was passed to it by `tRunner`, so there’s a `testing.T` in memory at address `0xc0000b4400`. What if we could get access to that `t` inside `check`? Then we could use it to call `t.Helper` and `t.Fatal`. Is that possible? + +### Dynamic scoping + +What we want is to be able to access a variable whose declaration is neither global, or local to the function, but somewhere higher in the call stack. This is called _dynamic scoping_. Go doesn’t support dynamic scoping, but it turns out, for restricted cases, we can fake it. I’ll skip to the chase: + +``` +// getT returns the address of the testing.T passed to testing.tRunner +// which called the function which called getT. If testing.tRunner cannot +// be located in the stack, say if getT is not called from the main test +// goroutine, getT returns nil. +func getT() *testing.T { +        var buf [8192]byte +        n := runtime.Stack(buf[:], false) +        sc := bufio.NewScanner(bytes.NewReader(buf[:n])) +        for sc.Scan() { +                var p uintptr +                n, _ := fmt.Sscanf(sc.Text(), "testing.tRunner(%v", &p) +                if n != 1 { +                        continue +                } +                return (*testing.T)(unsafe.Pointer(p)) +        } +        return nil +} +``` + +We know that each `Test` is called by the `testing` package in its own goroutine (see the stack trace above). The `testing` package launches the test via a function called `tRunner` which takes a `*testing.T` and a `func(*testing.T)` to invoke. Thus we grab a stack trace of the current goroutine, scan through it for the line beginning with `testing.tRunner` — which can only be the `testing` package as `tRunner` is a private function — and parse the address of the first parameter, which is a pointer to a `testing.T`. With a little `unsafe` we convert the raw pointer back to a `*testing.T` and we’re done. + +If the search fails then it is likely that `getT` wasn’t called from a `Test`. This is actually ok because the reason we needed the `*testing.T` was to call `t.Fatal` and the testing package already requires that `t.Fatal` be called from the [main test goroutine][1]. + +``` +import "github.com/pkg/expect" + +func TestOpenFile(t *testing.T) { +        f, err := os.Open("notfound") +        expect.Nil(err) + +        // ... +} +``` + +Putting it all together we’ve eliminated the assertion boilerplate and possibly made the expectation of the test a little clearer to read, _after opening the file `err` is expected to be nil_. + +### Is this fine? + +At this point you should be asking, _is this fine?_ And the answer is, no, this is not fine. You should be screaming internally at this point. But it’s probably worth introspecting those feelings of revulsion. + +Apart from the inherent fragility of scrobbling around in a goroutine’s call stack, there are some serious design issues: + + 1. The `expect.Nil`‘s behaviour now depends on _who called it_. Provided with the same arguments it may have different behaviour depending on where it appears in the call stack — this is unexpected. + 2. Taken to the extreme dynamic scoping effective brings into the scope of a single function all the variables passed into any function that preceded it. It is a side channel for passing data in to and out of functions that is not explicitly documented in function declaration. + + + +Ironically these are precisely the critiques I have of [`context.Context`][2]. I’ll leave it to you to decide if they are justified. + +### A final word + +This is a bad idea, no argument there. This is not a pattern you should ever use in production code. But, this isn’t production code, it’s a test, and perhaps there are different rules that apply to test code. After all, we use mocks, and stubs, and monkey patching, and type assertions, and reflection, and helper functions, and build flags, and global variables, all so we can test our code effectively. None of those, uh, _hacks_ will ever show up in the production code path, so is it really the end of the world? + +If you’ve read this far perhaps you’ll agree with me that as unconventional as this approach is, not having to pass a `*testing.T` into every function that could possibly need to assert something transitively, makes for clearer test code. + +So maybe, in this case, the ends do justify the means. + +* * * + +If you’re interested, I’ve put together a [small assertion library][3] using this pattern. _Caveat emptor_. + +#### Related posts: + + 1. [Go, without package scoped variables][4] + 2. [On declaring variables][5] + 3. [A whirlwind tour of Go’s runtime environment variables][6] + 4. [You shouldn’t name your variables after their types for the same reason you wouldn’t name your pets “dog” or “cat”][7] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/12/08/dynamically-scoped-variables-in-go + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://golang.org/pkg/testing/#T.FailNow +[2]: https://dave.cheney.net/2017/01/26/context-is-for-cancelation +[3]: https://github.com/pkg/expect +[4]: https://dave.cheney.net/2017/06/11/go-without-package-scoped-variables (Go, without package scoped variables) +[5]: https://dave.cheney.net/2014/05/24/on-declaring-variables (On declaring variables) +[6]: https://dave.cheney.net/2015/11/29/a-whirlwind-tour-of-gos-runtime-environment-variables (A whirlwind tour of Go’s runtime environment variables) +[7]: https://dave.cheney.net/2019/01/29/you-shouldnt-name-your-variables-after-their-types-for-the-same-reason-you-wouldnt-name-your-pets-dog-or-cat (You shouldn’t name your variables after their types for the same reason you wouldn’t name your pets “dog” or “cat”) From da6a7fabbb7f286050e6f4e041e2c04622e03744 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 10 Dec 2019 00:56:52 +0800 Subject: [PATCH 013/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191209=205G=20i?= =?UTF-8?q?n=202020:=20Still=20just=20a=20private=20party?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191209 5G in 2020- Still just a private party.md --- ... 5G in 2020- Still just a private party.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/talk/20191209 5G in 2020- Still just a private party.md diff --git a/sources/talk/20191209 5G in 2020- Still just a private party.md b/sources/talk/20191209 5G in 2020- Still just a private party.md new file mode 100644 index 0000000000..45d7b48d5f --- /dev/null +++ b/sources/talk/20191209 5G in 2020- Still just a private party.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5G in 2020: Still just a private party) +[#]: via: (https://www.networkworld.com/article/3488563/5g-in-2020-still-just-a-private-party.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +5G in 2020: Still just a private party +====== + +Vertigo3D / Getty Images + +To hear the major mobile carriers talk about it, [5G][1] is here. They’ve deployed it, it works, and it’s ready to start changing the world just about right away, with ultra-fast connectivity, low latency and a dramatically improved ability to handle huge numbers of different connections at once. + +Eventually, that will all be true – but, according to experts in the field, it isn’t yet, and most of it won’t take place within the coming calendar year. The 3GPP standards that will underpin all new-radio 5G technology are still not yet finalized, although that is expected to happen in early 2020, which means the much-touted 5G deployments in the U.S. are based partially on pre-standard technology. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Those deployments are also, at this point, quite limited in size, confined to a few major cities, and only covering centrally located intersections and occasional landmarks. It’s worth noting, though, that the parts of the 5G standard that work over some of the same frequencies as existing LTE have been finalized. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Babak Beheshti, a member of the IEEE’s board of directors, said that the main way 5G will make a mark in 2020 will be in private deployments. A company can use pre-standard versions of 5G to create very fast, low-latency networks within its own facilities. Vendors like Ericsson and Nokia are already getting ready to sell the requisite equipment, and a private 5G network has a number of potential upsides, thanks in part to it being based on existing carrier technology. + +“Because of its inherent privacy and security, in that sense, it’ll provide wireless access to employees at a much more secure level,” he said. + +Beheshti also noted that there are potential downsides to the use of private 5G – including cost and the fact that it will require a fairly dense deployment of access points, given its use of comparatively high-frequency radio waves. + +According to Forrester Research vice president Glenn O’Donnell, another potential issue is power consumption – compared to a [Wi-Fi 6][4] network of similar capacity, at least – but that’s an arguable point, and both technologies will be competitive for this type of deployment. + +“This is one of the many holy wars we’ve seen in technology,” he said. “You’ll get people who fall into one camp or the other – a lot of it, unfortunately, is going to come down to who’s marketing better.” + +Still, it seems clear that there’s a potential market there in the enterprise sector for a fast, low-latency network that’s also highly secure. O’Donnell said that the manufacturing, warehousing and logistics verticals might be particularly interested in private 5G, given the networking needs created by IoT and related developments and a lesser incidence of highly sophisticated Wi-Fi implementations. + +Beheshti concurred, saying that a relatively green field makes the most sense for private 5G deployment. + +“Given the expenditure involved, where it would really provide most ROI is for companies that have no private wireless or very little private wireless setup or infrastructure,” he said. + +Widespread carrier-based implementation of 5G technology, however, is unlikely to happen over the course of 2020, and a big part of the reason why is that the devices on the market that are compatible with 5G networks are slim to non-existent. + +According to O’Donnell, software-defined 5G radios are present on some of the latest Samsung phones and a few handsets made in China, and they’re likely capable of being reconfigured with OTA updates to mesh with any final standard for the millimeter-wave technology that provides 5G’s most impressive connection speeds. Yet that’s not a guarantee. + +“If a new band opened up that nobody foresaw as a possibility, that could cause hiccups,” he said. + +It’s easy to understand the reason behind all the hype. The mobile carriers are eager to tout their cutting-edge technology, and full-fledged 5G will be an undeniably impressive achievement. It will enable a huge range of new wireless applications, and improve overall connectivity for just about every user. But the fact remains that it’s not going to do all that in 2020, and, beyond the limited use case for private implementations of the technology, 5G isn’t something that enterprise users will need to concern themselves with too heavily in the coming year. + +“I fully believe 5G is going to be transformative, but it needs to be built out,” said O’Donnell. “This is going to take time and a lot of money.” + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3488563/5g-in-2020-still-just-a-private-party.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 8fe8ec33f7318b69aebcd5c8f468068999526f94 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 10 Dec 2019 00:58:53 +0800 Subject: [PATCH 014/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191209=20Counti?= =?UTF-8?q?ng=20down=20the=20days=20using=20bash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191209 Counting down the days using bash.md --- ...91209 Counting down the days using bash.md | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 sources/tech/20191209 Counting down the days using bash.md diff --git a/sources/tech/20191209 Counting down the days using bash.md b/sources/tech/20191209 Counting down the days using bash.md new file mode 100644 index 0000000000..27f9a606d3 --- /dev/null +++ b/sources/tech/20191209 Counting down the days using bash.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Counting down the days using bash) +[#]: via: (https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Counting down the days using bash +====== +Need to know how many days there are before some important event? Let Linux bash and the date command help with that! +Thinkstock + +With some pretty important holidays right around the corner, you might need to be reminded how much longer you have to prepare. + +Fortunately, you can get a lot of help from the **date** command. In this post, we’ll look at ways that **date** and bash scripts can tell you how many days there are between today and some event that you’re anticipating. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +First a couple hints at how this is going to work. The **date** command’s **%j** option is going to show you today’s date as a number between 1 and 366. January 1st, as you’d expect, will be displayed as 1 and December 31st will be 365 or 366 depending on whether it’s leap year. Go ahead and try it. You should see something like this: + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +$ date +%j +339 +``` + +You can, however, get the **date** command to give you the day-of-the-year number for _any_ date by supplying it in a **date** command like this: + +``` +$ date -d "Mar 18" +%j +077 +``` + +One important thing to keep in mind is that this command will show you the date in the _current year_ even if that date is in the past. However, you can add a year to the command and fix that: + +``` +$ date -d "Apr 29" +%j +119 +$ date -d "Apr 29 2020" +%j +120 +``` + +In a leap year, Apr 29th will be the 120th day of the year, not the 119th. + +If you want to count down the days until Christmas and don’t want to end up with fingerprints on your wall calendar, you can use a script like this: + +``` +#!/bin/sh + +XMAS=`date -d "Dec 25" +%j` +TODAY=`date +%j` +DAYS=$(($XMAS - $TODAY)) + +case $DAYS in + 0) echo "It's today! Merry Christmas!";; + [0-9]*) echo "$DAYS days remaining";; + -[0-9]*) echo "Oops, you missed it";; +esac +``` + +In this script, we get the day numbers for Dec 25th and today and then subtract one from the other. If the result is positive, we display the number of days remaining. If it’s zero, we issue a “Merry Christmas” message and, if it’s negative, we just tell the person running the script that they missed the holiday. Maybe they got carried away with the egg nog. + +The case statement is made up of ready-to-print statements for remaining-day counts that equal zero, those that that include any digits and those that start with a **-** sign (i.e., in the past). + +The same idea can be generalized for any date that someone wants to keep in focus. In fact, we can ask the person running our script to supply the date and then let them know how many days remain between now and then. This version of the script does just that. + +``` +#!/bin/sh + +echo -n "Enter event date (e.g., June 6): " +read dt +EVENT=`date -d "$dt" +%j` +TODAY=`date +%j` +DAYS=`expr $EVENT - $TODAY` + +case $DAYS in + 0) echo "It's today!";; + [0-9]*) echo "$DAYS days remaining";; + -[0-9]*) echo "Oops, you missed it";; +esac +``` + +One problem you’ll have with this script is that, if the person running it is hoping to find out how many days must pass before they reach a special day the following year, they’ll be disappointed. Even if they supply a year when they enter the date, the date -d command will still only supply the day number in that year, not the days between now and then. + +Calculating the number of days between today and some date years from now can be a bit tricky. You’d need to include all the intervening years and pay attention to those that are leap years. + +### Using Unix (Epoch) time + +Another way to calculate the number of days between now and some special date is to take advantage of the way that Unix systems store dates. If you convert the number of seconds since the start of the day on Jan 1, 1970 to days, you can do this quite easily as in this script: + +``` +#!/bin/bash + +echo -n "Enter target date (e.g., Mar 18 2021)> " +read target_date +today=`echo $(($(date --utc --date "$1" +%s)/86400))` +target=`echo $(($(date --utc --date "$target_date" +%s)/86400))` +days=`expr $target - $today` +echo "$days days until $target_date" +``` + +To explain, 86400 is the number of seconds in a day. Dividing the number of seconds since the epoch began by this number gives us the number of days. + +``` +$ ./countdown +Enter target date (e.g., Mar 18 2021)> Mar 18 2020 +104 days until Mar 18 2020 +``` + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 98e85a7ba2b81739abee274d87ea2d6d9196dcbb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 10 Dec 2019 00:59:38 +0800 Subject: [PATCH 015/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191209=20Data?= =?UTF-8?q?=20centers=20in=202020:=20Automation,=20cheaper=20memory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191209 Data centers in 2020- Automation, cheaper memory.md --- ...ers in 2020- Automation, cheaper memory.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sources/talk/20191209 Data centers in 2020- Automation, cheaper memory.md diff --git a/sources/talk/20191209 Data centers in 2020- Automation, cheaper memory.md b/sources/talk/20191209 Data centers in 2020- Automation, cheaper memory.md new file mode 100644 index 0000000000..fdea7c35c8 --- /dev/null +++ b/sources/talk/20191209 Data centers in 2020- Automation, cheaper memory.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data centers in 2020: Automation, cheaper memory) +[#]: via: (https://www.networkworld.com/article/3487684/data-centers-in-2020-automation-cheaper-memory.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Data centers in 2020: Automation, cheaper memory +====== +As data centers grow in 2020, enterprises will refine the balance between on-premises and cloud resources, adopt AI on servers and try to manage data sprawl effectively. +[Arthur Ogleznev / Unsplash][1] [(CC0)][2] + +It’s that time of year again when those of us in the press make our annual prognostications for the coming year. Some things we saw coming; the rise of the cloud and the advance of SSD. Others, like the return of many cloud migrations to on-premises or the roaring comeback of AMD, went right by us. We do our best but occasionally there are surprises. + +So with that, let’s take a peek into the always cloudy (no pun intended) crystal ball and make 10 data-center-oriented predictions. + +### IoT spawns data-center growth in urban areas + +This isn’t a hard prediction to make since it’s already happening. For the longest time, [data centers][3] were placed in the middle of nowhere near renewable energy (usually hydro), but need is going to force more expansion in major metro areas. [IoT][3] will be one driver but so will the increasing use of data center providers like Equinix and DRT as interconnection providers. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +### Rise of network accelerators + +Big Data and artificial intelligence of all flavors mean enormous amounts of data, and not all of it can be found in one place. Add to it that for now, CPUs are required to power network traffic controllers, thus taking them away from their main job of crunching data. + +So you will see more and more network accelerators coming to market like Mellanox’s [ConnectX line][5] to let CPUs do the job of processing data and accelerators do the job of moving around massive amounts of data faster than is done now. + +### NVMe over fabrics grows + +Non-volatile memory express ([NVMe][6]) is a storage interface, like serial advanced technology attachment (SATA). The downside of SATA is that its legacy is in hard disks so it fails to take full advantage of the speed and parallelism of [SSD][7]s. But early enterprise SSDs had a problem: They could only talk to the physical server in which they were installed. Either that or a server needed storage arrays, which meant network hops, which meant latency. + +NVMe over fabrics ([NVMeoF][8]) is an important advance. It lets an SSD in one server communicate over the network to another drive somewhere else on the network. This direct communication will be vital for improved data movement in enterprise computing and digital transformation. + + * [Backup vs. archive: Why it’s important to know the difference][9] + * [How to pick an off-site data-backup method][10] + * [Tape vs. disk storage: Why isn’t tape dead yet?][11] + * [The correct levels of backup save time, bandwidth, space][12] + + + +### Cheaper storage-class memory + +Storage-class memory is memory that goes in a DRAM slot and can function like DRAM but can also function like an SSD. It has near-DRAM-like speed but has storage capabilities, too, effectively turning it into a cache for SSD. + +Intel and Micron were working on SCM together but parted company. Intel released its SCM product, [Optane][13], in May, and Micron came to market in October with QuantX. South Korean memory giant SK Hynix is also working on a SCM product that’s different from the 3D XPoint technology Micron and Intel use as well. + +All of this should do wonders to advance the technology and hopefully bring the price down. Right now a 512GB stick of Optane runs an insane $8,000. Granted, Xeons sell for even more than that, but after a while it becomes prohibitively expensive to assemble a fully decked-out server. Advancement of the technology and competition should lower prices, which will make this class of memory more attractive to enterprises. + +### AI automation on brand-name servers + +All of the server vendors are adding AI to their systems but Oracle is really taking the lead with its autonomous everything, from the hardware through OS and application and middleware stack. HPE, Dell, and Lenovo will continue to make their own advances as well but the hyperscale-server vendors like Inspur and Supermicro will lag because they have only the hardware stack and have done next to nothing in the OS space. They also are lagging in storage, something the big-three server vendors excel at. + +Oracle may not be a top-five server vendor, but no one can ignore what they are doing in the automation space. Expect the other brand name-vendors to provide their own increasing levels of automation. + +### Cloud migrations slow + +Remember when everyone was looking forward to shutting down their data centers entirely and moving to the cloud? So much for that idea. IDC’s latest CloudPulse survey suggests that 85% of enterprises plan to move workload from public to private environments over the next year. And a recent survey by Nutanix found 73% of respondents reported that they are moving some applications off the public cloud and back on-prem. Security was cited as the primary reason. + +And since it’s doubtful security will ever be good enough for some companies and some data, it seems the mad rush to the cloud will likely slow a little as people become more picky about what they put in the cloud and what they keep behind their firewall. + +### Data sprawl, Part 1 + +Most data is not where it should be, according to IDC. Only 10% of corporate data is “hot” –  data that is repeatedly accessed and used – while 30% is “warm ” – used semi-regularly – and the other 60% belongs in cold storage where it is rarely if ever accessed. + +But the problem is that data is scattered all over the place and often in the wrong tier. Many storage firms have focused on deduplication but not on storage tiers. A startup called Spectra Logic is targeting that very problem, and I suspect it won’t be the last firm to make such an effort. If it really takes off, I expect HPE and Dell to lock horns over the company, too. + +### Data sprawl, Part 2 + +IDC [predicts][14] the total global data haul to weigh in at 175 zettabytes by 2025, and we are already at 32ZB of data, much of it useless. There was a time when data warehousing ruled that data was sorted and processed and stored as something useful. Now people fill data lakes with an endless supply of data from a growing number of sources, like social media and IoT. + +Sooner or later, something will have to give. People will take a look at petabytes of data-lake junk and say enough is enough and start to become considerably more picky about what they store. They will question the rationale behind spending a fortune on hard disks and storage arrays to store vast quantities of unused and valueless data. The pendulum will swing back to the data-warehouse model of keeping usable data. It has to or people will be overwhelmed. + +### More servers with a mix of processors + +Ten years ago, it didn’t matter if your definition of a server was a single-socket Xeon tower sitting under a desk or four-socket rack-mount in a seven-foot cabinet, they were defined by an x86 processor. But now we are seeing more server designs with on-board GPUs, Arm processors, AI accelerators, and network accelerators. + +This will require some changes in server designs. First, liquid cooling will become more necessary with this multitude of chips running faster and hotter and in an enclosed space. Second, the software stack will need to be more robust to handle all these chips, requiring some work on the part of Microsoft and the Linux distros. + +### IT workload will change + +Don’t think that automation means you can sit around playing games on your iPhone. Thanks to their ever-evolving systems, IT pros will have a bunch of new headaches including: + + * Combating shadow IT + * Addressing digital transformation + * Developing AI strategies to keep up with competitors + * Reacting appropriately to the fallout from new AI strategies + * Maintaining security governance across the company + * Handling an increasing inflow of data and figuring out what to do with it + * Responding faster than ever to customers and to company reputation on social media + + + +Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3487684/data-centers-in-2020-automation-cheaper-memory.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/rWDumHFt8E8 +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3433924/mellanox-introduces-smartnics-to-eliminate-network-load-on-cpus.html +[6]: https://www.networkworld.com/article/3280991/what-is-nvme-and-how-is-it-changing-enterprise-storage.html +[7]: https://www.networkworld.com/article/3326058/what-is-an-ssd.html +[8]: https://www.networkworld.com/article/3394296/nvme-over-fabrics-creates-data-center-storage-disruption.html +[9]: https://www.networkworld.com/article/3285652/storage/backup-vs-archive-why-its-important-to-know-the-difference.html +[10]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html +[11]: https://www.networkworld.com/article/3315156/storage/tape-vs-disk-storage-why-isnt-tape-dead-yet.html +[12]: https://www.networkworld.com/article/3302804/storage/the-correct-levels-of-backup-save-time-bandwidth-space.html +[13]: https://www.networkworld.com/article/3279271/intel-launches-optane-the-go-between-for-memory-and-storage.html +[14]: https://www.networkworld.com/article/3325397/idc-expect-175-zettabytes-of-data-worldwide-by-2025.html +[15]: https://www.facebook.com/NetworkWorld/ +[16]: https://www.linkedin.com/company/network-world From ac5660cd459f994f0c01a11d227b8bff5fb9422d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 10 Dec 2019 00:59:57 +0800 Subject: [PATCH 016/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191209=20Google?= =?UTF-8?q?=20Cloud=20bare-metal=20initiative=20targets=20migrating=20lega?= =?UTF-8?q?cy=20apps=20from=20on-prem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191209 Google Cloud bare-metal initiative targets migrating legacy apps from on-prem.md --- ...gets migrating legacy apps from on-prem.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/talk/20191209 Google Cloud bare-metal initiative targets migrating legacy apps from on-prem.md diff --git a/sources/talk/20191209 Google Cloud bare-metal initiative targets migrating legacy apps from on-prem.md b/sources/talk/20191209 Google Cloud bare-metal initiative targets migrating legacy apps from on-prem.md new file mode 100644 index 0000000000..bb87e12189 --- /dev/null +++ b/sources/talk/20191209 Google Cloud bare-metal initiative targets migrating legacy apps from on-prem.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Google Cloud bare-metal initiative targets migrating legacy apps from on-prem) +[#]: via: (https://www.networkworld.com/article/3487626/google-cloud-bare-metal-initiative-targets-migrating-legacy-apps-from-on-prem.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Google Cloud bare-metal initiative targets migrating legacy apps from on-prem +====== +Google Cloud now offers Google Bare Metal Solution, a service that supplies hardware in the cloud for enterprises that want full control of the entire stack from operating system on up to their most important legacy apps. +Google + +In the cloud-services market, [bare metal offerings][1] have lagged behind virtualized ones, mostly because the use of the cloud for things like elastic apps and developer environments are better suited to instances with a native operating system. + +The term “bare metal” simply means no software of any kind, not even a [hypervisor][2]. Customers provide their own operating environments, and the provider offers nothing more than CPUs, memory, and storage. Up to now, IBM has led the charge with bare-metal services because SoftLayer, the major data-center provider it acquired in 2014, was heavily involved in that business. + +Now Google Cloud is going after that market, especially targeting “lift and shift” of an entire operating environment – OS, hypervisor, apps, and data -- from on-premises data centers to the cloud. + +[][3] + +BrandPost Sponsored by HPE + +[HPE Synergy For Dummies][3] + +Here’s how IT can provide an anytime, anywhere, any workload infrastructure. + +Google [recently announced][4] the Google Bare Metal Solution for legacy applications that must run on dedicated hardware and have strict hardware certification requirements, as well as dedicated, low-latency and highly resilient interconnects, and connections to all native Google Cloud services. + +Bare Metal Solution uses OEM hardware that is certified for many ISV software applications as well as custom-built applications, with Oracle Database the one commercial software product specifically named. The hardware is a bit of a mystery, since Google, like most hyperscale data-center operators, uses off-brand hardware from Gigabyte, Inspur, and Supermicro, but it’s usually hardware from HPE, Dell, and Lenovo that gets those kinds of certifications. Not that the white-box brands don’t have it, but it’s usually not as much of a priority for them. + +These hardware configurations are offered as a subscription, billed monthly with a preferred term length of 36 months, which means they want you to stick around a while. There are no data ingress and egress charges between Bare Metal Solution and Google Cloud in the same region, however for now, Bare Metal Solutions are only available in East Coast data centers. + +Moving an Oracle database to the cloud isn’t trivial. If the database stretches into the petabytes, that could get very expensive. Not to mention Oracle is doing its darnedest to keep that business by making it easier for customers to migrate their databases into Oracle’s cloud infrastructure. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][5] + +Storage comes in 1TB increments, either a mix of HDD and SSD or all-flash. As for the rest of the configurations: + +Dual-socket x86 systems + + * 16 core with 384 GB DRAM + * 24 core with 768 GB DRAM + * 56 core with 1536 GB DRAM + + + +Quad-socket x86 systems + + * 56 core with 1536 GB DRAM + * 112 core with 3072 GB DRAM + + + +Other benefits of the service are: + + * End-to-end infrastructure management such as compute, storage and networking, as well as fully managed and monitored environments such as power, cooling and facilities. + * Support for infrastructure, including defined SLAs for initial response; 24X7 coverage for all Priority 1 and 2 issues; unified billing across Google Cloud and Bare Metal Solution. + * Enterprise-grade SLAs for hardware uptime and interconnect availability. + + + +Bare metal has its appeal but caveats, too. The allure of the cloud is its bursty elasticity. Many on-prem apps are used to running all out for much if not all of the day. In a cloud setting that can get expensive in a hurry, so it’s up to IT staff to decide if it’s a good idea to migrate an Oracle database to the cloud. If it's serving up reads and writes constantly, any savings from moving it off premises will be immediately offset by paying to run it at high utilization in the cloud. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3487626/google-cloud-bare-metal-initiative-targets-migrating-legacy-apps-from-on-prem.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3261113/why-a-bare-metal-cloud-provider-might-be-just-what-you-need.html +[2]: https://www.networkworld.com/article/3243262/what-is-a-hypervisor.html +[3]: https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE19718&utm_content=sidebar (HPE Synergy For Dummies) +[4]: https://cloud.google.com/blog/products/gcp/bare-metal-solution-enabling-specialized-workloads-in-google-cloud +[5]: https://www.networkworld.com/newsletters/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 730d08333dc0d068abe0d592e81030fdc7d77591 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 10 Dec 2019 01:34:48 +0800 Subject: [PATCH 017/676] translating --- ... Logical operators and shell expansions.md | 116 +++++++++--------- 1 file changed, 60 insertions(+), 56 deletions(-) diff --git a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md index 5cfef23305..a12d370214 100644 --- a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md +++ b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -1,29 +1,29 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to program with Bash: Logical operators and shell expansions) -[#]: via: (https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions) -[#]: author: (David Both https://opensource.com/users/dboth) +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How to program with Bash: Logical operators and shell expansions" +[#]: via: "https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions" +[#]: author: "David Both https://opensource.com/users/dboth" -How to program with Bash: Logical operators and shell expansions +Bash 编程教程:逻辑操作符和 shell 扩展 ====== -Learn about logical operators and shell expansions, in the second -article in this three-part series on programming with Bash. + +学习逻辑操作符和 shell 扩展,本文是Bash 编程系列(三篇文章)的第二篇。 ![Women in computing and open source v5][1] -Bash is a powerful programming language, one perfectly designed for use on the command line and in shell scripts. This three-part series (which is based on my [three-volume Linux self-study course][2]) explores using Bash as a programming language on the command-line interface (CLI). +Bash 是一种强大的编程语言,完美契合命令行和 shell 脚本。本系列(三篇文章,基于我的 [Linux 自学课程三卷][2])讲解如何在 CLI 使用 Bash 编程。 -The [first article][3] explored some simple command-line programming with Bash, including using variables and control operators. This second article looks into the types of file, string, numeric, and miscellaneous logical operators that provide execution-flow control logic and different types of shell expansions in Bash. The third and final article in the series will explore the **for**, **while**, and **until** loops that enable repetitive operations. +[第一篇文章][3] 讲解了 Bash 的一些简单命令行操作,包括如何使用变量和控制操作符。第二篇文章探讨文件、字符串、数字等类型和各种各样在执行流中提供控制逻辑的的逻辑运算符,还有 Bash 中的各类 shell 扩展。本系列第三篇也是最后一篇文章,将会探索能重复执行操作的 **for** 、**while** 和 **until** 循环。 -Logical operators are the basis for making decisions in a program and executing different sets of instructions based on those decisions. This is sometimes called flow control. +逻辑操作符是程序中判断的根本要素,也是执行不同的语句组合的依据。有时这也被称为流控制。 -### Logical operators +### 逻辑操作符 -Bash has a large set of logical operators that can be used in conditional expressions. The most basic form of the **if** control structure tests for a condition and then executes a list of program statements if the condition is true. There are three types of operators: file, numeric, and non-numeric operators. Each operator returns true (0) if the condition is met and false (1) if the condition is not met. +Bash 中有大量的用于不同条件表达式的逻辑操作符。最基本的是 **if** 控制结构,它判断一个条件,如果条件为真,就执行一些了程序语句。操作符共有三类:文件,数字和非数字操作符。如果条件为真,所有的操作符返回 true(0),如果条件为假,返回 false (1)。 -The functional syntax of these comparison operators is one or two arguments with an operator that are placed within square braces, followed by a list of program statements that are executed if the condition is true, and an optional list of program statements if the condition is false: +这些比较操作符的函数语法是,一个操作符加一个或两个参数放在中括号内,后面跟一系列程序语句,如果条件为真,程序语句执行,可能会有另一个程序语句 list,该 list 在条件为假时执行: ``` @@ -32,54 +32,54 @@ or if [ arg1 operator arg2 ] ; then list ; else list ; fi ``` -The spaces in the comparison are required as shown. The single square braces, **[** and **]**, are the traditional Bash symbols that are equivalent to the **test** command: +像例子中那样,在比较表达式中,空格不能省略。中括号的每部分,**[** 和 **]**,是跟 **test** 命令一样的传统的 Bash 符号: ``` `if test arg1 operator arg2 ; then list` ``` -There is also a more recent syntax that offers a few advantages and that some sysadmins prefer. This format is a bit less compatible with different versions of Bash and other shells, such as ksh (the Korn shell). It looks like: +还有一个更新的语法能提供一点点便利,一些系统管理员比较喜欢用。这种格式对于不同版本的 Bash 和一些 shell 如 ksh(the Korn shell)兼容性稍差。格式如下: ``` `if [[ arg1 operator arg2 ]] ; then list` ``` -#### File operators +#### 文件操作符 -File operators are a powerful set of logical operators within Bash. Figure 1 lists more than 20 different operators that Bash can perform on files. I use them quite frequently in my scripts. +文件操作符是 Bash 中一系列强大的逻辑操作符。图表1列出了 20 多种不同的 Bash 处理文件的操作符。在我的脚本中使用频率很高。 Operator | Description ---|--- --a filename | True if the file exists; it can be empty or have some content but, so long as it exists, this will be true --b filename | True if the file exists and is a block special file such as a hard drive like **/dev/sda** or **/dev/sda1** --c filename | True if the file exists and is a character special file such as a TTY device like **/dev/TTY1** --d filename | True if the file exists and is a directory --e filename | True if the file exists; this is the same as **-a** above --f filename | True if the file exists and is a regular file, as opposed to a directory, a device special file, or a link, among others --g filename | True if the file exists and is **set-group-id**, **SETGID** +-a filename | 如果文件存在,返回 true;文件可以为空也可以有内容,但是只要它存在,就返回 true +-b filename | 如果文件存在且是一个块设备如**/dev/sda** or **/dev/sda1**,则返回 true +-c filename | 如果文件存在且是一个字符设备如**/dev/TTY1**,则返回 true +-d filename | 文件存在且是一个目录,返回 true +-e filename | 文件存在,返回 true;与上面的 **-a** 相同 +-f filename | 文件存在且是一个一般文件,不是目录、设备文件或链接等的其他的文件,则返回 true +-g filename | 文件存在且 **SETGID** 标记被设置在其上,返回 true -h filename | True if the file exists and is a symbolic link -k filename | True if the file exists and its "sticky'" bit is set --p filename | True if the file exists and is a named pipe (FIFO) --r filename | True if the file exists and is readable, i.e., has its read bit set --s filename | True if the file exists and has a size greater than zero; a file that exists but that has a size of zero will return false --t fd | True if the file descriptor **fd** is open and refers to a terminal --u filename | True if the file exists and its **set-user-id** bit is set --w filename | True if the file exists and is writable --x filename | True if the file exists and is executable --G filename | True if the file exists and is owned by the effective group ID --L filename | True if the file exists and is a symbolic link --N filename | True if the file exists and has been modified since it was last read --O filename | True if the file exists and is owned by the effective user ID +-p filename | 文件存在且是一个命名的管道(FIFO),返回 true +-r filename | 文件存在且有可读权限,如它的可读位被设置,返回 true +-s filename | 文件存在且大小大于 0,返回 true;如果一个文件存在但大小为 0,则返回 false +-t fd | 文件描述符 **fd** 被打开且被关联到一个终端设备上,返回 true +-u filename | 文件存在且它的**set-user-id** 位被设置,返回 true +-w filename | 文件存在且有可写权限,返回 true +-x filename | 文件存在且有可执行权限,返回 true +-G filename | 文件存在且文件的 group ID 与当前用户相同,返回 true +-L filename | 文件存在且是一个符号链接,返回 true +-N filename | 文件存在且从文件上一次被读取到现在为止, 文件被修改过,返回 true +-O filename | 文件存在且你是文件的拥有者,返回 true -S filename | True if the file exists and is a socket -file1 -ef file2 | True if file1 and file2 refer to the same device and iNode numbers -file1 -nt file2 | True if file1 is newer (according to modification date) than file2, or if file1 exists and file2 does not -file1 -ot file2 | True if file1 is older than file2, or if file2 exists and file1 does not +file1 -ef file2 | 文件`file1`和 文件`file2`是相同文件的硬链接,返回 true +file1 -nt file2 | 文件 file1 比 file2 新(根据修改日期),或 file1 存在而 file2 不存在 +file1 -ot file2 | 文件 file1 比 file2 旧(根据修改日期),或 file1 不存在而 file2 存在 -_**Fig. 1: The Bash file operators**_ +_**Fig.1:Bash 文件操作符**_ -As an example, start by testing for the existence of a file: +以测试一个文件存在与否来举例: ``` @@ -88,14 +88,14 @@ The file TestFile1 does not exist. [student@studentvm1 testdir]$ ``` -Next, create a file for testing named **TestFile1**. For now, it does not need to contain any data: +创建一个用来测试的文件,命名为 **TestFile1**。目前它不需要包含任何数据: ``` `[student@studentvm1 testdir]$ touch TestFile1` ``` -It is easy to change the value of the **$File** variable rather than a text string for the file name in multiple locations in this short CLI program: +在这个简短的 CLI 程序中, 修改 **$File** 变量的值相比于在多个地方修改表示文件名的字符串的值要容易: ``` @@ -104,7 +104,7 @@ The file TestFile1 exists. [student@studentvm1 testdir]$ ``` -Now, run a test to determine whether a file exists and has a non-zero length, which means it contains data. You want to test for three conditions: 1. the file does not exist; 2. the file exists and is empty; and 3. the file exists and contains data. Therefore, you need a more complex set of tests—use the **elif** stanza in the **if-elif-else** construct to test for all of the conditions: +现在,运行一个测试来判断一个文件是否存在且长度不为 0(表示它包含数据)。假设你想判断三种情况:1. 文件不存在;2. 文件存在且为空;3. 文件存在且包含数据。因此,你需要一组更负责的测试代码 — 为了测试所有的情况在 **if-elif-else** 结构中使用 **elif** 语句: ``` @@ -112,16 +112,16 @@ Now, run a test to determine whether a file exists and has a non-zero length, wh [student@studentvm1 testdir]$ ``` -In this case, the file exists but does not contain any data. Add some data and try again: +在本案例中,文件存在但不包含任何数据。向文件添加一些数据再运行一次: ``` -[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; fi +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; fi TestFile1 exists and contains data. [student@studentvm1 testdir]$ ``` -That works, but it is only truly accurate for one specific condition out of the three possible ones. Add an **else** stanza so you can be somewhat more accurate, and delete the file so you can fully test this new code: +这组语句能返回正常的结果,但是仅仅是在我们已知三种可能的情况下测试某种确切的条件。添加一段 **else** 语句,这样你就可以更精确地测试。把文件删掉,你就可以完整地测试这段新代码: ``` @@ -129,7 +129,7 @@ That works, but it is only truly accurate for one specific condition out of the TestFile1 does not exist or is empty. ``` -Now create an empty file to test: +现在创建一个空文件用来测试: ``` @@ -137,7 +137,7 @@ Now create an empty file to test: TestFile1 does not exist or is empty. ``` -Add some content to the file and test again: +向文件添加一些内容,然后再测试一次: ``` @@ -145,7 +145,7 @@ Add some content to the file and test again: TestFile1 exists and contains data. ``` -Now, add the **elif** stanza to discriminate between a file that does not exist and one that is empty: +现在加入 **elif** 语句来辨别是文件不存在还是文件为空: ``` @@ -160,6 +160,10 @@ Now you have a Bash CLI program that can test for these three different conditio It is easier to see the logic structure of the more complex compound commands if you arrange the program statements more like you would in a script that you can save in a file. Figure 2 shows how this would look. The indents of the program statements in each stanza of the **if-elif-else** structure help to clarify the logic. +现在你有一个可以测试这三种情况的 Bash CLI 程序,但是可能的情况是无限的。 + +如果你能像保存在文件中的脚本那样书写程序语句,那么对于即使更复杂的命令组合也会很容易看出它们的逻辑结构。图表 2 就是一个示例。 **if-elif-else** 结构中每一部分的程序语句的缩进让逻辑更变得清晰。 + ``` File="TestFile1" @@ -175,9 +179,9 @@ else fi ``` -_**Fig. 2: The command line program rewritten as it would appear in a script**_ +_**Fig. 2: 像在脚本里一样重写书写命令行程序**_ -Logic this complex is too lengthy for most CLI programs. Although any Linux or Bash built-in commands may be used in CLI programs, as the CLI programs get longer and more complex, it makes more sense to create a script that is stored in a file and can be executed at any time, now or in the future. +对于大多数 CLI 程序来说,让这些复杂的命令变得有逻辑需要写很长的代码。虽然 CLI 可能是用 Linux 或 Bash 内置的命令,但是当 CLI 程序很长或很复杂时,创建一个脚本保存在一个文件中将更有效,保存到文件中后,可以随时运行。 #### String comparison operators @@ -493,6 +497,6 @@ via: https://opensource.com/article/19/10/programming-bash-logical-operators-she [a]: https://opensource.com/users/dboth [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_5.png?itok=YHpNs_ss (Women in computing and open source v5) +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_5.png?itok=YHpNs_ss "Women in computing and open source v5" [2]: http://www.both.org/?page_id=1183 [3]: https://opensource.com/article/19/10/programming-bash-part-1 From b6237e54ec5858f9324c92ba980d1ac4931069f4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Dec 2019 08:54:28 +0800 Subject: [PATCH 018/676] PUB @geekpi https://linux.cn/article-11660-1.html --- ...hy use the Pantheon desktop for Linux Elementary OS.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename {translated/tech => published}/20191203 Why use the Pantheon desktop for Linux Elementary OS.md (96%) diff --git a/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md similarity index 96% rename from translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md rename to published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md index 0963892604..208bb6a90a 100644 --- a/translated/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md +++ b/published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11660-1.html) [#]: subject: (Why use the Pantheon desktop for Linux Elementary OS) [#]: via: (https://opensource.com/article/19/12/pantheon-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -为何在 Elementary OS 中使用 Pantheon 桌面 +为何 Elementary OS 中使用 Pantheon 桌面 ====== > 本文是 Linux 桌面特别系列的一部分。通过在 Elementary OS 上运行 Pantheon 桌面获得广受喜爱的 Mac OS 特性。 -![A person programming][1] +![](https://img.linux.net.cn/data/attachment/album/201912/10/085342dfgngrpt6sgzl3af.jpg) 你愿意为 Linux 桌面支付 20 美元吗?事实上,我会在下载自由软件时选择支付更多的钱!我这样做的原因是开源是值得的。对于 [Elementary OS][2] 的拷贝,默认价格是 20 美元(你可以选择 1 美元,如果你无法负担,你甚至可以用 0 美元下载)。作为回报,你将获得一个出色且精心制作的发行版,同时拥有它自己的 Pantheon 桌面设计。 From 438bc87f5c9932e4039d4142c952997e6871eff4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 10 Dec 2019 08:56:16 +0800 Subject: [PATCH 019/676] translated --- ...ava vs. Python- Which should you choose.md | 157 ------------------ ...ava vs. Python- Which should you choose.md | 156 +++++++++++++++++ 2 files changed, 156 insertions(+), 157 deletions(-) delete mode 100644 sources/talk/20191204 Java vs. Python- Which should you choose.md create mode 100644 translated/talk/20191204 Java vs. Python- Which should you choose.md diff --git a/sources/talk/20191204 Java vs. Python- Which should you choose.md b/sources/talk/20191204 Java vs. Python- Which should you choose.md deleted file mode 100644 index edc59c7b3d..0000000000 --- a/sources/talk/20191204 Java vs. Python- Which should you choose.md +++ /dev/null @@ -1,157 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Java vs. Python: Which should you choose?) -[#]: via: (https://opensource.com/article/19/12/java-vs-python) -[#]: author: (Archit Modi https://opensource.com/users/architmodi) - -Java vs. Python: Which should you choose? -====== -Compare the two most popular programming languages in the world, and let -us know which one you prefer in our poll. -![Developing code.][1] - -Let's compare the two most popular and powerful programming languages in the world: Java and Python! Both languages have huge community support and libraries to perform almost any programming task, although selecting a programming language usually depends on the developer's use case. After you compare and contrast, please make sure to answer our poll to [share your opinion][2] on which is best. - -### What is it? - - * **Java** is a general-purpose object-oriented programming language used mostly for developing a wide range of applications from mobile to web to enterprise apps. - * **Python** is a high-level object-oriented programming language used mostly for web development, artificial intelligence, machine learning, automation, and other data science applications. - - - -### Creator - - * **Java** was created by James Gosling (Sun Microsystems). - * **Python** was created by Guido van Rossum. - - - -### Open source status - - * **Java** is free and (mostly) open source except for corporate use. - * **Python** is free and open source for all use cases. - - - -### Platform dependencies - - * **Java** is platform-independent (although JVM isn't) per its WORA ("write once, run anywhere") philosophy. - * **Python** is platform-dependent. - - - -### Compiled or interpreted - - * **Java** is a compiled language. Java programs are translated to byte code at compile time and not runtime. - * **Python** is an interpreted language. Python programs are translated at runtime. - - - -### File creation - - * **Java**: After compilation, **<filename>.class** is generated. - * **Python**: During runtime, **<filename>.pyc** is created. - - - -### Errors types - - * **Java** has ****2 ****types of errors: compile and runtime errors. - * **Python** has 1 error type: traceback (or runtime) error. - - - -### Statically or dynamically typed - - * **Java** is statically typed. When initiating variables, their types need to be specified in the program because type checking is done at compile time. - * **Python** is dynamically typed. Variables don't need to have a type specified when initiated because type checking is done at runtime. - - - -### Syntax - - * **Java**: Every statement needs to end with a semicolon ( **;** ), and blocks of code are separated by curly braces ( **{}** ). - * **Python**: Blocks of code are separated by indentation (the user can choose how many white spaces to use, but it should be consistent throughout the block). - - - -### Number of classes - - * **Java**: Only one public top-level class can exist in a single file in Java. - * **Python**: Any number of classes can exist in a single file in Python. - - - -### More or less code? - - * **Java** generally involves writing more lines of code compared to Python. - * **Python** involves writing fewer lines of code compared to Java. - - - -### Multiple inheritance - - * **Java** does not support multiple inheritance (inheriting from two or more base classes) - * **Python** supports multiple inheritance although it is rarely implemented due to various issues like inheritance complexity, hierarchy, dependency issues, etc. - - - -### Multi-threading - - * **Java** multi-threading can support two or more concurrent threads running at the same time. - * **Python** uses a global interpreter lock (GIL), allowing only a single thread (CPU core) to run at a time. - - - -### Execution speed - - * **Java** is usually faster in execution time than Python. - * **Python** is usually slower in execution time than Java. - - - -### Hello world in Java - - -``` -public class Hello { -   public static void main([String][3][] args) { -      [System][4].out.println("Hello Opensource.com from Java!"); -   } -} -``` - -### Hello world in Python - - -``` -`print("Hello Opensource.com from Java!")` -``` - -### Run the programs - -![Java vs. Python][5] - -To run the java program "Hello.java" you need to compile it first which creates a "Hello.class" file. To run just the class name, use "java Hello." For Python, you would just run the file "python3 helloworld.py." - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/java-vs-python - -作者:[Archit Modi][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/architmodi -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_development_programming.png?itok=M_QDcgz5 (Developing code.) -[2]: tmp.Bpi8QYfp8j#poll -[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string -[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system -[5]: https://opensource.com/sites/default/files/uploads/python-java-hello-world_0.png (Java vs. Python) diff --git a/translated/talk/20191204 Java vs. Python- Which should you choose.md b/translated/talk/20191204 Java vs. Python- Which should you choose.md new file mode 100644 index 0000000000..3dbe4bb50e --- /dev/null +++ b/translated/talk/20191204 Java vs. Python- Which should you choose.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Java vs. Python: Which should you choose?) +[#]: via: (https://opensource.com/article/19/12/java-vs-python) +[#]: author: (Archit Modi https://opensource.com/users/architmodi) + +Java vs. Python:你应该选择哪个? +====== +比较世界上最流行的两种编程语言,并在投票中让我们知道你喜欢哪一个。 +![Developing code.][1] + +让我们比较一下世界上两种最受欢迎、最强大的编程语言:Java 和 Python!这两种语言有巨大的社区支持和库来执行几乎任何编程任务,尽管选择编程语言通常取决于开发人员的场景。在比较和对比之后,请投票[分享你的观点][2]。 + +### 是什么? + + * **Java** 是一门通用面向对象的编程语言,主要用于开发从移动端到 Web 到企业级应用的各种应用。 + * **Python** 是一门高级面向对象的编程语言,主要用于 Web 开发、人工智能、机器学习、自动化和其他数据科学应用。 + + + +### 创建者 + + * **Java** 是由 James Gosling(Sun Microsystems)创造的。 + * **Python** 是由 Guido van Rossum 创造的。 + + + +### 开源状态 + + * **Java** 是免费的,(大部分)开源,但商业用途除外。 + * **Python** 所有场景均免费。 + + + +### 平台依赖 + + * **Java** 根据它的 WORA (”一次编写,到处运行“)哲学,它是平台无关的。 + * **Python** 依赖于平台。 + + + +### 编译或解释 + + * **Java** 是一门编译语言。Java 程序在编译时转换为字节码,而不是运行时。 + * **Python** 是一门解释性语言。Python 程序在运行时进行解释。 + + + +### 文件创建 + + * **Java**:编译后生成 **<filename>.class** 文件。 + * **Python**:在运行期,创建 **<filename>.pyc** 文件 + + + +### 错误类型 + + * **Java** 有 2 种错误类型:编译和运行时错误。 + * **Python** 有 1 种错误类型:回溯(或运行时)错误。 + + + +### 静态或动态类型 + + * **Java** 是静态类型。当初始化变量时,需要在程序中指定变量的类型,因为类型检查是在编译时完成的。 + * **Python** 是动态类型。变量不需要在初始化时指定类型,因为类型检查是在运行时完成的。 + + + +### 语法 + + * **Java**:每个语句都需要以分号 (\*; ) 结尾,并且代码块由大括号 ( {} ) 分隔。 + * **Python**:代码块通过缩进分隔(用户可以选择要使用的空格数,但在整个块中应保持一致)。 + + + +### 类的数量 + + * **Java**:在 Java 中的单个文件中只能存在一个公有顶级类。 + * **Python**:Python 中的单个文件中可以存在任意数量的类。 + + + +### 代码更多或更少? + + * **Java** 通常比 Python 要写更多代码行。 + * **Python**通常比 Java 要写更少代码行。 + + + +### 多重继承 + + * **Java** 不支持多重继承(从两个或多个基类继承)。 + * **Python** 支持多重继承,但由于继承复杂性、层次结构、依赖等各种问题,它很少实现。 + + + +### 多线程 + + * **Java** 多线程可以支持同时运行的两个或多个并发线程。 + * **Python** 使用全局解释器锁 (GIL),一次只允许运行单个线程 ( CPU 核)。 + + + +### 执行速度 + + * **Java** 的执行时间通常比 Python 快。 + * **Python** 的执行时间通常比 Java 慢。 + + + +### Java 的 Hello world + + +``` +public class Hello { +   public static void main([String][3][] args) { +      [System][4].out.println("Hello Opensource.com from Java!"); +   } +} +``` + +### Python 的 Hello world + + +``` +`print("Hello Opensource.com from Java!")` +``` + +### 运行程序 + +![Java vs. Python][5] + +要运行 java 程序 ”Hello.java“,你需要先编译它,这将创建一个 ”Hello.class“ 文件。只需运行类名 ”java Hello“。对于 Python,只需运行文件 ”python3 helloworld.py“。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/java-vs-python + +作者:[Archit Modi][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/architmodi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_development_programming.png?itok=M_QDcgz5 (Developing code.) +[2]: tmp.Bpi8QYfp8j#poll +[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[5]: https://opensource.com/sites/default/files/uploads/python-java-hello-world_0.png (Java vs. Python) From 9ffe738259d30d02dfb58546be2a36eea38b0024 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 10 Dec 2019 09:04:24 +0800 Subject: [PATCH 020/676] translating --- .../20191207 Getting started with the GNOME Linux desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191207 Getting started with the GNOME Linux desktop.md b/sources/tech/20191207 Getting started with the GNOME Linux desktop.md index 43b15042c9..128dd70de6 100644 --- a/sources/tech/20191207 Getting started with the GNOME Linux desktop.md +++ b/sources/tech/20191207 Getting started with the GNOME Linux desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 075ff1f143c334744013497330aba6be132dc4eb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Dec 2019 09:38:26 +0800 Subject: [PATCH 021/676] PRF @lxbwolf --- ...e is up or down from the Linux Terminal.md | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md b/translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md index 39e12ca4a3..d59d927423 100644 --- a/translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md +++ b/translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md @@ -1,24 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (6 Methods to Quickly Check if a Website is up or down from the Linux Terminal) [#]: via: (https://www.2daygeek.com/linux-command-check-website-is-up-down-alive/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -在 Linux Terminal 快速检测网站是否宕机的 6 个方法 +在 Linux 终端快速检测网站是否宕机的 6 个方法 ====== -本教程教你怎样在 Linux terminal 快速检测一个网站是否宕机。 +> 本教程教你怎样在 Linux 终端快速检测一个网站是否宕机。 -你可能已经了解了一些类似的命令,像 ping,curl 和 wget。我们在本教程中又加入了一些其他命令。同时,对于要检测单个和多个主机的信息我们也加入了不同的选项。 +![](https://img.linux.net.cn/data/attachment/album/201912/10/093801u332115oocxz4531.jpg) -本文将帮助你检测网站是否宕机。但是如果你在维护一个网站,希望网站宕掉时得到实时的报警,我推荐你去使用实时网站监控工具。这种工具有很多,有些是免费的,大部分收费。根据你的需求,选择合适的工具。在后续的文章中我们会涉及这个主题。 +你可能已经了解了一些类似的命令,像 `ping`、`curl` 和 `wget`。我们在本教程中又加入了一些其他命令。同时,我们也加入了不同的选项来检测单个和多个主机的信息。 + +本文将帮助你检测网站是否宕机。但是如果你在维护一些网站,希望网站宕掉时得到实时的报警,我推荐你去使用实时网站监控工具。这种工具有很多,有些是免费的,大部分收费。根据你的需求,选择合适的工具。在后续的文章中我们会涉及这个主题。 ### 方法 1:使用 fping 命令检测一个网站是否宕机 -**[fping 命令][1]** 是一个类似 ping 的程序,使用互联网控制消息协议回应请求报文(ICMP echo request)来判断目标主机是否能回应。fping 与 ping 的不同之处在于它可以并行地 ping 任意数量的主机,也可以从一个文本文件读入主机。fping 发送一个 ICMP echo request 后不等待目标主机响应,就以 round-robin 模式向下一个目标主机发请求。如果一个目标主机有响应,那么它就被标记为存活的(active)然后从检查目标列表里去掉。如果一个目标主机在限定的时间和(或)重试次数内没有响应,则被指定为网站无法到达(unreachable)。 +[fping 命令][1] 是一个类似 `ping` 的程序,使用互联网控制消息协议(ICMP)的回应请求报文echo request来判断目标主机是否能回应。`fping` 与 `ping` 的不同之处在于它可以并行地 `ping` 任意数量的主机,也可以从一个文本文件读入主机名称。`fping` 发送一个 ICMP 回应请求后不等待目标主机响应,就以轮询模式向下一个目标主机发请求。如果一个目标主机有响应,那么它就被标记为存活的,然后从检查目标列表里去掉。如果一个目标主机在限定的时间和(或)重试次数内没有响应,则被指定为网站无法到达的。 ``` # fping 2daygeek.com linuxtechnews.com magesh.co.in @@ -30,7 +32,7 @@ magesh.co.in is alive ### 方法 2:使用 http 命令检测一个网站是否宕机 -HTTPie(读作 aitch-tee-tee-pie)是一个命令行 HTTP 客户端。**[httpie tool][2]** 是一个可以与 web 服务通过 CLI(command-line interface)进行交互的现代工具。httpie tool 提供了简单的 http 命令,可以通过发送简单的、自然语言语法的任意 HTTP 请求得到多彩的结果输出。HTTPie 可以用来对 HTTP 服务器进行测试、调试和基本的交互。 +HTTPie(读作 aitch-tee-tee-pie)是一个命令行 HTTP 客户端。[httpie][2] 是一个可以与 web 服务通过 CLI 进行交互的现代工具。httpie 工具提供了简单的 `http` 命令,可以通过发送简单的、自然语言语法的任意 HTTP 请求得到多彩的结果输出。HTTPie 可以用来对 HTTP 服务器进行测试、调试和基本的交互。 ``` # http 2daygeek.com @@ -49,7 +51,7 @@ Vary: Accept-Encoding ### 方法 3:使用 curl 命令检测一个网站是否宕机 -**[curl 命令](https://www.2daygeek.com/curl-linux-command-line-download-manager/)** 是一个用于在服务器间通过支持的协议(DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET 和 TFTP)传输数据的工具。这个工具不支持用户交互。curl 也支持使用代理、用户认证、FTP 上传、HTTP post、SSL 连接、cookies、断点续传、Metalink等等。curl 由 libcurl 库提供所有与传输有关的能力。 +[curl 命令][3] 是一个用于在服务器间通过支持的协议(DICT、FILE、FTP、FTPS、GOPHER、HTTP、HTTPS、IMAP、IMAPS、LDAP、LDAPS、POP3、POP3S、RTMP、RTSP、SCP、SFTP、SMTP、SMTPS、TELNET 和 TFTP)传输数据的工具。这个工具不支持用户交互。`curl` 也支持使用代理、用户认证、FTP 上传、HTTP POST 请求、SSL 连接、cookie、断点续传、Metalink 等等。`curl `由 libcurl 库提供所有与传输有关的能力。 ``` # curl -I https://www.magesh.co.in @@ -67,7 +69,7 @@ server: cloudflare cf-ray: 535b74123ca4dbf3-LHR ``` -如果你只想看 HTTP 状态码而不是返回的全部信息,用下面的 curl 命令: +如果你只想看 HTTP 状态码而不是返回的全部信息,用下面的 `curl` 命令: ``` # curl -I "www.magesh.co.in" 2>&1 | awk '/HTTP\// {print $2}' @@ -87,7 +89,7 @@ else fi ``` -当你把脚本内容添加到一个文件后,执行文件,查看结果 +当你把脚本内容添加到一个文件后,执行文件,查看结果: ``` # sh curl-url-check.sh @@ -113,7 +115,7 @@ echo "----------------------------------" done ``` -当你把上面脚本内容添加到一个文件后,执行文件,查看结果 +当你把上面脚本内容添加到一个文件后,执行文件,查看结果: ``` # sh curl-url-check-1.sh @@ -130,7 +132,7 @@ www.xyzzz.com is down ### 方法 4:使用 wget 命令检测一个网站是否宕机 -**[wget 命令][4]** (前身是 Geturl)是一个免费的开源命令行下载工具,通过 HTTP、HTTPS、FTP和其他广泛使用的互联网协议检索文件。wget 是非交互式的命令行工具,由 World Wide Web 和 get 得名。wget 相对于其他工具来说更优秀,功能包括后台运行、递归下载、多文件下载、断点续传、非交互式下载和大文件下载。 +[wget 命令][4](前身是 Geturl)是一个自由开源的命令行下载工具,通过 HTTP、HTTPS、FTP 和其他广泛使用的互联网协议获取文件。`wget` 是非交互式的命令行工具,由 World Wide Web 和 get 得名。`wget` 相对于其他工具来说更优秀,功能包括后台运行、递归下载、多文件下载、断点续传、非交互式下载和大文件下载。 ``` # wget -S --spider https://www.magesh.co.in @@ -158,7 +160,7 @@ Remote file exists and could contain further links, but recursion is disabled -- not retrieving. ``` -如果你只想看 HTTP 状态码而不是返回的全部结果,用下面的 wget 命令: +如果你只想看 HTTP 状态码而不是返回的全部结果,用下面的 `wget` 命令: ``` # wget --spider -S "www.magesh.co.in" 2>&1 | awk '/HTTP\// {print $2}' @@ -178,7 +180,7 @@ else fi ``` -当你把脚本内容添加到一个文件后,执行文件,查看结果 +当你把脚本内容添加到一个文件后,执行文件,查看结果: ``` # wget-url-check.sh @@ -221,7 +223,7 @@ www.xyzzz.com is down ### 方法 5:使用 lynx 命令检测一个网站是否宕机 -**[lynx][5]** 是一个在可寻址光标字符单元终端上使用的基于文本的高度可配的 web 浏览器,它是最古老的 web 浏览器并且现在仍在开发。 +[lynx][5] 是一个在可寻址光标字符单元终端cursor-addressable character cell terminals上使用的基于文本的高度可配的 web 浏览器,它是最古老的 web 浏览器并且现在仍在活跃开发。 ``` # lynx -head -dump http://www.magesh.co.in @@ -240,7 +242,7 @@ Server: cloudflare CF-RAY: 535fc5704a43e694-LHR ``` -如果你只想看 HTTP 状态码而不是返回的全部结果,用下面的 lynx 命令: +如果你只想看 HTTP 状态码而不是返回的全部结果,用下面的 `lynx` 命令: ``` # lynx -head -dump https://www.magesh.co.in 2>&1 | awk '/HTTP\// {print $2}' @@ -260,7 +262,7 @@ else fi ``` -当你把脚本内容添加到一个文件后,执行文件,查看结果 +当你把脚本内容添加到一个文件后,执行文件,查看结果: ``` # sh lynx-url-check.sh @@ -303,7 +305,7 @@ www.xyzzz.com is down ### 方法 6:使用 ping 命令检测一个网站是否宕机 -**[ping 命令][1]** (Packet Internet Groper)是网络工具的代表,用于在互联网协议(IP)的网络中测试一个目标主机是否可用/可连接。通过向目标主机发送 ICMP 回应请求报文包并等待 ICMP 回应响应报文来检测主机的可用性。它基于已发送的包、接收到的包和丢失了的包来统计结果数据,通常包含最小/平均/最大响应时间。 +[ping 命令][1](Packet Internet Groper)是网络工具的代表,用于在互联网协议(IP)的网络中测试一个目标主机是否可用/可连接。通过向目标主机发送 ICMP 回应请求报文包并等待 ICMP 回应响应报文来检测主机的可用性。它基于已发送的包、接收到的包和丢失了的包来统计结果数据,通常包含最小/平均/最大响应时间。 ``` # ping -c 5 2daygeek.com @@ -320,9 +322,9 @@ PING 2daygeek.com (104.27.157.177) 56(84) bytes of data. rtt min/avg/max/mdev = 170.668/213.824/250.295/28.320 ms ``` -### 方法 7:使用 telnet 命令检测一个网站是否宕机 +### 附加 1:使用 telnet 命令检测一个网站是否宕机 -telnet 命令是一个使用 TELNET 协议用于 TCP/IP 网络中多个主机相互通信的古老的网络协议。它通过 23 端口连接其他设备如计算机和网络设备。telnet 是不安全的协议,现在由于用这个协议发送的数据没有经过加密可能被黑客拦截,所以不推荐使用。大家都使用经过加密且非常安全的 SSH 协议来代替 telnet。 +`telnet` 命令是一个使用 TELNET 协议用于 TCP/IP 网络中多个主机相互通信的古老的网络协议。它通过 23 端口连接其他设备如计算机和网络设备。`telnet` 是不安全的协议,现在由于用这个协议发送的数据没有经过加密可能被黑客拦截,所以不推荐使用。大家都使用经过加密且非常安全的 SSH 协议来代替 `telnet`。 ``` # telnet google.com 80 @@ -335,11 +337,11 @@ telnet> quit Connection closed. ``` -### 方法 8:使用 bash 脚本检测一个网站是否宕机 +### 附加 2:使用 bash 脚本检测一个网站是否宕机 -简而言之,一个 **[shell 脚本][6]** 就是一个包含一系列命令的文件。shell 从文件读取内容按输入顺序逐行在命令行执行。为了让它更有效,我们添加一些条件。这也减轻了 Linux 管理员的负担。 +简而言之,一个 [shell 脚本][6] 就是一个包含一系列命令的文件。shell 从文件读取内容按输入顺序逐行在命令行执行。为了让它更有效,我们添加一些条件。这也减轻了 Linux 管理员的负担。 -如果你想想用 wget 命令看多个网站的状态,使用下面的 shell 脚本: +如果你想想用 `wget` 命令看多个网站的状态,使用下面的 shell 脚本: ``` # vi wget-url-check-2.sh @@ -365,7 +367,7 @@ google.co.in is up www.xyzzz.com is down ``` -如果你想想用 wget 命令看多个网站的状态,使用下面的 **[shell 脚本][7]**: +如果你想用 `wget` 命令看多个网站的状态,使用下面的 [shell 脚本][7]: ``` # vi curl-url-check-2.sh @@ -398,7 +400,7 @@ via: https://www.2daygeek.com/linux-command-check-website-is-up-down-alive/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 09f3e2617e2a8dae00e3d750312252d8ce475ab3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Dec 2019 09:39:10 +0800 Subject: [PATCH 022/676] PUB @lxbwolf https://linux.cn/article-11661-1.html --- ...heck if a Website is up or down from the Linux Terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md (99%) diff --git a/translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md b/published/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md similarity index 99% rename from translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md rename to published/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md index d59d927423..222e24b4c7 100644 --- a/translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md +++ b/published/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11661-1.html) [#]: subject: (6 Methods to Quickly Check if a Website is up or down from the Linux Terminal) [#]: via: (https://www.2daygeek.com/linux-command-check-website-is-up-down-alive/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From c1dedc3459afc9e402a64a8d0c3d4bd2f8df6110 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Dec 2019 15:08:36 +0800 Subject: [PATCH 023/676] PRF --- ...1203 Why use the Pantheon desktop for Linux Elementary OS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md index 208bb6a90a..e54061f81e 100644 --- a/published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md +++ b/published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md @@ -26,7 +26,7 @@ Pantheon 桌面整洁、吸引人,并且有许多用户希望在桌面中获 最明显的例子是“文件名高亮”。几十年来,Mac OS 一直有一个广受欢迎的功能,你可以高亮显示重要文件的名称。人们使用此功能作为快速视觉指示器,来告诉自己哪个文件是这几个的“最佳”版本,或者哪个文件应该发送给朋友,或者哪个文件仍然需要处理。它们可以是任意颜色,可以表示用户想要的任何含义。最重要的是,它是引人注目的视觉元数据。 -从 Mac OS 切换过来用户往往会错过 GNOME 和 KDE 以及其他 Linux 桌面提供的这个功能。Pantheon 悄悄地随手解决了这个问题。 +从 Mac OS 切换过来用户往往会在 GNOME 和 KDE 以及 Linux 提供的其它桌面里怀念这个功能。Pantheon 悄悄地随手解决了这个问题。 ![A highlighted file in the Pantheon desktop][5] From 2daa64e6de3d2b00a0babb7f995c4bdc7f5e615a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Dec 2019 15:27:49 +0800 Subject: [PATCH 024/676] APL --- ... SCP Command Examples to Securely Transfer Files in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md index e34b1d825c..b6aa28ae8e 100644 --- a/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md +++ b/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 85f50a8e519ffcb5aadcb305d906e88eec7e39bb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Dec 2019 16:19:16 +0800 Subject: [PATCH 025/676] TSL --- ...les to Securely Transfer Files in Linux.md | 241 ----------------- ...les to Securely Transfer Files in Linux.md | 243 ++++++++++++++++++ 2 files changed, 243 insertions(+), 241 deletions(-) delete mode 100644 sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md create mode 100644 translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md diff --git a/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md deleted file mode 100644 index b6aa28ae8e..0000000000 --- a/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md +++ /dev/null @@ -1,241 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (14 SCP Command Examples to Securely Transfer Files in Linux) -[#]: via: (https://www.linuxtechi.com/scp-command-examples-in-linux/) -[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) - -14 SCP Command Examples to Securely Transfer Files in Linux -====== - -**SCP** (Secure Copy) is command line tool in Linux and Unix like systems which is used to transfer files and directories across the systems securely over the network. When we use scp command to copy files and directories from our local system to remote system then in the backend it makes **ssh connection** to remote system. In other words, we can say scp uses the same **SSH security mechanism** in the backend, it needs either password or keys for authentication. - -[![scp-command-examples-linux][1]][2] - -In this tutorial we will discuss 14 useful Linux scp command examples. - -**Syntax of scp command:** - -### scp <options> <files_or_directories> [root@linuxtechi][3]_host:/<folder> - -### scp <options> [root@linuxtechi][3]_host:/files   <folder_local_system> - -First syntax of scp command demonstrate how to copy files or directories from local system to target host under the specific folder. - -Second syntax of scp command demonstrate how files from target host is copied into local system. - -Some of the most widely used options in scp command are listed below, - - *  -C         Enable Compression - *  -i           identity File or private key - *  -l           limit the bandwidth while copying - *  -P          ssh port number of target host - *  -p          Preserves permissions, modes and access time of files while copying - *  -q          Suppress warning message of SSH - *   -r          Copy files and directories recursively - *   -v          verbose output - - - -Let’s jump into the examples now!!!! - -###### Example:1) Copy a file from local system to remote system using scp - -Let’s assume we want to copy jdk rpm package from our local Linux system to remote system (172.20.10.8) using scp command, use the following command, - -``` -[root@linuxtechi ~]$ scp jdk-linux-x64_bin.rpm root@linuxtechi:/opt -root@linuxtechi's password: -jdk-linux-x64_bin.rpm 100% 10MB 27.1MB/s 00:00 -[root@linuxtechi ~]$ -``` - -Above command will copy jdk rpm package file to remote system under /opt folder. - -###### Example:2) Copy a file from remote System to local system using scp - -Let’s suppose we want to copy a file from remote system to our local system under the /tmp folder, execute the following scp command, - -``` -[root@linuxtechi ~]$ scp root@linuxtechi:/root/Technical-Doc-RHS.odt /tmp -root@linuxtechi's password: -Technical-Doc-RHS.odt 100% 1109KB 31.8MB/s 00:00 -[root@linuxtechi ~]$ ls -l /tmp/Technical-Doc-RHS.odt --rwx------. 1 pkumar pkumar 1135521 Oct 19 11:12 /tmp/Technical-Doc-RHS.odt -[root@linuxtechi ~]$ -``` - -######  Example:3) Verbose Output while transferring files using scp (-v) - -In scp command, we can enable the verbose output using -v option, using verbose output we can easily find what exactly is happening in the background. This becomes very useful in **debugging connection**, **authentication** and **configuration problems**. - -``` -root@linuxtechi ~]$ scp -v jdk-linux-x64_bin.rpm root@linuxtechi:/opt -Executing: program /usr/bin/ssh host 172.20.10.8, user root, command scp -v -t /opt -OpenSSH_7.8p1, OpenSSL 1.1.1 FIPS 11 Sep 2018 -debug1: Reading configuration data /etc/ssh/ssh_config -debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf -debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config -debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 8: Applying options for * -debug1: Connecting to 172.20.10.8 [172.20.10.8] port 22. -debug1: Connection established. -………… -debug1: Next authentication method: password -root@linuxtechi's password: -``` - -###### Example:4) Transfer multiple files to remote system - -Multiple files can be copied / transferred to remote system using scp command in one go, in scp command specify the multiple files separated by space, example is shown below - -``` -[root@linuxtechi ~]$ scp install.txt index.html jdk-linux-x64_bin.rpm root@linuxtechi:/mnt -root@linuxtechi's password: -install.txt 100% 0 0.0KB/s 00:00 -index.html 100% 85KB 7.2MB/s 00:00 -jdk-linux-x64_bin.rpm 100% 10MB 25.3MB/s 00:00 -[root@linuxtechi ~]$ -``` - -###### Example:5) Transfer files across two remote hosts - -Using scp command we can copy files and directories between two remote hosts, let’s suppose we have a local Linux system which can connect to two remote Linux systems, so from my local linux system I can use scp command to copy files across these two systems, - -Syntax: - -### scp [root@linuxtechi][3]_hosts1:/<files_to_transfer>  [root@linuxtechi][3]_host2:/<folder> - -Example is shown below, - -``` -# scp root@linuxtechi:~/backup-Oct.zip root@linuxtechi:/tmp -# ssh root@linuxtechi "ls -l /tmp/backup-Oct.zip" --rwx------. 1 root root 747438080 Oct 19 12:02 /tmp/backup-Oct.zip -``` - -###### Example:6) Copy files and directories recursively (-r) - -Use -r option in scp command to recursively copy the entire directory from one system to another, example is shown below, - -``` -[root@linuxtechi ~]$ scp -r Downloads root@linuxtechi:/opt -``` - -Use below command to verify whether Download folder is copied to remote system or not, - -``` -[root@linuxtechi ~]$ ssh root@linuxtechi "ls -ld /opt/Downloads" -drwxr-xr-x. 2 root root 75 Oct 19 12:10 /opt/Downloads -[root@linuxtechi ~]$ -``` - -###### Example:7) Increase transfer speed by enabling compression (-C) - -In scp command, we can increase the transfer speed by enabling the compression using -C option, it will automatically enable compression at source and decompression at destination host. - -``` -root@linuxtechi ~]$ scp -r -C Downloads root@linuxtechi:/mnt -``` - -In the above example we are transferring the Download directory with compression enabled. - -###### Example:8) Limit bandwidth while copying ( -l ) - -Use ‘-l’ option in scp command to put limit on bandwidth usage while copying. Bandwidth is specified in Kbit/s, example is shown below, - -``` -[root@linuxtechi ~]$ scp -l 500 jdk-linux-x64_bin.rpm root@linuxtechi:/var -``` - -###### Example:9) Specify different ssh port while scp ( -P) - -There can be some scenario where ssh port is changed on destination host, so while using scp command we can specify the ssh port number using ‘-P’ option. - -``` -[root@linuxtechi ~]$ scp -P 2022 jdk-linux-x64_bin.rpm root@linuxtechi:/var -``` - -In above example, ssh port for remote host is “2022” - -###### Example:10) Preserves permissions, modes and access time of files while copying (-p) - -Use “-p” option in scp command to preserve permissions, access time and modes while copying from source to destination - -``` -[root@linuxtechi ~]$ scp -p jdk-linux-x64_bin.rpm root@linuxtechi:/var/tmp -jdk-linux-x64_bin.rpm 100% 10MB 13.5MB/s 00:00 -[root@linuxtechi ~]$ -``` - -###### Example:11) Transferring files in quiet mode ( -q) in scp - -Use ‘-q’ option in scp command to suppress transfer progress, warning and diagnostic messages of ssh. Example is shown below, - -``` -[root@linuxtechi ~]$ scp -q -r Downloads root@linuxtechi:/var/tmp -[root@linuxtechi ~]$ -``` - -###### Example:12) Use Identify file in scp while transferring ( -i ) - -In most of the Linux environments, keys-based authentication is preferred. In scp command we specify the identify file or private key file using ‘-i’ option, example is shown below, - -``` -[root@linuxtechi ~]$ scp -i my_key.pem -r Downloads root@linuxtechi:/root -``` - -In above example, “my_key.pem” is the identity file or private key file. - -###### Example:13) Use different ‘ssh_config’ file in scp ( -F) - -There are some scenarios where you use different networks to connect to Linux systems, may be some network is behind proxy servers, so in that case we must have different **ssh_config** file. - -Different ssh_config file in scp command is specified via ‘-F’ option, example is shown below - -``` -[root@linuxtechi ~]$ scp -F /home/pkumar/new_ssh_config -r Downloads root@linuxtechi:/root -root@linuxtechi's password: -jdk-linux-x64_bin.rpm 100% 10MB 16.6MB/s 00:00 -backup-Oct.zip 100% 713MB 41.9MB/s 00:17 -index.html 100% 85KB 6.6MB/s 00:00 -[root@linuxtechi ~]$ -``` - -###### Example:14) Use Different Cipher in scp command (-c) - -By default, scp uses ‘AES-128’ cipher to encrypt the files. If you want to use another cipher in scp command then use ‘-c’ option followed by cipher name, - -Let’s suppose we want to use ‘3des-cbc’ cipher in scp command while transferring the files, run the following scp command - -``` -[root@linuxtechi ~]# scp -c 3des-cbc -r Downloads root@linuxtechi:/root -``` - -Use the below command to list ssh and scp ciphers, - -``` -[root@linuxtechi ~]# ssh -Q cipher localhost | paste -d , -s - -3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,root@linuxtechi,aes128-ctr,aes192-ctr,aes256-ctr,root@linuxtechi,root@linuxtechi,root@linuxtechi -[root@linuxtechi ~]# -``` - -That’s all from this tutorial, to get more details about scp command, kindly refer its man page. Please do share your feedback and comments in comments section below. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/scp-command-examples-in-linux/ - -作者:[Pradeep Kumar][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linuxtechi.com/author/pradeep/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/scp-command-examples-linux.jpg -[3]: https://www.linuxtechi.com/cdn-cgi/l/email-protection diff --git a/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md new file mode 100644 index 0000000000..39851d35b6 --- /dev/null +++ b/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md @@ -0,0 +1,243 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (14 SCP Command Examples to Securely Transfer Files in Linux) +[#]: via: (https://www.linuxtechi.com/scp-command-examples-in-linux/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +在 Linux 上安全传输文件的 14 SCP 命令示例 +====== + +SCP(Secure Copy)是 Linux 和 Unix 之类的系统中的命令行工具,用于通过网络安全地跨系统传输文件和目录。当我们使用 `scp` 命令将文件和目录从本地系统复制到远程系统时,则在后端与远程系统建立 ssh 连接。换句话说,我们可以说 `scp` 在后端使用了相同的 SSH 安全机制,它需要密码或密钥进行身份验证。 + +![scp-command-examples-linux][2] + +在本教程中,我们将讨论 14 个有用的 Linux `scp` 命令示例。 + +`scp` 命令语法: + +``` +# scp <选项> <文件或目录> 用户名@目标主机:/<文件夹> + +# scp <选项> 用户名@目标主机:/文件 <本地文件夹> +``` + +`scp` 命令的第一个语法演示了如何将文件或目录从本地系统复制到特定文件夹下的目标主机。 + +`scp` 命令的第二种语法演示了如何将目标主机中的文件复制到本地系统中。 + +下面列出了 `scp` 命令中使用最广泛的一些选项, + +* `-C` 启用压缩 +* `-i` 指定识别文件或私钥 +* `-l` 复制时限制带宽 +* `-P` 目标主机的 ssh 端口号 +* `-p` 复制时保留文件的权限、模式和访问时间 +* `-q` 禁止 SSH 警告消息 +* `-r` 递归复制文件和目录 +* `-v` 详细输出 + +现在让我们跳入示例!!!! + +### 示例:1)使用 scp 将文件从本地系统复制到远程系统 + +假设我们要使用 `scp` 命令将 jdk 的 rpm 软件包从本地 Linux 系统复制到远程系统(172.20.10.8),请使用以下命令, + +``` +[root@linuxtechi ~]$ scp jdk-linux-x64_bin.rpm root@linuxtechi:/opt +root@linuxtechi's password: +jdk-linux-x64_bin.rpm 100% 10MB 27.1MB/s 00:00 +[root@linuxtechi ~]$ +``` + +上面的命令会将 jdk 的 rpm 软件包文件复制到 `/opt` 文件夹下的远程系统。 + +### 示例:2)使用 scp 将文件从远程系统复制到本地系统 + +假设我们想将文件从远程系统复制到 `/tmp` 文件夹下的本地系统,执行以下 `scp` 命令, + +``` +[root@linuxtechi ~]$ scp root@linuxtechi:/root/Technical-Doc-RHS.odt /tmp +root@linuxtechi's password: +Technical-Doc-RHS.odt 100% 1109KB 31.8MB/s 00:00 +[root@linuxtechi ~]$ ls -l /tmp/Technical-Doc-RHS.odt +-rwx------. 1 pkumar pkumar 1135521 Oct 19 11:12 /tmp/Technical-Doc-RHS.odt +[root@linuxtechi ~]$ +``` + +### 示例:3)使用 scp 传输文件时的详细输出(-v) + +在 `scp` 命令中,我们可以使用 `-v` 选项启用详细输出,使用详细输出,我们可以轻松地发现后台确切发生了什么。这对于调试连接、认证和配置问题非常有用。 + +``` +root@linuxtechi ~]$ scp -v jdk-linux-x64_bin.rpm root@linuxtechi:/opt +Executing: program /usr/bin/ssh host 172.20.10.8, user root, command scp -v -t /opt +OpenSSH_7.8p1, OpenSSL 1.1.1 FIPS 11 Sep 2018 +debug1: Reading configuration data /etc/ssh/ssh_config +debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf +debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config +debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 8: Applying options for * +debug1: Connecting to 172.20.10.8 [172.20.10.8] port 22. +debug1: Connection established. +………… +debug1: Next authentication method: password +root@linuxtechi's password: +``` + +### 示例:4)将多个文件传输到远程系统 + +可以使用 `scp` 命令一次性将多个文件复制/传输到远程系统,在 `scp` 命令中指定多个文件,并用空格隔开,示例如下所示 + +``` +[root@linuxtechi ~]$ scp install.txt index.html jdk-linux-x64_bin.rpm root@linuxtechi:/mnt +root@linuxtechi's password: +install.txt 100% 0 0.0KB/s 00:00 +index.html 100% 85KB 7.2MB/s 00:00 +jdk-linux-x64_bin.rpm 100% 10MB 25.3MB/s 00:00 +[root@linuxtechi ~]$ +``` + +### 示例:5)在两个远程主机之间传输文件 + +使用 `scp` 命令,我们可以在两个远程主机之间复制文件和目录,假设我们有一个可以连接到两个远程 Linux 系统的本地 Linux 系统,因此从我的本地 Linux 系统中,我可以使用 `scp` 命令在这两个系统之间复制文件, + +命令语法: + +``` +# scp 用户名@远程主机1:/<要传输的文件> 用户名@远程主机2:/<文件夹> +``` + +示例如下: + +``` +# scp root@linuxtechi:~/backup-Oct.zip root@linuxtechi:/tmp +# ssh root@linuxtechi "ls -l /tmp/backup-Oct.zip" +-rwx------. 1 root root 747438080 Oct 19 12:02 /tmp/backup-Oct.zip +``` + +### 示例:6)递归复制文件和目录(-r) + +在 `scp` 命令中使用 `-r` 选项将整个目录从一个系统递归复制到另一个系统,示例如下所示: + +``` +[root@linuxtechi ~]$ scp -r Downloads root@linuxtechi:/opt +``` + +使用以下命令验证 `Downloads` 文件夹是否已复制到远程系统, + +``` +[root@linuxtechi ~]$ ssh root@linuxtechi "ls -ld /opt/Downloads" +drwxr-xr-x. 2 root root 75 Oct 19 12:10 /opt/Downloads +[root@linuxtechi ~]$ +``` + +### 示例:7)通过启用压缩来提高传输速度(-C) + +在 `scp` 命令中,我们可以通过使用 `-C` 选项启用压缩来提高传输速度,它将自动在源上启用压缩并在目标主机上启用解压缩。 + +``` +root@linuxtechi ~]$ scp -r -C Downloads root@linuxtechi:/mnt +``` + +在以上示例中,我们正在启用压缩的情况下传输下载目录。 + +### 示例:8)复制时限制带宽(-l) + +在 `scp` 命令中使用 `-l` 选项设置复制时对带宽使用的限制。带宽以 Kbit/s 为单位指定,示例如下所示, + +``` +[root@linuxtechi ~]$ scp -l 500 jdk-linux-x64_bin.rpm root@linuxtechi:/var +``` + +### 示例:9)在 scp 时指定其他 ssh 端口(-P) + +在某些情况下,目标主机上的 ssh 端口会更改,因此在使用 `scp` 命令时,我们可以使用 `-P` 选项指定 ssh 端口号。 + +``` +[root@linuxtechi ~]$ scp -P 2022 jdk-linux-x64_bin.rpm root@linuxtechi:/var +``` + +在上面的示例中,远程主机的 ssh 端口为 “2022” + +### 示例:10)复制时保留文件的权限、模式和访问时间(-p) + +从源复制到目标时,在 `scp` 命令中使用 `-p` 选项保留权限、访问时间和模式。 + +``` +[root@linuxtechi ~]$ scp -p jdk-linux-x64_bin.rpm root@linuxtechi:/var/tmp +jdk-linux-x64_bin.rpm 100% 10MB 13.5MB/s 00:00 +[root@linuxtechi ~]$ +``` + +### 示例:11)在 scp 中以安静模式传输文件(-q) + +在 `scp` 命令中使用 `-q` 选项可禁止显示 ssh 的传输进度、警告和诊断消息。示例如下所示: + +``` +[root@linuxtechi ~]$ scp -q -r Downloads root@linuxtechi:/var/tmp +[root@linuxtechi ~]$ +``` + +### 示例:12)在传输时使用 scp 中的识别文件(-i) + +在大多数 Linux 环境中,首选基于密钥的身份验证。在 scp 命令中,我们使用 `-i` 选项指定识别文件(私钥文件),示例如下所示: + +``` +[root@linuxtechi ~]$ scp -i my_key.pem -r Downloads root@linuxtechi:/root +``` + +在上面的示例中,`my_key.pem` 是识别文件或私钥文件。 + +### 示例:13)在 scp 中使用其他 ssh_config 文件(-F) + +在某些情况下,你使用不同的网络连接到 Linux 系统,可能某些网络位于代理服务器后面,因此在这种情况下,我们必须具有不同的 `ssh_config` 文件。 + +通过 `-F` 选项在 `scp` 命令中指定了不同的 `ssh_config` 文件,示例如下所示: + +``` +[root@linuxtechi ~]$ scp -F /home/pkumar/new_ssh_config -r Downloads root@linuxtechi:/root +root@linuxtechi's password: +jdk-linux-x64_bin.rpm 100% 10MB 16.6MB/s 00:00 +backup-Oct.zip 100% 713MB 41.9MB/s 00:17 +index.html 100% 85KB 6.6MB/s 00:00 +[root@linuxtechi ~]$ +``` + +### 示例:14)在 scp 命令中使用其他加密方式(-c) + +默认情况下,`scp` 使用 AES-128 加密方式来加密文件。如果你想在 `scp` 命令中使用其他加密方式,请使用 `-c` 选项,后接加密方式名称, + +假设我们要在用 `scp`命令传输文件时使用 3des-cbc 加密方式,请运行以下 `scp` 命令: + +``` +[root@linuxtechi ~]# scp -c 3des-cbc -r Downloads root@linuxtechi:/root +``` + +使用以下命令列出 `ssh` 和 `scp` 加密方式: + +``` +[root@linuxtechi ~]# ssh -Q cipher localhost | paste -d , -s - +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,root@linuxtechi,aes128-ctr,aes192-ctr,aes256-ctr,root@linuxtechi,root@linuxtechi,root@linuxtechi +[root@linuxtechi ~]# +``` + +以上就是本教程的全部内容,要获取有关 `scp` 命令的更多详细信息,请参考其手册页。请在下面的评论部分中分享你的反馈和评论。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/scp-command-examples-in-linux/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/scp-command-examples-linux.jpg +[3]: https://www.linuxtechi.com/cdn-cgi/l/email-protection From 165fcc943137810c271cdfab7c4a91fd9348fc6f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Dec 2019 16:56:33 +0800 Subject: [PATCH 026/676] APL --- ...S 13 7390 Review- The Best Laptop For Desktop Linux Users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md b/sources/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md index aee0728113..c4e95cdb62 100644 --- a/sources/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md +++ b/sources/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1828cf9f324725ae139fc4d737717b7570e24b57 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 10 Dec 2019 22:10:07 +0800 Subject: [PATCH 027/676] TSL&PRF --- ...The Best Laptop For Desktop Linux Users.md | 65 ------------------- ...The Best Laptop For Desktop Linux Users.md | 63 ++++++++++++++++++ 2 files changed, 63 insertions(+), 65 deletions(-) delete mode 100644 sources/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md create mode 100644 translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md diff --git a/sources/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md b/sources/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md deleted file mode 100644 index c4e95cdb62..0000000000 --- a/sources/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Dell XPS 13 7390 Review: The Best Laptop For Desktop Linux Users) -[#]: via: (https://www.linux.com/articles/dell-xps-13-7390-review-the-best-laptop-for-desktop-linux-user/) -[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) - -Dell XPS 13 7390 Review: The Best Laptop For Desktop Linux Users -====== - -[![][1]][2] - -[![][1]][2] - -Gone are the days when we had to do a lot of research and read a lot of reviews to find a machine that would work with the least amount of trouble with the desktop Linux distribution of choice. Today, almost every machine out there can run Linux. The kernel community has done an incredible job with device driver support to make everything work out of the box. - -Still, there are machines that can run Linux, and then there are machines that run Linux. Dell machines fall in the latter category. Five years ago, Barton George started a program within Dell to bring desktop Linux to consumer grade, high-end Dell systems. What started as one machine is now an entire line of high-end laptops and desktops. - -Among these machines, XPS 13 is my favorite. While I need a really powerful desktop to handle my 4K UHD, multicam video production, I also need an ultra-portable laptop that I can bring with me anywhere without having to worry about a bulky backpack and charger. XPS 13 was also my very first laptop, which lasted me more than 7 years. So, yes, there is that nostalgic factor, too. - -Dell updates the XPS line almost every year and the latest [rollout was announced in October][3] (link to video interview). [XPS 13 (7390)][4] is an incremental update to the series, and Dell was kind enough to send me a review unit. - -It is powered by a 6-core, Core i7-10710U CPU. It comes with 16GB of memory and 1TB SSD. At the base frequency of 1.10 GHz, which can boost to 4.1 GHz, this is a great machine for average workloads. It doesn’t have any dedicated GPU, so it’s not meant for gaming or compiling from source for Gentoo Linux or Arch Linux. However, I did manage to run some Steam games on it. - -If you are looking to run your Kubernetes clusters, AI frameworks or Virtual Reality, then there are more powerful machines from the Precision line, which are certified to run Red Hat Enterprise Linux and Ubuntu. - -The machine’s chassis is identical to the previous generation. The bezels remains as thin as they were in the previous generation, still thinner than MacBook and Microsoft’s Surface Pro. - -It has three ports, two of which are USB-C Thunderbolt 3, which can be used to connect to 4K monitors, USB accessories, and high-speed data transfer between machines with peer-to-peer networking. - -It also has a microSD slot. As a video journalist, a slot for an SD card would have been more useful. Heavy users of Raspberry Pis would also love this card. - -It has 4 microphones and an improved camera, which is now located at the top (goodbye, nosecam!). - -XPS 13 (7390) is sleek and slim. At 2.7 lbs, it is certainly comparable to Apple’s MacBook Air. This machine is meant to be your travel companion and for everyday tasks like checking emails, browsing the web, and writing. - -Its 4K UHD screen supports HDR, which means you will be able to enjoy Mandalorian in all its full glory. That said, the on-board speakers are not that great and sound muffled. They are OK for video chats or casual YouTube viewing, but if you want to enjoy the The Witcher later this year, or if you want to enjoy music from Amazon, Apple Music or YouTube Music, you need headphones or external speakers. - -But how much fun can you get out of this machine before you reach for charging cable? It gave me around 7-8 hours of battery life with average workload: browsing the web with a few tabs, just watching a movie or listening to music. Multi-tasking, especially any kind of web activity, will drain the battery. Some fine-tuning on Linux may give you even more life. On Windows 10, I was able to get more than 10 hours! - -As a video journalist who is still doing a fair amount of writing, I really like the keyboard. However, the trackpad is the same story that we have been hearing on desktop Linux for ages: it’s nowhere near the quality on MacBook or Windows machines. Maybe one day. To Dell’s credit, they do release drivers for the trackpad that enhances the experience, but I am not running the stock Ubuntu 18.04 LTS that came with this system. I did a fresh install of Ubuntu 19.10 because Gnome is painfully slow in 18.04. I tried openSUSE Tumbleweed, Zorin OS, elementary OS, Fedora, KDE’s neon and Arch Linux. All worked, although some needed extra effort to run. - -So, who is this system for? It’s certainly for professionals who want a well designed, high-end machine from a brand they can trust. It’s for those who like a MacBook Air, but prefer the desktop Linux ecosystem. It’s for those who want to use Linux for work, instead of working on it to make it work. - -Spending a week with this machine reinforced why I love Dell’s XPS series so much. They are the best Linux laptops out there. And this XPS 13 (7390) packs a punch. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/articles/dell-xps-13-7390-review-the-best-laptop-for-desktop-linux-user/ - -作者:[Swapnil Bhartiya][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/author/swapnil/ -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/wp-content/uploads/2019/12/dell-xps-13-7390-1068x665.jpg (dell-xps-13-7390) -[2]: https://www.linux.com/wp-content/uploads/2019/12/dell-xps-13-7390.jpg -[3]: https://bartongeorge.io/2019/08/21/please-welcome-the-9th-generation-of-the-xps-13-developer-edition/ -[4]: https://blog.dell.com/en-us/dells-new-consumer-pc-portfolio-unveiled-ifa-2019/ diff --git a/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md b/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md new file mode 100644 index 0000000000..03b16de85e --- /dev/null +++ b/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Dell XPS 13 7390 Review: The Best Laptop For Desktop Linux Users) +[#]: via: (https://www.linux.com/articles/dell-xps-13-7390-review-the-best-laptop-for-desktop-linux-user/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Dell XPS 13 7390:最好的 Linux 桌面笔记本 +====== + +![][1] + +曾经,我们必须进行大量研究、阅读大量评论,才能找到一种在所选的 Linux 桌面发行版上可以以最少的麻烦工作的机器。而如今,这种日子已经一去不复返了,几乎每台机器都可以运行 Linux。Linux 内核社区在设备驱动程序支持方面做得非常出色,可以使一切都开箱即用。 + +不过,有的是机器可以运行 Linux,有的是运行 Linux 的机器。戴尔计算机属于后一类。五年前,Barton George 在戴尔内部启动了一项计划,将桌面版 Linux 引入到消费级的高端戴尔系统。从一台机器开始,现在已经是一整套高端的 Linux 笔记本电脑和台式机。 + +在这些机器中,XPS 13 是我的最爱。尽管我需要一个功能强大的台式机来处理 4K UHD、多机位视频制作,但我还需要一台超便携的笔记本电脑,可以随身携带,而不必担心笨重的背包和充电器。XPS 13 也是我的第一台笔记本电脑,使用了 7 年多。因此,是的,这还有一个怀旧因素。 + +戴尔几乎每年都会更新其 XPS 产品线,并且最新的[产品展示宣布于 10 月][3]。[XPS 13(7390)] [4] 是该系列的增量更新,而且戴尔非常乐意向我寄来一台测评设备。 + +它由 6 核 Core i7-10710U CPU 所支持。它配备 16GB 内存和 1TB SSD。在 1.10 GHz 的基本频率(可以超频到 4.1 GHz)的情况下,这是一台用于常规工作负载的出色机器。它没有使用任何专用的 GPU,因此它并不适合进行游戏或从源代码进行编译的 Gentoo Linux 或 Arch Linux。但是,我确实设法在上面运行了一些 Steam 游戏。 + +如果你想运行 Kubernetes 集群、AI 框架或虚拟现实,那么 Precision 系列中还有更强大的机器,这些机器可以运行 Red Hat Enterprise Linux 和 Ubuntu。 + +该机器的底盘与上一代相同。边框保持与上一代一样的薄,仍比 MacBook 和微软的 Surface Pro 薄。 + +它具有三个端口,其中两个是 USB-C Thunderbolt 3,可用于连接 4K 显示器、USB 附件以及用于对等网络的计算机之间的高速数据传输。 + +它还具有一个 microSD 插槽。作为视频记者,SD 卡插槽会更有用。大量使用树莓派的用户也会喜欢此卡。 + +它具有 4 个麦克风和一个改进的摄像头,该摄像头现在位于顶部(再见,鼻孔摄像头!)。 + +XPS 13(7390)光滑纤薄。它的重量仅为 2.7 磅(1.2kg),可以与苹果的 MacBook Air 相提并论。 这台机器可以成为你的旅行伴侣,并且可以执行日常任务,例如检查电子邮件、浏览网络和书写。 + +其 4K UHD 屏幕支持 HDR,这意味着你将可以尽享全尺寸的《The Mandalorian》。另外,车载扬声器并没有那么好,听起来有些沉闷。它们适合进行视频聊天或休闲的 YouTube 观看,但是如果你想在今年晚些时候观看《The Witcher》剧集,或者想欣赏 Amazon、Apple Music 或 YouTube Music 的音乐,则需要耳机或外接扬声器。 + +但是,在插入充电线之前,你可以从这台机器中获得多少乐趣?在正常工作量的情况下,它为我提供了大约 7-8 个小时的电池续航时间:我打开了几个选项卡浏览网络,只是看看电影或听音乐。多任务处理,尤其是各种 Web 活动,都会消耗电池电量。在 Linux 上进行一些微调可能会给你带来更多的续航时间。而在 Windows 10 上,我可以使用 10 多个小时呢! + +作为仍在从事大量写作工作的视频记者,我非常喜欢键盘。但是,我们这么多年来在 Linux 台式机上听到的触控板故事一直没变:它与 MacBook 或 Windows 上的质量相差甚远。这或许有一天能改变。值得称道的是,他们确实发布了可增强体验的触控板驱动程序,但我没有运行此系统随附的提供的 Ubuntu 18.04 LTS。我全新安装了 Ubuntu 19.10,因为 Gnome 在 18.04 中的运行速度非常慢。我尝试过 openSUSE Tumbleweed、Zorin OS、elementary OS、Fedora、KDE neon 和 Arch Linux。一切正常,尽管有些需要额外的努力才能运行。 + +那么,该系统适用于谁?显然,这是给那些想要设计精良的、他们信赖的品牌高端机器的专业人士打造的。适用于喜欢 MacBook Air,但更喜欢 Linux 台式机生态系统的用户。适用于那些希望使用 Linux 来工作,而不是使 Linux 可以工作的人。 + +我用这台机器花了一周的时间,进一步说明了为什么我如此喜欢戴尔的 XPS 系列。它们是目前最好的 Linux 笔记本电脑。这款 XPS 13(7390),你值得拥有! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/dell-xps-13-7390-review-the-best-laptop-for-desktop-linux-user/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2019/12/dell-xps-13-7390-1068x665.jpg (dell-xps-13-7390) +[2]: https://www.linux.com/wp-content/uploads/2019/12/dell-xps-13-7390.jpg +[3]: https://bartongeorge.io/2019/08/21/please-welcome-the-9th-generation-of-the-xps-13-developer-edition/ +[4]: https://blog.dell.com/en-us/dells-new-consumer-pc-portfolio-unveiled-ifa-2019/ From 2669d83167a42d0ccf32b633ec331cba0f63bb85 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 00:52:26 +0800 Subject: [PATCH 028/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191211=20How=20?= =?UTF-8?q?to=20Find=20High=20CPU=20Consumption=20Processes=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md --- ...High CPU Consumption Processes in Linux.md | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md diff --git a/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md b/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md new file mode 100644 index 0000000000..1e628a04b4 --- /dev/null +++ b/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Find High CPU Consumption Processes in Linux) +[#]: via: (https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Find High CPU Consumption Processes in Linux +====== + +We have already described in our previous article **[how to find high memory consumption processes in Linux][1]**. + +There are situations where you might see more CPU usage on a Linux system. + +If so, you should identify a list of processes that consume more CPU on the system. + +I believe there are only two ways for you to check this. + +This can be done using the **[top command][2]** and the **[ps command][3]**. + +I’d like to go with the top command for most reasons instead of ps. + +But both will give you the same results, so you can choose the one you like. + +Both of these options are widely used by Linux administrators. + +### 1) How to Find High CPU Consumption Process in Linux Using the top Command + +The Linux top command is the best and most well known command that everyone uses to monitor Linux system performance. + +The top command provides a dynamic real-time view of the running process on a Linux system. + +It display system summary information, the list of processes currently being managed by the Linux kernel. + +It displays various system information such as CPU usage, Memory usage, Swap Memory, Number of running processes, system uptime, system load, Buffer Size, Cache Size, Process PID, etc. + +By default, it sorts the top output with the CPU usage and updates the top command data every 5 seconds. + +If you want to see a clear view of the top command output for further analysis, this is a best way to **[run the top command in the batch mode][4]**. + +Also, you need to **[understand the top command output][5]** to fix the performance problem on the system. + +``` +# top -c -b | head -50 + +top - 00:19:17 up 14:23, 1 user, load average: 2.46, 2.18, 1.97 +Tasks: 306 total, 1 running, 305 sleeping, 0 stopped, 0 zombie +%Cpu0 : 10.4 us, 3.0 sy, 0.0 ni, 83.9 id, 0.0 wa, 1.3 hi, 1.3 si, 0.0 st +%Cpu1 : 17.0 us, 3.0 sy, 0.0 ni, 78.7 id, 0.0 wa, 0.3 hi, 1.0 si, 0.0 st +%Cpu2 : 13.0 us, 4.0 sy, 0.0 ni, 81.3 id, 0.0 wa, 0.3 hi, 1.3 si, 0.0 st +%Cpu3 : 12.3 us, 3.3 sy, 0.0 ni, 82.5 id, 0.3 wa, 0.7 hi, 1.0 si, 0.0 st +%Cpu4 : 12.2 us, 3.0 sy, 0.0 ni, 82.8 id, 0.7 wa, 0.3 hi, 1.0 si, 0.0 st +%Cpu5 : 6.4 us, 2.7 sy, 0.0 ni, 89.2 id, 0.0 wa, 0.7 hi, 1.0 si, 0.0 st +%Cpu6 : 26.7 us, 3.4 sy, 0.0 ni, 68.6 id, 0.0 wa, 0.7 hi, 0.7 si, 0.0 st +%Cpu7 : 15.6 us, 4.0 sy, 0.0 ni, 78.8 id, 0.0 wa, 0.7 hi, 1.0 si, 0.0 st +KiB Mem : 16248556 total, 1448920 free, 8571484 used, 6228152 buff/cache +KiB Swap: 17873388 total, 17873388 free, 0 used. 4596044 avail Mem +PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 2179 daygeek 20 3106324 613584 327564 S 79.5 3.8 14:19.76 Web Content + 1714 daygeek 20 4603372 974600 403504 S 20.2 6.0 65:18.91 firefox + 1227 daygeek 20 4192012 376332 180348 S 13.9 2.3 20:43.26 gnome-shell +18324 daygeek 20 3296192 766040 127948 S 6.3 4.7 9:18.12 Web Content + 1170 daygeek 20 1008264 572036 546180 S 6.0 3.5 18:07.85 Xorg + 4684 daygeek 20 3363708 1.1g 1.0g S 3.6 7.2 13:49.92 VirtualBoxVM + 4607 daygeek 20 4591040 1.7g 1.6g S 3.0 11.0 14:09.65 VirtualBoxVM + 1211 daygeek 9 -11 2865268 21032 16588 S 2.0 0.1 10:46.37 pulseaudio + 4562 daygeek 20 1096888 28812 21044 S 1.7 0.2 4:42.93 VBoxSVC + 1783 daygeek 20 3123888 376896 134788 S 1.3 2.3 39:32.56 Web Content + 3286 daygeek 20 3089736 404088 184968 S 1.0 2.5 41:57.44 Web Content +``` + +Details of the above command: + + * **top :** This is a command. + * **-b :** Batch mode. + * **head -50:** Display first 50 lines in the output. + * **PID :** Unique ID of the process. + * **USER :** Owner of the process. + * **PR :** priority of the process. + * **NI :** The NICE value of the process. + * **VIRT :** How much virtual memory used by the process. + * **RES :** How much physical memory used by the process. + * **SHR :** How much shared memory used by the process. + * **S :** This indicates the status of the process: S=sleep R=running Z=zombie. + * **%CPU :** The percentage of CPU used by the process. + * **%MEM :** The percentage of RAM used by the process. + * **TIME+ :** How long the process being running. + * **COMMAND :** Name of the process. + + + +If you want to see the full path of the command instead of the command name, run the following top command format. + +``` +# top -b | head -50 + +top - 00:28:49 up 14:33, 1 user, load average: 2.43, 2.49, 2.23 +Tasks: 305 total, 1 running, 304 sleeping, 0 stopped, 0 zombie +%Cpu0 : 11.7 us, 3.7 sy, 0.0 ni, 82.3 id, 0.0 wa, 1.0 hi, 1.3 si, 0.0 st +%Cpu1 : 13.6 us, 3.3 sy, 0.0 ni, 81.1 id, 0.7 wa, 0.3 hi, 1.0 si, 0.0 st +%Cpu2 : 10.9 us, 2.6 sy, 0.0 ni, 85.1 id, 0.0 wa, 0.3 hi, 1.0 si, 0.0 st +%Cpu3 : 16.0 us, 2.6 sy, 0.0 ni, 80.1 id, 0.0 wa, 0.3 hi, 1.0 si, 0.0 st +%Cpu4 : 9.2 us, 3.6 sy, 0.0 ni, 85.9 id, 0.0 wa, 0.3 hi, 1.0 si, 0.0 st +%Cpu5 : 15.6 us, 2.9 sy, 0.0 ni, 80.5 id, 0.0 wa, 0.3 hi, 0.7 si, 0.0 st +%Cpu6 : 11.6 us, 4.3 sy, 0.0 ni, 82.7 id, 0.0 wa, 0.3 hi, 1.0 si, 0.0 st +%Cpu7 : 8.0 us, 3.0 sy, 0.0 ni, 87.3 id, 0.0 wa, 0.7 hi, 1.0 si, 0.0 st +KiB Mem : 16248556 total, 1022456 free, 8778508 used, 6447592 buff/cache +KiB Swap: 17873388 total, 17873388 free, 0 used. 4201560 avail Mem +PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND +18527 daygeek 20 3151820 624808 325748 S 52.8 3.8 59:26.72 /usr/lib/firefox/firefox -contentproc -childID 18 -isForBrowser -prefsLen 10002 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /+ + 1714 daygeek 20 4764668 910940 443228 S 21.5 5.6 68:59.33 /usr/lib/firefox/firefox --new-window + 1227 daygeek 20 4193108 377344 181404 S 11.6 2.3 21:47.36 /usr/bin/gnome-shell + 1170 daygeek 20 1008820 572700 546844 S 5.6 3.5 19:05.10 /usr/lib/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3 +18324 daygeek 20 3300288 789344 127948 S 5.0 4.9 9:46.89 /usr/lib/firefox/firefox -contentproc -childID 16 -isForBrowser -prefsLen 10002 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /+ + 4684 daygeek 20 3363708 1.1g 1.0g S 3.6 7.2 14:10.18 /usr/lib/virtualbox/VirtualBoxVM --comment CentOS7 --startvm 002f47b8-2af2-48f5-be1d-67b67e03514c --no-startvm-errormsgbox + 4607 daygeek 20 4591040 1.7g 1.6g S 3.0 11.0 14:28.86 /usr/lib/virtualbox/VirtualBoxVM --comment Ubuntu-18.04 --startvm e8c32dbb-8b01-41b0-977a-bf28b9db1117 --no-startvm-errormsgbox + 1783 daygeek 20 3132640 451924 132168 S 2.6 2.8 39:49.66 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /usr/l+ + 1211 daygeek 9 -11 2865268 21272 16828 S 2.0 0.1 11:01.29 /usr/bin/pulseaudio --daemonize=no + 4562 daygeek 20 1096888 28812 21044 S 1.7 0.2 4:49.33 /usr/lib/virtualbox/VBoxSVC --auto-shutdown +16865 daygeek 20 3073364 430596 124652 S 1.3 2.7 8:04.02 /usr/lib/firefox/firefox -contentproc -childID 15 -isForBrowser -prefsLen 10002 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /+ + 2179 daygeek 20 2945348 429644 172940 S 1.0 2.6 15:20.90 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 7821 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /us+ +``` + +### 2) How to Find High CPU Consumption Process in Linux Using the ps Command + +ps stands for processes status, it display the information about the active/running processes on the system. + +It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc. + +``` +# ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%cpu | head + + PID PPID %MEM %CPU CMD +18527 1714 4.2 40.3 /usr/lib/firefox/firefox -contentproc -childID 18 -isForBrowser -prefsLen 10002 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1714 true tab + 1714 1152 5.6 8.0 /usr/lib/firefox/firefox --new-window +18324 1714 4.9 6.3 /usr/lib/firefox/firefox -contentproc -childID 16 -isForBrowser -prefsLen 10002 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1714 true tab + 3286 1714 2.0 5.1 /usr/lib/firefox/firefox -contentproc -childID 14 -isForBrowser -prefsLen 8078 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1714 true tab + 1783 1714 3.0 4.5 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1714 true tab + 1227 1152 2.3 2.5 /usr/bin/gnome-shell + 1170 1168 3.5 2.2 /usr/lib/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3 +16865 1714 2.5 2.1 /usr/lib/firefox/firefox -contentproc -childID 15 -isForBrowser -prefsLen 10002 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1714 true tab + 2179 1714 2.7 1.8 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 7821 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1714 true tab +``` + +Details of the above command: + + * **ps :** This is a command. + * **-e :** Select all processes. + * **-o :** To customize a output format. + * **–sort=-%cpu :** Sort the ouput based on CPU usage. + * **head :** To display first 10 lines of the output + * **PID :** Unique ID of the process. + * **PPID :** Unique ID of the parent process. + * **%MEM :** The percentage of RAM used by the process. + * **%CPU :** The percentage of CPU used by the process. + * **Command :** Name of the process. + + + +If you only want to see the command name instead of the absolute path of the command, use the ps command format below. + +``` +# ps -eo pid,ppid,%mem,%cpu,comm --sort=-%cpu | head + + PID PPID %MEM %CPU COMMAND +18527 1714 4.1 40.4 Web Content + 1714 1152 5.7 8.0 firefox +18324 1714 4.9 6.3 Web Content + 3286 1714 2.0 5.1 Web Content + 1783 1714 3.0 4.5 Web Content + 1227 1152 2.3 2.5 gnome-shell + 1170 1168 3.5 2.2 Xorg +16865 1714 2.4 2.1 Web Content + 2179 1714 2.7 1.8 Web Content +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ +[2]: https://www.2daygeek.com/linux-top-command-linux-system-performance-monitoring-tool/ +[3]: https://www.2daygeek.com/linux-ps-command-find-running-process-monitoring/ +[4]: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/ +[5]: https://www.2daygeek.com/understanding-linux-top-command-output-usage/ From b4c69905f81f902a03ddd1c50b2454d0a357cdef Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 00:55:53 +0800 Subject: [PATCH 029/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191210=203=20ea?= =?UTF-8?q?sy=20steps=20to=20update=20your=20apps=20to=20Python=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191210 3 easy steps to update your apps to Python 3.md --- ...y steps to update your apps to Python 3.md | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 sources/tech/20191210 3 easy steps to update your apps to Python 3.md diff --git a/sources/tech/20191210 3 easy steps to update your apps to Python 3.md b/sources/tech/20191210 3 easy steps to update your apps to Python 3.md new file mode 100644 index 0000000000..5b3f7adcb8 --- /dev/null +++ b/sources/tech/20191210 3 easy steps to update your apps to Python 3.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 easy steps to update your apps to Python 3) +[#]: via: (https://opensource.com/article/19/12/update-apps-python-3) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +3 easy steps to update your apps to Python 3 +====== +Python 2 has reached its end of life, so it's past time to convert your +Python 2 project to Python 3. +![Hands on a keyboard with a Python book ][1] + +The 2.x series of Python is [officially over][2], but converting code to Python 3 is easier than you think. Over the weekend, I spent an evening converting the frontend code of a 3D renderer (and its corresponding [PySide][3] version) to Python 3, and it was surprisingly simple in retrospect, although it seemed relatively hopeless during the refactoring process. The conversion process can seem a little like a labyrinth, with every change you make revealing a dozen more changes you need to make. + +You may or may not _want_ to do the conversion, but—whether it's because you procrastinated too long or you rely on a module that won't be maintained unless you convert—sometimes you just don't have a choice. And if you're looking for an easy task to start your contribution to open source, converting a Python 2 app to Python 3 is a great way to make an easy but meaningful impression. + +Whatever your reason for refactoring Python 2 code into Python 3, it's an important job. Here are three steps to approach the task with clarity. + +### 1\. Run 2to3 + +For the past several years, Python has shipped with a script called [**2to3**][4], which does the bulk of the conversion from Python 2 to Python 3 for you. Automatically. And you already have it installed (whether you realize it or not). + +Here's a short snippet of code written in Python 2.6: + + +``` +#!/usr/bin/env python +# -*- coding: utf-8 -*- +mystring = u'abcdé' +print ord(mystring[-1]) +``` + +Run the **2to3** script: + + +``` +$ 2to3 example.py +RefactoringTool: Refactored example.py +\--- example.py     (original) ++++ example.py     (refactored) +@@ -1,5 +1,5 @@ + #!/usr/bin/env python + # -*- coding: utf-8 -*- +  +-mystring = u'abcdé' +-print ord(mystring[-1]) ++mystring = 'abcdé' ++print(ord(mystring[-1])) +RefactoringTool: Files that need to be modified: +RefactoringTool: example.py +``` + +By default, **2to3** prints only the changes required to bring old Python code up to Python 3 standards. The output is a usable patch you can use to change your file, but it's easier to just let Python do that for you, using the **\--write** (or **-w**) option: + + +``` +$ 2to3 -w example.py +[...] +RefactoringTool: Files that were modified: +RefactoringTool: example.py +``` + +The **2to3** script doesn't work on just a single file. You can run it on an entire directory of Python files, with or without the **\--write** option, to process all ***.py** files in the directory and its subdirectories. + +### 2\. Use Pylint or Pyflakes + +It's not uncommon to discover code quirks that ran without issue in Python 2 but don't work so well in Python 3. Because these quirks can't be fixed by converting syntax, they get past **2to3** unchanged, but they fail once you try to run the code. + +To detect such issues, you can use an application like [Pylint][5] or a tool like [Pyflakes][6] (or the [flake8][7] wrapper). I prefer Pyflakes because, unlike Pylint, it ignores deviations in the _style_ of your code. While the "prettiness" of Python is often praised as one of its strong points, when porting someone else's code from 2 to 3, treating style and function as two separate bugs is a matter of prioritization. + +Here's example output from Pyflakes: + + +``` +$ pyflakes example/maths +example/maths/enum.py:19: undefined name 'cmp' +example/maths/enum.py:105: local variable 'e' is assigned to but never used +example/maths/enum.py:109: undefined name 'basestring' +example/maths/enum.py:208: undefined name 'EnumValueCompareError' +example/maths/enum.py:208: local variable 'e' is assigned to but never used +``` + +This output (compared to 143 lines from Pylint, most of which were complaints about indentation) clearly displays the problems in the code that you should repair. + +The most interesting error here is the first one, on line 19. It's a little misleading because you might think that **cmp** is a variable that was never defined, but **cmp** is really a function from Python 2 that doesn't exist in Python 3. It's wrapped in a **try** statement, so the issue could easily go unnoticed until it becomes obvious that the **try** result is not getting produced. + + +``` +    try: +        result = cmp(self.index, other.index) +        except: +                result = 42 +        +        return result +``` + +There are countless examples of functions that no longer exist or that have changed between when an application was maintained as a Python 2 codebase and when you decide to port it. PySide(2) bindings have changed, Python functions have disappeared or been transformed (**imp** to **importlib**, for example), and so on. Fix them one by one as you encounter them. Even though it's up to you to reimplement or replace those missing functions, by now, most of these issues are known and [well-documented][8]. The real challenge is more about catching the errors than fixing them, so use Pyflakes or a similar tool. + +### 3\. Repair broken Python 2 code + +The **2to3** script gets your code Python 3 compliant, but it only knows about differences between Python 2 and 3. It generally can't make adjustments to account for changes in libraries that worked one way back in 2010 but have had major revisions since then. You must update that code manually. + +For instance, this code apparently worked back in the days of Python 2.6: + + +``` +class CLOCK_SPEED: +        TICKS_PER_SECOND = 16 +        TICK_RATES = [int(i * TICKS_PER_SECOND) +                      for i in (0.5, 1, 2, 3, 4, 6, 8, 11, 20)] + +class FPS: +        STATS_UPDATE_FREQUENCY = CLOCK_SPEED.TICKS_PER_SECOND +``` + +Automated tools like **2to3** and **Pyflakes** don't detect the problem, but Python 3 doesn't see **GAME_SPEED.TICKS_PER_SECOND** as a valid statement because the function being called was never explicitly declared. Adjusting the code is a simple exercise in object-oriented programming: + + +``` +class CLOCK_SPEED: +        def TICKS_PER_SECOND(): +                TICKS_PER_SECOND = 16 +                TICK_RATES = [int(i * TICKS_PER_SECOND) +                        for i in (0.5, 1, 2, 3, 4, 6, 8, 11, 20)] +                return TICKS_PER_SECOND + +class FPS: +        STATS_UPDATE_FREQUENCY = CLOCK_SPEED.TICKS_PER_SECOND() +``` + +You may be inclined to make it cleaner still by replacing the **TICKS_PER_SECOND** function with a constructor (an **__init__** function to set default values), but that would change the required call from **CLOCK_SPEED.TICKS_PER_SECOND()** to just **CLOCK_SPEED()**, which may or may not have ramifications elsewhere in the codebase. If you know the code well, then you can use your better judgment about how + +much alteration is _required_ and how much would just be pleasant, but generally, I prefer to assume every change I make inevitably demands at least three changes to every other file in the project, so I try to work within its existing structure. + +### Don't stop believing + +If you're porting a very large project, it sometimes starts to feel like there's no end in sight. It can seem like forever before you see a useful error message that's _not_ about a Python 2 quirk that slipped past the scripts and linters, and once you get to that point, you'll start to suspect it would be easier to just start from scratch. The bright side is that you (presumably) know that the codebase you're porting works (or worked) in Python 2, and once you make your adjustments, it will work again in Python 3; it's just a matter of conversion. + +Once you've done the legwork, you'll have a Python 3 module or application, and regular maintenance (and those style changes to make Pylint happy) can begin anew! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/update-apps-python-3 + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://opensource.com/article/19/11/end-of-life-python-2 +[3]: https://pypi.org/project/PySide/ +[4]: https://docs.python.org/3.1/library/2to3.html +[5]: https://opensource.com/article/19/10/python-pylint-introduction +[6]: https://pypi.org/project/pyflakes/ +[7]: https://opensource.com/article/19/5/python-flake8 +[8]: https://docs.python.org/3.0/whatsnew/3.0.html From b0513c3cd668aea3da4f8b77c0226eb46680f89c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 00:56:20 +0800 Subject: [PATCH 030/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191210=20Custom?= =?UTF-8?q?ize=20your=20Linux=20desktop=20with=20FVWM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191210 Customize your Linux desktop with FVWM.md --- ... Customize your Linux desktop with FVWM.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20191210 Customize your Linux desktop with FVWM.md diff --git a/sources/tech/20191210 Customize your Linux desktop with FVWM.md b/sources/tech/20191210 Customize your Linux desktop with FVWM.md new file mode 100644 index 0000000000..2e49ce787a --- /dev/null +++ b/sources/tech/20191210 Customize your Linux desktop with FVWM.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Customize your Linux desktop with FVWM) +[#]: via: (https://opensource.com/article/19/12/fvwm-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Customize your Linux desktop with FVWM +====== +This article is part of a special series of 24 days of Linux desktops. +If you're looking for a lightweight, fast, and simple Linux window +manager, FVWM qualifies. But if you're looking for something to dig +into, explore, and hack, then FVWM is a must. +![Coding on a computer][1] + +The [FVWM][2] window manager started out as modifications to [TWM][3], back in 1993. After several years of iteration, what emerged is an extremely customizable environment where any behavior, action, or event is configurable. It has support for custom key bindings, mouse gestures, theming, scripting, and much more. + +While FVWM is usable immediately after installation, its default distribution provides only the absolute minimum configuration. It's a great foundation to start your own custom desktop environment, but if you just want to use it as a desktop, then you probably want to install a full configuration distributed by another user. There are a few different distributions of FVWM, including FVWM95, which mimics Windows 95 (at least in appearance and layout). I tried [FVWM-Crystal][4], a modern-looking theme with some common Linux desktop conventions. + +Install the FVWM distribution you want to try from your Linux distribution's software repository. If you can't find a specific FVWM distribution, it's safe to install the base FVWM2 package and then go to [Box-Look.org][5] to download a theme package manually. It's a little more work that way, but not nearly as much as building your own workspace from scratch. + +After installing, log out of your current desktop session so you can log into FVWM. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +To do so with GDM: + +![Select your desktop session in GDM][6] + +And with KDM: + +![Select your desktop session with KDM][7] + +### FVWM desktop + +Regardless of what theme and configuration you're using, FVWM, at minimum, provides a menu when you left-click on the desktop. The contents of this menu vary depending on what you've installed. The menu in the FVWM-Crystal distribution contains quick access to common preferences, such as screen resolution, wallpaper settings, window decorations, and so on. + +As with pretty much everything in FVWM, the menu can be edited to include whatever you want, but FVWM-Crystal favors the application menu bar. The application menu is located at the top-left of the screen, and each icon contains a menu of related application launchers. For example, the GIMP icon reveals image editors, the KDevelop icon reveals integrated development environments (IDEs), the GNU icon reveals text editors, and so on, depending on what you have installed on your system. + +![FVWM-crystal running on Slackware 14.2][8] + +FVWM-Crystal also provides virtual desktops, a taskbar, a clock, and an application bar. + +For your background, you can use the wallpapers bundled with FVWM-Crystal or set your own with the **feh** command (you may need to install it from your repository). This command has a few options for setting the background, including **\--bg-scale** to fill the screen with a scaled version of your wallpaper of choice, **\--bg-fill** to fill the screen without adjusting the size of the image, and so on. + + +``` +`$ feh --bg-scale ~/Pictures/wallpapers/mybackground.jpg` +``` + +Most configuration files are contained in **$HOME/.fvwm-crystal**, with some systemwide defaults located in **/usr/share/fvwm-crystal**. + +### Do it yourself + +FVWM is as much a desktop-building platform as it is a window manager. It doesn't do anything for you, and it expects you to configure anything—and possibly everything. +If you're looking for a lightweight, fast, and simple window manager, FVWM qualifies. But if you're looking for something to dig into, explore, and hack, then FVWM is a must. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/fvwm-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: http://www.fvwm.org/ +[3]: https://en.wikipedia.org/wiki/Twm +[4]: https://www.box-look.org/p/1018270/ +[5]: http://box-look.org +[6]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) +[7]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) +[8]: https://opensource.com/sites/default/files/advent-fvwm-crystal.jpg (FVWM-crystal running on Slackware 14.2) From 9d4247df881ea2a6d3d59fafa941c0d8fa0d8ebe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 00:56:44 +0800 Subject: [PATCH 031/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191210=20Lesson?= =?UTF-8?q?s=20learned=20from=20programming=20in=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191210 Lessons learned from programming in Go.md --- ... Lessons learned from programming in Go.md | 334 ++++++++++++++++++ 1 file changed, 334 insertions(+) create mode 100644 sources/tech/20191210 Lessons learned from programming in Go.md diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md new file mode 100644 index 0000000000..1702d36c47 --- /dev/null +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -0,0 +1,334 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Lessons learned from programming in Go) +[#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) +[#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) + +Lessons learned from programming in Go +====== +Prevent future concurrent processing headaches by learning how to +address these common pitfalls. +![Goland gopher illustration][1] + +When you are working with complex distributed systems, you will likely come across the need for concurrent processing. At [Mode.net][2], we deal daily with real-time, fast and resilient software. Building a global private network that dynamically routes packets at the millisecond scale wouldn’t be possible without a highly concurrent system. This dynamic routing is based on the state of the network and, while there are many parameters to consider here, our focus is on link [metrics][3]. In our context, link metrics can be anything related to the status or current properties of a network link (e.g.: link latency). + +### Concurrent probing for link metrics + +[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing), our dynamic routing algorithm relies partially on link metrics to compute its routing table. Those metrics are collected by an independent component that sits on each [PoP][5] (Point of Presence). PoPs are machines that represent a single routing entity in our networks, connected by links and spread around multiple locations shaping our network. This component probes neighboring machines using network packets, and those neighbors will bounce back the initial probe. Link latency values can be derived from the received probes. Because each PoP has more than one neighbor, the nature of such a task is intrinsically concurrent: we need to measure latency for each neighboring link in real-time. We can’t afford sequential processing; each probe must be processed as soon as possible in order to compute this metric. + +![latency computation graph][6] + +### Sequence numbers and resets: A reordering situation + +Our probing component exchanges packets and relies on sequence numbers for packet processing. This aims to avoid processing of packet duplication or out-of-order packets. Our first implementation relied on a special sequence number 0 to reset sequence numbers. Such a number was only used during initialization of a component. The main problem was that we were considering an increasing sequence number value that always started at 0. After the component restarts, packet reordering could happen, and a packet could easily replace the sequence number with the value that was being used before the reset. This meant that the following packets would be ignored until it reaches the sequence number that was in use just before the reset. + +### UDP handshake and finite state machine + +The problem here was proper agreement of a sequence number after a component restarts. There are a few ways to handle this and, after discussing our options, we chose to implement a 3-way handshake protocol with a clear definition of states. This handshake establishes sessions over links during initialization. This guarantees that nodes are communicating over the same session and using the appropriate sequence number for it. + +To properly implement this, we have to define a finite state machine with clear states and transitions. This allows us to properly manage all corner cases for the handshake formation. + +![finite state machine diagram][7] + +Session IDs are generated by the handshake initiator. A full exchange sequence is as follows: + + 1. The sender sends out a **SYN (ID)*** *packet. + 2. The receiver stores the received **ID** and sends a **SYN-ACK (ID)**. + 3. The sender receives the **SYN-ACK (ID) *_and sends out an **ACK (ID)**._ *It also starts sending packets starting with sequence number 0. + 4. The receiver checks the last received **ID*** _and accepts the **ACK (ID)**_ *if the ID matches. It also starts accepting packets with sequence number 0. + + + +### Handling state timeouts + +Basically, at each state, you need to handle, at most, three types of events: link events, packet events, and timeout events. And those events show up concurrently, so here you have to handle concurrency properly. + + * Link events are either link up or link down updates. This can either initiate a link session or break an existing session. + * Packet events are control packets **(SYN/SYN-ACK/ACK)** or just probe responses. + * Timeout events are the ones triggered after a scheduled timeout expires for the current session state. + + + +The main challenge here is how to handle concurrent timeout expiration and other events. And this is where one can easily fall into the traps of deadlocks and race conditions. + +### A first approach + +The language used for this project is [Golang][8]. It does provide native synchronization mechanisms such as native channels and locks and is able to spin lightweight threads for concurrent processing. + +![gophers hacking together][9] + +gophers hacking together + +You can start first by designing a structure that represents our **Session** and **Timeout Handlers**. + + +``` +type Session struct {   +  State SessionState   +  Id SessionId   +  RemoteIp string   +} + +type TimeoutHandler struct {   +  callback func(Session)   +  session Session   +  duration int   +  timer *timer.Timer   +} +``` + +**Session** identifies the connection session, with the session ID, neighboring link IP, and the current session state. + +**TimeoutHandler** holds the callback function, the session for which it should run, the duration, and a pointer to the scheduled timer. + +There is a global map that will store, per neighboring link session, the scheduled timeout handler. + + +``` +`SessionTimeout map[Session]*TimeoutHandler` +``` + +Registering and canceling a timeout is achieved by the following methods: + + +``` +// schedules the timeout callback function.   +func (timeout* TimeoutHandler) Register() {   +  timeout.timer = time.AfterFunc(time.Duration(timeout.duration) * time.Second, func() {   +    timeout.callback(timeout.session)   +  })   +} + +func (timeout* TimeoutHandler) Cancel() {   +  if timeout.timer == nil {   +    return   +  }   +  timeout.timer.Stop()   +} +``` + +For the timeouts creation and storage, you can use a method like the following: + + +``` +func CreateTimeoutHandler(callback func(Session), session Session, duration int) *TimeoutHandler {   +  if sessionTimeout[session] == nil {   +    sessionTimeout[session] := new(TimeoutHandler)   +  }   +    +  timeout = sessionTimeout[session]   +  timeout.session = session   +  timeout.callback = callback   +  timeout.duration = duration   +  return timeout   +} +``` + +Once the timeout handler is created and registered, it runs the callback after _duration_ seconds have elapsed. However, some events will require you to reschedule a timeout handler (as it happens at **SYN** state — every 3 seconds). + +For that, you can have the callback rescheduling a new timeout: + + +``` +func synCallback(session Session) {   +  sendSynPacket(session) + +  // reschedules the same callback.   +  newTimeout := NewTimeoutHandler(synCallback, session, SYN_TIMEOUT_DURATION)   +  newTimeout.Register() + +  sessionTimeout[state] = newTimeout   +} +``` + +This callback reschedules itself in a new timeout handler and updates the global **sessionTimeout** map. + +### **Data race and references** + +Your solution is ready. One simple test is to check that a timeout callback is executed after the timer has expired. To do this, register a timeout, sleep for its duration, and then check whether the callback actions were done. After the test is executed, it is a good idea to cancel the scheduled timeout (as it reschedules), so it won’t have side effects between tests. + +Surprisingly, this simple test found a bug in the solution. Canceling timeouts using the cancel method was just not doing its job. The following order of events would cause a data race condition: + + 1. You have one scheduled timeout handler. + 2. Thread 1: +a) You receive a control packet, and you now want to cancel the registered timeout and move on to the next session state. (e.g. received a **SYN-ACK** **after you sent a **SYN**). +b) You call **timeout.Cancel()**, which calls a **timer.Stop()**. (Note that a Golang timer stop doesn’t prevent an already expired timer from running.) + 3. Thread 2: +a) Right before that cancel call, the timer has expired, and the callback was about to execute. +b) The callback is executed, it schedules a new timeout and updates the global map. + 4. Thread 1: +a) Transitions to a new session state and registers a new timeout, updating the global map. + + + +Both threads were updating the timeout map concurrently. The end result is that you failed to cancel the registered timeout, and then you also lost the reference to the rescheduled timeout done by thread 2. This results in a handler that keeps executing and rescheduling for a while, doing unwanted behavior. + +### When locking is not enough + +Using locks also doesn’t fix the issue completely. If you add locks before processing any event and before executing a callback, it still doesn’t prevent an expired callback to run: + + +``` +func (timeout* TimeoutHandler) Register() {   +  timeout.timer = time.AfterFunc(time.Duration(timeout.duration) * time._Second_, func() {   +    stateLock.Lock()   +    defer stateLock.Unlock() + +    timeout.callback(timeout.session)   +  })   +} +``` + +The difference now is that the updates in the global map are synchronized, but this doesn’t prevent the callback from running after you call the **timeout.Cancel() **— This is the case if the scheduled timer expired but didn’t grab the lock yet. You should again lose reference to one of the registered timeouts. + +### Using cancellation channels + +Instead of relying on golang’s **timer.Stop()**, which doesn’t prevent an expired timer to execute, you can use cancellation channels. + +It is a slightly different approach. Now you won’t do a recursive re-scheduling through callbacks; instead, you register an infinite loop that waits for cancellation signals or timeout events. + +The new **Register()** spawns a new go thread that runs your callback after a timeout and schedules a new timeout after the previous one has been executed. A cancellation channel is returned to the caller to control when the loop should stop. + + +``` +func (timeout *TimeoutHandler) Register() chan struct{} {   +  cancelChan := make(chan struct{})   +    +  go func () {   +    select {   +    case _ = <\- cancelChan:   +      return   +    case _ = <\- time.AfterFunc(time.Duration(timeout.duration) * time.Second):   +      func () {   +        stateLock.Lock()   +        defer stateLock.Unlock() + +        timeout.callback(timeout.session)   +      } ()   +    }   +  } () + +  return cancelChan   +} + +func (timeout* TimeoutHandler) Cancel() {   +  if timeout.cancelChan == nil {   +    return   +  }   +  timeout.cancelChan <\- struct{}{}   +} +``` + +This approach gives you a cancellation channel for each timeout you register. A cancel call sends an empty struct to the channel and triggers the cancellation. However, this doesn’t resolve the previous issue; the timeout can expire right before you call cancel over the channel, and before the lock is grabbed by the timeout thread. + +The solution here is to check the cancellation channel inside the timeout scope after you grab the lock. + + +``` +  case _ = <\- time.AfterFunc(time.Duration(timeout.duration) * time.Second):   +    func () {   +      stateLock.Lock()   +      defer stateLock.Unlock()   +      +      select {   +      case _ = <\- handler.cancelChan:   +        return   +      default:   +        timeout.callback(timeout.session)   +      }   +    } ()   +  } +``` + +Finally, this guarantees that the callback is only executed after you grab the lock and no cancellation was triggered. + +### Beware of deadlocks + +This solution seems to work; however, there is one hidden pitfall here: [deadlocks][10]. + +Please read the code above again and try to find it yourself. Think of concurrent calls to any of the methods described. + +The last problem here is with the cancellation channel itself. We made it an unbuffered channel, which means that sending is a blocking call. Once you call cancel in a timeout handler, you only proceed once that handler is canceled. The problem here is when you have multiple calls to the same cancelation channel, where a cancel request is only consumed once. And this can easily happen if concurrent events were to cancel the same timeout handler, like a link down or control packet event. This results in a deadlock situation, possibly bringing the application to a halt. + +![gophers on a wire, talking][11] + +Is anyone listening? + +By Trevor Forrey. Used with permission. + +The solution here is to at least make the channel buffered by one, so sends are not always blocking, and also explicitly make the send non-blocking in case of concurrent calls. This guarantees the cancellation is sent once and won’t block the subsequent cancel calls. + + +``` +func (timeout* TimeoutHandler) Cancel() {   +  if timeout.cancelChan == nil {   +    return   +  }   +    +  select {   +  case timeout.cancelChan <\- struct{}{}:   +  default:   +    // can’t send on the channel, someone has already requested the cancellation.   +  }   +} +``` + +### Conclusion + +You learned in practice how common mistakes can show up while working with concurrent code. Due to their non-deterministic nature, those issues can go easily undetected, even with extensive testing. Here are the three main problems we encountered in the initial implementation. + +#### Updating shared data without synchronization + +This seems like an obvious one, but it’s actually hard to spot if your concurrent updates happen in different locations. The result is data race, where multiple updates to the same data can cause update loss, due to one update overriding another. In our case, we were updating the scheduled timeout reference on the same shared map. (Interestingly, if Go detects a concurrent read/write on the same Map object, it throws a fatal error —you can try to run Go’s [data race detector][12]). This eventually results in losing a timeout reference and making it impossible to cancel that given timeout. Always remember to use locks when they are needed. + +![gopher assembly line][13] + +don’t forget to synchronize gophers’ work + +#### Missing condition checks + +Condition checks are needed in situations where you can’t rely only on the lock exclusivity. Our situation is a bit different, but the core idea is the same as [condition variables][14]. Imagine a classic situation where you have one producer and multiple consumers working with a shared queue. A producer can add one item to the queue and wake up all consumers. The wake-up call means that some data is available at the queue, and because the queue is shared, access must be synchronized through a lock. Every consumer has a chance to grab the lock; however, you still need to check if there are items in the queue. A condition check is needed because you don’t know the queue status by the time you grab the lock. + +In our example, the timeout handler got a ‘wake up’ call from a timer expiration, but it still needed to check if a cancel signal was sent to it before it could proceed with the callback execution. + +![gopher boot camp][15] + +condition checks might be needed if you wake up multiple gophers + +#### Deadlocks + +This happens when one thread is stuck, waiting indefinitely for a signal to wake up, but this signal will never arrive. Those can completely kill your application by halting your entire program execution. + +In our case, this happened due to multiple send calls to a non-buffered and blocking channel. This meant that the send call would only return after a receive is done on the same channel. Our timeout thread loop was promptly receiving signals on the cancellation channel; however, after the first signal is received, it would break off the loop and never read from that channel again. The remaining callers are stuck forever. To avoid this situation, you need to carefully think through your code, handle blocking calls with care, and guarantee that thread starvation doesn’t happen. The fix in our example was to make the cancellation calls non-blocking—we didn’t need a blocking call for our needs. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/go-common-pitfalls + +作者:[Eduardo Ferreira][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/edufgf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny (Goland gopher illustration) +[2]: http://mode.net +[3]: https://en.wikipedia.org/wiki/Metrics_%28networking%29 +[4]: https://people.ece.cornell.edu/atang/pub/15/HALO_ToN.pdf +[5]: https://en.wikipedia.org/wiki/Point_of_presence +[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png (latency computation graph) +[7]: https://opensource.com/sites/default/files/uploads/image3_0.png (finite state machine diagram) +[8]: https://golang.org/ +[9]: https://opensource.com/sites/default/files/uploads/image4.png (gophers hacking together) +[10]: https://en.wikipedia.org/wiki/Deadlock +[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg (gophers on a wire, talking) +[12]: https://golang.org/doc/articles/race_detector.html +[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg (gopher assembly line) +[14]: https://en.wikipedia.org/wiki/Monitor_%28synchronization%29#Condition_variables +[15]: https://opensource.com/sites/default/files/uploads/image7.png (gopher boot camp) From 6760719a1fe4d61c526b9d68a02b2ee1a0748337 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 00:57:01 +0800 Subject: [PATCH 032/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191210=20Italia?= =?UTF-8?q?n=20job:=20Translating=20our=20mission=20statement=20in=20the?= =?UTF-8?q?=20open?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191210 Italian job- Translating our mission statement in the open.md --- ...ating our mission statement in the open.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20191210 Italian job- Translating our mission statement in the open.md diff --git a/sources/tech/20191210 Italian job- Translating our mission statement in the open.md b/sources/tech/20191210 Italian job- Translating our mission statement in the open.md new file mode 100644 index 0000000000..4ef0c383ff --- /dev/null +++ b/sources/tech/20191210 Italian job- Translating our mission statement in the open.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Italian job: Translating our mission statement in the open) +[#]: via: (https://opensource.com/open-organization/19/12/translating-mission-statement) +[#]: author: (Antonella Iecle https://opensource.com/users/aiecle) + +Italian job: Translating our mission statement in the open +====== +A seemingly straightforward translation exercise turned into a lesson +about the power of open decision making. +![Yellow arrows going both ways with texture][1] + +At Red Hat, part of my job is to ensure that company messages maintain their meaning and effectiveness in my native language—Italian—so that customers in my region can learn not only about our products and services but also about [our organizational values][2]. + +The work tends to be simple and straightforward. But in an open organization, even the tasks that seem small can present big opportunities for learning about the power of working the open way. + +That was the case for me recently, when what I thought would be a quick translation exercise turned into a lesson in the [benefits of open decision making][3]. + +### A crowdsourced decision + +A few months ago, I noticed a post on our company's internal collaboration platform that seemed to be calling my name. Colleagues from around the world were leaving comments on translated versions of one particular (and very important) corporate message: the [company's mission statement][4]. And they had questions about the Italian translation. + +So I joined the conversation with no hesitation, assuming I'd engage in a quick exchange of opinions and reach a conclusion about the best way to translate Red Hat's mission statement: + +_To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way._ + +That's a single sentence consisting of less than 20 words. Translating it into another language should be a no-brainer, right? If anything, the work should take no longer than a few minutes: Read it out loud, spot room for improvement, swap a word for a more effective synonym, maybe rephrase a bit, and you're done! + +As a matter of fact, that's not always the case. + +Translations of the mission statement in a few languages were already available, but comments from colleagues reflected a need for some review. And as more Red Hatters from different parts of the globe joined the discussion and shared their perspectives, I began to see many possibilities for solving this translation problem—and the challenges that come with this abundance of ideas. + +Seeing so many inspiring comments can make reaching a decision much more complicated. One might put concepts into words in a _number_ of ways, but how do we all agree on the _best_ way? How do we deliver a message that reflects our common goal? How do we make sure that all employees can identify with it? And how do we ensure that our customers understand how we can help them grow? + +It's true: When you're about to make a decision that has an impact on other people, you have to ask yourself—and each other—a lot of questions. + +It's true: When you're about to make a decision that has an impact on other people, you have to ask yourself—and each other—a lot of questions. + +### Found in translation + +Localising a message for our readers around the world means more than just translating it word by word. A literal translation may not be fully understandable, especially when the original message was written with English native speakers in mind. On the other hand, a creative translation may be just one of many possible interpretations of the original text. And then there are personal preferences: Which translation sounds better to me? Is there a particular reason? If so, how do I get my point across? + +Linguistic debates can highlight complex aspects of communication, from the subtle nuances in the meaning of a particular word to the cultural traits, mindsets, and levels of familiarity with a topic that define how the same message can be perceived by readers from different countries. Our own conversations delved into known linguistic dilemmas like the use of anglicisms and the disambiguation of expressions that can have more than one interpretation. + +Localisation teams must ensure that messages are delivered accurately and consistently. Working collaboratively is essential to achieving this goal. + +To get started, we only had to look at how our original mission statement had come together in the first place. Since we were trying to do something that someone else had done before, we needed to ask: "[How did Red Hat find its mission][5]?" + +The answer? By asking the whole company what it should be. + +Opening up the conversation doesn't always accelerate the decision making process. + +It may be counterintuitive, but engaging the broader community can be a very efficient way to overcome uncertainties and address problems you weren't even aware of. Opening up the conversation doesn't always accelerate the decision making process, but by bringing people together you allow them to draw a clearer picture of the problem and provide you with the elements you need to make better decisions. + +With that in mind, all you have to do is ask other teams to contribute, then give them a reasonable amount of time to make room in their busy schedule and think about how they can help. Suggestions will come, and how you will channel the incoming information is up to you. + +Surveys are often a great way to gather feedback and keep track of incoming responses, and this is the approach we chose. We submitted a new translation, and asked our teams in Italy to tell us if they were happy with it. The majority of the respondents were. However, a few participants had their own versions to share (and valid comments to add). + +After considering everyone's input, we submitted a second survey. We asked the participants to choose between the solution we offered in the first survey and a _newer_ version, one we obtained by incorporating the feedback we'd received from our recent collaborative discussion. + +The second option was the winner. + +The initial translation did not represent Red Hat's mission as clearly and faithfully as the improved statement did. For example, in the original version, Red Hat was a “point of reference” rather than a "catalyst," and worked with "a community" rather than a larger and more diverse number of "communities." We were using the word "collaborators" instead of "contributors," and our actions were following a set of "principles" rather than the open source "way." + +The changes we made reaffirmed Red Hat's role in the communities and its commitment to open source technology, but also to open source as a way of working. + +Don't be afraid to jump into a conversation—or even to take the lead—if you think you can help to make better decisions. + +So here is some advice this experience taught me: Don't be afraid to jump into a conversation—or even to take the lead—if you think you can help to make better decisions. Because as Jim Whitehurst likes to say, in the open source world, we believe [the best ideas should win][6], no matter where they come from. + +In short, here is my five-point checklist for open decision-making, regardless of the task you face: + + 1. Encourage wide participation. + 2. Welcome all responses as they arrive. + 3. Identify the best ideas and get the most out of everyone's suggestions. + 4. Answer questions and address concerns. + 5. Communicate the outcome, and summarize the steps of the decision process. In doing so, reassert the value of broad collaboration. + + + +One more thing (I know I said I only had five more points, but don't switch off yet): Keep listening to what people might have to say about the decision you just made together. + +The best ideas may take longer to brew. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/12/translating-mission-statement + +作者:[Antonella Iecle][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/aiecle +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arrows_translation_lead.jpg?itok=S4vAh9CP (Yellow arrows going both ways with texture) +[2]: https://www.redhat.com/en/book-of-red-hat#our-values +[3]: https://opensource.com/open-organization/resources/open-decision-framework +[4]: https://www.redhat.com/en/book-of-red-hat#our-vision-intro +[5]: https://www.managementexchange.com/blog/how-red-hat-used-open-source-way-develop-company-mission +[6]: https://opensource.com/open-organization/16/8/how-make-meritocracy-work From 92e7ef8362d7e74196fadd301ea1da233ebc7f9a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 00:57:49 +0800 Subject: [PATCH 033/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191209=20KubeCo?= =?UTF-8?q?n=20gets=20bigger,=20the=20kernel=20gets=20better,=20and=20more?= =?UTF-8?q?=20industry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md --- ...l gets better, and more industry trends.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md diff --git a/sources/tech/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md b/sources/tech/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md new file mode 100644 index 0000000000..81b00a0ec9 --- /dev/null +++ b/sources/tech/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (KubeCon gets bigger, the kernel gets better, and more industry trends) +[#]: via: (https://opensource.com/article/19/12/kubecon-bigger-kernel-better-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +KubeCon gets bigger, the kernel gets better, and more industry trends +====== +A weekly look at open source community, market, and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [KubeCon showed Kubernetes is big, but is it a Unicorn?][2] + +> It’s hard to remember now but there was a time when Kubernetes was a distant No. 3 in terms of container orchestrators being used in the market. It’s also eye opening to now realize that [the firms][3] that hatched the two platforms that [towered over][4] Kubernetes have had to completely re-jigger their business models under the Kubernetes onslaught. +> +> And full credit to the CNCF for attempting to diffuse some of that attention from Kubernetes by spending the vast majority of the KubeCon opening keynote address touting some of the nearly two dozen graduated, incubating, and sandbox projects it also hosts. But, it was really the Big K that stole the show. + +**The impact:** Open source is way more than the source code; governance is a big deal and can be the difference between longevity and irrelevance. Gathering, organizing, and maintaining humans is an entirely different skill set than doing the same for bits, but can have just as big an influence on the success of a project. + +## [Report: Kubernetes use on the rise][5] + +> At the same time, the Datadog report notes that container churn rates are approximately 10 times higher in orchestrated environments. Churn rates in container environments that lack an orchestration platform such as Kubernetes have increased in the last year as well. The average container lifespan at a typical company running infrastructure without orchestration is about two days, down from about six days in mid-2018. In 19% of those environments not running orchestration, the average container lifetime exceeded 30 days. That compares to only 3% of organizations running containers longer than 30 days in Kubernetes environments, according to the report’s findings. + +**The impact**: If your containers aren't churning, you're probably not getting the full benefit of the technology you've adopted. + +## [Upcoming Linux 5.5 kernel improves live patching, scheduling][6] + +> A new WFX Wi-Fi driver for the Silicon Labs WF200 ASIC transceiver is coming to Linux kernel 5.5. This particular wireless transceiver is geared toward low-power IoT devices and uses a 2.4 GHz 802.11b/g/n radio optimized for low power RF performance in crowded RF environments. This new driver can interface via both Serial Peripheral Interface (SPI) and Secure Digital Input Output (SDIO). + +**The impact**: The kernel's continued relevance is a direct result of the never-ending grind to keep being where people need it to be (i.e. basically everywhere). + +## [DigitalOcean Currents: December 2019][7] + +> In that spirit, this fall’s installment of our seasonal Currents report is dedicated to open source for the second year running. We surveyed more than 5800 developers around the world on the overall health and direction of the open source community. When we last checked in with the community in [2018][8], more than half of developers reported contributing to open source projects, and most felt the community was healthy and growing. + +**The impact**: While the good news outweighs the bad, there are a couple of things to keep an eye on: namely, making open source more inclusive and mitigating potential negative impact of big money. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/kubecon-bigger-kernel-better-more-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.sdxcentral.com/articles/opinion-editorial/kubecon-showed-kubernetes-is-big-but-is-it-a-unicorn/2019/11/ +[3]: https://www.sdxcentral.com/articles/news/docker-unloads-enterprise-biz-to-mirantis/2019/11/ +[4]: https://www.sdxcentral.com/articles/news/mesosphere-is-now-d2iq-and-kubernetes-is-its-game/2019/08/ +[5]: https://containerjournal.com/topics/container-ecosystems/report-kubernetes-use-on-the-rise/ +[6]: https://thenewstack.io/upcoming-linux-5-5-kernel-improves-live-patching-scheduling/ +[7]: https://blog.digitalocean.com/digitalocean-currents-december-2019/ +[8]: https://www.digitalocean.com/currents/october-2018/ From 628b3310eb85db9c1a32d6ca91965e59e83f5267 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 01:05:41 +0800 Subject: [PATCH 034/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191209=20LibreC?= =?UTF-8?q?orps=20mentors=20humanitarian=20startups=20on=20how=20to=20run?= =?UTF-8?q?=20the=20open=20source=20way?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md --- ...rtups on how to run the open source way.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 sources/tech/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md diff --git a/sources/tech/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md b/sources/tech/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md new file mode 100644 index 0000000000..3d3674e7db --- /dev/null +++ b/sources/tech/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LibreCorps mentors humanitarian startups on how to run the open source way) +[#]: via: (https://opensource.com/article/19/12/humanitarian-startups-open-source) +[#]: author: (Justin W. Flory https://opensource.com/users/jflory) + +LibreCorps mentors humanitarian startups on how to run the open source way +====== +NGOs and nonprofits can increase their reach by building open source +communities. +![Two diverse hands holding a globe][1] + +Free and open source software are no longer workplace taboos, at least not in the same way they were fifteen years ago. Today, distributed collaboration platforms and tools empower people around the world to contribute code, documentation, design, leadership, and other skills to open source projects. But do newcomers actually have a deep understanding of free and open source software? + +If you hang around in open source communities for long enough, you realize there is more to open source than slapping a free software license on a project and throwing it over an imaginary fence to wait for contributors who never come. To address this problem in the humanitarian sector, the LibreCorps program, led by Rochester Institute of Technology's FOSS initiative at the [Center for Media, Arts, Interaction & Creativity][2] (MAGIC,) partnered with UNICEF to develop a set of resources to help new open source maintainers chart an "open source roadmap" to build a community. + +![Grassroots presentation in UNICEF office ][3] + +### What is LibreCorps? + +[LibreCorps][4] connects RIT students interested in open source to humanitarian and civic coding opportunities; specifically, opportunities for co-operative education placements (co-ops,) which are full-time paid internships included in the university's graduation requirements. + +LibreCorps students work in two major areas on co-ops. The first, not surprisingly, is technology. The second is FOSS community and processes. Many NGOs and civic organizations put openly licensed work in repositories but need a plan to build and maintain a community of contributors around their technology. + +LibreCorps has worked with numerous humanitarian projects over the years. Recently, LibreCorps was contracted by [UNICEF Innovation][5] to support the [Innovation Fund][6] by mentoring several cohorts of international start-ups in adopting best practices to meet the open source requirement of their funding. + +Periodically, the UNICEF Innovation Fund invites the companies together for cohort workshops, with hands-on mentorship a primary component of the workshop. [Stephen Jacobs][7] and [Justin W. Flory][8] represented LibreCorps at [two UNICEF Innovation Fund workshops][9] to help these teams better understand free and open source, as well as how to successfully build communities and teams that operate as [open organizatio][10][ns][10]. Most of these teams have either never worked in open source projects or only have a basic understanding of licenses and GitHub. Often, for these teams, working on your code in a way where anyone can see what you are doing is a radical shift in process. + +UNICEF Innovation has engaged with open source for years and currently provides funded teams with a course on [open source business models][11]. + +> "We'd approached open-source pretty tentatively and definitely naively. We were keen to move to open source for transparency and perception but, beyond that, had no plans around deriving or creating value, and we were nervous about the perceived risks. The mentorship from Mike Nolan has given us clear direction and a deeper understanding that open source isn't a compromise but a communication channel and a way to build a community, and he's giving us the tools that enable that." — Michael Nunan, Director at Tupaia. + +### How do we create workable community strategy guides? + +This past summer, LibreCorps began developing and evolving resources to help these teams take the complex and difficult challenge of building an open source community and break it down into smaller, more manageable steps. [Mike Nolan][12] and [Kent Reese][13] developed a roadmap template for teams to evaluate their current status in maintainership best practices and chart out milestones for where to go next. For a cohort working in open source for the first time, the LibreCorps team offers advice and suggestions on crafting a mission statement, choosing the right license for your project, and more. The rubrics provide an interactive, color-coded reference to unlock a deeper understanding of their progress towards each milestone. + +Let's explore each resource in more detail to understand how they work: + +### Roadmap template + +The [roadmap template][14] is a resource that gets hands-on and personal to a specific open source project. There are five tracks within the roadmaps with different tasks to gradually ramp up the areas of focus for community management. + +The first track includes milestones like writing a mission statement, choosing a free software license, and establishing a code of conduct, and provides a set of open source tools or frameworks for users to learn more about. The second track includes gradually more advanced milestones like documenting how to set up a development environment, learning the pull request workflow, choosing a project hosting platform, and more. Further tracks include milestones like implementing continuous integration (CI,) organizing community events, and gathering user testimonials. + +The LibreCorps team works with each Innovation Fund team within the cohort to create a rubric specific to their projects. The cohort identifies their current position based on which milestone they are currently working toward. Then, we work together to determine next steps for growing their open source community, then create a strategy to reach and accomplish those goals. + +### Self-evaluation rubric + +The milestone template provides high-level guidance on which direction to go, but the [self-evaluation rubric][15] is a feedback mechanism to give cohorts a picture of exceptional, acceptable, and poor implementations for each assigned task. The self-evaluation rubrics enable LibreCorps cohorts to independently self-evaluate progress towards building a sustainable and open community. + +The rubric is organized into five tracks: + + * Community outreach + * Continuous integration and health checks + * Documentation + * Project management + * Workflow + + + +Each track includes detailed sets of sub-tasks or specific components of building an open source community. For example, documentation includes writing guidelines for how to contribute, and community outreach includes maintaining a project website and engaging with an upstream project community, if one exists. + +The LibreCorps team mostly works with the rubric to evaluate whether Innovation Fund cohort teams sufficiently meet the open source requirement for their project. Some teams make use of the rubric to get a more detailed understanding of whether they are heading in the right direction with their community work. + +### Contribute to these resources + +Do these resources sound useful or interesting? Fortunately, the LibreCorps content is licensed under Creative Commons licenses. Learn more about LibreCorps on the [FOSS@MAGIC website][4] and keep up with what we are doing on [our GitHub][16]. To get in touch with us, visit our community Discourse forums on [fossrit.community][17]. + +A few months ago, we profiled open source projects working to make the world a better place. In... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/humanitarian-startups-open-source + +作者:[Justin W. Flory][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jflory +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe) +[2]: https://www.rit.edu/magic/ +[3]: https://opensource.com/sites/default/files/uploads/unicef-flory_0.jpg (Grassroots presentation in UNICEF office ) +[4]: https://fossrit.github.io/librecorps/ +[5]: https://www.wired.com/story/wired25-stories-people-racing-to-save-us/ +[6]: https://unicefinnovationfund.org/ +[7]: https://www.rit.edu/magic/affiliate-spotlight-stephen-jacobs +[8]: https://justinwflory.com/ +[9]: https://fossrit.github.io/announcements/2019/04/01/unicef-foss-community-building/ +[10]: https://opensource.com/open-organization/resources/open-org-maturity-model +[11]: https://www.google.com/url?q=https://agora.unicef.org/course/info.php?id%3D18096&sa=D&ust=1573658770972000&usg=AFQjCNGemgWoJ3kCoKImLCDok7opIo2RCA +[12]: https://nolski.rocks/ +[13]: https://kentr.itch.io/ +[14]: https://docs.google.com/document/d/1M2nVwh7ArjAU31M7QZWP4AQz1cOyMhw90iP8Wg9lZNo/edit?usp=sharing +[15]: https://docs.google.com/spreadsheets/d/11DaQxbiOv9_EiZEozEkUapf2AsVQ4vBFelhnZ0a8R4w/edit?usp=sharing +[16]: https://github.com/librecorps/ +[17]: https://fossrit.community/ From b80d235ef4b64658f9e8cdec6a347ab1d1bff125 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 01:08:45 +0800 Subject: [PATCH 035/676] add done: 20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md --- ...0191209 How to change colors and themes in Vim.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sources/tech/20191209 How to change colors and themes in Vim.md diff --git a/sources/tech/20191209 How to change colors and themes in Vim.md b/sources/tech/20191209 How to change colors and themes in Vim.md new file mode 100644 index 0000000000..a5aac50b0b --- /dev/null +++ b/sources/tech/20191209 How to change colors and themes in Vim.md @@ -0,0 +1,12 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to change colors and themes in Vim) +[#]: via: (https://opensource.com/article/19/12/colors-themes-vim) +[#]: author: (Rashan Smith https://opensource.com/users/rsmith) + +How to change colors and themes in Vim +====== +Style your command line Vim with your favorite color scheme. From 5a3b9ffbad156509ec82d4fa6582b3eeae7aa564 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 01:17:18 +0800 Subject: [PATCH 036/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191209=20Use=20?= =?UTF-8?q?the=20Fluxbox=20Linux=20desktop=20as=20your=20window=20manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md --- ...ox Linux desktop as your window manager.md | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md diff --git a/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md b/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md new file mode 100644 index 0000000000..8c7ddcb1e5 --- /dev/null +++ b/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use the Fluxbox Linux desktop as your window manager) +[#]: via: (https://opensource.com/article/19/12/fluxbox-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Use the Fluxbox Linux desktop as your window manager +====== +This article is part of a special series of 24 days of Linux desktops. +Fluxbox is very light on system resources, yet it has vital Linux +desktop features to make your user experience easy, blazingly efficient, +and unduly fast. +![Text editor on a browser, in blue][1] + +The concept of a desktop may differ from one computer user to another. Many people see the desktop as a home base, or a comfy living room, or even a literal desktop where they place frequently used notepads, their best pens and pencils, and their favorite coffee mug. KDE, GNOME, Pantheon (and so on) provide that kind of comfort on Linux. + +But for some users, the desktop is just empty monitor space, a side effect of not yet having any free-floating application windows projected directly onto their retina. For these users, the desktop is a void over which they can run applications—whether big office and graphic suites, or a simple terminal window, or docked applets—to manage services. This model of operating a [POSIX][2] computer has a long history, and one branch of that family tree is the *box window managers: Blackbox, Fluxbox, and Openbox. + +[Fluxbox][3] is a window manager for X11 systems that's based on an older project called Blackbox. Blackbox development was waning when I discovered Linux, so I fell into Fluxbox, and I've used it ever since on at least one of my active systems. It is written in C++ and is licensed under the MIT open source license. + +### Installing Fluxbox + +You are likely to find Fluxbox included in the software repository of your Linux distribution, but you can also find it on [Fluxbox.org][4]. If you're already running a different desktop, it's safe to install Fluxbox on the same system because Fluxbox doesn't predetermine any configuration or accompanying applications. + +After installing Fluxbox, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +To override the desktop with GDM: + +![Select your desktop session in GDM][5] + +Or with KDM: + +![Select your desktop session with KDM][6] + +### Configuring the Fluxbox desktop + +When you first log in, the screen is mostly empty because all Fluxbox provides are panels (for a taskbar, system tray, and so on) and window decoration for application windows. + +![Default Fluxbox configuration on CentOS 7][7] + +If your distribution delivers a plain Fluxbox desktop, you can set a background for your desktop using the **feh** command (you may need to install it from your distribution's repository). This command has a few options for setting the background, including **\--bg-fill** to fill the screen with your wallpaper of choice, **\--bg-scale** to scale it to fit, and so on. + + +``` +`$ feh --bg-fill ~/photo/oamaru/leaf-spiral.jpg` +``` + +![Fluxbox with a theme applied][8] + +By default, Fluxbox auto-generates a menu, available with a right-click anywhere on the desktop, that gives you access to applications. Depending on your distribution, this menu may be very minimal, or it may list all the launchers in your **/usr/share/applications** directory. + +Fluxbox configuration is set in text files, and those text files are contained in the **$HOME/.fluxbox** directory. You can: + + * Set keyboard shortcuts in **keys** + * Set startup services and applications in **startup** + * Set desktop preferences (such as the number of workspaces, locations of panels, and so on) in **init** + * Set menu items in **menu** + + + +The text configuration files are easy to reverse-engineer, but you also can (and should) read the Fluxbox [documentation][9]. + +For example, this is my typical menu (or at least the basic structure of it): + + +``` +# to use your own menu, copy this to ~/.fluxbox/menu, then edit +# ~/.fluxbox/init and change the session.menuFile path to ~/.fluxbox/menu + +[begin] (fluxkbox) + [submenu] (apps) {} +  [submenu] (txt) {} +   [exec] (Emacs 23 (text\\)) { x-terminal-emulator -T "Emacs (text)" -e /usr/bin/emacs -nw} <> +   [exec] (Emacs (X11\\)) {/usr/bin/emacs} <> +   [exec] (LibreOffice) {/usr/bin/libreoffice} +  [end] +  [submenu] (code) {} +   [exec] (qtCreator) {/usr/bin/qtcreator} +   [exec] (eclipse) {/usr/bin/eclipse} +  [end] +  [submenu] (graphics) {} +   [exec] (ksnapshot) {/usr/bin/ksnapshot} +   [exec] (gimp) {/usr/bin/gimp} +   [exec] (blender) {/usr/bin/blender} +  [end] +  [submenu] (files) {} +   [exec] (dolphin) {/usr/bin/dolphin} +   [exec] (konqueror) { /usr/bin/kfmclient openURL $HOME } +  [end] +  [submenu] (network) {} +   [exec] (firefox) {/usr/bin/firefox} +   [exec] (konqueror) {/usr/bin/konqueror} +  [end] + [end] +## change window manager or work env +[submenu] (environments) {} + [restart] (flux)  {/usr/bin/startfluxbox} + [restart] (ratpoison)  {/usr/bin/ratpoison} + [exec] (openIndiana) {/home/kenlon/qemu/startSolaris.sh} +[end] + +[config] (config) + [submenu] (styles) {} +  [stylesdir] (/usr/share/fluxbox/styles) +  [stylesdir] (~/.fluxbox/styles) + [end] +[workspaces] (workspaces) +[reconfig] (reconfigure) +[restart] (restart) +[exit] (exeunt) +[end] +``` + +The menu also provides a few preference settings, such as the ability to pick a theme and restart or log out from your Fluxbox session. + +I launch most applications using keyboard shortcuts, which are entered into the **keys** configuration file. Here are some examples (the **Mod4** key is the Super key, which I use to designate global shortcuts): + + +``` +# open apps +Mod4 t :Exec konsole +Mod4 k :Exec konqueror +Mod4 z :Exec fbrun +Mod4 e :Exec emacs +Mod4 f :Exec firefox +Mod4 x :Exec urxvt +Mod4 d :Exec dolphin +Mod4 q :Exec xscreensaver-command -activate +Mod4 3 :Exec ksnapshot +``` + +Between these shortcuts and an open terminal, I have little use for a mouse during most of my workday, so there's no wasted time switching from one controller to another. And because Fluxbox stays well out of the way, there's little distraction. + +### Why you should use Fluxbox + +Fluxbox is very light on system resources, yet it has vital features to make your user experience easy, blazingly efficient, and unduly fast. It's simple to customize, and it allows you to define your own workflow. You don't have to use Fluxbox's panels, because there are other excellent panels out there. You can even middle-click and drag two separate application windows into one another so that they become one window, each in its own tab. + +The possibilities are endless, so try the steady simplicity that is Fluxbox on your Linux box today! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/fluxbox-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: http://fluxbox.org +[4]: http://fluxbox.org/download/ +[5]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) +[6]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) +[7]: https://opensource.com/sites/default/files/advent-fluxbox-default.jpg (Default Fluxbox configuration on CentOS 7) +[8]: https://opensource.com/sites/default/files/advent-fluxbox-green.jpg (Fluxbox with a theme applied) +[9]: http://fluxbox.org/features/ From d0d6d5de1f3cce81163e9303c2c1e6c60b72d6a8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 01:26:56 +0800 Subject: [PATCH 037/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191208=20Why=20?= =?UTF-8?q?choose=20Xfce=20for=20your=20lightweight=20Linux=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191208 Why choose Xfce for your lightweight Linux desktop.md --- ...Xfce for your lightweight Linux desktop.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20191208 Why choose Xfce for your lightweight Linux desktop.md diff --git a/sources/tech/20191208 Why choose Xfce for your lightweight Linux desktop.md b/sources/tech/20191208 Why choose Xfce for your lightweight Linux desktop.md new file mode 100644 index 0000000000..cde1d600d7 --- /dev/null +++ b/sources/tech/20191208 Why choose Xfce for your lightweight Linux desktop.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why choose Xfce for your lightweight Linux desktop) +[#]: via: (https://opensource.com/article/19/12/xfce-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Why choose Xfce for your lightweight Linux desktop +====== +This article is part of a special series of 24 days of Linux desktops. +Looking for for a lightweight Linux distribution with plenty of +features? The Xfce Linux desktop has been the standard for a long time. +![Woman sitting in front of her laptop][1] + +The [Xfce desktop][2] has a specific, self-stated goal: to be fast on a system with low resources while being visually appealing and user-friendly. It's been the de facto choice for lightweight Linux distributions (or remixes) for years and is often cited by its fans as a desktop that provides just enough to be useful, but never so much as to be a burden. + +You may find Xfce included in the software repository of your Linux distribution, or you can download and install a distribution that ships Xfce as an available desktop (like the Xfce [Mageia][3] or [Fedora][4] spins or [Slackware][5]). Before you install it, be aware that, while it's lightweight, it is intended to provide a full desktop experience, so many Xfce apps are installed along with the desktop. If you're already running a different desktop, you may find yourself with redundant applications (two PDF readers, two file managers, and so on). If you just want to try the Xfce desktop, you can install an Xfce-based distribution in a virtual machine, such as [GNOME Boxes][6]. + +### Xfce desktop tour + +True to the Unix philosophy, Xfce keeps its desktop modular. Many different components, such as the xfwm4 window manager, xfce4-panel, xfdesktop, Thunar, Xfconf, and so on, are bundled together to form the Xfce desktop environment. That may seem a pedantic way of defining a bunch of components that are always bundled together as a desktop, but in the case of Xfce, it's significant because these components truly are separate. You can run the Xfce panel over your Openbox or PekWM window manager, or use Xfce applets in your Fluxbox toolbar, and run Thunar as your file manager in Cinnamon or Pantheon. The possibilities are endless, but together they form the Xfce desktop. + +The design of the Xfce desktop is clean, direct, and true to its Unix origins. Xfce began as some desktop widgets written with the XForms framework, even before GNOME existed. It was based conceptually upon the CDE desktop, which was the ubiquitous desktop at the time. Neither CDE nor XForms were open source, but Xfce was distributed freely. Eventually, Xfce was rewritten using the open source GTK toolkit, was included in several distributions, became a popular CDE and GNOME alternative, and eventually became the dominant choice of "lightweight" distributions. + +Here's what it looked like on [Alan Formy-Duval's][7] desktop back in 2003: + +![XFCE in 2003][8] + +Xfce isn't necessarily a simple desktop: its application menu is in the upper-left corner (a tradition familiar to Linux users but probably foreign to newcomers), and it has a place for pinned application launchers, a system tray, virtual desktops, and a taskbar. It's a proper control panel for the GUI side of a Linux computer, with all the essential knobs and switches exposed for easy access. And it does all of that without making much of an impact on your system resources. + +![XFCE in 2019 on Mageia Linux][9] + +Significantly, Xfce uses GTK libraries to accomplish a lightweight desktop, and in doing so, it looks good, it looks familiar, and it can be themed to look really beautiful. The [Xfce screenshot forum][10] affords users the opportunity to show off their themes and configurations. + +### Using the Xfce desktop + +Xfce is an ideal desktop for a server or when you want quick access to important settings on a desktop that you rarely _look_ at. It's also ideal for Linux power users who want to adjust common settings quickly, but otherwise rarely deals with the GUI. Then again, it's a good-looking lightweight desktop, it can be themed easily, and it's got plenty of features. It may be the perfect desktop for you, no matter how you use your Linux computer. The only way to find out is to try! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/xfce-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_4.png?itok=VGZO8CxT (Woman sitting in front of her laptop) +[2]: http://xfce.org +[3]: http://mageia.org +[4]: http://fedoraproject.org +[5]: http://slackware.com +[6]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[7]: https://opensource.com/users/alanfdoss +[8]: https://opensource.com/sites/default/files/advent-xfce-2003.jpg (XFCE in 2003) +[9]: https://opensource.com/sites/default/files/advent-xfce.jpg (XFCE on Mageia Linux in 2019) +[10]: https://forum.xfce.org/viewtopic.php?id=12676 From 304ed3914139198a28a0b5ade4727b97c28588be Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 01:36:46 +0800 Subject: [PATCH 038/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191208=20What's?= =?UTF-8?q?=20your=20favorite=20terminal=20emulator=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191208 What-s your favorite terminal emulator.md --- ... What-s your favorite terminal emulator.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/tech/20191208 What-s your favorite terminal emulator.md diff --git a/sources/tech/20191208 What-s your favorite terminal emulator.md b/sources/tech/20191208 What-s your favorite terminal emulator.md new file mode 100644 index 0000000000..ff3ed8349d --- /dev/null +++ b/sources/tech/20191208 What-s your favorite terminal emulator.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's your favorite terminal emulator?) +[#]: via: (https://opensource.com/article/19/12/favorite-terminal-emulator) +[#]: author: (Opensource.com https://opensource.com/users/admin) + +What's your favorite terminal emulator? +====== +We asked our community to tell us about their experience with terminal +emulators. Here are a few of the responses we received. Take our poll to +weigh in on your favorite. +![Terminal window with green text][1] + +Preference of a terminal emulator can say a lot about a person's workflow. Is the ability to drive mouseless a must-have? Do you like to navigate between tabs or windows? There's something to be said about how it makes you feel, too. Does it have that cool factor? Tell us about your favorite terminal emulator by taking our poll or leaving us a comment. How many have you tried? + +We asked our community to tell us about their experience with terminal emulators. Here are a few of the responses we received. + +"My favorite terminal emulator is Tilix, customized with Powerline. I love that it supports multiple terminals open in a single window." —Dan Arel + +"urxvt ([rxvt-unicode][2]). It's simple to configure via files, is lightweight, and readily available in most package manager repositories." —Brian Tomlinson + +"gnome-terminal is still my go-to even though I don't use GNOME anymore. :)" —Justin W. Flory + +"Terminator at this point on FC31.  I just started using it but like the split screen feature and it seems light enough for me. Investigating plugins." —Marc Maxwell + +"I switched over to Tilix a while back and it does everything I need terminals to do. :) Multiple panes, notifications, lean and runs my tmux sessions great." —Kevin Fenzi + +"alacritty. It's optimized for speed, implemented in Rust and generally feature packed, but, honestly speaking, I only care about one feature: configurable inter-glyph spacing that allows me to further condense my font. I'm so-o hooked." —Alexander Sosedkin +  + +"I am old and grumpy: KDE Konsole. With tmux in it if session is remote." —Marcin Juszkiewicz + +"iTerm2 for macOS. Yes, it's open source. :-) Terminator on Linux." —Patrick Mullins + + "I've been using alacritty for a year or two now, but recently I started also using cool-retro-term in fullscreen mode whenever I have to run a script that has a lot of output because it looks cool and makes me feel cool. This is important to me." —Nick Childers +  +"I love Tilix, partly because it's good at staying out of the way (I usually just run it full screen with tmux inside), but also for the custom hotlinking support: in my terminal, text like "rhbz#1234" is a hotlink that takes me to bugzilla. Similar for LaunchPad issues, Gerrit change ids for OpenStack, etc." —Lars Kellogg-Stedman +  +"Eterm, also presentations look best in cool-retro-term with Vintage profile." —Ivan Horvath +  +"+1 for Tilix. It’s the best for an option for GNOME users, IMO!"  —Eric Rich +  +"urxvt. Fast. Small. Configurable. Extendable via perl plugins, which can make it mouseless." —Roman Dobosz  +  +"Konsole is the best, the only app I use from KDE project. The highlight of all search result occurrences is a killer feature which afaik does not have any other Linux terminal (glad if you prove me wrong). Best for searching compilation errors and output logs." —Jan Horak +  +"I use Terminator in past a lot. Now I cloned the theme (dark one) in Tilix and I didn't miss a thing. Is easy to move between tabs. That's all." —Alberto Fanjul Alonso +  +"Started my journey in using Terminator, I have since (in the past 3 years or so) completely switched over to Tilix." —Mike Harris +  +"I use Drop Down Terminal X. It's a very simple extension for GNOME 3 that lets me have a terminal always at the stroke of a single key (F12 for me). And it also supports tabs, which is kind of all I need." —Germán Pulido +  +"xfce4-terminal: wayland support, zoom, no borders, no title bar, no scroll bar - that's all I want from terminal emulator, for everything else I have tmux. I want my terminal emulator to use as much screen space as possible as I usually have editor (Vim) and repl side by side in tmux panes." —Martin Kourim + +"Fish! Don’t ask! ;-)" —Eric Schabell + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/favorite-terminal-emulator + +作者:[Opensource.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/admin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_terminals_0.png?itok=XwIRERsn (Terminal window with green text) +[2]: https://opensource.com/article/19/10/why-use-rxvt-terminal From b455608d97e6aeb34c95d0aaed63365ada8fc480 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 11 Dec 2019 01:39:29 +0800 Subject: [PATCH 039/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191210=20Breaki?= =?UTF-8?q?ng=20Linux=20files=20into=20pieces=20with=20the=20split=20comma?= =?UTF-8?q?nd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191210 Breaking Linux files into pieces with the split command.md --- ...iles into pieces with the split command.md | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 sources/tech/20191210 Breaking Linux files into pieces with the split command.md diff --git a/sources/tech/20191210 Breaking Linux files into pieces with the split command.md b/sources/tech/20191210 Breaking Linux files into pieces with the split command.md new file mode 100644 index 0000000000..710a6c3e35 --- /dev/null +++ b/sources/tech/20191210 Breaking Linux files into pieces with the split command.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Breaking Linux files into pieces with the split command) +[#]: via: (https://www.networkworld.com/article/3489256/breaking-linux-files-into-pieces-with-the-split-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Breaking Linux files into pieces with the split command +====== +Some simple Linux commands allow you to break up files and reassemble them as needed in order to accommodate size restrictions on file size for storage or email attachments +[Marco Verch][1] [(CC BY 2.0)][2] + +Linux systems provide a very easy-to-use command for breaking files into pieces. This is something that you might need to do prior to uploading your files to some storage site that limits file sizes or emailing them as attachments. To split a file into pieces, you simply use the split command. + +``` +$ split bigfile +``` + +By default, the split command uses a very simple naming scheme. The file chunks will be named xaa, xab, xac, etc., and, presumably, if you break up a file that is sufficiently large, you might even get chunks named xza and xzz. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +Unless you ask, the command runs without giving you any feedback. You can, however, use the --verbose option if you would like to see the file chunks as they are being created. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +$ split –-verbose bigfile +creating file 'xaa' +creating file 'xab' +creating file 'xac' +``` + +You can also contribute to the file naming by providing a prefix. For example, to name all the pieces of your original file bigfile.xaa, bigfile.xab and so on, you would add your prefix to the end of your split command like so: + +``` +$ split –-verbose bigfile bigfile. +creating file 'bigfile.aa' +creating file 'bigfile.ab' +creating file 'bigfile.ac' +``` + +Note that a dot is added to the end of the prefix shown in the above command. Otherwise, the files would have names like bigfilexaa rather than bigfile.xaa. + +Note that the split command does _not_ remove your original file, just creates the chunks. If you want to specify the size of the file chunks, you can add that to your command using the -b option. For example: + +``` +$ split -b100M bigfile +``` + +File sizes can be specified in kilobytes, megabytes, gigabytes … up to yottabytes! Just use the appropriate letter from K, M, G, T, P, E, Z and Y. + +If you want your file to be split based on the number of lines in each chunk rather than the number of bytes, you can use the -l (lines) option. In this example, each file will have 1,000 lines except, of course, for the last one which may have fewer lines. + +``` +$ split --verbose -l1000 logfile log. +creating file 'log.aa' +creating file 'log.ab' +creating file 'log.ac' +creating file 'log.ad' +creating file 'log.ae' +creating file 'log.af' +creating file 'log.ag' +creating file 'log.ah' +creating file 'log.ai' +creating file 'log.aj' +``` + +If you need to reassemble your file from pieces on a remote site, you can do that fairly easily using a cat command like one of these: + +``` +$ cat x?? > original.file +$ cat log.?? > original.file +``` + +Splitting and reassembling with the commands shown above should work for binary files as well as text files. In this example, we’ve split the zip binary into 50 kilobyte chunks, used cat to reassemble them and then compared the assembled and original files. The diff command verifies that the files are the same. + +``` +$ split --verbose -b50K zip zip. +creating file 'zip.aa' +creating file 'zip.ab' +creating file 'zip.ac' +creating file 'zip.ad' +creating file 'zip.ae' +$ cat zip.a? > zip.new +$ diff zip zip.new +$ <== no output = no difference +``` + +The only caution I have to give at this point is that, if you use split often and use the default naming, you will likely end up overwriting some chunks with others and maybe sometimes having more chunks than you were expecting because some were left over from some earlier split. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489256/breaking-linux-files-into-pieces-with-the-split-command.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.flickr.com/photos/30478819@N08/34879296673/in/photolist-V9avJ2-LysA9-qVeu6t-dV4dkC-RWNeA5-LFKPG-aLpKTg-aLpJoK-4rN35a-97zDK4-7fevx8-mBSVT-64r2D4-8TbXFw-4g2Wgv-4pAdnq-4g6Ycf-9pt9t9-ceyN2u-LYckrJ-23sDdLH-dAQgiK-25eyt6N-UuAEk9-koNDTn-dAVK2j-ea8feG-bWpNKQ-bzJNPM-dAQ22K-dnkd1e-8qkaFp-dnCtBr-dnknKi-TKXaei-dnkjzV-RxvhHd-pQXTfa-c3crQf-dnkwXG-dnfW2K-2SKdMh-efHTUr-5mMzpp-XdMr5c-88H1s3-d67Gth-aMuG6v-Uio4v1-KZt3M +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 6cb902be902d9d819b30cdaa25b1341e1ee99969 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Dec 2019 08:19:28 +0800 Subject: [PATCH 040/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lxbwolf 首先,非常感谢你最近的积极贡献!不过,这篇翻译的语句有点生硬,建议翻译后审阅一遍。而且,我根据实际情况做了一些修改,所以,要根据自己的理解深入了 解文章所述技术,并在需要时补充完善。 --- ... Send Email from the Linux Command Line.md | 159 +++++++----------- 1 file changed, 63 insertions(+), 96 deletions(-) diff --git a/translated/tech/20191206 6 Ways to Send Email from the Linux Command Line.md b/translated/tech/20191206 6 Ways to Send Email from the Linux Command Line.md index d014acc66b..f773f4917f 100644 --- a/translated/tech/20191206 6 Ways to Send Email from the Linux Command Line.md +++ b/translated/tech/20191206 6 Ways to Send Email from the Linux Command Line.md @@ -1,240 +1,207 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (6 Ways to Send Email from the Linux Command Line) [#]: via: (https://www.2daygeek.com/6-ways-to-send-email-from-the-linux-command-line/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Linux 命令行发送邮件的 6 种方法 +Linux 命令行发送邮件的 5 种方法 ====== -当你需要在 shell 脚本中创建邮件时,就需要用到命令行发送邮件的知识。Linux 中有很多命令可以实现发送邮件。本教程中包含了命令行邮件客户端的 Top 6,你可以选择其中一个。6 个命令分别是: - - * mail - * mailx - * mutt - * mpack - * sendmail - * ssmtp - +当你需要在 shell 脚本中创建邮件时,就需要用到命令行发送邮件的知识。Linux 中有很多命令可以实现发送邮件。本教程中包含了最流行的 5 个命令行邮件客户端,你可以选择其中一个。这 5 个命令分别是: + * `mail` / `mailx` + * `mutt` + * `mpack` + * `sendmail` + * `ssmtp` ### 工作原理 -我先从整体上来解释下Linux中邮件命令怎么把邮件传递给收件人的。邮件命令(如 sendmail,postfix)生成邮件并发送给一个本地的邮件传输代理(MTA)。本质上发送和接收邮件时邮件服务器和远程邮件服务器之间的通信。下面的流程可以看得更详细。 +我先从整体上来解释下 Linux 中邮件命令怎么把邮件传递给收件人的。邮件命令撰写邮件并发送给一个本地邮件传输代理(MTA,如 sendmail、Postfix)。邮件服务器和远程邮件服务器之间通信以实际发送和接收邮件。下面的流程可以看得更详细。 ![](https://www.2daygeek.com/wp-content/uploads/2019/12/smtp-simple-mail-transfer-protocol.png) -### 1) Linux 安装 mail 命令 +### 1) 如何在 Linux 上安装 mail/mailx 命令 -mail 命令是 Linux 终端发送邮件使用次数最多的命令。可以运行下面的命令从官方发行库安装 mail 命令。对于 **”Debian/Ubuntu“** 系统,使用 **[APT-GET 命令][3]** 或 **[APT 命令][4]** 安装 mailutils。 +`mail` 命令是 Linux 终端发送邮件用的最多的命令。`mailx` 是 `mail` 命令的更新版本,基于 Berkeley Mail 8.1,意在提供 POSIX `mailx` 命令的功能,并支持 MIME、IMAP、POP3、SMTP 和 S/MIME 扩展。mailx 在某些交互特性上更加强大,如缓冲邮件消息、垃圾邮件评分和过滤等。在 Linux 发行版上,`mail` 命令是 `mailx` 命令的软链接。可以运行下面的命令从官方发行版仓库安装 `mail` 命令。 + +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][3] 或 [APT 命令][4] 安装 mailutils。 ``` $ sudo apt-get install mailutils ``` - 对于 **“RHEL/CentOS”** 系统,使用 **[YUM 命令][5]** 安装 mailx。 +对于 RHEL/CentOS 系统,使用 [YUM 命令][5] 安装 mailx。 ``` $ sudo yum install mailx ``` -对于 **“Fedora”** 系统,使用 **[DNF 命令][6]** 安装 mailx。 +对于 Fedora 系统,使用 [DNF 命令][6] 安装 mailx。 ``` $ sudo dnf install mailx ``` -### 1a) Linux 安装 mail 命令后发送邮件 +#### 1a) 如何在 Linux 上使用 mail 命令发送邮件 -mail 命令简单易用。如果你不需要发送附件,使用下面的 mail 命令格式就可以发送邮件了。 +`mail` 命令简单易用。如果你不需要发送附件,使用下面的 `mail` 命令格式就可以发送邮件了: ``` -$ echo "This is the mail body" | mail -s "Subject" [email protected] +$ echo "This is the mail body" | mail -s "Subject" 2daygeek@gmail.com ``` -如果你要发送附件,使用下面的 mail 命令格式。 +如果你要发送附件,使用下面的 `mail` 命令格式: ``` -$ echo "This is the mail body" | mail -a test1.txt -s "Subject" [email protected] +$ echo "This is the mail body" | mail -a test1.txt -s "Subject" 2daygeek@gmail.com ``` -``` -+---------+----------------------------------------------------+ -| Options | Description | -+---------+----------------------------------------------------+ -| -a | It's used for attachment on Red Hat based systems. | -| -A | It's used for attachment on Debian based systems. | -| -s | Specify the subject of the message | -+--------------------------------------------------------------+ -``` +- `-a`:用于在基于 Red Hat 的系统上添加附件。 +- `-A`:用于在基于 Debian 的系统上添加附件。 +- `-s`:指定消息标题。 -### 2) Linux 安装 mutt 命令 +### 2) 如何在 Linux 上安装 mutt 命令 -mutt 是另一个 Linux 终端发送邮件很受欢迎的命令。mutt 是一个小而强大的基于文本的程序,用来阅读和发送 unix 操作系统的电子邮件,功能支持多彩终端、MIME、OpenPGP和按邮件线索排序的模式。可以运行下面的命令从官方发行库安装 mutt 命令。对于 **”Debian/Ubuntu“** 系统,使用 **[APT-GET 命令][3]** 或 **[APT 命令][4]** 安装 mutt。 +`mutt` 是另一个很受欢迎的在 Linux 终端发送邮件的命令。`mutt` 是一个小而强大的基于文本的程序,用来在 unix 操作系统下阅读和发送电子邮件,并支持彩色终端、MIME、OpenPGP 和按邮件线索排序的模式。可以运行下面的命令从官方发行版仓库安装 `mutt` 命令。 + +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][3] 或 [APT 命令][4] 安装 mutt。 ``` $ sudo apt-get install mutt ``` -对于 **“RHEL/CentOS”** 系统,使用 **[YUM 命令][5]** 安装 mutt。 +对于 RHEL/CentOS 系统,使用 [YUM 命令][5] 安装 mutt。 ``` $ sudo yum install mutt ``` -对于 **“Fedora”** 系统,使用 **[DNF 命令][6]** 安装 mutt。 +对于 Fedora 系统,使用 [DNF 命令][6] 安装 mutt。 ``` $ sudo dnf install mutt ``` -### 2b) Linux 使用 mutt 命令发送邮件 +#### 2b) 如何在 Linux 上使用 mutt 命令发送邮件 -mutt 也是简单易用的。如果你不需要发送附件,使用下面的 mutt 命令格式就可以发送邮件了。 +`mutt` 一样简单易用。如果你不需要发送附件,使用下面的 `mutt` 命令格式就可以发送邮件了: ``` -$ echo "This is the mail body" | mutt -s "Subject" [email protected] +$ echo "This is the mail body" | mutt -s "Subject" 2daygeek@gmail.com ``` -如果你要发送附件,使用下面的 mutt 命令格式。 +如果你要发送附件,使用下面的 `mutt` 命令格式: ``` -$ echo "This is the mail body" | mutt -s "Subject" [email protected] -a test1.txt +$ echo "This is the mail body" | mutt -s "Subject" 2daygeek@gmail.com -a test1.txt ``` -### 3) Linux 安装 mpack 命令 +### 3) 如何在 Linux 上安装 mpack 命令 -mpack 是另一个 Linux 终端发送邮件很受欢迎的命令。mpack 程序会对 MIME 消息中文件进行编码。编码后的消息被发送到一个或多个收件人。可以运行下面的命令从官方发行库安装 mpack 命令。对于 **”Debian/Ubuntu“** 系统,使用 **[APT-GET 命令][3]** 或 **[APT 命令][4]** 安装 mpack。 +`mpack` 是另一个很受欢迎的在 Linux 终端上发送邮件的命令。`mpack` 程序会在一个或多个 MIME 消息中对命名的文件进行编码。编码后的消息被发送到一个或多个收件人。可以运行下面的命令从官方发行版仓库安装 `mpack` 命令。 + +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][3] 或 [APT 命令][4] 安装 mpack。 ``` $ sudo apt-get install mpack ``` -对于 **“RHEL/CentOS”** 系统,使用 **[YUM 命令][5]** 安装 mpack。 +对于 RHEL/CentOS 系统,使用 [YUM 命令][5] 安装 mpack。 ``` $ sudo yum install mpack ``` -对于 **“Fedora”** 系统,使用 **[DNF 命令][6]** 安装 mpack。 +对于 Fedora 系统,使用 [DNF 命令][6] 安装 mpack。 ``` $ sudo dnf install mpack ``` -### 3a) Linux 使用 mpack 命令发送邮件 +#### 3a) 如何在 Linux 上使用 mpack 命令发送邮件 -mpack 也是简单易用的。如果你不需要发送附件,使用下面的 mpack 命令格式就可以发送邮件了。 +`mpack` 同样简单易用。如果你不需要发送附件,使用下面的 `mpack` 命令格式就可以发送邮件了: ``` -$ echo "This is the mail body" | mpack -s "Subject" [email protected] +$ echo "This is the mail body" | mpack -s "Subject" 2daygeek@gmail.com ``` -如果你要发送附件,使用下面的 mpack 命令格式。 +如果你要发送附件,使用下面的 mpack 命令格式: ``` -$ echo "This is the mail body" | mpack -s "Subject" [email protected] -a test1.txt +$ echo "This is the mail body" | mpack -s "Subject" 2daygeek@gmail.com -a test1.txt ``` -### 4) Linux 安装 mailx 命令 +### 4) 如何在 Linux 上安装 sendmail 命令 -mailx 是 mail 命令的更新版本,基于 Berkeley Mail 8.1,意在提供 POSIX mailx 命令的功能和支持MIME、IMAP、POP3、SMTP和S/MIME 的扩展。mailx 在某些交互特性上更加强大,如缓冲邮件消息、排序和过滤等。可以运行下面的命令从官方发行库安装 mailx 命令。对于 **”Debian/Ubuntu“** 系统,使用 **[APT-GET 命令][3]** 或 **[APT 命令][4]** 安装 mailutils。 +sendmail 是一个上广泛使用的通用 SMTP 服务器,你也可以从命令行用 `sendmail` 发邮件。可以运行下面的命令从官方发行版仓库安装 `sendmail` 命令。 -``` -$ sudo apt-get install mailutils -``` - - 对于 **“RHEL/CentOS”** 系统,使用 **[YUM 命令][5]** 安装 mailx。 - -``` -$ sudo yum install mailx -``` - -对于 **“Fedora”** 系统,使用 **[DNF 命令][6]** 安装 mailx。 - -``` -$ sudo dnf install mailx -``` - -### 4a) Linux 使用 mailx 命令发送邮件 - -mailx 也是简单易用的。如果你不需要发送附件,使用下面的 mail 命令格式就可以发送邮件了。 - -``` -$ echo "This is the mail body" | mail -s "Subject" [email protected] -``` - -如果你要发送附件,使用下面的 mail 命令格式。 - -``` -$ echo "This is the mail body" | mail -a test1.txt -s "Subject" [email protected] -``` - -### 5) Linux 安装 sendmail 命令 - -sendmail 是一个 Linux 上广泛使用的 SMTP 服务器,你也可以从命令行用 sendmail 发邮件。可以运行下面的命令从官方发行库安装 sendmail 命令。对于 **”Debian/Ubuntu“** 系统,使用 **[APT-GET 命令][3]** 或 **[APT 命令][4]** 安装 sendmail。 +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][3] 或 [APT 命令][4]安装 sendmail。 ``` $ sudo apt-get install sendmail ``` -对于 **“RHEL/CentOS”** 系统,使用 **[YUM 命令][5]** 安装 sendmail。 +对于 RHEL/CentOS 系统,使用 [YUM 命令][5] 安装 sendmail。 ``` $ sudo yum install sendmail ``` -对于 **“Fedora”** 系统,使用 **[DNF 命令][6]** 安装 sendmail。 +对于 Fedora 系统,使用 [DNF 命令][6] 安装 sendmail。 ``` $ sudo dnf install sendmail ``` -### 5a) Linux 使用 sendmail 命令发送邮件 +#### 4a) 如何在 Linux 上使用 sendmail 命令发送邮件 -sendmail 也是简单易用的。使用下面的 sendmail 命令格式发送邮件。 +`sendmail` 同样简单易用。使用下面的 `sendmail` 命令发送邮件。 ``` $ echo -e "Subject: Test Mail\nThis is the mail body" > /tmp/send-mail.txt ``` ``` -$ sendmail [email protected] < send-mail.txt +$ sendmail 2daygeek@gmail.com < send-mail.txt ``` -### 6) Linux 安装 ssmtp 命令 +### 5) 如何在 Linux 上安装 ssmtp 命令 -ssmtp 是类似 sendmail 的一个只发送不接收的工具,可以把邮件从本地计算机传递到配置好的 mailhost(mailhub)。用户可以在 Linux 命令行用 SSMTP 把邮件发送到 SMTP 服务器。可以运行下面的命令从官方发行库安装 ssmtp 命令。对于 **”Debian/Ubuntu“** 系统,使用 **[APT-GET 命令][3]** 或 **[APT 命令][4]** 安装 ssmtp。 +`ssmtp` 是类似 `sendmail` 的一个只发送不接收的工具,可以把邮件从本地计算机传递到配置好的 邮件主机(mailhub)。用户可以在 Linux 命令行用 `ssmtp` 把邮件发送到 SMTP 服务器。可以运行下面的命令从官方发行版仓库安装 `ssmtp` 命令。 + +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][3] 或 [APT 命令][4]安装 ssmtp。 ``` $ sudo apt-get install ssmtp ``` -对于 **“RHEL/CentOS”** 系统,使用 **[YUM 命令][5]** 安装 ssmtp。 +对于 RHEL/CentOS 系统,使用 [YUM 命令][5] 安装 ssmtp。 ``` $ sudo yum install ssmtp ``` -对于 **“Fedora”** 系统,使用 **[DNF 命令][6]** 安装 ssmtp。 +对于 Fedora 系统,使用 [DNF 命令][6] 安装 ssmtp。 ``` $ sudo dnf install ssmtp ``` -### 6a) Linux 使用 ssmtp 命令发送邮件 +### 5a) 如何在 Linux 上使用 ssmtp 命令发送邮件 -ssmtp 也是简单易用的。使用下面的 sendmail 命令格式发送邮件。 +`ssmtp` 同样简单易用。使用下面的 `ssmtp` 命令格式发送邮件。 ``` $ echo -e "Subject: Test Mail\nThis is the mail body" > /tmp/ssmtp-mail.txt ``` ``` -$ ssmtp [email protected] < /tmp/ssmtp-mail.txt +$ ssmtp 2daygeek@gmail.com < /tmp/ssmtp-mail.txt ``` -------------------------------------------------------------------------------- @@ -244,7 +211,7 @@ via: https://www.2daygeek.com/6-ways-to-send-email-from-the-linux-command-line/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fab0ac285d32777ef32156371a4bc2254705bd43 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Dec 2019 08:20:03 +0800 Subject: [PATCH 041/676] PUB @lxbwolf https://linux.cn/article-11663-1.html --- ...191206 6 Ways to Send Email from the Linux Command Line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191206 6 Ways to Send Email from the Linux Command Line.md (99%) diff --git a/translated/tech/20191206 6 Ways to Send Email from the Linux Command Line.md b/published/20191206 6 Ways to Send Email from the Linux Command Line.md similarity index 99% rename from translated/tech/20191206 6 Ways to Send Email from the Linux Command Line.md rename to published/20191206 6 Ways to Send Email from the Linux Command Line.md index f773f4917f..dcfb8ff8ce 100644 --- a/translated/tech/20191206 6 Ways to Send Email from the Linux Command Line.md +++ b/published/20191206 6 Ways to Send Email from the Linux Command Line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11663-1.html) [#]: subject: (6 Ways to Send Email from the Linux Command Line) [#]: via: (https://www.2daygeek.com/6-ways-to-send-email-from-the-linux-command-line/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 0737e6792d1c9be779277e8c22e12ce2affa1806 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 11 Dec 2019 08:51:12 +0800 Subject: [PATCH 042/676] translated --- ...1206 Pekwm- A lightweight Linux desktop.md | 95 ------------------- ...1206 Pekwm- A lightweight Linux desktop.md | 91 ++++++++++++++++++ 2 files changed, 91 insertions(+), 95 deletions(-) delete mode 100644 sources/tech/20191206 Pekwm- A lightweight Linux desktop.md create mode 100644 translated/tech/20191206 Pekwm- A lightweight Linux desktop.md diff --git a/sources/tech/20191206 Pekwm- A lightweight Linux desktop.md b/sources/tech/20191206 Pekwm- A lightweight Linux desktop.md deleted file mode 100644 index ce4e527911..0000000000 --- a/sources/tech/20191206 Pekwm- A lightweight Linux desktop.md +++ /dev/null @@ -1,95 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Pekwm: A lightweight Linux desktop) -[#]: via: (https://opensource.com/article/19/12/pekwm-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Pekwm: A lightweight Linux desktop -====== -This article is part of a special series of 24 days of Linux desktops. -If you're a minimalist who finds traditional desktops get in your way, -try the Pekwm Linux desktop. -![Penguin with green background][1] - -Let's say you want a lightweight desktop environment, with just enough to get graphics on the screen, move some windows around, and not much else. You find traditional desktops get in your way, with their notifications and taskbars and system trays. You want to live your life primarily from a terminal, but you also want the luxury of launching graphical applications. If that sounds like you, then [Pekwm][2] may be what you've been looking for all along. - -Pekwm is, presumably, inspired by the likes of Window Maker and Fluxbox. It provides an application menu, window decoration, and not a whole lot more. It's ideal for minimalists—users who want to conserve resources and users who prefer to work from a terminal. - -Install Pekwm from your distribution's software repository. After installing, log out of your current desktop session so you can log into your new desktop. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -To override the previous desktop on GDM: - -![Selecting your desktop in GDM][3] - -And on KDM: - -![Selecting your desktop in KDM][4] - -The first time you log into Pekwm, you may encounter nothing but a black screen. Believe it or not, that's normal. What you're seeing is a blank desktop without background wallpaper. You can set a wallpaper with the **feh** command (you may need to install it from your repository). This command has a few options for setting the background, including **\--bg-fill** to fill the screen with your wallpaper, **\--bg-scale** to scale it to fit, and so on. - - -``` -`$ feh --bg-fill ~/Pictures/wallpapers/mybackground.jpg` -``` - -### Application menu - -By default, Pekwm auto-generates a menu, available with a right-click anywhere on the desktop, that gives you access to applications. This menu also provides a few preference settings, such as the ability to pick a theme and to log out of your Pekwm session. - -![Pekwm running on Fedora][5] - -### Configuration - -Pekwm is primarily configured in text config files stored in **$HOME/.pekwm**. The **menu** file defines your application menu, the **keys** file defines keyboard shortcuts, and so on. - -The **start** file is a shell script that is executed after Pekwm launches. It is analogous to the **rc.local** file on a traditional Unix system; it's intentionally last in line, so whatever you put into it overrides everything that came before it. This is an important file—it's probably where you want to set your background so that _your_ choice overrides the default on the theme you're using.  - -The **start** file is also where you can launch dockapps. Dockapps are tiny applets that rose to prominence with Window Maker and Fluxbox. They usually provide network monitors, a clock, audio settings, and other things you might be used to seeing in a system tray or as a KDE plasmoid or widget in a full desktop environment. You might find some dockapps in your distribution's repository, or you can look for them online at [dockapps.net][6]. - -You can launch dockapps at startup by listing them in the **start** file followed by an **&** symbol: - - -``` -feh --bg-fill ~/Pictures/wallpapers/mybackground.jpg -wmnd & -bubblemon -d & -``` - -The **start** file must be [marked executable][7] for it to run when Pekwm starts. - - -``` -`$ chmod +x $HOME/.pekwm/start` -``` - -### Features - -There's not much to Pekwm, and that's the beauty of it. If you want extra services to run on your desktop, it's up to you to launch them. If you're still learning Linux, this is a great way to learn about the minute GUI components you usually don't think about when they come bundled with a complete desktop environment (like [a taskbar][8]). It's also a good way to get used to some of the Linux commands, like [nmcli][9], that you've been meaning to learn. - -Pekwm is a fun window manager. It's sparse, terse, and very lightweight. Give it a try! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/pekwm-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) -[2]: http://www.pekwm.org/ -[3]: https://opensource.com/sites/default/files/uploads/advent-gdm_1.jpg (Selecting your desktop in GDM) -[4]: https://opensource.com/sites/default/files/uploads/advent-enlightenment-kdm_0.jpg (Selecting your desktop in KDM) -[5]: https://opensource.com/sites/default/files/uploads/advent-pekwm.jpg (Pekwm running on Fedora) -[6]: http://dockapps.net -[7]: https://opensource.com/article/19/6/understanding-linux-permissions -[8]: https://opensource.com/article/19/1/productivity-tool-tint2 -[9]: https://opensource.com/article/19/5/set-static-network-connection-linux diff --git a/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md b/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md new file mode 100644 index 0000000000..58f025dc21 --- /dev/null +++ b/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pekwm: A lightweight Linux desktop) +[#]: via: (https://opensource.com/article/19/12/pekwm-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Pekwm:一个轻量级的 Linux 桌面 +====== +本文是 24 天 Linux 桌面特别系列的一部分。如果你是一个觉得传统桌面会妨碍你的极简主义者,那么试试 Pekwm Linux 桌面。 +![Penguin with green background][1] + +假设你想要一个轻量级桌面环境,它的功能足以在屏幕上显示图形,移动一些窗口,而没有其他东西。你会发现传统桌面的通知、任务栏和系统托盘会妨碍你的工作。你想主要通过终端工作,但也希望运行图形应用。如果听起来像你,那么 [Pekwm][2] 可能是你一直在寻找的东西。 + +Pekwm 的灵感大概来自于 Window Maker 和 Fluxbox 等。它提供了一个应用菜单,窗口装饰,而不是一大堆其他东西。它非常适合极简主义者,即那些希望节省资源的用户和喜欢在终端工作的用户。 + +从发行版仓库安装 Pekwm。安装后,请先退出当前桌面会话,以便可以登录到新桌面。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,具体取决于你的设置)将继续登录到以前的桌面,因此需要在登录之前修改它。 + +在 GDM 中覆盖之前的桌面: + +![Selecting your desktop in GDM][3] + +在 KDM 中: + +![Selecting your desktop in KDM][4] + +第一次登录 Pekwm 时,你可能会看到黑屏。信不信由你,这是正常的。你看到的是一个空白桌面,没有背景壁纸。你可以使用 **feh** 命令设置壁纸(你可能需要从仓库中安装它)。此命令有几个用于设置背景的选项,包括 **\--bg-fill** 用壁纸填充屏幕,**\--bg-scale** 缩放到合适大小,等等。 + +``` +`$ feh --bg-fill ~/Pictures/wallpapers/mybackground.jpg` +``` + +### 应用菜单 + +默认情况下,Pekwm 自动生成一个菜单,可在桌面上的任意位置右键单击,从而可让你运行应用。此菜单还提供一些首选项设置,例如选择主题和注销 Pekwm 会话。 + +![Pekwm running on Fedora][5] + +### 配置 + +Pekwm 主要通过保存在 **$HOME/.pekwm**. 的文本配置文件配置。**menu** 文件定义你的应用菜单,**keys** 文件定义键盘快捷键,等等。 + +**start** 文件是在 Pekwm 启动后执行的 shell 脚本。它类似于传统 Unix 系统上的 **rc.local**。它故意放在最后一行,因此这里的东西将覆盖之前的一切。这是一个重要文件,它可能是你要设置背景的地方,以便_你的_选择会覆盖正在使用的主题的默认值。 + +**start** 文件也是可以启动 dockapp 的地方。dockapp 是 一种小程序,它在 Window Maker 和 Fluxbox 引起了人们的关注。它们通常有网络监视器、时钟、音频设置和其他你能会在系统托盘或作为一个 KDE plasmoid 或者完整桌面环境中看到的小部件。你可能会在发行版仓库中找到一些 dockapp,或者可以在 [dockapps.net][6] 上在线查找它们。 + +你可以在启动时运行 dockapp,将它们列在 **start** 文件中,跟上 **&** 符号: + + +``` +feh --bg-fill ~/Pictures/wallpapers/mybackground.jpg +wmnd & +bubblemon -d & +``` + +**start** 文件必须[设置为可执行][7],才能在 Pekwm 启动时运行。 + +``` +`$ chmod +x $HOME/.pekwm/start` +``` + +### 功能 + +Pekwm 的功能不多,但这就是它的美。如果你希望在桌面上运行额外的服务,那么由你来启动这些服务。如果你仍在学习 Linux,这是了解那些与完整的桌面环境捆绑在一起时通常不会考虑的微小 GUI 组件的好方法(像是[任务栏][8])。这也习惯一些 Linux 命令(例如 [nmcli][9])的好方法。 + +Pekwm 是一个有趣的窗口管理器。它分散、简洁、轻巧。请试试看! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/pekwm-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: http://www.pekwm.org/ +[3]: https://opensource.com/sites/default/files/uploads/advent-gdm_1.jpg (Selecting your desktop in GDM) +[4]: https://opensource.com/sites/default/files/uploads/advent-enlightenment-kdm_0.jpg (Selecting your desktop in KDM) +[5]: https://opensource.com/sites/default/files/uploads/advent-pekwm.jpg (Pekwm running on Fedora) +[6]: http://dockapps.net +[7]: https://opensource.com/article/19/6/understanding-linux-permissions +[8]: https://opensource.com/article/19/1/productivity-tool-tint2 +[9]: https://opensource.com/article/19/5/set-static-network-connection-linux From f7d22e86271cdeecf60d208ecaee445565db29f6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 11 Dec 2019 08:56:43 +0800 Subject: [PATCH 043/676] translating --- sources/tech/20191209 Counting down the days using bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191209 Counting down the days using bash.md b/sources/tech/20191209 Counting down the days using bash.md index 27f9a606d3..b8822a3cdc 100644 --- a/sources/tech/20191209 Counting down the days using bash.md +++ b/sources/tech/20191209 Counting down the days using bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3f800324ab48f423a4141f76465adf22badd0f92 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Dec 2019 09:14:09 +0800 Subject: [PATCH 044/676] PRF --- ...The Best Laptop For Desktop Linux Users.md | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md b/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md index 03b16de85e..53588ce200 100644 --- a/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md +++ b/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md @@ -10,39 +10,43 @@ Dell XPS 13 7390:最好的 Linux 桌面笔记本 ====== -![][1] +![](https://img.linux.net.cn/data/attachment/album/201912/11/090509vwdm33q8dwqdgnnx.jpg) 曾经,我们必须进行大量研究、阅读大量评论,才能找到一种在所选的 Linux 桌面发行版上可以以最少的麻烦工作的机器。而如今,这种日子已经一去不复返了,几乎每台机器都可以运行 Linux。Linux 内核社区在设备驱动程序支持方面做得非常出色,可以使一切都开箱即用。 -不过,有的是机器可以运行 Linux,有的是运行 Linux 的机器。戴尔计算机属于后一类。五年前,Barton George 在戴尔内部启动了一项计划,将桌面版 Linux 引入到消费级的高端戴尔系统。从一台机器开始,现在已经是一整套高端的 Linux 笔记本电脑和台式机。 +不过,有的是**可以**运行 Linux d 机器,有的是运行 Linux 的机器。戴尔计算机属于后一类。五年前,Barton George 在戴尔内部启动了一项计划,将桌面版 Linux 引入到消费级的高端戴尔系统。从一台机器开始,到现在整套从产品线的高端笔记本电脑和台式机都可以运行 Linux。 -在这些机器中,XPS 13 是我的最爱。尽管我需要一个功能强大的台式机来处理 4K UHD、多机位视频制作,但我还需要一台超便携的笔记本电脑,可以随身携带,而不必担心笨重的背包和充电器。XPS 13 也是我的第一台笔记本电脑,使用了 7 年多。因此,是的,这还有一个怀旧因素。 +在这些机器中,XPS 13 是我的最爱。尽管我需要一个功能强大的台式机来处理 4K UHD、多机位视频制作,但我还需要一台超便携的笔记本电脑,可以随身携带,而不必担心笨重的背包和充电器。XPS 13 也是我的第一台笔记本电脑,陪了我 7 年多。因此,是的,这还有一个怀旧因素。 戴尔几乎每年都会更新其 XPS 产品线,并且最新的[产品展示宣布于 10 月][3]。[XPS 13(7390)] [4] 是该系列的增量更新,而且戴尔非常乐意向我寄来一台测评设备。 +![](https://img.linux.net.cn/data/attachment/album/201912/11/090524z2xk670shp0080mx.jpg) + 它由 6 核 Core i7-10710U CPU 所支持。它配备 16GB 内存和 1TB SSD。在 1.10 GHz 的基本频率(可以超频到 4.1 GHz)的情况下,这是一台用于常规工作负载的出色机器。它没有使用任何专用的 GPU,因此它并不适合进行游戏或从源代码进行编译的 Gentoo Linux 或 Arch Linux。但是,我确实设法在上面运行了一些 Steam 游戏。 如果你想运行 Kubernetes 集群、AI 框架或虚拟现实,那么 Precision 系列中还有更强大的机器,这些机器可以运行 Red Hat Enterprise Linux 和 Ubuntu。 -该机器的底盘与上一代相同。边框保持与上一代一样的薄,仍比 MacBook 和微软的 Surface Pro 薄。 +该机器的底盘与上一代相同。边框保持与上一代一样的薄,依旧比 MacBook 和微软的 Surface Pro 薄。 它具有三个端口,其中两个是 USB-C Thunderbolt 3,可用于连接 4K 显示器、USB 附件以及用于对等网络的计算机之间的高速数据传输。 -它还具有一个 microSD 插槽。作为视频记者,SD 卡插槽会更有用。大量使用树莓派的用户也会喜欢此卡。 +它还具有一个 microSD 插槽。作为视频记者,SD 卡插槽会更有用。大量使用树莓派的用户也会喜欢这种卡。 它具有 4 个麦克风和一个改进的摄像头,该摄像头现在位于顶部(再见,鼻孔摄像头!)。 -XPS 13(7390)光滑纤薄。它的重量仅为 2.7 磅(1.2kg),可以与苹果的 MacBook Air 相提并论。 这台机器可以成为你的旅行伴侣,并且可以执行日常任务,例如检查电子邮件、浏览网络和书写。 +XPS 13(7390)光滑纤薄。它的重量仅为 2.7 磅(1.2kg),可以与苹果的 MacBook Air 相提并论。 这台机器可以成为你的旅行伴侣,并且可以执行日常任务,例如检查电子邮件、浏览网络和写作。 -其 4K UHD 屏幕支持 HDR,这意味着你将可以尽享全尺寸的《The Mandalorian》。另外,车载扬声器并没有那么好,听起来有些沉闷。它们适合进行视频聊天或休闲的 YouTube 观看,但是如果你想在今年晚些时候观看《The Witcher》剧集,或者想欣赏 Amazon、Apple Music 或 YouTube Music 的音乐,则需要耳机或外接扬声器。 +其 4K UHD 屏幕支持 HDR,这意味着你将可以尽享《The Mandalorian》的全部美妙之处。另外,车载扬声器并没有那么好,听起来有些沉闷。它们适合进行视频聊天或休闲的 YouTube 观看,但是如果你想在今年晚些时候观看《The Witcher》剧集,或者想欣赏 Amazon、Apple Music 或 YouTube Music 的音乐,则需要耳机或外接扬声器。 -但是,在插入充电线之前,你可以从这台机器中获得多少乐趣?在正常工作量的情况下,它为我提供了大约 7-8 个小时的电池续航时间:我打开了几个选项卡浏览网络,只是看看电影或听音乐。多任务处理,尤其是各种 Web 活动,都会消耗电池电量。在 Linux 上进行一些微调可能会给你带来更多的续航时间。而在 Windows 10 上,我可以使用 10 多个小时呢! +![](https://img.linux.net.cn/data/attachment/album/201912/11/091107p8de88jk5pwffd4a.jpg) -作为仍在从事大量写作工作的视频记者,我非常喜欢键盘。但是,我们这么多年来在 Linux 台式机上听到的触控板故事一直没变:它与 MacBook 或 Windows 上的质量相差甚远。这或许有一天能改变。值得称道的是,他们确实发布了可增强体验的触控板驱动程序,但我没有运行此系统随附的提供的 Ubuntu 18.04 LTS。我全新安装了 Ubuntu 19.10,因为 Gnome 在 18.04 中的运行速度非常慢。我尝试过 openSUSE Tumbleweed、Zorin OS、elementary OS、Fedora、KDE neon 和 Arch Linux。一切正常,尽管有些需要额外的努力才能运行。 +但是,在插入充电线之前,你可以能使用这台机器多少时间?在正常工作量的情况下,它为我提供了大约 7-8 个小时的电池续航时间:我打开了几个选项卡浏览网络,只是看看电影或听音乐。多任务处理,尤其是各种 Web 活动,都会加速消耗电池电量。在 Linux 上进行一些微调可能会给你带来更多的续航时间,而在 Windows 10 上,我可以使用 10 多个小时呢! -那么,该系统适用于谁?显然,这是给那些想要设计精良的、他们信赖的品牌高端机器的专业人士打造的。适用于喜欢 MacBook Air,但更喜欢 Linux 台式机生态系统的用户。适用于那些希望使用 Linux 来工作,而不是使 Linux 可以工作的人。 +作为仍在从事大量写作工作的视频记者,我非常喜欢键盘。但是,我们这么多年来在 Linux 台式机上听到的触控板故事一直没变:它与 MacBook 或 Windows 上的品质相差甚远。这或许有一天能改变。值得称道的是,他们确实发布了可增强体验的触控板驱动程序,但我没有运行此系统随附的提供的 Ubuntu 18.04 LTS。我全新安装了 Ubuntu 19.10,因为 Gnome 在 18.04 中的运行速度非常慢。我尝试过 openSUSE Tumbleweed、Zorin OS、elementary OS、Fedora、KDE neon 和 Arch Linux。一切正常,尽管有些需要额外的努力才能运行。 -我用这台机器花了一周的时间,进一步说明了为什么我如此喜欢戴尔的 XPS 系列。它们是目前最好的 Linux 笔记本电脑。这款 XPS 13(7390),你值得拥有! +那么,该系统适用于谁?显然,这是给那些想要设计精良的、他们信赖的品牌的高端机器的专业人士打造的。适用于喜欢 MacBook Air,但更喜欢 Linux 台式机生态系统的用户。适用于那些希望使用 Linux 来工作,而不是使 Linux 可以工作的人。 + +我使用这台机器一周的时间,进一步说明了为什么我如此喜欢戴尔的 XPS 系列。它们是目前最好的 Linux 笔记本电脑。这款 XPS 13(7390),你值得拥有! -------------------------------------------------------------------------------- From 97a67ecc61d5b4606b07c062efc2010412c37b01 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Dec 2019 09:14:38 +0800 Subject: [PATCH 045/676] PUB @wxy https://linux.cn/article-11664-1.html --- ...13 7390 Review- The Best Laptop For Desktop Linux Users.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md (98%) diff --git a/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md b/published/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md similarity index 98% rename from translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md rename to published/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md index 53588ce200..e97c3a570b 100644 --- a/translated/tech/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md +++ b/published/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11664-1.html) [#]: subject: (Dell XPS 13 7390 Review: The Best Laptop For Desktop Linux Users) [#]: via: (https://www.linux.com/articles/dell-xps-13-7390-review-the-best-laptop-for-desktop-linux-user/) [#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) From 193403c71a8b446ea8cbe1a10276a2288e02d46f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 11 Dec 2019 09:50:10 +0800 Subject: [PATCH 046/676] Rename sources/tech/20191210 Italian job- Translating our mission statement in the open.md to sources/talk/20191210 Italian job- Translating our mission statement in the open.md --- ... Italian job- Translating our mission statement in the open.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191210 Italian job- Translating our mission statement in the open.md (100%) diff --git a/sources/tech/20191210 Italian job- Translating our mission statement in the open.md b/sources/talk/20191210 Italian job- Translating our mission statement in the open.md similarity index 100% rename from sources/tech/20191210 Italian job- Translating our mission statement in the open.md rename to sources/talk/20191210 Italian job- Translating our mission statement in the open.md From 0791f65cc0e2c310f63f57ff7203934b3778c14c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 11 Dec 2019 09:56:43 +0800 Subject: [PATCH 047/676] Rename sources/tech/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md to sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md --- ...ts bigger, the kernel gets better, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md (100%) diff --git a/sources/tech/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md b/sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md similarity index 100% rename from sources/tech/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md rename to sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md From 8301f554ab1ce9e4165641528e824fca47c01994 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 11 Dec 2019 10:08:02 +0800 Subject: [PATCH 048/676] Rename sources/tech/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md to sources/talk/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md --- ...ors humanitarian startups on how to run the open source way.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md (100%) diff --git a/sources/tech/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md b/sources/talk/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md similarity index 100% rename from sources/tech/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md rename to sources/talk/20191209 LibreCorps mentors humanitarian startups on how to run the open source way.md From 79ffaa273682448a192a0d722a7b23bde070a539 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 11 Dec 2019 12:12:06 +0800 Subject: [PATCH 049/676] translated --- ... Logical operators and shell expansions.md | 211 +++++++++--------- 1 file changed, 102 insertions(+), 109 deletions(-) diff --git a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md index a12d370214..4e6fd82862 100644 --- a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md +++ b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -21,7 +21,7 @@ Bash 是一种强大的编程语言,完美契合命令行和 shell 脚本。 ### 逻辑操作符 -Bash 中有大量的用于不同条件表达式的逻辑操作符。最基本的是 **if** 控制结构,它判断一个条件,如果条件为真,就执行一些了程序语句。操作符共有三类:文件,数字和非数字操作符。如果条件为真,所有的操作符返回 true(0),如果条件为假,返回 false (1)。 +Bash 中有大量的用于不同条件表达式的逻辑操作符。最基本的是 **if** 控制结构,它判断一个条件,如果条件为真,就执行一些程序语句。操作符共有三类:文件,数字和非数字操作符。如果条件为真,所有的操作符返回 true(0),如果条件为假,返回 false(1)。 这些比较操作符的函数语法是,一个操作符加一个或两个参数放在中括号内,后面跟一系列程序语句,如果条件为真,程序语句执行,可能会有另一个程序语句 list,该 list 在条件为假时执行: @@ -48,34 +48,34 @@ if [ arg1 operator arg2 ] ; then list ; else list ; fi #### 文件操作符 -文件操作符是 Bash 中一系列强大的逻辑操作符。图表1列出了 20 多种不同的 Bash 处理文件的操作符。在我的脚本中使用频率很高。 +文件操作符是 Bash 中一系列强大的逻辑操作符。图表 1 列出了 20 多种不同的 Bash 处理文件的操作符。在我的脚本中使用频率很高。 Operator | Description ---|--- -a filename | 如果文件存在,返回 true;文件可以为空也可以有内容,但是只要它存在,就返回 true -b filename | 如果文件存在且是一个块设备如**/dev/sda** or **/dev/sda1**,则返回 true -c filename | 如果文件存在且是一个字符设备如**/dev/TTY1**,则返回 true --d filename | 文件存在且是一个目录,返回 true --e filename | 文件存在,返回 true;与上面的 **-a** 相同 --f filename | 文件存在且是一个一般文件,不是目录、设备文件或链接等的其他的文件,则返回 true --g filename | 文件存在且 **SETGID** 标记被设置在其上,返回 true --h filename | True if the file exists and is a symbolic link --k filename | True if the file exists and its "sticky'" bit is set --p filename | 文件存在且是一个命名的管道(FIFO),返回 true --r filename | 文件存在且有可读权限,如它的可读位被设置,返回 true --s filename | 文件存在且大小大于 0,返回 true;如果一个文件存在但大小为 0,则返回 false --t fd | 文件描述符 **fd** 被打开且被关联到一个终端设备上,返回 true --u filename | 文件存在且它的**set-user-id** 位被设置,返回 true --w filename | 文件存在且有可写权限,返回 true --x filename | 文件存在且有可执行权限,返回 true --G filename | 文件存在且文件的 group ID 与当前用户相同,返回 true --L filename | 文件存在且是一个符号链接,返回 true --N filename | 文件存在且从文件上一次被读取到现在为止, 文件被修改过,返回 true --O filename | 文件存在且你是文件的拥有者,返回 true +-d filename | 如果文件存在且是一个目录,返回 true +-e filename | 如果文件存在,返回 true;与上面的 **-a** 相同 +-f filename | 如果文件存在且是一个一般文件,不是目录、设备文件或链接等的其他的文件,则返回 true +-g filename | 如果文件存在且 **SETGID** 标记被设置在其上,返回 true +-h filename | 如果文件存在且是一个符号链接,则返回 true +-k filename | 如果文件存在且粘贴位已设置,则返回 true +-p filename | 如果文件存在且是一个命名的管道(FIFO),返回 true +-r filename | 如果文件存在且有可读权限,如它的可读位被设置,返回 true +-s filename | 如果文件存在且大小大于 0,返回 true;如果一个文件存在但大小为 0,则返回 false +-t fd | 如果文件描述符 **fd** 被打开且被关联到一个终端设备上,返回 true +-u filename | 如果文件存在且它的 **set-user-id** 位被设置,返回 true +-w filename | 如果文件存在且有可写权限,返回 true +-x filename | 如果文件存在且有可执行权限,返回 true +-G filename | 如果文件存在且文件的 group ID 与当前用户相同,返回 true +-L filename | 如果文件存在且是一个符号链接,返回 true +-N filename | 如果文件存在且从文件上一次被读取到现在为止, 文件被修改过,返回 true +-O filename | 如果文件存在且你是文件的拥有者,返回 true -S filename | True if the file exists and is a socket -file1 -ef file2 | 文件`file1`和 文件`file2`是相同文件的硬链接,返回 true -file1 -nt file2 | 文件 file1 比 file2 新(根据修改日期),或 file1 存在而 file2 不存在 -file1 -ot file2 | 文件 file1 比 file2 旧(根据修改日期),或 file1 不存在而 file2 存在 +file1 -ef file2 | 如果文件`file1`和 文件`file2`是相同文件的硬链接,返回 true +file1 -nt file2 | 如果文件 file1 比 file2 新(根据修改日期),或 file1 存在而 file2 不存在 +file1 -ot file2 | 如果文件 file1 比 file2 旧(根据修改日期),或 file1 不存在而 file2 存在 _**Fig.1:Bash 文件操作符**_ @@ -88,14 +88,14 @@ The file TestFile1 does not exist. [student@studentvm1 testdir]$ ``` -创建一个用来测试的文件,命名为 **TestFile1**。目前它不需要包含任何数据: +创建一个用来测试的文件,命名为 **TestFile1**。目前它不需要包含任何数据: ``` `[student@studentvm1 testdir]$ touch TestFile1` ``` -在这个简短的 CLI 程序中, 修改 **$File** 变量的值相比于在多个地方修改表示文件名的字符串的值要容易: +在这个简短的 CLI 程序中,修改 **$File** 变量的值相比于在多个地方修改表示文件名的字符串的值要容易: ``` @@ -104,7 +104,15 @@ The file TestFile1 exists. [student@studentvm1 testdir]$ ``` -现在,运行一个测试来判断一个文件是否存在且长度不为 0(表示它包含数据)。假设你想判断三种情况:1. 文件不存在;2. 文件存在且为空;3. 文件存在且包含数据。因此,你需要一组更负责的测试代码 — 为了测试所有的情况在 **if-elif-else** 结构中使用 **elif** 语句: +现在,运行一个测试来判断一个文件是否存在且长度不为 0(表示它包含数据)。假设你想判断三种情况: + +1. 文件不存在; + +2. 文件存在且为空; + +3. 文件存在且包含数据。 + + 因此,你需要一组更负责的测试代码 — 为了测试所有的情况在 **if-elif-else** 结构中使用 **elif** 语句: ``` @@ -156,10 +164,6 @@ TestFile1 exists and contains data. [student@studentvm1 testdir]$ ``` -Now you have a Bash CLI program that can test for these three different conditions… but the possibilities are endless. - -It is easier to see the logic structure of the more complex compound commands if you arrange the program statements more like you would in a script that you can save in a file. Figure 2 shows how this would look. The indents of the program statements in each stanza of the **if-elif-else** structure help to clarify the logic. - 现在你有一个可以测试这三种情况的 Bash CLI 程序,但是可能的情况是无限的。 如果你能像保存在文件中的脚本那样书写程序语句,那么对于即使更复杂的命令组合也会很容易看出它们的逻辑结构。图表 2 就是一个示例。 **if-elif-else** 结构中每一部分的程序语句的缩进让逻辑更变得清晰。 @@ -183,34 +187,31 @@ _**Fig. 2: 像在脚本里一样重写书写命令行程序**_ 对于大多数 CLI 程序来说,让这些复杂的命令变得有逻辑需要写很长的代码。虽然 CLI 可能是用 Linux 或 Bash 内置的命令,但是当 CLI 程序很长或很复杂时,创建一个脚本保存在一个文件中将更有效,保存到文件中后,可以随时运行。 -#### String comparison operators +#### 字符串比较操作符 -String comparison operators enable the comparison of alphanumeric strings of characters. There are only a few of these operators, which are listed in Figure 3. +字符串比较操作符使我们可以对字符串中的字符按字母顺序进行比较。图表 3 列出了仅有的几个字符串比较操作符。 Operator | Description ---|--- -z string | True if the length of string is zero -n string | True if the length of string is non-zero -string1 == string2 -or -string1 = string2 | True if the strings are equal; a single **=** should be used with the test command for POSIX conformance. When used with the **[[** command, this performs pattern matching as described above (compound commands). -string1 != string2 | True if the strings are not equal -string1 < string2 | True if string1 sorts before string2 lexicographically (refers to locale-specific sorting sequences for all alphanumeric and special characters) -string1 > string2 | True if string1 sorts after string2 lexicographically +string1 == string2
or
string1 = string2 | 如果两个字符串相等,返回 true。为了保持 POSIX 一致性,一个等号 **=** 应与 test 命令一起用。命令 **[[** 支持模式匹配,跟前面描述的一样(复杂命令)。 +string1 != string2 | 两个字符串不相等,返回 true +string1 < string2 | 如果对 string1 和 string2 按字母顺序进行排序,string1 排在 string2 前面(即基于地区设定的对所有字母和特殊字符的排列顺序) +string1 > string2 | 如果对 string1 和 string2 按字母顺序进行排序,string1 排在 string2 后面 +_**Fig. 3: Bash 字符串逻辑操作符**_ -_**Fig. 3: Bash string logical operators**_ - -First, look at string length. The quotes around **$MyVar** in the comparison must be there for the comparison to work. (You should still be working in **~/testdir**.) +首先,检查字符串长度。比较表达式中 **$MyVar** 两边的双引号不能省略(你仍应该在目录 **~/testdir** 下 )。 ``` -[student@studentvm1 testdir]$ MyVar="" ; if [ -z "" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi +[student@studentvm1 testdir]$ MyVar="" ; if [ -z "$MyVar" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi MyVar is zero length. -[student@studentvm1 testdir]$ MyVar="Random text" ; if [ -z "" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi +[student@studentvm1 testdir]$ MyVar="Random text" ; if [ -z "$MyVar" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi MyVar is zero length. ``` -You could also do it this way: +你也可以这样做: ``` @@ -220,7 +221,7 @@ MyVar contains data. MyVar is zero length ``` -Sometimes you may need to know a string's exact length. This is not a comparison, but it is related. Unfortunately, there is no simple way to determine the length of a string. There are a couple of ways to do it, but I think using the **expr** (evaluate expression) command is easiest. Read the man page for **expr** for more about what it can do. Note that quotes are required around the string or variable you're testing. +有时候你需要知道一个字符串确切的长度。这虽然不是比较,但是也与比较相关。不幸的是,计算字符串的长度没有简单的方法。有很多种方法可以计算,但是我认为使用 **expr**(evaluate expression,求值表达式)是相对最简单的一种。阅读 **expr** 的 man 主页可以了解更多相关知识。注意表达式中你检测的字符串或变量两边的引号不要省略。 ``` @@ -232,7 +233,7 @@ Sometimes you may need to know a string's exact length. This is not a comparison 70 ``` -Regarding comparison operators, I use a lot of testing in my scripts to determine whether two strings are equal (i.e., identical). I use the non-POSIX version of this comparison operator: +关于比较操作符,在我们的脚本中使用了大量的检测两个字符串是否相等(例如,两个字符串是否实际上是同一个字符串)的操作。我使用的是非 POSIX 版本的比较表达式: ``` @@ -242,24 +243,24 @@ Var1 matches Var2 Var1 and Var2 do not match. ``` -Experiment some more on your own to try out these operators. +在你自己的脚本中去试一下这些操作符。 -#### Numeric comparison operators +#### 数字比较操作符 -Numeric operators make comparisons between two numeric arguments. Like the other operator classes, most are easy to understand. +数字操作符用于两个数字参数之间的比较。像其他类操作符一样,大部分都很容易理解。 Operator | Description ---|--- arg1 -eq arg2 | True if arg1 equals arg2 -arg1 -ne arg2 | True if arg1 is not equal to arg2 -arg1 -lt arg2 | True if arg1 is less than arg2 -arg1 -le arg2 | True if arg1 is less than or equal to arg2 -arg1 -gt arg2 | True if arg1 is greater than arg2 -arg1 -ge arg2 | True if arg1 is greater than or equal to arg2 +arg1 -ne arg2 | 如果 arg1 不等于 arg2,返回 true +arg1 -lt arg2 | 如果 arg1 小于 arg2,返回 true +arg1 -le arg2 | 如果 arg1 小于或等于 arg2,返回 true +arg1 -gt arg2 | 如果 arg1 大于 arg2,返回 true +arg1 -ge arg2 | 如果 arg1 大于或等于 arg2,返回 true -_**Fig. 4: Bash numeric comparison logical operators**_ +_**Fig. 4: Bash 数字比较逻辑操作符**_ -Here are some simple examples. The first instance sets the variable **$X** to 1, then tests to see if **$X** is equal to 1. In the second instance, **X** is set to 0, so the comparison is not true. +来看几个简单的例子。第一个示例设置变量 **$X** 的值为 1,然后检测 **$X** 是否等于 1.第二个示例中, **$X** 被设置为 0,所以比较表达式返回结果不为 true。 ``` @@ -270,31 +271,31 @@ X does not equal 1 [student@studentvm1 testdir]$ ``` -Try some more experiments on your own. +自己来多尝试一下其他的。 -#### Miscellaneous operators +#### 混杂操作符 -These miscellaneous operators show whether a shell option is set or a shell variable has a value, but it does not discover the value of the variable, just whether it has one. +这些混杂操作符展示一个 shell 选项是否被设置或一个 shell 变量是否有值,但是它不显示变量的值,只显示它是否有值。 Operator | Description ---|--- --o optname | True if the shell option optname is enabled (see the list of options under the description of the **-o** option to the Bash set builtin in the Bash man page) --v varname | True if the shell variable varname is set (has been assigned a value) --R varname | True if the shell variable varname is set and is a name reference +-o optname | 如果一个选项 `optname` 开启了(查看 Bash 内建的 Bash man 页面中 **-o** 选项描述下面的选项列表),则返回 true +-v varname | 如果 shell 变量 varname 被设置了值(被赋予了值),则返回 true +-R varname | 如果一个 shell 变量 varname 被设置了值且是一个名字引用,则返回 true -_**Fig. 5: Miscellaneous Bash logical operators**_ +_**Fig. 5: 混杂 Bash 逻辑操作符**_ -Experiment on your own to try out these operators. +自己来使用这些操作符实践下。 -### Expansions +### 扩展 -Bash supports a number of types of expansions and substitutions that can be quite useful. According to the Bash man page, Bash has seven forms of expansions. This article looks at five of them: tilde expansion, arithmetic expansion, pathname expansion, brace expansion, and command substitution. +Bash 支持一些类型扩展和一些非常有用的命令替换。根据 Bash man 页面,Bash 有多种扩展格式。本文只介绍其中 5 种:`~` 扩展,算术扩展,路径名称扩展,大括号扩展和命令替换。 -#### Brace expansion +#### 大括号扩展 -Brace expansion is a method for generating arbitrary strings. (This tool is used below to create a large number of files for experiments with special pattern characters.) Brace expansion can be used to generate lists of arbitrary strings and insert them into a specific location within an enclosing static string or at either end of a static string. This may be hard to visualize, so it's best to just do it. +大括号扩展是生成任意字符串的一种方法。(下面的例子是用特定模式的字符创建大量的文件。)大括号扩展可以用于生产任意字符串的列表,并把它们插入一个静态字符串的中间特定位置或静态字符串的两端。这可能很难想象,所以还是来实践一下。 -First, here's what a brace expansion does: +首先,看一下大括号扩展的作用: ``` @@ -302,7 +303,7 @@ First, here's what a brace expansion does: string1 string2 string3 ``` -Well, that is not very helpful, is it? But look what happens when you use it just a bit differently: +看起来不是很有用,对吧?但是用其他方式使用它,再来看看: ``` @@ -310,7 +311,7 @@ Well, that is not very helpful, is it? But look what happens when you use it jus Hello David. Hello Jen. Hello Rikki. Hello Jason. ``` -That looks like something useful—it could save a good deal of typing. Now try this: +这看起来貌似有点用了 — 我们可以少打很多字。现在试一下这个: ``` @@ -318,13 +319,13 @@ That looks like something useful—it could save a good deal of typing. Now try beds bolts bars ``` -I could go on, but you get the idea. +我可以继续举例,但是你应该已经理解了它的用处。 -#### Tilde expansion +#### ~ 扩展 -Arguably, the most common expansion is the tilde (**~**) expansion. When you use this in a command like **cd ~/Documents**, the Bash shell expands it as a shortcut to the user's full home directory. +资料显示,使用最多的扩展是波浪字符(~)扩展。当你在命令中使用它(如 **cd ~/Documents**)时,Bash shell 把这个快捷方式展开式完整的 home 目录。 -Use these Bash programs to observe the effects of the tilde expansion: +使用 Bash 程序观察 ~ 扩展的作用: ``` @@ -337,16 +338,14 @@ Use these Bash programs to observe the effects of the tilde expansion: [student@studentvm1 Documents]$ ``` -#### Pathname expansion +#### 路径名称扩展 -Pathname expansion is a fancy term expanding file-globbing patterns, using the characters **?** and *****, into the full names of directories that match the pattern. File globbing refers to special pattern characters that enable significant flexibility in matching file names, directories, and other strings when performing various actions. These special pattern characters allow matching single, multiple, or specific characters in a string. +路径名称扩展是展开文件代换模式到匹配到的完成路径名称的另一种说法,匹配字符使用 **?** 和 **\*** 。文件代换指的是在大量操作中匹配文件名、路径和其他字符串时用特定的模式字符产生极大的灵活性。这些特定的模式字符允许匹配字符串中的一个、多个或特定字符。 - * **?** — Matches only one of any character in the specified location within the string - * ***** — Matches zero or more of any character in the specified location within the string + * **?** — 匹配字符串中特定位置的一个任意字符 + * ***** — 匹配字符串中特定位置的 0 个或多个任意字符 - - -This expansion is applied to matching directory names. To see how this works, ensure that **testdir** is the present working directory (PWD) and start with a plain listing (the contents of my home directory will be different from yours): +这个扩展用于匹配路径名称。为了弄清它的用法,请确保 **testdir** 是当前工作目录(PWD),先执行基本的列出清单命令 `ls`(我 home 目录下的内容跟你的不一样)。 ``` @@ -358,7 +357,7 @@ cpuHog     Desktop       dmesg.txt   link3      random.txt  testdir1 [student@studentvm1 testdir]$ ``` -Now list the directories that start with **Do**, **testdir/Documents**, and **testdir/Downloads**: +现在列出以 **Do**, **testdir/Documents**, 和 **testdir/Downloads** 开头的目录: ``` @@ -376,7 +375,7 @@ Downloads: [student@studentvm1 testdir]$ ``` -Well, that did not do what you wanted. It listed the contents of the directories that begin with **Do**. To list only the directories and not their contents, use the **-d** option. +然而,并没有得到你期望的结果。它列出了以 **Do** 开头的目录下的内容。使用 **-d** 选项,仅列出目录而不列出它们的内容。 ``` @@ -385,7 +384,7 @@ Documents  Downloads [student@studentvm1 testdir]$ ``` -In both cases, the Bash shell expands the **Do*** pattern into the names of the two directories that match the pattern. But what if there are also files that match the pattern? +在两个例子中,Bash shell 都把 **Do*** 模式展开成了匹配该模式的目录名称。但是如果有文件也匹配这个模式,会发生什么? ``` @@ -394,17 +393,17 @@ Documents  Downloads  Downtown [student@studentvm1 testdir]$ ``` -This shows the file, too. So any files that match the pattern are also expanded to their full names. +因此所有匹配这个模式的文件也被展开成了完成名字。 -#### Command substitution +#### 命令替换 -Command substitution is a form of expansion that allows the STDOUT data stream of one command to be used as the argument of another command; for example, as a list of items to be processed in a loop. The Bash man page says: "Command substitution allows the output of a command to replace the command name." I find that to be accurate if a bit obtuse. +命令替换让一个命令的 STDOUT 数据流被当做参数传给另一个命令,例如,在一个循环中作为一系列被处理的项目。Bash man 页面显示:”命令替换用命令的输出替换了命令的名字。“ 可能不太好理解。 -There are two forms of this substitution, **`command`** and **$(command)**. In the older form using back tics (**`**), using a backslash (**\**) in the command retains its literal meaning. However, when it's used in the newer parenthetical form, the backslash takes on its meaning as a special character. Note also that the parenthetical form uses only single parentheses to open and close the command statement. +命令替换有两种格式:**`command`** 和 **$(command)**。在更早的格式中使用反引号(**\`**),在命令中使用反斜杠(`\`)来保持它转义之前的文本含义。然而,当用在新版本的括号格式中时,反斜杠被当做一个特殊字符处理。也请注意带括号的格式打开个关闭命令语句都是用一个括号。 -I frequently use this capability in command-line programs and scripts where the results of one command can be used as an argument for another command. +我经常在命令行程序和脚本中出现一个命令的结果可以被作为参数传给另一个命令时使用命令替换。 -Start with a very simple example that uses both forms of this expansion (again, ensure that **testdir** is the PWD): +来看一个非常简单的示例,这个示例使用了这个扩展的两种格式(再一次提醒,确保 **testdir** 是当前工作目录): ``` @@ -415,9 +414,9 @@ Todays date is Sun Apr  7 14:42:59 EDT 2019 [student@studentvm1 testdir]$ ``` -The **-w** option to the **seq** utility adds leading zeros to the numbers generated so that they are all the same width, i.e., the same number of digits regardless of the value. This makes it easier to sort them in numeric sequence. +**-seq** 工具加上 **-w** 选项后,在生成的数字前面会用 0 补全,这样所有的结果都等宽,例如,忽略数字的值,它们的位数一样。这样在对它们按数字顺序进行排列时很容易。 -The **seq** utility is used to generate a sequence of numbers: +**-seq** 工具用于一个数字序列: ``` @@ -432,22 +431,20 @@ The **seq** utility is used to generate a sequence of numbers: [student@studentvm1 testdir]$ ``` -Now you can do something a bit more useful, like creating a large number of empty files for testing: +现在你可以做一些更有用处的操作,比如创建大量用于测试的空文件。 ``` `[student@studentvm1 testdir]$ for I in $(seq -w 5000) ; do touch file-$I ; done` ``` -In this usage, the statement **seq -w 5000** generates a list of numbers from one to 5,000. By using command substitution as part of the **for** statement, the list of numbers is used by the **for** statement to generate the numerical part of the file names. + **seq -w 5000** 语句生成了1 到 5000 的数字序列。通过把命令替换用于 **for** 语句,**for** 语句就可以使用数字序列来生成文件名的数字部分。 -#### Arithmetic expansion +#### 算术扩展 -Bash can perform integer math, but it is rather cumbersome (as you will soon see). The syntax for arithmetic expansion is **$((arithmetic-expression))**, using double parentheses to open and close the expression. +Bash 可以进行整型的数学计算,但是比较繁琐(你一会儿将看到)。数字扩展的语法是 **$((算术表达式))** ,分别用两个括号来打开和关闭表达式。算术扩展在 shell 程序或脚本中类似命令替换;表达式结算后的结果替换了表达式,用于 shell 后续的计算。 -Arithmetic expansion works like command substitution in a shell program or script; the value calculated from the expression replaces the expression for further evaluation by the shell. - -Once again, start with something simple: +我们再用一个简单的用法来开始: ``` @@ -457,7 +454,7 @@ Once again, start with something simple: Var 3 = 35 ``` -The following division results in zero because the result would be a decimal value of less than one: +下面的除法结果是 0,因为表达式的结果是一个小于 1 的整型数字: ``` @@ -465,7 +462,7 @@ The following division results in zero because the result would be a decimal val Var 3 = 0 ``` -Here is a simple calculation I often do in a script or CLI program that tells me how much total virtual memory I have in a Linux host. The **free** command does not provide that data: +这是一个我经常在脚本或 CLI 程序中使用的一个简单的计算,用来查看在 Linux 主机中使用了多少虚拟内存。 **free** 不提供我需要的数据: ``` @@ -474,15 +471,11 @@ RAM = 4037080 and Swap = 6291452 Total Virtual memory is 10328532 ``` -I used the **`** character to delimit the sections of code used for command substitution. +我使用 **\`** 字符来划定用作命令替换的界限。我用 Bash 算术扩展的场景主要是用脚本检查系统资源用量后基于返回的结果选择一个程序运行的路径。 -I use Bash arithmetic expansion mostly for checking system resource amounts in a script and then choose a program execution path based on the result. +### 总结 -### Summary - -This article, the second in this series on Bash as a programming language, explored the Bash file, string, numeric, and miscellaneous logical operators that provide execution-flow control logic and the different types of shell expansions. - -The third article in this series will explore the use of loops for performing various types of iterative operations. +本文是 Bash 编程语言系列的第二篇,探讨了 Bash 文件,字符串,数字和各种提供流程控制逻辑的逻辑操作符还有不同种类的 shell 扩展。 -------------------------------------------------------------------------------- @@ -490,7 +483,7 @@ via: https://opensource.com/article/19/10/programming-bash-logical-operators-she 作者:[David Both][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lxbwolf](https://github.com/lxbwolf) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ffb62101bf06e9e5464cb0fa049f664c5ecb723d Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 11 Dec 2019 12:13:27 +0800 Subject: [PATCH 050/676] TSL: 20191022 How to program with Bash- Logical operators and shell expansions --- ...o program with Bash- Logical operators and shell expansions.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191022 How to program with Bash- Logical operators and shell expansions.md (100%) diff --git a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md similarity index 100% rename from sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md rename to translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md From dce05ca93086042420d2936a1c942cdad9ebbbb4 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 11 Dec 2019 12:16:24 +0800 Subject: [PATCH 051/676] TSL: 20191022 How to program with Bash- Logical operators and shell expansions --- ...- Logical operators and shell expansions.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md index 4e6fd82862..a3adfeb6cf 100644 --- a/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md +++ b/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -1,11 +1,11 @@ -[#]: collector: "lujun9972" -[#]: translator: "lxbwolf" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "How to program with Bash: Logical operators and shell expansions" -[#]: via: "https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions" -[#]: author: "David Both https://opensource.com/users/dboth" +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to program with Bash: Logical operators and shell expansions) +[#]: via: (https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions) +[#]: author: (David Both https://opensource.com/users/dboth) Bash 编程教程:逻辑操作符和 shell 扩展 ====== @@ -490,6 +490,6 @@ via: https://opensource.com/article/19/10/programming-bash-logical-operators-she [a]: https://opensource.com/users/dboth [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_5.png?itok=YHpNs_ss "Women in computing and open source v5" +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_5.png?itok=YHpNs_ss (Women in computing and open source v5) [2]: http://www.both.org/?page_id=1183 [3]: https://opensource.com/article/19/10/programming-bash-part-1 From 6b6c5660e9e64e83992ae5641fb82db2e29a00c5 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 11 Dec 2019 18:59:58 +0800 Subject: [PATCH 052/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191204=20#:acid?= =?UTF-8?q?=20'words:=20Handle=20Chromium=20&=20Firefox=20sessions=20with?= =?UTF-8?q?=20org-mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md --- ...romium - Firefox sessions with org-mode.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md diff --git a/sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md b/sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md new file mode 100644 index 0000000000..7b71e21ff3 --- /dev/null +++ b/sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (#:acid 'words: Handle Chromium & Firefox sessions with org-mode) +[#]: via: (https://acidwords.com/posts/2019-12-04-handle-chromium-and-firefox-sessions-with-org-mode.html) +[#]: author: (Sanel Z https://acidwords.com/) + +Handle Chromium & Firefox sessions with org-mode +====== + +I was big fan of [Session Manager][1], small addon for Chrome and Chromium that will save all open tabs, assign the name to session and, when is needed, restore it. + +Very useful, especially if you are like me, switching between multiple "mind sessions" during the day - research, development or maybe news reading. Or simply, you'd like to remember workflow (and tabs) you had few days ago. + +After I decided to ditch all extensions from Chromium except [uBlock Origin][2], it was time to look for alternative. My main goal was it to be browser agnostic and session links had to be stored in text file, so I can enjoy all the goodies of plain text file. What would be better for that than good old [org-mode][3] ;) + +Long time ago I found this trick: [Get the currently open tabs in Google Chrome via the command line][4] and with some elisp sugar and coffee, here is the code: + +``` +(require 'cl-lib) + +(defun save-chromium-session () + "Reads chromium current session and generate org-mode heading with items." + (interactive) + (save-excursion + (let* ((cmd "strings ~/'.config/chromium/Default/Current Session' | 'grep' -E '^https?://' | sort | uniq") + (ret (shell-command-to-string cmd))) + (insert + (concat + "* " + (format-time-string "[%Y-%m-%d %H:%M:%S]") + "\n" + (mapconcat 'identity + (cl-reduce (lambda (lst x) + (if (and x (not (string= "" x))) + (cons (concat " - " x) lst) + lst)) + (split-string ret "\n") + :initial-value (list)) + "\n")))))) + +(defun restore-chromium-session () + "Restore session, by openning each link in list with (browse-url). +Make sure to put cursor on date heading that contains list of urls." + (interactive) + (save-excursion + (beginning-of-line) + (when (looking-at "^\\*") + (forward-line 1) + (while (looking-at "^[ ]+-[ ]+\\(http.?+\\)$") + (let* ((ln (thing-at-point 'line t)) + (ln (replace-regexp-in-string "^[ ]+-[ ]+" "" ln)) + (ln (replace-regexp-in-string "\n" "" ln))) + (browse-url ln)) + (forward-line 1))))) +``` + +So, how does it work? + +Evaluate above code, open new org-mode file and call `M-x save-chromium-session`. It will create something like this: + +``` +* [2019-12-04 12:14:02] + - https://www.reddit.com/r/emacs/comments/... + - https://www.reddit.com/r/Clojure + - https://news.ycombinator.com +``` + +or whatever urls are running in Chromium instance. To restore it back, put cursor on desired date and run `M-x restore-chromium-session`. All tabs should be back. + +Here is how I use it, with randomly generated data for the purpose of this text: + +``` +#+TITLE: Browser sessions + +* [2019-12-01 23:15:00]... +* [2019-12-02 18:10:20]... +* [2019-12-03 19:00:12] + - https://www.reddit.com/r/emacs/comments/... + - https://www.reddit.com/r/Clojure + - https://news.ycombinator.com + +* [2019-12-04 12:14:02] + - https://www.reddit.com/r/emacs/comments/... + - https://www.reddit.com/r/Clojure + - https://news.ycombinator.com +``` + +Note that hack for reading Chromium session isn't perfect: `strings` will read whatever looks like string and url from binary database and sometimes that will yield small artifacts in urls. But, you can easily edit those and keep session file lean and clean. + +To actually open tabs, elisp code will use [browse-url][5] and it can be further customized to run Chromium, Firefox or any other browser with `browse-url-browser-function` variable. Make sure to read documentation for this variable. + +Don't forget to put session file in git, mercurial or svn and enjoy the fact that you will never loose your session history again :) + +### What about Firefox? + +If you are using Firefox (recent versions) and would like to pull session urls, here is how to do it. + +First, download and compile [lz4json][6], small tool that will decompress Mozilla lz4json format, where Firefox stores session data. Session data (at the time of writing this post) is stored in `$HOME/.mozilla/firefox//sessionstore-backups/recovery.jsonlz4`. + +If Firefox is not running, `recovery.jsonlz4` will not be present, but use `previous.jsonlz4` instead. + +To extract urls, try this in terminal: + +``` +$ lz4jsoncat recovery.jsonlz4 | grep -oP '"(http.+?)"' | sed 's/"//g' | sort | uniq +``` + +and update `save-chromium-session` with: + +``` +(defun save-chromium-session () + "Reads chromium current session and converts it to org-mode chunk." + (interactive) + (save-excursion + (let* ((path "~/.mozilla/firefox//sessionstore-backups/recovery.jsonlz4") + (cmd (concat "lz4jsoncat " path " | grep -oP '\"(http.+?)\"' | sed 's/\"//g' | sort | uniq")) + (ret (shell-command-to-string cmd))) +... +;; rest of the code is unchanged +``` + +Updating documentation strings, function name and any further refactoring is left for exercise. + +-------------------------------------------------------------------------------- + +via: https://acidwords.com/posts/2019-12-04-handle-chromium-and-firefox-sessions-with-org-mode.html + +作者:[Sanel Z][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://acidwords.com/ +[b]: https://github.com/lujun9972 +[1]: https://chrome.google.com/webstore/detail/session-manager/mghenlmbmjcpehccoangkdpagbcbkdpc?hl=en-US +[2]: https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en +[3]: https://orgmode.org/ +[4]: https://superuser.com/a/1310873 +[5]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Browse_002dURL.html +[6]: https://github.com/andikleen/lz4json From 20a555dc9a690c810728109cfd672603599052a2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Dec 2019 22:46:38 +0800 Subject: [PATCH 053/676] PRF @hanwckf --- ...ugging Software Deployments with strace.md | 90 +++++++++---------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/translated/tech/20191114 Debugging Software Deployments with strace.md b/translated/tech/20191114 Debugging Software Deployments with strace.md index ee3c54090d..9fe2f9f6ca 100644 --- a/translated/tech/20191114 Debugging Software Deployments with strace.md +++ b/translated/tech/20191114 Debugging Software Deployments with strace.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (hanwckf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Debugging Software Deployments with strace) @@ -10,20 +10,18 @@ 在软件部署中使用 strace 进行调试 ====== -我的大部分工作都包括部署软件系统,这意味着我需要花费很多时间来解决以下问题: +我的大部分工作都涉及到部署软件系统,这意味着我需要花费很多时间来解决以下问题: - * 这个软件可以在原始开发者的机器上工作,但是为什么不能在我这里运行? - * 这个软件昨天可以在我的机器上工作,但是为什么今天就不行? +* 这个软件可以在原开发者的机器上工作,但是为什么不能在我这里运行? +* 这个软件昨天可以在我的机器上工作,但是为什么今天就不行? - - -这是调试的一种类型,但是与传统的软件调试有所不同。传统的调试通常只关心代码的逻辑,但是在软件部署中的调试关注的是程序的代码和它所在的运行环境之间的相互影响。即便问题的根源是代码的逻辑错误,但软件显然可以在别的机器上运行的事实意味着这类问题与运行环境密切相关。 +这是一种调试的类型,但是与一般的软件调试有所不同。一般的调试通常只关心代码的逻辑,但是在软件部署中的调试关注的是程序的代码和它所在的运行环境之间的相互影响。即便问题的根源是代码的逻辑错误,但软件显然可以在别的机器上运行的事实意味着这类问题与运行环境密切相关。 所以,在软件部署过程中,我没有使用传统的调试工具(例如 `gdb`),而是选择了其它工具进行调试。我最喜欢的用来解决“为什么这个软件无法在这台机器上运行?”这类问题的工具就是 `strace`。 -### 什么是 `strace`? +### 什么是 strace? -[`strace`][1] 是一个用来“追踪系统调用”的工具。它主要是一个 Linux 工具,但是你也可以在其它系统上使用类似的工具(例如 [DTrace][2] 和 [ktrace][3])。 +[strace][1] 是一个用来“追踪系统调用”的工具。它主要是一个 Linux 工具,但是你也可以在其它系统上使用类似的工具(例如 [DTrace][2] 和 [ktrace][3])。 它的基本用法非常简单。只需要在 `strace` 后面跟上你需要运行的命令,它就会显示出该命令触发的所有系统调用(你可能需要先安装好 `strace`): @@ -37,41 +35,39 @@ exit_group(0) = ? +++ exited with 0 +++ ``` -这些系统调用都是什么?他们就像是操作系统提供的 API。很久以前,软件拥有直接访问硬件的权限。如果软件需要在屏幕上显示一些东西,它将会与视频硬件的端口和内存映射寄存器纠缠不清。当多任务操作系统变得流行以后,这就导致了混乱的局面,因为不同的应用程序将“争夺”硬件,并且一个应用程序的错误可能致使其它应用程序崩溃,甚至导致整个系统崩溃。所以 CPUs 开始支持多种不同的特权模式 (或者称为“保护环”)。它们让操作系统内核在具有完全硬件访问权限的最高特权模式下运行,于此同时,其它在低特权模式下运行的应用程序必须通过向内核发起系统调用才能够与硬件进行交互。 +这些系统调用都是什么?它们就像是操作系统内核提供的 API。很久以前,软件拥有直接访问硬件的权限。如果软件需要在屏幕上显示一些东西,它将会与视频硬件的端口和内存映射寄存器纠缠不清。当多任务操作系统变得流行以后,这就导致了混乱的局面,因为不同的应用程序将“争夺”硬件,并且一个应用程序的错误可能致使其它应用程序崩溃,甚至导致整个系统崩溃。所以 CPU 开始支持多种不同的特权模式(或者称为“保护环”)。它们让操作系统内核在具有完全硬件访问权限的最高特权模式下运行,于此同时,其它在低特权模式下运行的应用程序必须通过向内核发起系统调用才能够与硬件进行交互。 在二进制级别上,发起系统调用相比简单的函数调用有一些区别,但是大部分程序都使用标准库提供的封装函数。例如,POSIX C 标准库包含一个 `write()` 函数,该函数包含用于进行 `write` 系统调用的所有与硬件体系结构相关的代码。 ![][4] -简单来说,一个应用程序与其环境(计算机系统)的相互影响都是通过系统调用来作用的。所以当软件在一台机器上可以工作但是在另一台机器无法工作的时候,追踪系统调用是一个很好的查错方法。具体地说,你可以通过追踪系统调用分析以下典型操作: +简单来说,一个应用程序与其环境(计算机系统)的交互都是通过系统调用来完成的。所以当软件在一台机器上可以工作但是在另一台机器无法工作的时候,追踪系统调用是一个很好的查错方法。具体地说,你可以通过追踪系统调用分析以下典型操作: * 控制台输入与输出 (IO) * 网络 IO * 文件系统访问以及文件 IO - * 进程/线程 生命周期管理 + * 进程/线程生命周期管理 * 原始内存管理 * 访问特定的设备驱动 - - -### 什么时候可以使用 `strace`? +### 什么时候可以使用 strace? 理论上,`strace` 适用于任何用户空间程序,因为所有的用户空间程序都需要进行系统调用。`strace` 对于已编译的低级程序最有效果,但如果你可以避免运行时环境和解释器带来的大量额外输出,则仍然可以与 Python 等高级语言程序一起使用。 -当软件在一台机器上正常工作,但在另一台机器上却不能正常工作,同时抛出有关文件、权限或者不能运行某某命令等模糊的错误信息时,`strace` 往往能大显身手。不幸的是,它不能诊断高等级的问题,例如数字证书验证错误等。这些问题通常需要结合 `strace`(有时候是 [`ltrace`][5]),以及其它高级工具(例如使用 `openssl` 命令行工具调试数字证书错误)。 +当软件在一台机器上正常工作,但在另一台机器上却不能正常工作,同时抛出了有关文件、权限或者不能运行某某命令等模糊的错误信息时,`strace` 往往能大显身手。不幸的是,它不能诊断高等级的问题,例如数字证书验证错误等。这些问题通常需要组合使用 `strace`(有时候是 [`ltrace`][5])和其它高级工具(例如使用 `openssl` 命令行工具调试数字证书错误)。 本文中的示例基于独立的服务器,但是对系统调用的追踪通常也可以在更复杂的部署平台上完成,仅需要找到合适的工具。 ### 一个简单的例子 -假设你正在尝试运行一个叫做 foo 的服务器应用程序,但是发生了以下情况: +假设你正在尝试运行一个叫做 `foo` 的服务器应用程序,但是发生了以下情况: ``` $ foo Error opening configuration file: No such file or directory ``` -显然,它没有找到你已经写好的配置文件。之所以会发生这种情况,是因为包管理工具有时候在编译应用程序时指定了自定义的路径,所以你应当遵循特定发行版提供的安装指南。如果错误信息告诉你正确的配置文件应该在什么地方,你就可以在几秒钟内解决这个问题,但事实并非如此。你该如何找到正确的路径? +显然,它没有找到你已经写好的配置文件。之所以会发生这种情况,是因为包管理工具有时候在编译应用程序时指定了自定义的路径,所以你应当遵循特定发行版提供的安装指南。如果错误信息告诉你正确的配置文件应该在什么地方,你就可以在几秒钟内解决这个问题,但如果没有告诉你呢?你该如何找到正确的路径? 如果你有权访问源代码,则可以通过阅读源代码来解决问题。这是一个好的备用计划,但不是最快的解决方案。你还可以使用类似 `gdb` 的单步调试器来观察程序的行为,但使用专门用于展示程序与系统环境交互作用的工具 `strace` 更加有效。 @@ -116,16 +112,14 @@ exit_group(1) = ? +++ exited with 1 +++ ``` -`strace` 输出的第一页通常是低级的进程启动过程。(你可以看到很多 `mmap`,`mprotect`,`brk` 调用,这是用来分配原始内存和映射动态链接库的。)实际上,在查找错误时,最好从下往上阅读 `strace` 的输出。你可以看到 `write` 调用在最后返回了错误信息。如果你努力了,你将会看到第一个失败的系统调用是 `openat`,它在尝试打开 `/etc/foo/config.json` 时抛出了 `ENOENT` (“No such file or directory”)的错误。现在我们已经知道了配置文件应该放在哪里。 +`strace` 输出的第一页通常是低级的进程启动过程。(你可以看到很多 `mmap`、`mprotect`、`brk` 调用,这是用来分配原始内存和映射动态链接库的。)实际上,在查找错误时,最好从下往上阅读 `strace` 的输出。你可以看到 `write` 调用在最后返回了错误信息。如果你向上找,你将会看到第一个失败的系统调用是 `openat`,它在尝试打开 `/etc/foo/config.json` 时抛出了 `ENOENT` (“No such file or directory”)的错误。现在我们已经知道了配置文件应该放在哪里。 这是一个简单的例子,但我敢说在 90% 的情况下,使用 `strace` 进行调试不需要更多复杂的工作。以下是完整的调试步骤: - 1. 从程序中获得含糊不清的错误信息 - 2. 使用 `strace` 运行程序 - 3. 在输出中找到错误信息 - 4. 往前追溯并找到第一个失败的系统调用 - - +1. 从程序中获得含糊不清的错误信息 +2. 使用 `strace` 运行程序 +3. 在输出中找到错误信息 +4. 往前追溯并找到第一个失败的系统调用 第四步中的系统调用很可能向你显示出问题所在。 @@ -133,27 +127,27 @@ exit_group(1) = ? 在开始更加复杂的调试之前,这里有一些有用的调试技巧帮助你高效使用 `strace`: -#### `man` 是你的朋友 +#### man 是你的朋友 在很多 *nix 操作系统中,你可以通过 `man syscalls` 查看系统调用的列表。你将会看到类似于 `brk(2)` 之类的东西,这意味着你可以通过运行 `man 2 brk` 得到与此相关的更多信息。 -一个小问题:`man 2 fork` 会显示出在 GNU `libc` 里封装的 `fork()` 手册页,而 `fork()` 现在实际上是由 `clone` 系统调用实现的。`fork` 的语义与 `clone` 相同,但是如果我写了一个含有 `fork()` 的程序并使用 `strace` 去调试它,我将找不到任何关于 `fork` 调用的信息,只能看到 `clone` 调用。只有在将源代码与 `strace` 的输出进行比较的时候,这种问题才会让人感到困惑。 +一个小问题:`man 2 fork` 会显示出在 GNU `libc` 里封装的 `fork()` 手册页,而 `fork()` 现在实际上是由 `clone` 系统调用实现的。`fork` 的语义与 `clone` 相同,但是如果我写了一个含有 `fork()` 的程序并使用 `strace` 去调试它,我将找不到任何关于 `fork` 调用的信息,只能看到 `clone` 调用。如果将源代码与 `strace` 的输出进行比较的时候,像这种问题会让人感到困惑。 -#### 使用 `-o` 将输出保存到文件 +#### 使用 -o 将输出保存到文件 -`strace` 可以生成很多输出,所以将输出保存到单独的文件是很有帮助的 (就像上面的例子一样)。它还能够在控制台中避免程序自身的输出与 `strace` 的输出发生混淆。 +`strace` 可以生成很多输出,所以将输出保存到单独的文件是很有帮助的(就像上面的例子一样)。它还能够在控制台中避免程序自身的输出与 `strace` 的输出发生混淆。 -#### 使用 `-s` 查看更多的参数 +#### 使用 -s 查看更多的参数 你可能已经注意到,错误信息的第二部分没有出现在上面的例子中。这是因为 `strace` 默认仅显示字符串参数的前 32 个字节。如果你需要捕获更多参数,请向 `strace` 追加类似于 `-s 128` 之类的参数。 -#### `-y` 使得追踪文件或套接字更加容易 +#### -y 使得追踪文件或套接字更加容易 “一切皆文件”意味着 *nix 系统通过文件描述符进行所有 IO 操作,不管是真实的文件还是通过网络或者进程间管道。这对于编程而言是很方便的,但是在追踪系统调用时,你将很难分辨出 `read` 和 `write` 的真实行为。 `-y` 参数使 `strace` 在注释中注明每个文件描述符的具体指向。 -#### 使用 `-p` 附加到正在运行的进程中 +#### 使用 -p 附加到正在运行的进程中 正如我们将在后面的例子中看到的,有时候你想追踪一个正在运行的程序。如果你知道这个程序的进程号为 1337 (可以通过 `ps` 查询),则可以这样操作: @@ -164,15 +158,15 @@ $ strace -p 1337 你可能需要 root 权限才能运行。 -#### 使用 `-f` 追踪子进程 +#### 使用 -f 追踪子进程 `strace` 默认只追踪一个进程。如果这个进程产生了一个子进程,你将会看到创建子进程的系统调用(一般是 `clone`),但是你看不到子进程内触发的任何调用。 -如果你认为在子进程中存在 bug,则需要使用 `-f` 参数启用子进程追踪功能。这样做的缺点是输出的内容会让人更加困惑。当追踪一个进程时,`strace` 显示的是单个调用事件流。当追踪多个进程的时候,你将会看到以 `` 开始的初始调用,接着是一系列针对其它线程的调用,最后才出现以 `<... foocall resumed>` 结束的初始调用。此外,你可以使用 `-ff` 参数将所有的调用分离到不同的文件中(查看 [the `strace` manual][6] 获取更多信息)。 +如果你认为在子进程中存在错误,则需要使用 `-f` 参数启用子进程追踪功能。这样做的缺点是输出的内容会让人更加困惑。当追踪一个进程时,`strace` 显示的是单个调用事件流。当追踪多个进程的时候,你将会看到以 `` 开始的初始调用,接着是一系列针对其它线程的调用,最后才出现以 `<... foocall resumed>` 结束的初始调用。此外,你可以使用 `-ff` 参数将所有的调用分离到不同的文件中(查看 [strace 手册][6] 获取更多信息)。 -#### 使用 `-e` 进行过滤 +#### 使用 -e 进行过滤 -正如你所看到的,默认的追踪输出是所有的系统调用。你可以使用 `-e` 参数过滤你需要追踪的调用(查看 [the `strace` manual][6])。这样做的好处是运行过滤后的 `strace` 比起使用 `grep` 进行二次过滤要更快。老实说,我大部分时间都不会被打扰。 +正如你所看到的,默认的追踪输出是所有的系统调用。你可以使用 `-e` 参数过滤你需要追踪的调用(查看 [strace 手册][6])。这样做的好处是运行过滤后的 `strace` 比起使用 `grep` 进行二次过滤要更快。老实说,我大部分时间都不会被打扰。 #### 并非所有的错误都是不好的 @@ -187,17 +181,17 @@ stat("/usr/bin/uname", {st_mode=S_IFREG|0755, st_size=39584, ...}) = 0 ... ``` -“错误信息之前的最后一次失败调用”这种启发式方法非常适合于查找错误。无论如何,自下而上地工作是有道理的。 +“错误信息之前的最后一次失败调用”这种启发式方法非常适合于查找错误。无论如何,自下而上地查找是有道理的。 -#### C编程指南非常有助于理解系统调用 +#### C 编程指南非常有助于理解系统调用 -标准 C 库函数调用不属于系统调用,但它们仅是系统调用之上的唯一一个薄层。所以如果你了解(甚至只是略知一二)如何使用 C 语言,那么阅读系统调用追踪信息就非常容易。例如,如果你在调试网络系统调用,你可以尝试略读 [Beej’s classic Guide to Network Programming][7]。 +标准 C 库函数调用不属于系统调用,但它们仅是系统调用之上的唯一一个薄层。所以如果你了解(甚至只是略知一二)如何使用 C 语言,那么阅读系统调用追踪信息就非常容易。例如,如果你在调试网络系统调用,你可以尝试略读 [Beej 经典的《网络编程指南》][7]。 ### 一个更复杂的调试例子 -就像我说的那样,简单的调试例子代表我在大部分情况下如何使用 `strace` 。然而,有时候需要一些更加细致的工作,所以这里有一个稍微复杂(且真实)的例子。 +就像我说的那样,简单的调试例子表现了我在大部分情况下如何使用 `strace`。然而,有时候需要一些更加细致的工作,所以这里有一个稍微复杂(且真实)的例子。 -[`bcron`][8] 是一个任务调度器,它是经典 *nix `cron` 守护程序的一种实现。它已经被安装到一台服务器上,但是当有人尝试编辑作业时间表时,发生了以下情况: +[bcron][8] 是一个任务调度器,它是经典 *nix `cron` 守护程序的另一种实现。它已经被安装到一台服务器上,但是当有人尝试编辑作业时间表时,发生了以下情况: ``` # crontab -e -u logs @@ -232,9 +226,9 @@ exit_group(111) = ? 在程序结束之前有一个 `write` 的错误信息,但是这次有些不同。首先,在此之前没有任何相关的失败系统调用。其次,我们看到这个错误信息是由 `read` 从别的地方读取而来的。这看起来像是真正的错误发生在别的地方,而 `bcrontab` 只是在转播这些信息。 -如果你查阅了 `man 2 read`,你将会看到 `read` 的第三个参数 (3) 代表文件描述符,这是 *nix 操作系统用于所有 IO 操作的句柄。你该如何知道文件描述符 3 代表什么?在这种情况下,你可以使用 `-y` 参数运行 `strace`(如上文所述),它将会在注释里告诉你文件描述符的具体指向,但是了解如何从上面这种输出中分析追踪结果是很有用的。 +如果你查阅了 `man 2 read`,你将会看到 `read` 的第一个参数 (`3`) 是一个文件描述符,这是 *nix 操作系统用于所有 IO 操作的句柄。你该如何知道文件描述符 3 代表什么?在这种情况下,你可以使用 `-y` 参数运行 `strace`(如上文所述),它将会在注释里告诉你文件描述符的具体指向,但是了解如何从上面这种输出中分析追踪结果是很有用的。 -一个文件描述符可以来自于许多系统调用之一(这取决于它是用于控制台、网络套接字还是真实文件等的描述符),但不论如何,我们都可以搜索返回值为 3 的系统调用(例如,在 `strace` 的输出中查找 “=3”)。在这次 `strace` 中可以看到有两个这样的调用:最上面的 `openat` 以及中间的 `socket`。`openat` 打开一个文件,但是紧接着的 `close(3)` 表明其已经被关闭。(注意:文件描述符可以在打开并关闭后重复使用。)所以 `socket` 调用才是与此相关的(它是在 `read` 之前的最后一次),这告诉我们 `brcontab` 正在与一个网络套接字通信。在下一行,`connect` 表明文件描述符 3 是一个连接到 `/var/run/bcron-spool` 的 Unix 域套接字。 +一个文件描述符可以来自于许多系统调用之一(这取决于它是用于控制台、网络套接字还是真实文件等的描述符),但不论如何,我们都可以搜索返回值为 `3` 的系统调用(例如,在 `strace` 的输出中查找 `=3`)。在这次 `strace` 中可以看到有两个这样的调用:最上面的 `openat` 以及中间的 `socket`。`openat` 打开一个文件,但是紧接着的 `close(3)` 表明其已经被关闭。(注意:文件描述符可以在打开并关闭后重复使用。)所以 `socket` 调用才是与此相关的(它是在 `read` 之前的最后一个),这告诉我们 `brcontab` 正在与一个网络套接字通信。在下一行,`connect` 表明文件描述符 3 是一个连接到 `/var/run/bcron-spool` 的 Unix 域套接字。 因此,我们需要弄清楚 Unix 套接字的另一侧是哪个进程在监听。有两个巧妙的技巧适用于在服务器部署中调试。一个是使用 `netstat` 或者较新的 `ss`。这两个命令都描述了当前系统中活跃的网络套接字,使用 `-l` 参数可以显示出处于监听状态的套接字,而使用 `-p` 参数可以得到正在使用该套接字的程序信息。(它们还有更多有用的选项,但是这两个已经足够完成工作了。) @@ -243,7 +237,7 @@ exit_group(111) = ? u_str LISTEN 0 128 /var/run/bcron-spool 1466637 * 0 users:(("unixserver",pid=20629,fd=3)) ``` -这告诉我们 `/var/run/bcron-spool` 套接字的监听程序是 `unixserver` 这个命令,它的进程 ID 为 20629。(巧合的是,这个程序也使用文件描述符 3 去连接这个套接字。) +这告诉我们 `/var/run/bcron-spool` 套接字的监听程序是 `unixserver` 这个命令,它的进程 ID 为 20629。(巧合的是,这个程序也使用文件描述符 `3` 去连接这个套接字。) 第二个常用的工具就是使用 `lsof` 查找相同的信息。它可以列出当前系统中打开的所有文件(或文件描述符)。或者,我们可以得到一个具体文件的信息: @@ -277,7 +271,7 @@ rt_sigreturn({mask=[]}) = 43 accept(3, NULL, NULL ``` -(最后一个 `accept` 调用没有在追踪周期里完成。)不幸的是,这次追踪没有包含我们想要的错误信息。我们没有观察到 `bcrontan` 往套接字发送或接受的任何信息。然而,我们看到了很多进程管理操作(`clone`,`wait4`,`SIGCHLD`,等等)。这个进程产生了子进程,我们猜测真实的工作是由子进程完成的。如果我们想捕获子进程的追踪信息,就必须往 `strace` 追加 `-f` 参数。以下是我们最终使用 `strace -f -o /tmp/trace -p 20629` 找到的错误信息: +(最后一个 `accept` 调用没有在追踪期间完成。)不幸的是,这次追踪没有包含我们想要的错误信息。我们没有观察到 `bcrontan` 往套接字发送或接受的任何信息。然而,我们看到了很多进程管理操作(`clone`、`wait4`、`SIGCHLD`,等等)。这个进程产生了子进程,我们猜测真实的工作是由子进程完成的。如果我们想捕获子进程的追踪信息,就必须往 `strace` 追加 `-f` 参数。以下是我们最终使用 `strace -f -o /tmp/trace -p 20629` 找到的错误信息: ``` 21470 openat(AT_FDCWD, "tmp/spool.21470.1573692319.854640", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) @@ -305,7 +299,9 @@ accept(3, NULL, NULL 21470 +++ exited with 111 +++ ``` -(如果你在这里失败了,你可能需要阅读 [我之前有关 *nix 进程管理和 shell 的文章][9])好的,现在 PID 为 20629 的服务器进程没有权限在 `/var/spool/cron/tmp/spool.21470.1573692319.854640` 创建文件。最可能的原因就是典型的 *nix 文件系统权限设置。让我们检查一下: +(如果你在这里迷糊了,你可能需要阅读 [我之前有关 \*nix 进程管理和 shell 的文章][9]) + +现在 PID 为 20629 的服务器进程没有权限在 `/var/spool/cron/tmp/spool.21470.1573692319.854640` 创建文件。最可能的原因就是典型的 *nix 文件系统权限设置。让我们检查一下: ``` # ls -ld /var/spool/cron/tmp/ @@ -330,7 +326,7 @@ via: https://theartofmachinery.com/2019/11/14/deployment_debugging_strace.html 作者:[Simon Arneaud][a] 选题:[lujun9972][b] 译者:[hanwckf](https://github.com/hanwckf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 54a36a3e32e5471f392f5369ef98ed57ae024b9e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Dec 2019 23:12:39 +0800 Subject: [PATCH 054/676] PRF --- ...ove duplicate lines from files with awk.md | 124 ++++++++---------- 1 file changed, 52 insertions(+), 72 deletions(-) diff --git a/translated/tech/20191028 How to remove duplicate lines from files with awk.md b/translated/tech/20191028 How to remove duplicate lines from files with awk.md index a6fe25570e..58d535bc13 100644 --- a/translated/tech/20191028 How to remove duplicate lines from files with awk.md +++ b/translated/tech/20191028 How to remove duplicate lines from files with awk.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to remove duplicate lines from files with awk) @@ -9,80 +9,73 @@ 怎样使用 awk 删掉文件中重复的行 ====== -学习怎样使用 awk 的 `!visited[$0]++` 在不重新排序或改变原排列顺序的前提下删掉重复的行。 + +> 学习怎样使用 awk 的 `!visited[$0]++` 在不重新排序或改变原排列顺序的前提下删掉重复的行。 + ![Coding on a computer][1] 假设你有一个文本文件,你需要删掉所有重复的行。 -### 这篇内容篇幅比较长,如果不想深入探讨或时间有限,可以看总结。 - -*保持原来的排列顺序*删掉重复行,使用: +### TL;DR +*要保持原来的排列顺序*删掉重复行,使用: ``` -`awk '!visited[$0]++' your_file > deduplicated_file` +awk '!visited[$0]++' your_file > deduplicated_file ``` ### 工作原理 -这个脚本维持一个关联数组,*index 总数*为文件去重后的行数,每个 index 对应的 *value* 为某行出现的次数。对于文件的每一行,如果这行出现的次数为 0,则 value 加 1 *并打印这行*,否则 value 加 1 *不打印这行*。 +这个脚本维持一个关联数组,索引为文件中去重后的行,每个索引对应的值为该行出现的次数。对于文件的每一行,如果这行出现的次数为 0,则值加 1,并打印这行,否则值加 1,不打印这行。 -我之前不熟悉 **awk**,我想弄清楚这么短小的一个脚本是怎么实现的。我调研了下,下面是调研心得: +我之前不熟悉 `awk`,我想弄清楚这么短小的一个脚本是怎么实现的。我调研了下,下面是调研心得: - * awk “脚本” **!visited[$0]++** 对输入文件的*每一行*都执行 - * **visited[]** 是一个 [关联数组][2] (又名 [Map][3])的变量。 **awk** 会在第一次执行时初始化它,因此我们不需要初始化。 - * **$0** 变量的值是当前正在被处理的行的内容 - * **visited[$0]** 通过与 **$0**(正在被处理的行)相等的 key 访问 map 中的值,即出现次数(我们在下面设置的) - * **!** 对表示出现次数的值取反 - * 在 awk 中,[任意非零的数或任意非空的字符串的值是 true][4]。 - * [变量默认的初始值为空字符串][5],如果被转换为数字,则为 0. +* 这个 awk “脚本” `!visited[$0]++` 对输入文件的*每一行*都执行。 +* `visited[]` 是一个[关联数组][2](又名[映射][3])类型的变量。`awk` 会在第一次执行时初始化它,因此我们不需要初始化。 +* `$0` 变量的值是当前正在被处理的行的内容。 +* `visited[$0]` 通过与 `$0`(正在被处理的行)相等的键来访问该映射中的值,即出现次数(我们在下面设置的)。 +* `!` 对表示出现次数的值取反: + * 在 `awk` 中,[任意非零的数或任意非空的字符串的值是 true][4]。 + * [变量默认的初始值为空字符串][5],如果被转换为数字,则为 0。 * 也就是说: - * 如果 **visited[$0]** 的值是一个比 0 大的数,取反后被解析成 **false**。 - * 如果 **visited[$0]** 的值为等于 0 的数字或空字符串,取反后被解析成 **true** 。 - * **++** 表示变量(visited[$0])的值加 1. - * 如果值为空,**awk** 自动把它转换为 **0**(数字) 后加 1。 - * **注意:**加 1 操作是在我们取到了变量的值之后执行的。 - - + * 如果 `visited[$0]` 的值是一个比 0 大的数,取反后被解析成 `false`。 + * 如果 `visited[$0]` 的值为等于 0 的数字或空字符串,取反后被解析成 `true` 。 + * `++` 表示变量(`visited[$0]`)的值加 1。 + * 如果该值为空,`awk` 自动把它转换为 `0`(数字) 后加 1。 + * 注意:加 1 操作是在我们取到了变量的值之后执行的。 总的来说,整个表达式的意思是: - * **true** 如果表示出现次数的值为 0 或空字符串 - * **false** 如果出现的次数大于 0 - - - -**awk** 由 [_pattern 表达式和一个与之关联的 action_][6] 组成 + * `true`:如果表示出现次数为 0 或空字符串 + * `false`:如果出现的次数大于 0 +`awk` 由 [模式或表达式和一个与之关联的动作][6] 组成 ``` -` { }` +<模式/表达式> { <动作> } ``` -如果匹配到了 pattern,就会执行后面的 action。如果没有 action,**awk** 默认会 **print** 输入。 +如果匹配到了模式,就会执行后面的动作。如果没有动作,`awk` 默认会打印(`print`)输入。 -> 省略 action 等于 **{print $0}**。 - -我们的脚本由一个 **awk** 表达式语句组成,省略了 action。因此这样写: +> 省略动作等价于 `{print $0}`。 +我们的脚本由一个 `awk` 表达式语句组成,省略了动作。因此这样写: ``` -`awk '!visited[$0]++' your_file > deduplicated_file` +awk '!visited[$0]++' your_file > deduplicated_file ``` 等于这样写: - ``` -`awk '!visited[$0]++ { print $0 }' your_file > deduplicated_file` +awk '!visited[$0]++ { print $0 }' your_file > deduplicated_file ``` -对于文件的每一行,如果表达式匹配到了,这行内容被 print 到输出。否则,不执行 action,不打印任何东西。 +对于文件的每一行,如果表达式匹配到了,这行内容被打印到输出。否则,不执行动作,不打印任何东西。 ### 为什么不用 uniq 命令? -**uniq** 命令仅能对相邻的行去重。这是一个示例: - +`uniq` 命令仅能对相邻的行去重。这是一个示例: ``` $ cat test.txt @@ -100,7 +93,7 @@ C B B A -$ uniq < test.txt +$ uniq < test.txt A B A @@ -113,26 +106,25 @@ A #### 使用 sort 命令 -我们也可以用下面的 [**sort**][7] 命令来去除重复的行,但是*行原来的顺序没有被保留*。 +我们也可以用下面的 [sort][7] 命令来去除重复的行,但是*原来的行顺序没有被保留*。 ``` -`sort -u your_file > sorted_deduplicated_file` +sort -u your_file > sorted_deduplicated_file ``` #### 使用 cat + sort + cut -上面的方法会产出一个去重的文件,各行是基于内容进行排序的。[通过管道连接命令][8] 可以解决这个问题。 +上面的方法会产出一个去重的文件,各行是基于内容进行排序的。[通过管道连接命令][8]可以解决这个问题。 ``` -`cat -n your_file | sort -uk2 | sort -nk1 | cut -f2-` +cat -n your_file | sort -uk2 | sort -nk1 | cut -f2- ``` -##### 工作原理 - -假设我们有下面一个文件 +**工作原理** +假设我们有下面一个文件: ``` abc @@ -145,8 +137,7 @@ ghi klm ``` -**cat -n test.txt** 在每行前面显示序号。 - +`cat -n test.txt` 在每行前面显示序号: ``` 1       abc @@ -159,8 +150,7 @@ klm 8       klm ``` -**sort -uk2** 基于第二列(**k2** 选项)进行排序,对于第二列相同的值只保留一次(**u** 选项)。 - +`sort -uk2` 基于第二列(`k2` 选项)进行排序,对于第二列相同的值只保留一次(`u` 选项): ``` 1       abc @@ -170,8 +160,7 @@ klm 5       xyz ``` -**sort -nk1** 基于第一列排序(**k1** 选项),把列的值作为数字来处理(**-n** 选项)。 - +`sort -nk1` 基于第一列排序(`k1` 选项),把列的值作为数字来处理(`-n` 选项): ``` 1       abc @@ -181,8 +170,7 @@ klm 8       klm ``` -最后,**cut -f2-** 打印每一行从第二列开始直到最后的内容(**-f2-** 选项:留意 - 后缀,- 表示这行后面的内容都包含在内)。 - +最后,`cut -f2-` 从第二列开始打印每一行,直到最后的内容(`-f2-` 选项:留意 `-` 后缀,它表示这行后面的内容都包含在内)。 ``` abc @@ -194,23 +182,15 @@ klm ### 参考 - * [GNU awk 用户手册][9] - * [awk 中的数组][2] - * [Awk—Truth values][4] - * [Awk 表达式][5] - * [Unix 怎么删除文件中重复的行?][10] - * [不用排序去掉重复的行【去重】][11] - * ['!a[$0]++' 工作原理][12] +* [GNU awk 用户手册][9] +* [awk 中的数组][2] +* [Awk — 真值][4] +* [Awk 表达式][5] +* [Unix 怎么删除文件中重复的行?][10] +* [不用排序去掉重复的行(去重)][11] +* ['!a[$0]++' 工作原理][12] - - -以上为全文。附上猫照。 - -![Duplicate cat][13] - -* * * - -本文首发在 [Lazarus Lazaridis][14] 的 iridakos 博客,遵照 [CC BY-NC 4.0 License][15] ,转载已获得作者授权。 +以上为全文。 -------------------------------------------------------------------------------- @@ -219,7 +199,7 @@ via: https://opensource.com/article/19/10/remove-duplicate-lines-files-awk 作者:[Lazarus Lazaridis][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From de68ae7a694d4c4eca1818abdecce830568b6203 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Dec 2019 00:57:24 +0800 Subject: [PATCH 055/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191212=2015=20U?= =?UTF-8?q?seful=20Firefox=20Keyboard=20Shortcuts=20You=20Should=20Know?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191212 15 Useful Firefox Keyboard Shortcuts You Should Know.md --- ...efox Keyboard Shortcuts You Should Know.md | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 sources/tech/20191212 15 Useful Firefox Keyboard Shortcuts You Should Know.md diff --git a/sources/tech/20191212 15 Useful Firefox Keyboard Shortcuts You Should Know.md b/sources/tech/20191212 15 Useful Firefox Keyboard Shortcuts You Should Know.md new file mode 100644 index 0000000000..345802439f --- /dev/null +++ b/sources/tech/20191212 15 Useful Firefox Keyboard Shortcuts You Should Know.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (15 Useful Firefox Keyboard Shortcuts You Should Know) +[#]: via: (https://itsfoss.com/firefox-keyboard-shortcuts/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +15 Useful Firefox Keyboard Shortcuts You Should Know +====== + +[Firefox][1] is one of the most popular free and open-source browsers for Linux users. Even though you have a lot of [open source chrome alternatives][2], Firefox still is one of the best choices to go with. + +And you don’t even need to [install Firefox on Ubuntu][3] or most other distributions because it is installed by default. + +What if you can make your browsing experience on Firefox even better by using some keyboard shortcuts? + +Hold on, of course, not everyone prefers to use keyboard shortcuts. But, if you’re comfortable with that and want to do perform tasks in a jiffy, you should know some of the most common Firefox keyboard shortcuts. + +It is also worth noting that you could use some of these shortcuts on Chrome/Chromium as well- however, we already have a list of [useful Google Chrome shortcuts][4] to help you out. So, if you’re using Chrome/Chromium, I insist you check out that article. + +### 15 Useful Firefox Keyboard Shortcuts + +![][5] + +You could always refer to the [official documentation][6] of keyboard shortcuts for Firefox. However, that’s a very long list, and you probably do not need to use all of that. + +So, here, I shall be listing the most commonly used (and useful) keyboard shortcuts that you can use on Firefox. To be honest, these are the shortcuts that I use most frequently on Firefox. + +#### 1\. Open A New Tab + +You don’t have to hover your cursor over to the **+** sign in the browser. + +Simply press **CTRL + T** to open a new tab in the same window. + +#### 2\. Open A New Tab In A New Window + +If you want to open up a new window along with a new tab, you just have to press **CTRL + N**. + +#### 3\. Close A Tab + +Lazy to use your mouse to navigate and close the tab? Fret not, just press **CTRL + W** to make your active tab vanish! + +#### 4\. Open A New Private Window + +Don’t want to store the history/cookies for a specific browsing session? You can try the private mode by pressing **CTRL + Shift + P** as the keyboard shortcut for Firefox. + +#### 5\. Open Recently Closed Tabs + +If you closed a tab recently (or a number of tabs), just press **CTRL + Shift + T** till you get all your closed tabs restored. + +#### 6\. Reload Webpage + +You might want to reload a webpage quickly, to do that press **F5**. + +If you want to ignore the cached content and want to fetch a new copy of the webpage, you can try **CTRL + F5**. + +#### 7\. Scroll Up/Down Webpage + +You can also scroll up/down using just your keyboard. + +Simply use **PAGE UP** to scroll up and **PAGE DOWN** key to scroll down. + +#### 8\. Find A Text In Webpage + +You do not need to endlessly look for a word on a webpage just like you would in a physical book. + +Simply press **CTRL + F** and then type in the exact word, it should highlight the matching words if it exists. + +#### 9\. Close Your Browser At Once + +Hit **CTRL + Shift + W** to close all the tabs in one go. However, you might get the prompt to confirm it. + +#### 10\. View The Page Source + +If you’re interested to take peek at the webpage’s source code, you just have to press **CTRL + U** to open view source in a new tab. + +#### 11\. Switch Tabs Quickly + +If you have multiple tabs opened up, you can easily navigate through them by pressing: + +**CTRL + Tab**. + +#### 12\. View Your Downloads + +Do you want to quickly take a look at your download library? All you need to do is press: + +**CTRL + Shift + Y** + +#### 13\. Bookmark A Webpage + +To bookmark a webpage, hit **CTRL + D** and press the **ENTER** key to save it. + +#### 14\. Select the Address/Search Bar + +If you want to search for something through the address bar, hit **CTRL + L** to immediately highlight the search bar for you. + +#### 15\. Check Browsing History + +Usually, it needs a couple of clicks to view your history. But, you can just press **CTRL + H** to launch the sidebar to view your history right away. + +### Wrapping Up + +As I mentioned, you will find a huge list of Firefox keyboard shortcuts if you take a look at their [official documentation][6]. + +If you want to explore more options, feel free to check the documentation. In either case, the mentioned keyboard shortcuts should come pretty handy. + +I’ll be interested to know what Firefox keyboard shortcuts do you use? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/firefox-keyboard-shortcuts/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.mozilla.org/en-US/firefox/ +[2]: https://itsfoss.com/open-source-browsers-linux/ +[3]: https://itsfoss.com/firefox-quantum-ubuntu/ +[4]: https://itsfoss.com/google-chrome-shortcuts/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/Firefox_Keyboard_Shortcuts.jpg?ssl=1 +[6]: https://developer.mozilla.org/en-US/docs/Tools/Keyboard_shortcuts From 5c366316ec61672acbb3204f0dd8cc47619f8ecf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Dec 2019 00:58:11 +0800 Subject: [PATCH 056/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191211=20Revamp?= =?UTF-8?q?=20your=20old=20Linux=20desktop=20with=20Joe's=20Window=20Manag?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191211 Revamp your old Linux desktop with Joe-s Window Manager.md --- ...Linux desktop with Joe-s Window Manager.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20191211 Revamp your old Linux desktop with Joe-s Window Manager.md diff --git a/sources/tech/20191211 Revamp your old Linux desktop with Joe-s Window Manager.md b/sources/tech/20191211 Revamp your old Linux desktop with Joe-s Window Manager.md new file mode 100644 index 0000000000..97240d2de9 --- /dev/null +++ b/sources/tech/20191211 Revamp your old Linux desktop with Joe-s Window Manager.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Revamp your old Linux desktop with Joe's Window Manager) +[#]: via: (https://opensource.com/article/19/12/joes-window-manager-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Revamp your old Linux desktop with Joe's Window Manager +====== +This article is part of a special series of 24 days of Linux desktops. +JWM's meager weight and simplicity makes it a great window manager for +slow or old Linux computers. +![and old computer and a new computer, representing migration to new software or hardware][1] + +Joe's Window Manager ([JWM][2] for short) is a lightweight window manager for X11. It's written in C, minimally using [Xlib][3]. Because it's so small and simple, JWM makes a great window manager for slow or old computers. The Raspberry Pi barely registers that JWM is running, leaving precious system resources for more important tasks than the desktop. + +JWM follows in the footsteps of environments like FVWM, Window Maker, and Fluxbox. It provides an application menu, window decoration, and a panel with an application menu, taskbar, and clock. + +Install JWM from your distribution's software repository. After installing it, log out of your current desktop session so you can log into JWM. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +To select a new desktop with GDM: + +![Select your desktop session in GDM][4] + +With KDM: + +![Select your desktop session with KDM][5] + +The first time you log into JWM, you may find a black screen with a panel at the bottom. It's normal on most distributions to let you choose the wallpaper for this minimal desktop. You can set a wallpaper with the **feh** command (you may need to install it from your repository). This command has a few options for setting the background, including **\--bg-fill** to fill the screen with your wallpaper of choice, **\--bg-scale** to scale it to fit, and so on. + + +``` +`$ feh --bg-fill ~/Pictures/wallpapers/mybackground.jpg` +``` + +### Application menu + +There are two locations for the application menus in JWM: it appears at your mouse cursor when you left-click on the desktop, and it is also available by clicking the JWM logo in the lower-left corner. + +![JWM running on Debian][6] + +There aren't any applications bundled with JWM, so it's up to you to decide what applications to use. You can get applications from any desktop, like GNOME or KDE, or you can use independent applications. Most of the integration between applications is done by [D-Bus][7] and other backend technology on Linux, so it's safe to mix and match them. I use [PCManFM-Qt][8] as a file manager, [unicode-rxvt][9] as a terminal, and, of course, Firefox as an internet browser. + +### Configuration + +Two configuration files govern JWM. The system-wide configuration file is **/etc/jwm/system.jwmrc**, and the user local file is **$HOME/.jwmrc**. Configuration files are written in XML, but the schema is very basic and easy to reverse-engineer, whether you know XML or not. Configuration options are well-documented on [Joewing.net][10], home of the JWM project. + +### Why you should use JWM + +There's no shortage of lightweight window managers available for Linux, and you might wonder why there seems to be so much redundancy, much less why you should try Joe's. There are a few reasons JWM is as important as any of the others. When looking at software projects, redundancy is a _good thing_. Should one project's implementation of a desktop paradigm fade, you have many others to choose from. And often, the strengths of each project are in the minor details. For example, the quick and easy setup of a taskbar and application menu makes for a quick, sensible default configuration for all the users who want that common setup. For technical users, the XML configuration may be a refreshing change from the custom configuration formats in other environments. + +Joe's Window Manager, in a way, demonstrates the rich diversity of open source and how it's a luxury Linux users enjoy. If you're interested in JWM, try it out today, and see if you can make your own window manager, too. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/joes-window-manager-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q (and old computer and a new computer, representing migration to new software or hardware) +[2]: http://joewing.net/projects/jwm/ +[3]: https://en.wikipedia.org/wiki/Xlib +[4]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) +[5]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) +[6]: https://opensource.com/sites/default/files/uploads/advent-jwm_675px.jpg (JWM running on Debian) +[7]: https://en.wikipedia.org/wiki/D-Bus +[8]: https://blog.lxqt.org/category/pcmanfm-qt/ +[9]: https://opensource.com/article/19/10/why-use-rxvt-terminal +[10]: http://joewing.net/projects/jwm/config-2.3.html From fca230ae6a8983d4a681abf536cc4080d0302655 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Dec 2019 00:58:46 +0800 Subject: [PATCH 057/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191211=20Annota?= =?UTF-8?q?te=20screenshots=20on=20Linux=20with=20Ksnip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md --- ...nnotate screenshots on Linux with Ksnip.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md diff --git a/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md b/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md new file mode 100644 index 0000000000..23b2107505 --- /dev/null +++ b/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Annotate screenshots on Linux with Ksnip) +[#]: via: (https://opensource.com/article/19/12/annotate-screenshots-linux-ksnip) +[#]: author: (Clayton Dewey https://opensource.com/users/cedewey) + +Annotate screenshots on Linux with Ksnip +====== +Ksnip allows you to create and mark up screenshots in Linux with ease. +![a checklist for a team][1] + +I recently switched from MacOS to [Elementary OS][2], a Linux distribution focused on ease of use and privacy. As a user-experience designer and a free software supporter, I take screenshots and annotate them all the time. After trying out several different tools, the one I enjoy the most by far is [Ksnip][3], an open source tool licensed under GPLv2. + +![Ksnip screenshot][4] + +### Installation + +Install Ksnip with your preferred package manager. I installed it via Apt: + + +``` +`sudo apt-get install ksnip` +``` + +### Configuration + +Ksnip comes with quite a few configuration options, including: + + * Location to save screenshots + * Default screenshot filename + * Image grabber behavior + * Cursor color and thickness + * Text font + + + +You can also integrate it with your Imgur account. + +![Ksnip configuration options][5] + +### Usage + +Ksnip offers a wide range of [features][6]. My favorite part of Ksnip is that it has all the annotation tools I need (plus one I hadn't thought of!). + +You can annotate with: + + * Pen + * Marker + * Rectangles + * Ellipses + * Text + + + +You can also blur areas to remove sensitive information. And use my new favorite tool: numbered dots for steps on an interface. + +### About the creator + +I'm enjoying Ksnip so much that I reached out to the creator, [Damir Porobic][7], to learn more about the project. + +When I asked what inspired him to create Ksnip, he said: + +> "I switched from Windows to Linux a few years ago and missed the Windows Snipping Tool that I was used to on Windows. All other screenshot tools at that time were either huge (a lot of buttons and complex features) or lacked key features like annotations, so I decided to build a simple Snipping Tool clone, but with time it got more and more features. So here we are." + +This is exactly what I found as I was evaluating screenshot tools. It's great that he took the time to build a solution and freely share it for others to benefit. + +As for the future of Ksnip, Damir would like to add global shortcuts (at least for Windows) and tabs for new screenshots and allow the application to run in the background. There is also a growing list of feature requests on GitHub. + +### Ways to help + +Damir's biggest need for Ksnip help is with development. He and his wife are expecting a baby soon, so he won't have as much time to devote to the project. He is available to review and accept pull requests, though. + +Also, the project could benefit from additional installation options via Snap and Flatpak and installers for MacOS and a setup for Windows. If you would like to help, check out the [Contribution][8] section of Ksnip's README. + +* * * + +_This article originally appeared on [Agaric Tech Cooperative's blog][9] and is republished with permission._ + +How do you know when your documentation needs screenshots? Ben Cotton shares some helpful tips. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/annotate-screenshots-linux-ksnip + +作者:[Clayton Dewey][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cedewey +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://elementary.io/ +[3]: https://github.com/damirporobic/ksnip +[4]: https://opensource.com/sites/default/files/uploads/ksnip.png (Ksnip screenshot) +[5]: https://opensource.com/sites/default/files/uploads/ksnip-configuration.png (Ksnip configuration options) +[6]: https://github.com/DamirPorobic/ksnip#features +[7]: https://github.com/damirporobic/ +[8]: https://github.com/DamirPorobic/ksnip/blob/master/README.md#contribution +[9]: https://agaric.coop/blog/annotate-screenshots-linux-ksnip From 60f9721dd7070d07fafada0376fe01755efe2f12 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Dec 2019 00:59:22 +0800 Subject: [PATCH 058/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191211=20Enable?= =?UTF-8?q?=20your=20Python=20game=20player=20to=20run=20forward=20and=20b?= =?UTF-8?q?ackward?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191211 Enable your Python game player to run forward and backward.md --- ...game player to run forward and backward.md | 474 ++++++++++++++++++ 1 file changed, 474 insertions(+) create mode 100644 sources/tech/20191211 Enable your Python game player to run forward and backward.md diff --git a/sources/tech/20191211 Enable your Python game player to run forward and backward.md b/sources/tech/20191211 Enable your Python game player to run forward and backward.md new file mode 100644 index 0000000000..fb9b020278 --- /dev/null +++ b/sources/tech/20191211 Enable your Python game player to run forward and backward.md @@ -0,0 +1,474 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Enable your Python game player to run forward and backward) +[#]: via: (https://opensource.com/article/19/12/python-platformer-game-run) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Enable your Python game player to run forward and backward +====== +Let your player run free by enabling the side-scroller effect in your +Python platformer using the Pygame module. +![Gaming artifacts with joystick, GameBoy, paddle][1] + +This is part 8 in an ongoing series about creating video games in Python 3 using the Pygame module. Previous articles are: + + * [Learn how to program in Python by building a simple dice game][2] + * [Build a game framework with Python using the Pygame module][3] + * [How to add a player to your Python game][4] + * [Using Pygame to move your game character around][5] + * [What's a hero without a villain? How to add one to your Python game][6] + * [Simulate gravity in your Python game][7] + * [Add jumping to your Python platformer game][8] + + + +In previous entries in this series about creating video games in [Python 3][9] using the [Pygame][10] module, you designed your level-design layout, but some portion of your level probably extended past your viewable screen. The ubiquitous solution to that problem in platformer games is, as the term "side-scroller" suggests, scrolling. + +The key to scrolling is to make the platforms around the player sprite move when the player sprite gets close to the edge of the screen. This provides the illusion that the screen is a "camera" panning across the game world. + +This scrolling trick requires two dead zones at either edge of the screen, at which point your avatar stands still while the world scrolls by. + +### Putting the scroll in side-scroller + +You need one trigger point to go forward and another if you want your player to be able to go backward. These two points are simply two variables. Set them each about 100 or 200 pixels from each screen edge. Create the variables in your **setup** section. In the following code, the first two lines are for context, so just add the last two lines: + + +``` +player_list.add(player) +steps = 10 +forwardX  = 600 +backwardX = 230 +``` + +In the main loop, check to see if your player sprite is at the **forwardx** or **backwardx** scroll point. If so, move all platforms either left or right, depending on whether the world is moving forward or backward. In the following code, the final three lines of code are only for your reference: + + +``` +        # scroll the world forward +        if player.rect.x >= forwardx: +                scroll = player.rect.x - forwardx +                player.rect.x = forwardx +                for p in plat_list: +                        p.rect.x -= scroll + +        # scroll the world backward +        if player.rect.x <= backwardx: +                scroll = backwardx - player.rect.x +                player.rect.x = backwardx +                for p in plat_list: +                        p.rect.x += scroll + +        ## scrolling code above +    world.blit(backdrop, backdropbox) +    player.gravity() # check gravity +    player.update() +``` + +Launch your game and try it out. + +![Scrolling the world in Pygame][11] + +Scrolling works as expected, but you may notice a small problem that happens when you scroll the world around your player and non-player sprites: the enemy sprite doesn't scroll along with the world. Unless you want + +your enemy sprite to pursue your player endlessly, you need to modify the enemy code so that when your player makes an expeditious retreat, the enemy is left behind. + +### Enemy scroll + +In your main loop, you must apply the same rules for scrolling platforms to your enemy's position. Because your game world will (presumably) have more than one enemy in it, the rules are applied to your enemy list rather than an individual enemy sprite. That's one of the advantages of grouping similar elements into lists. + +The first two lines are for context, so just add the final two to your main loop: + + +``` +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +``` + +To scroll in the other direction: + + +``` +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll +``` + +Launch the game again and see what happens. + +Here's all the code you've written for this Python platformer so far: + + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform +# add gravity +# add jumping +# add scrolling + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os + +''' +Objects +''' + +class Platform(pygame.sprite.Sprite): +    # x location, y location, img width, img height, img file     +    def __init__(self,xloc,yloc,imgw,imgh,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)).convert() +        self.image.convert_alpha() +        self.rect = self.image.get_rect() +        self.rect.y = yloc +        self.rect.x = xloc + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 +        self.movey = 0 +        self.frame = 0 +        self.health = 10 +        self.collide_delta = 0 +        self.jump_delta = 6 +        self.score = 1 +        self.images = [] +        for i in range(1,9): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha() +            img.set_colorkey(ALPHA) +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() + +    def jump(self,platform_list): +        self.jump_delta = 0 + +    def gravity(self): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty +        +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +        +    def update(self): +        ''' +        Update sprite position +        ''' +        +        self.rect.x = self.rect.x + self.movex +        self.rect.y = self.rect.y + self.movey + +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        for enemy in enemy_hit_list: +            self.health -= 1 +            #print(self.health) + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.collide_delta = 0 # stop jumping +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty +            +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.movey = 0 +            self.rect.y = worldy-ty-ty +            self.collide_delta = 0 # stop jumping +            if self.rect.y > g.rect.y: +                self.health -=1 +                print(self.health) +                +        if self.collide_delta < 6 and self.jump_delta < 6: +            self.jump_delta = 6*2 +            self.movey -= 33  # how high to jump +            self.collide_delta += 6 +            self.jump_delta    += 6 +            +class Enemy(pygame.sprite.Sprite): +    ''' +    Spawn an enemy +    ''' +    def __init__(self,x,y,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)) +        self.movey = 0 +        #self.image.convert_alpha() +        #self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.counter = 0 + +                +    def move(self): +        ''' +        enemy movement +        ''' +        distance = 80 +        speed = 8 + +        self.movey += 3.2 +        +        if self.counter >= 0 and self.counter <= distance: +            self.rect.x += speed +        elif self.counter >= distance and self.counter <= distance*2: +            self.rect.x -= speed +        else: +            self.counter = 0 +        +        self.counter += 1 + +        if not self.rect.y >= worldy-ty-ty: +            self.rect.y += self.movey + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.rect.y = worldy-ty-ty + +        +class Level(): +    def bad(lvl,eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list.add(enemy)              # add enemy to group +            +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return enemy_list + +    def loot(lvl,lloc): +        print(lvl) + +    def ground(lvl,gloc,tx,ty): +        ground_list = pygame.sprite.Group() +        i=0 +        if lvl == 1: +            while i < len(gloc): +                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') +                ground_list.add(ground) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return ground_list + +    def platform(lvl,tx,ty): +        plat_list = pygame.sprite.Group() +        ploc = [] +        i=0 +        if lvl == 1: +            ploc.append((0,worldy-ty-128,3)) +            ploc.append((300,worldy-ty-256,3)) +            ploc.append((500,worldy-ty-128,4)) + +            while i < len(ploc): +                j=0 +                while j <= ploc[i][2]: +                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') +                    plat_list.add(plat) +                    j=j+1 +                print('run' + str(i) + str(ploc[i])) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return plat_list + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4  # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +ALPHA = (0,255,0) + +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +forwardx = 600 +backwardx = 230 + +eloc = [] +eloc = [200,20] +gloc = [] +#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] +tx = 64 #tile size +ty = 64 #tile size + +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) + +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print("LEFT") +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print("RIGHT") +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                player.jump(plat_list) + +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +                +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll + +    world.blit(backdrop, backdropbox) +    player.gravity() # check gravity +    player.update() +    player_list.draw(world) #refresh player position +    enemy_list.draw(world)  # refresh enemies +    ground_list.draw(world)  # refresh enemies +    plat_list.draw(world)   # refresh platforms +    for e in enemy_list: +        e.move() +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/python-platformer-game-run + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_gaming_games_roundup_news.png?itok=KM0ViL0f (Gaming artifacts with joystick, GameBoy, paddle) +[2]: https://opensource.com/article/17/10/python-101 +[3]: https://opensource.com/article/17/12/game-framework-python +[4]: https://opensource.com/article/17/12/game-python-add-a-player +[5]: https://opensource.com/article/17/12/game-python-moving-player +[6]: https://opensource.com/article/18/5/pygame-enemy +[7]: https://opensource.com/article/19/11/simulate-gravity-python +[8]: https://opensource.com/article/19/12/jumping-python-platformer-game +[9]: https://www.python.org/ +[10]: https://www.pygame.org/news +[11]: https://opensource.com/sites/default/files/uploads/pygame-scroll.jpg (Scrolling the world in Pygame) From d675ffc5f393160e958eadb2229a7ec5cf4f1994 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 12 Dec 2019 01:00:29 +0800 Subject: [PATCH 059/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191211=20Passiv?= =?UTF-8?q?e=20optical=20networking:=20Its=20day=20is=20dawning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191211 Passive optical networking- Its day is dawning.md --- ... optical networking- Its day is dawning.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/talk/20191211 Passive optical networking- Its day is dawning.md diff --git a/sources/talk/20191211 Passive optical networking- Its day is dawning.md b/sources/talk/20191211 Passive optical networking- Its day is dawning.md new file mode 100644 index 0000000000..c8e61f2c4c --- /dev/null +++ b/sources/talk/20191211 Passive optical networking- Its day is dawning.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Passive optical networking: Its day is dawning) +[#]: via: (https://www.networkworld.com/article/3489477/passive-optical-networking-its-day-is-dawning.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Passive optical networking: Its day is dawning +====== + +Getty Images + +The concept of using passive optical LANs in enterprise campuses has been around for years, but hasn’t taken off because most businesses consider all-fiber networks to be overkill for their needs. I’ve followed this market for the better part of two decades, and now I believe we’re on the cusp of seeing POL go mainstream, starting in certain verticals. + +The primary driver of change from copper to optical is that the demands on the network have evolved. Every company now considers its network to be business critical where just a few years ago, it was considered best effort in nature.  Downtime or a congested network meant inconvenienced users, but today they mean the business is likely losing big money. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +There are also a number of new trends driving the evolution of the campus network.  These include: + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + + * Cloud services. The cloud is certainly the way of the future but it’s playing havoc with enterprise networks. As data centers evolved to modernized systems, East-West traffic was superseded by North-South. Today, businesses are connecting direct to cloud for [hybrid-cloud][3] deployments driving more North-South traffic.  Traditional networks can be a bottleneck.  + * [Internet of Things][4] (IoT). [Wi-Fi 6 and 5G][5] will enable more devices to be connected in more places leading to more bandwidth on the network. For the first time in history, wireless speeds will match wired speeds straining the campus network. + * Video of all kinds is on the rise.  Surveillance, collaboration, room systems, streaming and other kinds of video usage are on the rise.  Video requires high-quality, low-latency connectivity. + + + +### Copper is running out of life + +The increased speeds pose quite a predicament for companies. If the organization has Cat5 cabling, the speed is capped at 1Gbps. If Cat6 is deployed, speeds of 10Gbps can be reached but only 55 meter’s distance. If the company wants to reach the full 100M length of copper, Cat6A or higher must be used.  Optical cable has no distance limitations because POL is completely passive and requires no electronics to boost the signal.  Optical cabling can carry petabytes of bandwidth over long distances.  Also, with optical, there’s no concern over what type of cable is being used and having the quality degrade over time.  Lastly, upgrading speeds is easier.  The cabling can stay in place and just the optics get changed out at the ends of the cable making the process simple. + +### POL is a cheaper, longer lasting than copper upgrades + +If businesses are faced with having to upgrade their networks from Cat5 to another type of cabling, it might make sense to look at POL as it can be the foundation for the campus network for years. + +The early adopters of POL are companies that are highly distributed with large campuses and need to get more network services in more places. This includes manufacturing organizations, universities, hospitality, cities and airports. Although I’ve highlighted a few verticals, the fact is that any business can take advantage of POL. + +### POL in a mixed-use development + +At a Huawei conference earlier this year the company showcased the Dubai Creek Harbor project being built by Emaar Properties – a six-square-mile development including residences, offices, retail and cultural facilities. The complex is designed to be fully digital and the network has to support IoT, cloud computing, AI-based analytics and more. + +The project features an optical network built on Huawei’s Campus OptiX solution that simplifies the network as the architecture moves from a three-tier hierarchical design to a two-tier one. That design uses less equipment and reduces power and cooling requirements. Also, the flat, 10Gbps network obviates the need for parallel overlay networks, making it easier to manage and giving it a degree of future-proofing as the network can easily be upgraded. The all-optical network resulted in a 60% improvement in operational efficiency and a deployment time that was cut in half compared a similar network using Ethernet. + +### Cost effective ** + +** + +Although there are many benefits to POL, adoption has been light. The biggest impediment to its adoption is a general lack of awareness and a misunderstanding of cost. The actual cost of fiber cabling is higher than copper, but I’ve talked to many companies that have looked at fully loaded costs and often optical is cheaper. Optical isn’t subject to electromagnetic interference like copper is so there’s no need to lay a pipeline down first. Also, copper cabling requires distribution cabinets to boost the signal and that adds the cost of UPSes, cooling and power that fiber does not. + +North American buyers may not have the same awareness of POL as those in China, where: + + * The engineering standard of POL was released in June, outlining the system, design, cabling, testing and acceptance rules. + * An alliance was established Oct. 22 bringing together a number of companies including Nokia, Huawei, and Yangtze Optical Fiber and Cable. + + + +Both of these will help drive innovation and standardization. + +Copper has been the preferred campus backbone, but businesses are changing and so is the network. It’s not enough to just change the infrastructure but the cabling that connects everything should be looked at and POL used as a next-generation backbone. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489477/passive-optical-networking-its-day-is-dawning.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[4]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[5]: https://www.networkworld.com/article/3402316/when-to-use-5g-when-to-use-wi-fi-6.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From e92ffdab38eff3da238264053e7f404f29ce9c31 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 12 Dec 2019 08:42:46 +0800 Subject: [PATCH 060/676] translated --- ...ng started with the GNOME Linux desktop.md | 69 ------------------- ...ng started with the GNOME Linux desktop.md | 65 +++++++++++++++++ 2 files changed, 65 insertions(+), 69 deletions(-) delete mode 100644 sources/tech/20191207 Getting started with the GNOME Linux desktop.md create mode 100644 translated/tech/20191207 Getting started with the GNOME Linux desktop.md diff --git a/sources/tech/20191207 Getting started with the GNOME Linux desktop.md b/sources/tech/20191207 Getting started with the GNOME Linux desktop.md deleted file mode 100644 index 128dd70de6..0000000000 --- a/sources/tech/20191207 Getting started with the GNOME Linux desktop.md +++ /dev/null @@ -1,69 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with the GNOME Linux desktop) -[#]: via: (https://opensource.com/article/19/12/gnome-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Getting started with the GNOME Linux desktop -====== -This article is part of a special series of 24 days of Linux desktops. -GNOME, the default desktop on most modern Linux distributions, is clean, -simple, and well-organized. -![Gnomes in a window.][1] - -The [GNOME][2] project is the Linux desktop's darling, and deservedly so. It began as the free and open desktop alternative to proprietary options (including KDE at the time), and it's been going strong ever since. GNOME took GTK+, [developed by the GIMP project][3], and ran with it, developing it into a robust, all-purpose GTK framework. The project has pioneered the user interface, challenging preconceptions of what a desktop "should" look like and offering users new paradigms and options. - -GNOME is widely available as the default desktop on most of the major modern Linux distributions, including RHEL, Fedora, Debian, and Ubuntu. If your distribution doesn't offer a version of it, you can probably install GNOME from your software repository. Before you do, though, be aware that it is meant to provide a full desktop experience, so many GNOME apps are installed along with the desktop. If you're already running a different desktop, you may find yourself with redundant applications (two PDF readers, two media players, two file managers, and so on). If you just want to try the GNOME desktop, consider installing a GNOME distribution in a virtual machine, such as [GNOME Boxes][4]. - -### GNOME features - -The GNOME desktop is clean, with a simple taskbar along the top and the bare minimum of items in a system tray in the right corner. There are no desktop icons on GNOME, and that's by design. If you're one of those users who stores _everything_ on your desktop, you probably recognize that your desktop gets badly disorganized on a regular basis, and—worse still—it's permanently hidden from view because your applications are covering it up. - -GNOME solves both problems: there _is_ no desktop (functionally), and new virtual workspaces are generated dynamically, so you can run your applications in full-screen mode. It can take some getting used to if you usually clutter up your screen, but in practice, it's an improved workflow in every sense. You learn to keep your assets organized (or you leave them scattered in your home directory), and you can switch between screens just as quickly as you do on your mobile phone. - -Of course, not all applications are designed to run in full-screen mode, so if you prefer to click through windows, you can do that, too. - -![GNOME running on Debian][5] - -The GNOME philosophy extols canonical solutions to common tasks. You don't often find eight different ways to accomplish the same thing in GNOME. You find one or two official ways to accomplish a task, and once you've learned those ways, that's all you have to remember. It's refreshingly simple, but because it's running on Linux, it's also technically flexible (after all, you don't have to use GNOME applications just because you're running a GNOME desktop). - -### Application menu - -To access the application menu, called **Activities**, click in the upper-left corner of the desktop. This menu takes over your entire screen to reveal a dock along the left edge of the screen with common applications and an icon to browse your apps in a grid. You can launch applications by browsing through what you have installed or by typing the first few letters of the software name to bring up a filtered list of what's available. - -![GNOME activities][6] - -### GNOME applications - -GNOME isn't just a desktop. It's a desktop plus a rich set of integrated applications, like the Gedit text editor, Evince PDF viewer, a web browser, an image viewer, the Nautilus file manager, and more. GNOME applications, like the desktop itself, follow the [GNOME Human Interface Guidelines][7], so the user experience is both pleasant and consistent. Whether or not you use the GNOME desktop, you probably use a GTK application, and you may well use a GNOME application. - -### GNOME 3 and beyond - -The GNOME project is going strong, and it's left several exciting projects (like MATE and [Cinnamon][8]) in its wake. It's popular, it's comfortable, and it's the face of the Linux desktop. - -Exploring different desktops is a good thing. I’ve recently converted to GNOME 3 ("hallowed be its... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/gnome-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/custom_gnomes.png?itok=iG98iL8d (Gnomes in a window.) -[2]: https://www.gnome.org/ -[3]: https://www.gtk.org/overview.php -[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization -[5]: https://opensource.com/sites/default/files/uploads/advent-gnome.jpg (GNOME running on Debian) -[6]: https://opensource.com/sites/default/files/uploads/advent-gnome-activities.jpg (GNOME activities) -[7]: https://developer.gnome.org/hig/stable/ -[8]: https://opensource.com/article/19/11/advent-2019-cinnamon diff --git a/translated/tech/20191207 Getting started with the GNOME Linux desktop.md b/translated/tech/20191207 Getting started with the GNOME Linux desktop.md new file mode 100644 index 0000000000..d8c80a5d45 --- /dev/null +++ b/translated/tech/20191207 Getting started with the GNOME Linux desktop.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with the GNOME Linux desktop) +[#]: via: (https://opensource.com/article/19/12/gnome-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +GNOME Linux 桌面入门 +====== +本文是 24 天 Linux 桌面特别系列的一部分。GNOME 是大多数现代 Linux 发行版的默认桌面,它干净、简单、组织良好。 +![Gnomes in a window.][1] + +[GNOME][2] 项目理所应当是 Linux 桌面的宠儿。它起初是专有桌面(当时包括 KDE)的免费开源桌面替代品,此后一直发展强劲。GNOME 采用了[由 GIMP 项目开发][3]的 GTK+,并将其开发为强大的通用 GTK 框架。该项目开创了用户界面的先驱,挑战了桌面“应有”外观的先入之见,并为用户提供了新的范例和选项。 + +在大多数主流现代 Linux 发行版(包括RHEL、Fedora、Debian 和 Ubuntu)中,GNOME 作为默认桌面广泛使用。如果你的发行版不提供它的版本,那么你可以从软件仓库中安装 GNOME。但是,在执行此操作之前,请注意,为了提供完整的桌面体验,这会随桌面一起安装许多 GNOME 应用。如果你在用其他桌面,那么你可能会发现有冗余的应用(两个 PDF 阅读器、两个媒体播放器、两个文件管理器,等等)。如果你只想尝试 GNOME 桌面,请考虑在虚拟机,如[GNOME Boxes][4],中安装 GNOME 发行版。 + +### GNOME 功能 + +GNOME 桌面很干净,顶部有一个简单的任务栏,右上角的系统托盘中只有很少的项。GNOME 上没有桌面图标,这是设计使然。如果你是在桌面上保存_任何东西_的用户之一,那么你可能会意识到桌面会定期地变得混乱,而且,更糟糕的是,由于你的应用掩盖了桌面,因此桌面永远不会显示出来。 + +GNOME 解决了两个问题:(在功能上)没有桌面,并且动态生成新的虚拟工作区,因此你可以在全屏模式下运行应用。如果你常把屏幕弄乱,那么可能需要一些时间来习惯,但实际上,从各个方面来说,这都是一种改进的工作流程。你将学习如何使文件井井有条(或者将它们分散在家目录中),并且可以像在手机上一样快速地在屏幕之间切换。 + +当然,并非所有应用都设计为在全屏模式下运行,因此,如果你更喜欢单击窗口,也可以这样做。 + +![GNOME running on Debian][5] + +GNOME 哲学褒扬了 Canonical 对常见任务的解决方案。在 GNOME 中,你通常不会发现有八种不同的方法来做同一件事。你找到一种或两种官方方法来完成一项任务,你了解了这些方法后,便只需记住这些即​​可。它非常简单,但由于它在 Linux 上运行,因此在技术上也很灵活(毕竟,你不必因为运行 GNOME 桌面而要使用 GNOME 应用)。 + +### 应用菜单 + +要访问名为“活动”的应用菜单,请在桌面的左上角单击。此菜单将占满整个屏幕,屏幕最左侧有一栏常见应用的 dock,并且有一个可以在网格中浏览应用的图标。你可以浏览已安装的应用,或输入软件的头几个字母来过滤列表,之后启动应用。 + +![GNOME activities][6] + +### GNOME 应用 + +GNOME 不仅是桌面。它是一个桌面以及一组丰富的集成应用,例如 Gedit 文本编辑器、Evince PDF 查看器、Web 浏览器、图像查看器、Nautilus 文件管理器等等。GNOME 应用(例如桌面本身)遵循 [GNOME 人机界面指南][7],因此用户体验既愉悦又一致。无论你是否使用 GNOME 桌面,都可能使用 GTK 应用,也可能会使用 GNOME 应用。 + +### GNOME 3 及更高版本 + +GNOME 项目进展顺利,还有几个令人兴奋的项目(例如 MATE 和 [Cinnamon][8])。它流行、令人舒适,并且是 Linux 桌面的外观。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/gnome-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/custom_gnomes.png?itok=iG98iL8d (Gnomes in a window.) +[2]: https://www.gnome.org/ +[3]: https://www.gtk.org/overview.php +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://opensource.com/sites/default/files/uploads/advent-gnome.jpg (GNOME running on Debian) +[6]: https://opensource.com/sites/default/files/uploads/advent-gnome-activities.jpg (GNOME activities) +[7]: https://developer.gnome.org/hig/stable/ +[8]: https://opensource.com/article/19/11/advent-2019-cinnamon From f72c4922761066f2f7696d21500b9c335d5dedbe Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 12 Dec 2019 08:53:42 +0800 Subject: [PATCH 061/676] translating --- ...0 Breaking Linux files into pieces with the split command.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191210 Breaking Linux files into pieces with the split command.md b/sources/tech/20191210 Breaking Linux files into pieces with the split command.md index 710a6c3e35..acbcea7f2b 100644 --- a/sources/tech/20191210 Breaking Linux files into pieces with the split command.md +++ b/sources/tech/20191210 Breaking Linux files into pieces with the split command.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a91975363ff89cae77bea4f30f7cee9c09885db4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 12 Dec 2019 12:43:53 +0800 Subject: [PATCH 062/676] PUB @lxbwolf https://linux.cn/article-11666-1.html --- ...remove duplicate lines from files with awk.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename {translated/tech => published}/20191028 How to remove duplicate lines from files with awk.md (90%) diff --git a/translated/tech/20191028 How to remove duplicate lines from files with awk.md b/published/20191028 How to remove duplicate lines from files with awk.md similarity index 90% rename from translated/tech/20191028 How to remove duplicate lines from files with awk.md rename to published/20191028 How to remove duplicate lines from files with awk.md index 58d535bc13..8a5148e708 100644 --- a/translated/tech/20191028 How to remove duplicate lines from files with awk.md +++ b/published/20191028 How to remove duplicate lines from files with awk.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11666-1.html) [#]: subject: (How to remove duplicate lines from files with awk) [#]: via: (https://opensource.com/article/19/10/remove-duplicate-lines-files-awk) [#]: author: (Lazarus Lazaridis https://opensource.com/users/iridakos) @@ -12,7 +12,7 @@ > 学习怎样使用 awk 的 `!visited[$0]++` 在不重新排序或改变原排列顺序的前提下删掉重复的行。 -![Coding on a computer][1] +![](https://img.linux.net.cn/data/attachment/album/201912/12/124322vwe3tq3wlw33tw1f.jpg) 假设你有一个文本文件,你需要删掉所有重复的行。 @@ -26,7 +26,7 @@ awk '!visited[$0]++' your_file > deduplicated_file ### 工作原理 -这个脚本维持一个关联数组,索引为文件中去重后的行,每个索引对应的值为该行出现的次数。对于文件的每一行,如果这行出现的次数为 0,则值加 1,并打印这行,否则值加 1,不打印这行。 +这个脚本维护一个关联数组,索引(键)为文件中去重后的行,每个索引对应的值为该行出现的次数。对于文件的每一行,如果这行(之前)出现的次数为 0,则值加 1,并打印这行,否则值加 1,不打印这行。 我之前不熟悉 `awk`,我想弄清楚这么短小的一个脚本是怎么实现的。我调研了下,下面是调研心得: @@ -35,12 +35,12 @@ awk '!visited[$0]++' your_file > deduplicated_file * `$0` 变量的值是当前正在被处理的行的内容。 * `visited[$0]` 通过与 `$0`(正在被处理的行)相等的键来访问该映射中的值,即出现次数(我们在下面设置的)。 * `!` 对表示出现次数的值取反: - * 在 `awk` 中,[任意非零的数或任意非空的字符串的值是 true][4]。 + * 在 `awk` 中,[任意非零的数或任意非空的字符串的值是 `true`][4]。 * [变量默认的初始值为空字符串][5],如果被转换为数字,则为 0。 * 也就是说: * 如果 `visited[$0]` 的值是一个比 0 大的数,取反后被解析成 `false`。 * 如果 `visited[$0]` 的值为等于 0 的数字或空字符串,取反后被解析成 `true` 。 - * `++` 表示变量(`visited[$0]`)的值加 1。 + * `++` 表示变量 `visited[$0]` 的值加 1。 * 如果该值为空,`awk` 自动把它转换为 `0`(数字) 后加 1。 * 注意:加 1 操作是在我们取到了变量的值之后执行的。 @@ -49,13 +49,13 @@ awk '!visited[$0]++' your_file > deduplicated_file * `true`:如果表示出现次数为 0 或空字符串 * `false`:如果出现的次数大于 0 -`awk` 由 [模式或表达式和一个与之关联的动作][6] 组成 +`awk` 由 [模式或表达式和一个与之关联的动作][6] 组成: ``` <模式/表达式> { <动作> } ``` -如果匹配到了模式,就会执行后面的动作。如果没有动作,`awk` 默认会打印(`print`)输入。 +如果匹配到了模式,就会执行后面的动作。如果省略动作,`awk` 默认会打印(`print`)输入。 > 省略动作等价于 `{print $0}`。 From 15cdf7d94490da0a589c7bdeda4b204b822ce682 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 12 Dec 2019 13:07:05 +0800 Subject: [PATCH 063/676] PUB @hanwckf https://linux.cn/article-11667-1.html --- .../20191114 Debugging Software Deployments with strace.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191114 Debugging Software Deployments with strace.md (99%) diff --git a/translated/tech/20191114 Debugging Software Deployments with strace.md b/published/20191114 Debugging Software Deployments with strace.md similarity index 99% rename from translated/tech/20191114 Debugging Software Deployments with strace.md rename to published/20191114 Debugging Software Deployments with strace.md index 9fe2f9f6ca..c3557e89ef 100644 --- a/translated/tech/20191114 Debugging Software Deployments with strace.md +++ b/published/20191114 Debugging Software Deployments with strace.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (hanwckf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11667-1.html) [#]: subject: (Debugging Software Deployments with strace) [#]: via: (https://theartofmachinery.com/2019/11/14/deployment_debugging_strace.html) [#]: author: (Simon Arneaud https://theartofmachinery.com) @@ -10,6 +10,8 @@ 在软件部署中使用 strace 进行调试 ====== +![](https://img.linux.net.cn/data/attachment/album/201912/12/130413poennny2pbrgy9ot.jpg) + 我的大部分工作都涉及到部署软件系统,这意味着我需要花费很多时间来解决以下问题: * 这个软件可以在原开发者的机器上工作,但是为什么不能在我这里运行? From a6812b7af931b9025e880a1eb77d19a651082757 Mon Sep 17 00:00:00 2001 From: laingke Date: Thu, 12 Dec 2019 13:50:20 +0800 Subject: [PATCH 064/676] 20191004-open-source-name-origins translated --- .../20191004 What-s in an open source name.md | 198 ------------------ .../20191004 What-s in an open source name.md | 196 +++++++++++++++++ 2 files changed, 196 insertions(+), 198 deletions(-) delete mode 100644 sources/talk/20191004 What-s in an open source name.md create mode 100644 translated/talk/20191004 What-s in an open source name.md diff --git a/sources/talk/20191004 What-s in an open source name.md b/sources/talk/20191004 What-s in an open source name.md deleted file mode 100644 index ae5ce6ee65..0000000000 --- a/sources/talk/20191004 What-s in an open source name.md +++ /dev/null @@ -1,198 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (laingke) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What's in an open source name?) -[#]: via: (https://opensource.com/article/19/10/open-source-name-origins) -[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) - -What's in an open source name? -====== -Ever wonder where the names of your favorite open source projects or -programming languages came from? Get the origin stories behind popular -tech nomenclature from A to Z. -![A person writing.][1] - -GNOME, Java, Jupyter, Python. If your friends or family members have ever eavesdropped on your work conversations, they might think you've made a career in Renaissance folklore, coffee roasting, astronomy, or zoology. Where did the names of these open source technologies come from? We asked our writer community for input and rounded up some of our favorite tech name origin stories. - -### Ansible - -The name "Ansible" is lifted directly from science fiction. Ursula Le Guin's book _Rocannon's World_ had devices allowing instantaneous (faster than light) communication called ansibles (derived, apparently, from the word "answerable"). Ansibles became a staple of science fiction, including in Orson Scott Card's _Ender's Game_ (which later became a popular film), where the device controlled many remote space ships. This seemed to be a good model for software that controls distributed machines, so Michael DeHaan (creator and founder of Ansible) borrowed the name. - -### Apache - -[Apache][2] is an open source web server that was originally released in 1995. Its name is not related to the famous Native American tribe; it instead refers to the repeated patches to its original software code. Hence, "A-patchy server." - -### awk - -"awk(1) Stands for Aho, Weinberger, Kernighan (authors)" —Michael Greenberg - -### Bash - -"The original Unix shell, the Bourne shell, was named after its creator. At the time Bash was being developed, csh (pronounced 'seashell') was actually more popular for interactive user logins. The Bash project aimed to give new life to the Bourne shell by making it more suitable for interactive use, thus it was named the 'Bourne again shell,' a pun on 'born again.'" —Ken Gaillot - -### C - -"In early days, Ken Thompson and Dennis Ritchie at AT&T found it interesting that you could use a higher-level programming language (instead of low-level and less-portable assembly programming) to write operating systems and tools. There was an early programming system called BCPL (Basic Combined Programming Language), and Thompson created a stripped-down version of BCPL called B. But B wasn't very flexible or fast. Ritchie then took the ideas of B and expanded it into a compiled language called C." —Jim Hall - -### dd - -"I don't think you can publish such an article without mentioning dd. My nickname is Didi. Correctly pronounced, it sounds like 'dd.' I first learned Unix, and then Linux, in 1993 as a student. Then I went to the army, arrived to one of the very few sections in my unit that used Unix (Ultrix) (the rest were mainly VMS), and one of the people there said: 'So, you are a hacker, right? You think you know Unix? OK, so what's the reason for the name dd?' I had no idea and tried to guess: "Data duplicator?" So he said, 'I'll tell you the story of dd. dd is short for _convert and copy_ (as anyone can still see today on the manpage), but since cc was already taken by the c compiler, it was named dd.' Only years later, I heard the true story about JCL's data definition and the non-uniform, semi-joking syntax for the Unix dd command somewhat being based on it." —Yedidyah Bar David - -### Emacs - -The classic anti-vi editor, the true etymology of the name is unremarkable, in that it derives from "Editing MACroS." Being an object of great religious opprobrium and worship it has, however, attracted many spoof bacronyms such as "Escape Meta Alt Control Shift" (to spoof its heavy reliance on keystrokes), "Eight Megabytes And Constantly Swapping" (from when that was a lot of memory), "Eventually malloc()s All Computer Storage," and "EMACS Makes A Computer Slow." —Adapted from the Jargon File/Hacker's Dictionary - -### Enarx - -[Enarx][3] is a new project in the confidential computing space. One of the project's design principles was that it should be "fungible." so an initial name was "psilocybin" (the famed magic mushroom). The general feeling was that manager types would probably be resistant, so new names were considered. The project's two founders, Mike Bursell and Nathaniel McCallum, are both ancient language geeks, so they considered lots of different ideas, including тайна (Tayna—Russian for secret or mystery—although Russian, admittedly, is not ancient, but hey), crypticon (total bastardization of Greek), cryptidion (Greek for small secret place), arcanus (Latin masculine adjective for secret), arcanum (Latin neuter adjective for secret), and ærn (Anglo-Saxon for place, secret place, closet, habitation, house, or cottage). In the end, for various reasons, including the availability of domains and GitHub project names, they settled on enarx, a combination of two Latin roots: en- (meaning within) and -arx (meaning citadel, stronghold, or fortress). - -### GIMP - -Where would we be without [GIMP][4]? The GNU Image Manipulation Project has been an open source staple for many years. [Wikipedia][5] states, "In 1995, [Spencer Kimball][6] and [Peter Mattis][7] began developing GIMP as a semester-long project at the University of California, Berkeley, for the eXperimental Computing Facility." - -### GNOME - -Have you ever wondered why GNOME is called GNOME? According to [Wikipedia][8], GNOME was originally an acronym that represented the "GNU Network Object Model Environment." Now that name no longer represents the project and has been dropped, but the name has stayed. [GNOME 3][9] is the default desktop environment for Fedora, Red Hat Enterprise, Ubuntu, Debian, SUSE Linux Enterprise, and more. - -### Java - -Can you imagine this programming language being named anything else? Java was originally called Oak, but alas, the legal team at Sun Microsystems vetoed that name due to its existing trademark. So it was back to the drawing board for the development team. [Legend has it][10] that a massive brainstorm was held by the language's working group in January 1995. Lots of other names were tossed around including Silk, DNA, WebDancer, and so on. The team did not want the new name to have anything to do with the overused terms, "web" or "net." Instead, they were searching for something more dynamic, fun, and easy to remember. Java met the requirements and miraculously, the team agreed! - -### Jupyter - -Many of today's data scientists and students use [Jupyter][11] notebooks in their work. The name Jupyter is an amalgamation of three open source computer languages that are used in the notebooks and prominent in data science: [Julia][12], [Python][13], and [R][14]. - -### Kubernetes - -Kubernetes is derived from the Greek word for helmsman. This etymology was corroborated in a [2015 Hacker News][15] response by a Kubernetes project founder, Craig McLuckie. Wanting to stick with the nautical theme, he explained that the technology drives containers, much like a helmsman or pilot drives a container ship. Thus, Kubernetes was the chosen name. Many of us are still trying to get the pronunciation right (koo-bur-NET-eez), so K8s is an acceptable substitute. Interestingly, it shares its etymology with the English word "governor," so has that in common with the mechanical negative-feedback device on steam engines. - -### KDE - -What about the K desktop? KDE originally represented the "Kool Desktop Environment." It was founded in 1996 by [Matthias Ettrich][16]. According to [Wikipedia][17], the name was a play on the words [Common Desktop Environment][18] (CDE) on Unix. - -### Linux - -[Linux][19] was named for its inventor, Linus Torvalds. Linus originally wanted to name his creation "Freax" as he thought that naming the creation after himself was too egotistical. According to [Wikipedia][19], "Ari Lemmke, Torvalds' coworker at the Helsinki University of Technology, who was one of the volunteer administrators for the FTP server at the time, did not think that 'Freax' was a good name. So, he named the project 'Linux' on the server without consulting Torvalds." - -Following are some of the most popular Linux distributions. - -#### CentOS - -[CentOS][20] is an acronym for Community Enterprise Operating System. It contains the upstream packages from Red Hat Enterprise Linux. - -#### Debian - -[Debian][21] Linux, founded in September 1993, is a portmanteau of its founder, Ian Murdock, and his then-girlfriend Debra Lynn. - -#### RHEL - -[Red Hat Linux][22] got its name from its founder Marc Ewing, who wore a red Cornell University fedora given to him by his grandfather. Red Hat was founded on March 26, 1993. [Fedora Linux][23] began as a volunteer project to provide extra software for the Red Hat distribution and got its name from Red Hat's "Shadowman" logo. - -#### Ubuntu - -[Ubuntu][24] aims to share open source widely and is named after the African philosophy of ubuntu, which can be translated as "humanity to others" or "I am what I am because of who we all are." - -### Moodle - -The open source learning platform [Moodle][25] is an acronym for "modular object-oriented dynamic learning environment." Moodle continues to be a leading platform for e-learning. There are nearly 104,000 registered Moodle sites worldwide. - -Two other popular open source content management systems are Drupal and Joomla. Drupal's name comes from the Dutch word for "druppel" which means "drop." Joomla is an [anglicized spelling][26] of the Swahili word "jumla," which means "all together" in Arabic, Urdu, and other languages, according to Wikipedia. - -### Mozilla - -[Mozilla][27] is an open source software community founded in 1998. According to its website, "The Mozilla project was created in 1998 with the release of the Netscape browser suite source code. It was intended to harness the creative power of thousands of programmers on the internet and fuel unprecedented levels of innovation in the browser market." The name was a portmanteau of [Mosaic][28] and Godzilla. - -### Nginx - -"Many tech people try to be cool and say it 'n' 'g' 'n' 'x'. Few actually did the basic actions of researching a bit more to find out very quickly that the name is actually supposed to be said as 'EngineX,' in reference to the powerful web server, like an engine." —Jean Sebastien Tougne - -### Perl - -Perl's founder Larry Wall originally named his project "Pearl." According to Wikipedia, Wall wanted to give the language a short name with positive connotations. Wall discovered the existing [PEARL][29] programming language before Perl's official release and changed the spelling of the name. - -### Piet and Mondrian - -"There are two programming language named after the artist Piet Mondrian. One is called 'Piet' and the other 'Mondrian.' [David Morgan-Mar [writes][30]]: 'Piet is a programming language in which programs look like abstract paintings. The language is named after Piet Mondrian, who pioneered the field of geometric abstract art. I would have liked to call the language Mondrian, but someone beat me to it with a rather mundane-looking scripting language. Oh well, we can't all be esoteric language writers, I suppose.'" —Yuval Lifshitz - -### Python - -The Python programming language received its unique name from its creator, Guido Van Rossum, who was a fan of the comedy group Monty Python. - -### Raspberry Pi - -Known for its tiny-but-mighty capabilities and wallet-friendly price tag, the Raspberry Pi is a favorite in the open source community. But where did its endearing (and yummy) name come from? In the '70s and '80s, it was a popular trend to name computers after fruit. Apple, Tangerine, Apricot... anyone getting hungry? According to a [2012 interview][31] with founder Eben Upton, the name "Raspberry Pi" is a nod to that trend. Raspberries are also tiny in size, yet mighty in flavor. The "Pi" in the name alludes to the fact that, originally, the computer could only run Python. - -### Samba - -[Server Message Block][32] for sharing Windows files on Linux. - -### ScummVM - -[ScummVM][33] (Script Creation Utility for Maniac Mansion Virtual Machine) is a program that makes it possible to run some classic computer adventure games on a modern computer. Originally, it was designed to play LucasArts adventure games that were built using SCUMM, which was originally used to develop Maniac Mansion before being used to develop most of LucasArts's other adventure games. Currently, ScummVM supports a large number of game engines, including Sierra Online's AGI and SCI, but still retains the name ScummVM. A related project, [ResidualVM][34], got its name because it covers the "residual" LucasArts adventure games not covered by ScummVM. The LucasArts games covered by ResidualVM were developed using GrimE (Grim Engine), which was first used to develop Grim Fandango, so the ResidualVM name is a double pun. - -### SQL - -"You may know [SQL] stands for Structured Query Language, but do you know why it's often pronounced 'sequel'? It was created as a follow-up (i.e. sequel) to the original 'QUEL' (QUEry Language)." —Ken Gaillot - -### XFCE - -[XFCE][35] is a popular desktop founded by [Olivier Fourdan][36]. It began as an alternative to CDE in 1996 and its name was originally an acronym for XForms Common Environment. - -### Zsh - -Zsh is an interactive login shell. In 1990, the first version of the shell was written by Princeton student Paul Falstad. He named it after seeing the login ID of Zhong Sha (zsh), then a teaching assistant at Princeton, and thought that it sounded like a [good name for a shell][37]. - -There are many more projects and names that we have not included in this list. Be sure to share your favorites in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/open-source-name-origins - -作者:[Joshua Allen Holm][a] -选题:[lujun9972][b] -译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/holmja -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_resume_rh1x.png?itok=S3HGxi6E (A person writing.) -[2]: https://httpd.apache.org/ -[3]: https://enarx.io -[4]: https://www.gimp.org/ -[5]: https://en.wikipedia.org/wiki/GIMP -[6]: https://en.wikipedia.org/wiki/Spencer_Kimball_(computer_programmer) -[7]: https://en.wikipedia.org/wiki/Peter_Mattis -[8]: https://en.wikipedia.org/wiki/GNOME -[9]: https://www.gnome.org/gnome-3/ -[10]: https://www.javaworld.com/article/2077265/so-why-did-they-decide-to-call-it-java-.html -[11]: https://jupyter.org/ -[12]: https://julialang.org/ -[13]: https://www.python.org/ -[14]: https://www.r-project.org/ -[15]: https://news.ycombinator.com/item?id=9653797 -[16]: https://en.wikipedia.org/wiki/Matthias_Ettrich -[17]: https://en.wikipedia.org/wiki/KDE -[18]: https://sourceforge.net/projects/cdesktopenv/ -[19]: https://en.wikipedia.org/wiki/Linux -[20]: https://www.centos.org/ -[21]: https://www.debian.org/ -[22]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[23]: https://getfedora.org/ -[24]: https://ubuntu.com/about -[25]: https://moodle.org/ -[26]: https://en.wikipedia.org/wiki/Joomla#Historical_background -[27]: https://www.mozilla.org/en-US/ -[28]: https://en.wikipedia.org/wiki/Mosaic_(web_browser) -[29]: https://en.wikipedia.org/wiki/PEARL_(programming_language) -[30]: http://www.dangermouse.net/esoteric/piet.html -[31]: https://www.techspot.com/article/531-eben-upton-interview/ -[32]: https://www.samba.org/ -[33]: https://www.scummvm.org/ -[34]: https://www.residualvm.org/ -[35]: https://www.xfce.org/ -[36]: https://en.wikipedia.org/wiki/Olivier_Fourdan -[37]: http://www.zsh.org/mla/users/2005/msg00951.html diff --git a/translated/talk/20191004 What-s in an open source name.md b/translated/talk/20191004 What-s in an open source name.md new file mode 100644 index 0000000000..50e24c9ae8 --- /dev/null +++ b/translated/talk/20191004 What-s in an open source name.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's in an open source name?) +[#]: via: (https://opensource.com/article/19/10/open-source-name-origins) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +开源名称中有什么? +====== +有没有想过您喜欢的开源项目或编程语言的名称来自何处?了解从 A 到 Z 的流行技术术语背后的起源故事。 +![A person writing.][1] + +GNOME、Java、Jupyter、Python。如果你的朋友或家人曾留意过你的工作对话,他们可能会认为您从事文艺复兴时期的民间文学艺术、咖啡烘焙、天文学或动物学工作。这些开源技术的名称从何而来?我们要求作者社区提供意见,并汇总了一些我们最喜欢的技术名称起源故事。 + +### Ansible + +“Ansible”这个名称直接来自科幻小说。厄休拉·勒古恩(Ursula Le Guin)的《鲁康农的世界》(_Rocannon's World_)一书中能进行即时(比光速更快)通信的设备允许被称为 ansibles(显然来自“ answerable”一词)。Ansibles 成为科幻小说的主要内容,包括在奥森·斯科特·卡德(Orson Scott Card)的《安德的游戏》(_Ender's Game_)(后来成为受欢迎的电影)中,该设备控制了许多远程太空飞船。对于控制分布式机器的软件来说,这似乎是一个很好的模型,因此 Michael DeHaan(Ansible 的创建者和创始人)借用了这个名称。 + +### Apache + +[Apache][2] 是最初于 1995 年发布的开源 Web 服务器。它的名称与著名的美国原住民部落无关;相反,它是指对原始软件代码重复的补丁。因此称之为,“一个修补A-patchy服务器”。 + +### awk + +“awk(1) 代表着 Aho, Weinberger, Kernighan(作者)”—— Michael Greenberg + +### Bash + +“最初的 Unix shell,即 Bourne shell,是以其创建者的名字命名的。在开发 Bash 时,csh(发音为‘seashell’)实际上更受交互登录用户的欢迎。Bash 项目旨在赋予 Bourne shell 新的生命,使其更适合于交互式使用,因此它被命名为‘Bourne again shell’,是‘重生’的双关语。’”——Ken Gaillot + +### C + +在早期,AT&T 的 Ken Thompson 和 Dennis Ritchie 发现可以使用更高级的编程语言(而不是低级的、可移植性更低的汇编编程)来编写操作系统和工具是很有趣的。早期有一个叫做 BCPL(Basic Combined programming Language,基本组合编程语言)的编程系统,汤普森创建了一个名为 B 的简化版 BCPL,但 B 的灵活性和速度都不高。然后,里奇把 B 的思想扩展成一种叫做 C 的编译语言。”——Jim Hall + +### dd + +“我想你发表这样一篇文章不能不提到 dd。我的外号叫 Didi。正确发音,它听起来像‘dd’。我第一次学的是 Unix,然后是 Linux,那是在 1993 年,当时我还是个学生。然后我去了军队,来到了我的部队中少数几个使用 Unix(Ultrix)的部门之一(其它部门主要是 VMS),那里的一个人说:‘这么说,你是一个黑客,对吗?你以为你了解 Unix 吗?好的,那么 dd 这个名字的原因是什么呢?’我不知道,试着猜:‘数据复印机?’所以他说,‘我要告诉你 dd 的故事。dd 是 _convert 和 copy_ 的缩写(任何人仍然可以在今天从参考页中看到),但由于 cc 这个缩写已经被 C 的编译器占用,它被命名为 dd。’只有几年后,我听闻了关于 JCL 的数据定义和非统一、半开玩笑的 Unix dd 命令语法的纪实中的一部分都是基于这个说法的。”——Yedidyah Bar David + +### Emacs + +经典的反 vianti-vi 编辑器,其名称的真正词源并不明显,因为它源自“Editing MACroS”。但是,它作为一个伟大的宗教亵渎和崇拜的对象,吸引了许多恶作剧般的缩写,例如“避开 Meta Alt Control Shift 键Escape Meta Alt Control Shift”(以调侃其对键盘的大量依赖),“8MB 并经常交换Eight Megabytes And Constantly Swapping”(从那时起就有很多内存了),“最终分配了所有的计算机存储Eventually malloc()s All Computer Storage”和 “EMACS 使一台计算机慢EMACS Makes A Computer Slow”——改编术语文件/黑客的字典 + +### Enarx + +[Enarx][3] 是机密计算领域的一个新项目。该项目的设计原则之一是它应该是“可替代的”。因此最初的名字是“psilocybin”(著名的魔术蘑菇)。一般情况下,经理级别的人可能会对这个名称有所抵触,因此考虑使用新名称。该项目的两位创始人 Mike Bursell 和 Nathaniel McCallum 都是老一辈的极客,因此他们考虑了许多不同的想法,包括 тайна(Tayna——俄语中代表秘密或神秘——虽然公认的俄语并不是一门古老的语言,但你就不要在乎这些细节了),crypticon(希腊语的意思是完全庶生的),cryptidion(希腊中表示小密室),arconus(拉丁语中表示秘密的褒义形容词),arcanum(拉丁语中表示秘密的中性形容词)和 ærn(盎格鲁撒克逊人表示地方,秘密的地方,壁橱,住所,房子,或小屋的词汇)。最后,由于各种原因,包括域名和 GitHub 项目名称的可用性,他们选择了 enarx,这是两个拉丁词根的组合:en-(表示内部)和 -arx(表示城堡,要塞或堡垒)。 + +### GIMP + +没有 [GIMP][4] 我们会怎么样?GNU 图像处理项目多年来一直是开源的主要内容。[维基百科][5]指出,“1995 年,[Spencer Kimball][6] 和 [Peter Mattis][7] 开始开发 GIMP,作为加州大学伯克利分校的一个为期一个学期的实验计算设施项目。” + +### GNOME + +你有没有想过为什么 GNOME 被称为 GNOME?根据[维基百科][8],GNOME 最初是一个表示“GNU 网络对象模型环境”的缩写词。现在,该名称不再表示项目,并已被删除,但该名称仍然保留。[GNOME 3][9] 是 Fedora、红帽企业版、Ubuntu、Debian、SUSE Linux 企业版等发行版的默认桌面环境。 + +### Java + +您能想象这种编程语言还有其它名称吗?Java 最初被称为 Oak,但是遗憾的是,Sun Microsystems 的法律团队因其现有商标而否决了该名称。所以开发团队又重新给它命名。[据说][10]该语言的工作组在 1995 年 1 月举行了一次大规模的头脑风暴。许多其它名称也被扔掉了,包括 Silk、DNA、WebDancer 等。该团队不希望新名称与过度使用的术语“web”或“net.”有任何关系。取而代之的是,他们在寻找更有活力、更有趣、更容易记住的东西。Java 满足了这些要求,并且奇迹般地,团队同意通过了! + +### Jupyter + +现在许多数据科学家和学生在工作中使用 [Jupyter][11] 笔记本。“Jupyter”这个名字是三种开源计算机语言的融合,这三种语言在笔记本中都有使用,在数据科学中也很突出:[Julia][12]、[Python][13] 和 [R][14]。 + +### Kubernetes + +Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuckie 在 [2015 Hacker News][15] 回应中证实了这种词源。为了坚持航海主题,他解释说,这项技术驱动集装箱,就像舵手或飞行员驱动集装箱船一样。因此,选择了 Kubernetes 这个名字。我们中的许多人仍然在尝试正确的发音(koo-bur-NET-eez),因此 K8s 是可以接受的替代发音。有趣的是,它与英语单词“ governor”具有相同的词源,也与蒸汽机上的机械负反馈装置相同。 + +### KDE + +那 K desktop 呢? KDE 最初代表“ Kool 桌面环境”。 它由 [Matthias Ettrich][16] 于 1996 年创立。根据[维基百科][17]上的说法,该名称是 Unix 上 [Common Desktop Environment][18](CDE)一词的调侃。 + +### Linux + +[Linux][19] 因其发明者 Linus Torvalds 的名字命名的。Linus 最初想将他的作品命名为“Freax”,因为他认为以他自己的名字命名太自负了。根据[维基百科][19]的说法,“赫尔辛基科技大学 Torvalds 的同事 Ari Lemmke 当时是 FTP 服务器的志愿管理员之一,他并不认为‘Freax’是个好名字。 因此,他在没有咨询 Torvalds 的情况下,将服务器上的这个项目命名为‘Linux’。” + +以下是一些最受欢迎的Linux发行版。 + +#### CentOS + +[CentOS][20] 是社区企业操作系统Community Enterprise Operating System的缩写。它包含 Red Hat Enterprise Linux 的上游软件包。 + +#### Debian + +[Debian][21] Linux 创建于 1993 年 9 月,是其创始人 Ian Murdock 和他当时的女友 Debra Lynn 的混成词。 + +#### RHEL + +[Red Hat Linux][22] 的名字来自它的创始人马克·尤因(Marc Ewing),他戴着一顶祖父送给他的康奈尔大学红色软呢帽。红帽公司成立于 1993 年 3 月 26 日。[Fedora Linux][23] 作为一个志愿者项目而启动,旨在为红帽发行版提供额外的软件,它的名字来自红帽的“Shadowman”标识。 + +#### Ubuntu + +[Ubuntu][24] 旨在广泛分享开源软件,它以非洲哲学“人的本质”命名,可以翻译为“对他人的人道主义”或“我之所以是我,是因为我们都是这样的人”。 + +### Moodle + +开源学习平台 [Moodle][25] 是“模块化面向对象动态学习环境modular object-oriented dynamic learning environment”的首字母缩写。Moodle 仍然是电子学习的领先平台。全球有近 10.4 万个注册的 Moodle 网站。 + +另外两个流行的开源内容管理系统是 Drupal 和 Joomla。Drupal 的名字来自荷兰语,意思是“放弃”。根据维基百科,Joomla 是斯瓦希里语单词“jumla”的[英式拼写][26],在阿拉伯语、乌尔都语和其他语言中是“一起”的意思。 + +### Mozilla + +[Mozilla][27] 是一个成立于 1998 年的开源软件社区。根据其网站,“Mozilla 项目创建于 1998 年,发布了 Netscape 浏览器套件源代码。它旨在利用互联网上成千上万的程序员的创造力,并推动浏览器市场上前所未有的创新水平。” 这个名字是 [Mosaic] [28] 和 Godzilla 的混成词。 + +### Nginx + +“许多技术人员都试图装酷,并将它念成‘n’‘g’‘n’‘x’。实际上,很少的一部分人只做了一些基本的研究工作,就可以很快发现名称实际上应该被说成是“ EngineX”,指的是功能强大的 web 服务器,例如引擎。”——Jean Sebastien Tougne + +### Perl + +Perl 的创始人 Larry Wall 最初将他的项目命名为“Pearl”。根据维基百科,Wall 想给这种语言起一个有积极含义的简短名字。在 Perl 正式发布之前,Wall 发现了现有的 [PEARL][29] 编程语言,并更改了名称的拼写。 + +### Piet and Mondrian + +“有两种编程语言以艺术家 Piet Mondrian 命名。一种叫做‘Piet’,另一种叫做‘Mondrian’。[David Morgan-Mar [写道][30]]:“Piet 是一种编程语言,其中的程序看起来像抽象绘画。该语言以几何抽象艺术的开创者 Piet Mondrian 的名字命名。我曾想将这种语言命名为 Mondrian,但是有人告诉我这会让它看起来像一种很普通的脚本语言。哦,好吧,我想我们不能都是深奥的语言作家。”——Yuval Lifshitz + +### Python + +Python编程语言的独特名称来自其创建者 Guido Van Rossum,他是喜剧团体 Monty Python 的粉丝。 + +### Raspberry Pi + +Raspberry Pi 以其微小但强大的功能和对钱包友好的价格标签而闻名,在开源社区中是最受欢迎的。但是它可爱(和好吃)的名字是从哪里来的呢?在 70 年代和 80 年代,以水果命名的计算机是一种流行的趋势。苹果,橘子,杏……有人饿了吗?根据创始人 Eben Upton 的 [2012 采访] [31],“Raspberry Pi”这个名称是对这种趋势的致敬。树莓也很小,但味道却很浓。名称中的“Pi”暗示着这样的事实:最初,计算机只能运行 Python。 + +### Samba + +[Server Message Block][32] 用于在 Linux 上共享 Windows 文件。 + +### ScummVM + +[ScummVM][33](《疯狂大楼》虚拟机的脚本创建实用程序)是一个程序,可以在现代计算机上运行一些经典的计算机冒险游戏。最初,它旨在玩用 SCUMM 构建的 LucasArts 冒险游戏,该游戏最初用于开发《疯狂大楼》,后来又被用来开发 LucasArts 的其它大多数冒险游戏。目前,ScummVM 支持大量游戏引擎,包括 Sierra Online 的 AGI 和 SCI,但仍保留名称 ScummVM。一个相关的项目 [ResidualVM][34] 之所以得名,是因为它涵盖了 ScummVM 未涵盖的“剩余” LucasArts 冒险游戏。 ResidualVM 涵盖的 LucasArts 游戏是使用 GrimE(Grim Engine)开发的,该引擎最初用于开发 Grim Fandango,因此 ResidualVM 的名称是双关语。 + +### SQL + +“你可能知道 [SQL] 代表结构化查询语言,但你知道为什么它经常被读作‘sequel’吗?”它是作为‘QUEL’(查询语言)的后续(即续集)而创建的。”——Ken Gaillot + +### XFCE + +[XFCE][35] 是由 [Olivier Fourdan][36] 创建的一个流行的桌面。它在 1996 年作为 CDE 的替代品出现,最初是 XForms 公共环境XForms Common Environment的缩写。 + +### Zsh + +Zsh 是一个交互式登录 shell。1990 年,普林斯顿大学的学生 Paul Falstad 写了 shell 的第一个版本。他在看到当时在普林斯顿大学担任助教的 Zhong Sha(zsh)的登录 ID 后,给它起了个名字,他觉得这个名字听起来像 [shell 的好名字][37]。 + +还有更多的项目和名称还没有包括在这个列表中。请一定要在评论中分享你的收藏。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/open-source-name-origins + +作者:[Joshua Allen Holm][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_resume_rh1x.png?itok=S3HGxi6E (A person writing.) +[2]: https://httpd.apache.org/ +[3]: https://enarx.io +[4]: https://www.gimp.org/ +[5]: https://en.wikipedia.org/wiki/GIMP +[6]: https://en.wikipedia.org/wiki/Spencer_Kimball_(computer_programmer) +[7]: https://en.wikipedia.org/wiki/Peter_Mattis +[8]: https://en.wikipedia.org/wiki/GNOME +[9]: https://www.gnome.org/gnome-3/ +[10]: https://www.javaworld.com/article/2077265/so-why-did-they-decide-to-call-it-java-.html +[11]: https://jupyter.org/ +[12]: https://julialang.org/ +[13]: https://www.python.org/ +[14]: https://www.r-project.org/ +[15]: https://news.ycombinator.com/item?id=9653797 +[16]: https://en.wikipedia.org/wiki/Matthias_Ettrich +[17]: https://en.wikipedia.org/wiki/KDE +[18]: https://sourceforge.net/projects/cdesktopenv/ +[19]: https://en.wikipedia.org/wiki/Linux +[20]: https://www.centos.org/ +[21]: https://www.debian.org/ +[22]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[23]: https://getfedora.org/ +[24]: https://ubuntu.com/about +[25]: https://moodle.org/ +[26]: https://en.wikipedia.org/wiki/Joomla#Historical_background +[27]: https://www.mozilla.org/en-US/ +[28]: https://en.wikipedia.org/wiki/Mosaic_(web_browser) +[29]: https://en.wikipedia.org/wiki/PEARL_(programming_language) +[30]: http://www.dangermouse.net/esoteric/piet.html +[31]: https://www.techspot.com/article/531-eben-upton-interview/ +[32]: https://www.samba.org/ +[33]: https://www.scummvm.org/ +[34]: https://www.residualvm.org/ +[35]: https://www.xfce.org/ +[36]: https://en.wikipedia.org/wiki/Olivier_Fourdan +[37]: http://www.zsh.org/mla/users/2005/msg00951.html From 8af9a8cb7baa43292435435c1ac1873a2ed09177 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 12 Dec 2019 17:45:04 +0800 Subject: [PATCH 065/676] APL --- ...90725 24 sysadmin job interview questions you should know.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190725 24 sysadmin job interview questions you should know.md b/sources/tech/20190725 24 sysadmin job interview questions you should know.md index c80bf8f86e..c9530f3a61 100644 --- a/sources/tech/20190725 24 sysadmin job interview questions you should know.md +++ b/sources/tech/20190725 24 sysadmin job interview questions you should know.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e9c2f846ef09dc3a9bbd295ad82ade113d494e1b Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Thu, 12 Dec 2019 23:20:14 +0800 Subject: [PATCH 066/676] APL: 20191211-How-to-Find-High-CPU-Consumption-Processes-in-Linux --- ...91211 How to Find High CPU Consumption Processes in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md b/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md index 1e628a04b4..465143ff79 100644 --- a/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md +++ b/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 57740609a7ee45b10dd9e3cce10478d127066274 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Fri, 13 Dec 2019 00:07:52 +0800 Subject: [PATCH 067/676] TSL: 20191211 How to Find High CPU Consumption Processes in Linux.md --- ...High CPU Consumption Processes in Linux.md | 120 +++++++----------- 1 file changed, 46 insertions(+), 74 deletions(-) diff --git a/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md b/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md index 465143ff79..cc6cf73b51 100644 --- a/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md +++ b/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md @@ -1,49 +1,23 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Find High CPU Consumption Processes in Linux) -[#]: via: (https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How to Find High CPU Consumption Processes in Linux" +[#]: via: "https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/" +[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" -How to Find High CPU Consumption Processes in Linux +Linux 中怎么找出 CPU 占用高的进程 ====== -We have already described in our previous article **[how to find high memory consumption processes in Linux][1]**. +在之前的文章中我们已经讨论过 [Linux 中怎么找出消耗内存高的进程][1] 。你可能也会遇到在 Linux 系统中找出 CPU 占用高的进程的情形。如果是这样,那么你需要列出系统中 CPU 占用高的进程的列表来确定。我认为只有两种方法能实现:使用 [top 命令][2] 和 [ps 命令][3]。出于一些理由,我更倾向于用 top 命令而不是 ps 命令。但是两个工具都能达到你要的目的,所以你可以根据需求决定使用哪个。这两个工具都被 Linux 系统管理员广泛使用。 -There are situations where you might see more CPU usage on a Linux system. +### 1) 怎样使用 top 命令找出 Linux 中 CPU 占用高的进程 -If so, you should identify a list of processes that consume more CPU on the system. - -I believe there are only two ways for you to check this. - -This can be done using the **[top command][2]** and the **[ps command][3]**. - -I’d like to go with the top command for most reasons instead of ps. - -But both will give you the same results, so you can choose the one you like. - -Both of these options are widely used by Linux administrators. - -### 1) How to Find High CPU Consumption Process in Linux Using the top Command - -The Linux top command is the best and most well known command that everyone uses to monitor Linux system performance. - -The top command provides a dynamic real-time view of the running process on a Linux system. - -It display system summary information, the list of processes currently being managed by the Linux kernel. - -It displays various system information such as CPU usage, Memory usage, Swap Memory, Number of running processes, system uptime, system load, Buffer Size, Cache Size, Process PID, etc. - -By default, it sorts the top output with the CPU usage and updates the top command data every 5 seconds. - -If you want to see a clear view of the top command output for further analysis, this is a best way to **[run the top command in the batch mode][4]**. - -Also, you need to **[understand the top command output][5]** to fix the performance problem on the system. +在所有监控 Linux 系统性能的工具中,Linux 的 top 命令是最好的也是最知名的。top 命令提供了 Linux 系统运行中的进程的动态实时视图。它能显示系统的概览信息,和 Linux 内核当前管理的进程列表。它显示了大量的系统信息,如 CPU 使用,内存使用,交换内存,运行的进程数,目前系统开机时间,系统负载,缓冲区大小,缓存大小,进程 PID等等。默认情况下,top 命令的输出结果按 CPU 占用进行排序,每 5 秒中更新一次结果。如果你想要一个更清晰的视图来更深入的分析结果,[以批次档模式运行 top 命令][4] 是最好的方法。同时,你需要 [理解 top 命令输出结果的含义][5] ,这样才能解决系统的性能问题。 ``` -# top -c -b | head -50 +# top -b | head -50 top - 00:19:17 up 14:23, 1 user, load average: 2.46, 2.18, 1.97 Tasks: 306 total, 1 running, 305 sleeping, 0 stopped, 0 zombie @@ -71,30 +45,30 @@ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3286 daygeek 20 3089736 404088 184968 S 1.0 2.5 41:57.44 Web Content ``` -Details of the above command: +上面的命令的各部分解释: - * **top :** This is a command. - * **-b :** Batch mode. - * **head -50:** Display first 50 lines in the output. - * **PID :** Unique ID of the process. - * **USER :** Owner of the process. - * **PR :** priority of the process. - * **NI :** The NICE value of the process. - * **VIRT :** How much virtual memory used by the process. - * **RES :** How much physical memory used by the process. - * **SHR :** How much shared memory used by the process. - * **S :** This indicates the status of the process: S=sleep R=running Z=zombie. - * **%CPU :** The percentage of CPU used by the process. - * **%MEM :** The percentage of RAM used by the process. - * **TIME+ :** How long the process being running. - * **COMMAND :** Name of the process. + * **top :** 命令 + * **-b :** 批次档模式 + * **head -50:** 显示输出结果的前 50 个 + * **PID :** 进程的 ID + * **USER :** 进程的归属者 + * **PR :** 进程的等级 + * **NI :** 进程的 NICE 值 + * **VIRT :** 进程使用的虚拟内存 + * **RES :** 进程使用的物理内存 + * **SHR :** 进程使用的共享内存 + * **S :** 这个值表示进程的状态: S=睡眠 R=运行 Z=僵尸进程 + * **%CPU :** 进程占用的 CPU 比例 + * **%MEM :** 进程使用的 RAM 比例 + * **TIME+ :** 进程运行了多长时间 + * **COMMAND :** 进程名字 -If you want to see the full path of the command instead of the command name, run the following top command format. +如果你想看命令的完整路径而不是命令名字,以运行下面的格式 top 命令: ``` -# top -b | head -50 +# top -c -b | head -50 top - 00:28:49 up 14:33, 1 user, load average: 2.43, 2.49, 2.23 Tasks: 305 total, 1 running, 304 sleeping, 0 stopped, 0 zombie @@ -123,11 +97,9 @@ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2179 daygeek 20 2945348 429644 172940 S 1.0 2.6 15:20.90 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 7821 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /us+ ``` -### 2) How to Find High CPU Consumption Process in Linux Using the ps Command +### 2) 怎样使用 ps 命令找出 Linux 中 CPU 占用高的进程 -ps stands for processes status, it display the information about the active/running processes on the system. - -It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc. +ps 是 `process status`(进程状态)的缩写,它能显示系统中活跃的/运行中的进程的信息。它提供了当前进程及其详细信息,诸如用户名、用户 ID、CPU 使用率、内存使用、进程启动日期时间、命令名等等的快照。 ``` # ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%cpu | head @@ -144,22 +116,22 @@ It provides a snapshot of the current processes along with detailed information 2179 1714 2.7 1.8 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 7821 -prefMapSize 213431 -parentBuildID 20191031132559 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1714 true tab ``` -Details of the above command: +上面的命令的各部分解释: - * **ps :** This is a command. - * **-e :** Select all processes. - * **-o :** To customize a output format. - * **–sort=-%cpu :** Sort the ouput based on CPU usage. - * **head :** To display first 10 lines of the output - * **PID :** Unique ID of the process. - * **PPID :** Unique ID of the parent process. - * **%MEM :** The percentage of RAM used by the process. - * **%CPU :** The percentage of CPU used by the process. - * **Command :** Name of the process. + * **ps :** 命令名字 + * **-e :** 选择所有进程 + * **-o :** 自定义输出格式 + * **–sort=-%cpu :** 基于 CPU 使用率对输出结果排序 + * **head :** 显示结果的前 10 行 + * **PID :** 进程的 ID + * **PPID :** 父进程的 ID + * **%MEM :** 进程使用的 RAM 比例 + * **%CPU :** 进程占用的 CPU 比例 + * **Command :** 进程名字 -If you only want to see the command name instead of the absolute path of the command, use the ps command format below. +如果你只想看命令名字而不是命令的绝对路径,以运行下面的格式 ps 命令: ``` # ps -eo pid,ppid,%mem,%cpu,comm --sort=-%cpu | head @@ -182,7 +154,7 @@ via: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linu 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lxbwolf](https://github.com/lxbwolf) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7b2f4f6f623c0bd227e7cdcb4e79ec2dfecda5d7 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Fri, 13 Dec 2019 00:08:38 +0800 Subject: [PATCH 068/676] TSL: 20191211 How to Find High CPU Consumption Processes in Linux.md --- ...0191211 How to Find High CPU Consumption Processes in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191211 How to Find High CPU Consumption Processes in Linux.md (100%) diff --git a/sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md b/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md similarity index 100% rename from sources/tech/20191211 How to Find High CPU Consumption Processes in Linux.md rename to translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md From 49b7130dfc9709155ffdbbbb37d3ae459804b472 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Fri, 13 Dec 2019 00:12:12 +0800 Subject: [PATCH 069/676] TSL: 20191211 How to Find High CPU Consumption Processes in Linux --- ...nd High CPU Consumption Processes in Linux.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md b/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md index cc6cf73b51..828494d8fd 100644 --- a/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md +++ b/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md @@ -1,11 +1,11 @@ -[#]: collector: "lujun9972" -[#]: translator: "lxbwolf" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "How to Find High CPU Consumption Processes in Linux" -[#]: via: "https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/" -[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Find High CPU Consumption Processes in Linux) +[#]: via: (https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) Linux 中怎么找出 CPU 占用高的进程 ====== From e0be3a5426f9b6237df9bff3c85564e0269bb55d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 13 Dec 2019 01:04:53 +0800 Subject: [PATCH 070/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191212=20How=20?= =?UTF-8?q?to=20configure=20Openbox=20for=20your=20Linux=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191212 How to configure Openbox for your Linux desktop.md --- ...onfigure Openbox for your Linux desktop.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20191212 How to configure Openbox for your Linux desktop.md diff --git a/sources/tech/20191212 How to configure Openbox for your Linux desktop.md b/sources/tech/20191212 How to configure Openbox for your Linux desktop.md new file mode 100644 index 0000000000..c017714234 --- /dev/null +++ b/sources/tech/20191212 How to configure Openbox for your Linux desktop.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to configure Openbox for your Linux desktop) +[#]: via: (https://opensource.com/article/19/12/openbox-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to configure Openbox for your Linux desktop +====== +This article is part of a special series of 24 days of Linux desktops. +The Openbox Linux window manager is light on system resources, easy to +configure, and a pleasure to use. +![open with sky and grass][1] + +You may have used the [Openbox][2] desktop without knowing it: While Openbox is a great window manager on its own, it also serves as the window manager "engine" for desktop environments like LXDE and LXQT, and it can even manage KDE and GNOME. Aside from being the foundation for several desktops, Openbox is arguably one of the easiest window managers to configure for anyone who doesn't want to learn all the options to put into a config file. By using the **obconf** menu-based configuration application, all the common preferences can be set just as easily as in a full desktop, like GNOME or KDE. + +### Installing Openbox + +You are likely to find Openbox in the software repository of your Linux distribution, but you can also find it on [Openbox.org][3]. If you're already running a different desktop, it's safe to install Openbox on the same system, because Openbox doesn't include any bundled applications aside from a few configuration panels. + +After installing it, log out of your current desktop session so you can log into your Openbox desktop. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +To override it with GDM: + +![Select your desktop session in GDM][4] + +With SDDM: + +![Select your desktop session with KDM][5] + +### Configure the Openbox desktop + +By default, Openbox includes the **obconf** application, which you can use to choose and install themes, modify mouse behavior, set desktop preferences, and do much more. You can probably find other configuration applications, like **obmenu**, in your repository to configure other parts of your window manager. + +![Openbox Obconf configuration application][6] + +Building your own desktop experience is relatively easy. There are little components for all the usual desktop tropes, like [stalonetray][7] for a system tray, [Tint2][8] for a taskbar, or [Xfce4-panel][9] for nearly anything you can think of. String any set of applications together until you have the open source desktop of your dreams. + +![Openbox][10] + +### Why you should use Openbox + +Openbox is light on system resources, easy to configure, and a pleasure to use. It pops up in the unlikeliest of places, so it can be a good system to get familiar with. You never know when you'll be in front of a desktop that secretly uses Openbox as its window manager (and won't it be nice that you know how to customize it?). If critical mass and open source appeal to you, open up the Openbox box and get started. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/openbox-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_general_openfield.png?itok=MeVN97oy (open with sky and grass) +[2]: http://openbox.org +[3]: http://openbox.org/wiki/Openbox:Download +[4]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) +[5]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) +[6]: https://opensource.com/sites/default/files/uploads/advent-openbox-obconf_675px.jpg (Openbox Obconf configuration application) +[7]: https://sourceforge.net/projects/stalonetray/ +[8]: https://opensource.com/article/19/1/productivity-tool-tint2 +[9]: http://xfce.org +[10]: https://opensource.com/sites/default/files/uploads/advent-openbox_675px.jpg (Openbox) From 2271eb845d1b955d86c81486cd7eb7c2268f816b Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 13 Dec 2019 08:55:29 +0800 Subject: [PATCH 071/676] translated --- ...91209 Counting down the days using bash.md | 137 ------------------ ...91209 Counting down the days using bash.md | 124 ++++++++++++++++ 2 files changed, 124 insertions(+), 137 deletions(-) delete mode 100644 sources/tech/20191209 Counting down the days using bash.md create mode 100644 translated/tech/20191209 Counting down the days using bash.md diff --git a/sources/tech/20191209 Counting down the days using bash.md b/sources/tech/20191209 Counting down the days using bash.md deleted file mode 100644 index b8822a3cdc..0000000000 --- a/sources/tech/20191209 Counting down the days using bash.md +++ /dev/null @@ -1,137 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Counting down the days using bash) -[#]: via: (https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Counting down the days using bash -====== -Need to know how many days there are before some important event? Let Linux bash and the date command help with that! -Thinkstock - -With some pretty important holidays right around the corner, you might need to be reminded how much longer you have to prepare. - -Fortunately, you can get a lot of help from the **date** command. In this post, we’ll look at ways that **date** and bash scripts can tell you how many days there are between today and some event that you’re anticipating. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - -First a couple hints at how this is going to work. The **date** command’s **%j** option is going to show you today’s date as a number between 1 and 366. January 1st, as you’d expect, will be displayed as 1 and December 31st will be 365 or 366 depending on whether it’s leap year. Go ahead and try it. You should see something like this: - -[][2] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][2] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -``` -$ date +%j -339 -``` - -You can, however, get the **date** command to give you the day-of-the-year number for _any_ date by supplying it in a **date** command like this: - -``` -$ date -d "Mar 18" +%j -077 -``` - -One important thing to keep in mind is that this command will show you the date in the _current year_ even if that date is in the past. However, you can add a year to the command and fix that: - -``` -$ date -d "Apr 29" +%j -119 -$ date -d "Apr 29 2020" +%j -120 -``` - -In a leap year, Apr 29th will be the 120th day of the year, not the 119th. - -If you want to count down the days until Christmas and don’t want to end up with fingerprints on your wall calendar, you can use a script like this: - -``` -#!/bin/sh - -XMAS=`date -d "Dec 25" +%j` -TODAY=`date +%j` -DAYS=$(($XMAS - $TODAY)) - -case $DAYS in - 0) echo "It's today! Merry Christmas!";; - [0-9]*) echo "$DAYS days remaining";; - -[0-9]*) echo "Oops, you missed it";; -esac -``` - -In this script, we get the day numbers for Dec 25th and today and then subtract one from the other. If the result is positive, we display the number of days remaining. If it’s zero, we issue a “Merry Christmas” message and, if it’s negative, we just tell the person running the script that they missed the holiday. Maybe they got carried away with the egg nog. - -The case statement is made up of ready-to-print statements for remaining-day counts that equal zero, those that that include any digits and those that start with a **-** sign (i.e., in the past). - -The same idea can be generalized for any date that someone wants to keep in focus. In fact, we can ask the person running our script to supply the date and then let them know how many days remain between now and then. This version of the script does just that. - -``` -#!/bin/sh - -echo -n "Enter event date (e.g., June 6): " -read dt -EVENT=`date -d "$dt" +%j` -TODAY=`date +%j` -DAYS=`expr $EVENT - $TODAY` - -case $DAYS in - 0) echo "It's today!";; - [0-9]*) echo "$DAYS days remaining";; - -[0-9]*) echo "Oops, you missed it";; -esac -``` - -One problem you’ll have with this script is that, if the person running it is hoping to find out how many days must pass before they reach a special day the following year, they’ll be disappointed. Even if they supply a year when they enter the date, the date -d command will still only supply the day number in that year, not the days between now and then. - -Calculating the number of days between today and some date years from now can be a bit tricky. You’d need to include all the intervening years and pay attention to those that are leap years. - -### Using Unix (Epoch) time - -Another way to calculate the number of days between now and some special date is to take advantage of the way that Unix systems store dates. If you convert the number of seconds since the start of the day on Jan 1, 1970 to days, you can do this quite easily as in this script: - -``` -#!/bin/bash - -echo -n "Enter target date (e.g., Mar 18 2021)> " -read target_date -today=`echo $(($(date --utc --date "$1" +%s)/86400))` -target=`echo $(($(date --utc --date "$target_date" +%s)/86400))` -days=`expr $target - $today` -echo "$days days until $target_date" -``` - -To explain, 86400 is the number of seconds in a day. Dividing the number of seconds since the epoch began by this number gives us the number of days. - -``` -$ ./countdown -Enter target date (e.g., Mar 18 2021)> Mar 18 2020 -104 days until Mar 18 2020 -``` - -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/newsletters/signup.html -[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20191209 Counting down the days using bash.md b/translated/tech/20191209 Counting down the days using bash.md new file mode 100644 index 0000000000..83d656596b --- /dev/null +++ b/translated/tech/20191209 Counting down the days using bash.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Counting down the days using bash) +[#]: via: (https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +用 bash 倒计时 +====== +需要知道重要事件发生前有多少天吗?让 Linux bash 和 date 命令可以帮助你! + +随着即将来临的重要假期,你可能需要提醒你还要准备多久。 + +幸运的是,你可以从 **date** 命令获得很多帮助。在本篇中,我们将研究 **date** 和 bash 脚本如何告诉你从今天到你预期的事件之间有多少天。 + +首先,有几个提示如何进行。**date** 命令的 **%j** 选项将以 1 至 366 之间的数字显示当前日期。如你所想的一样,1 月 1 日将显示为 1,12 月 31 日将显示为 365 或 366,这取决于是否是闰年。继续尝试。你应该会看到以下内容: + +``` +$ date +%j +339 +``` + +但是,你可以通过以下方式,在 **date** 命令中得到一年中_任何_一天的数字: + +``` +$ date -d "Mar 18" +%j +077 +``` + +要记住的是,即使该日期是过去的日期,此命令也会向你显示_当年_的日期。但是,你可以在命令中添加年来修复该问题: + +``` +$ date -d "Apr 29" +%j +119 +$ date -d "Apr 29 2020" +%j +120 +``` + +在闰年中,4 月 29 日将是一年的 120 天,而不是 119 天。 + +如果你想倒数圣诞节之前的日子并且不想在挂历上留下指纹,你可以使用以下脚本: + +``` +#!/bin/sh + +XMAS=`date -d "Dec 25" +%j` +TODAY=`date +%j` +DAYS=$(($XMAS - $TODAY)) + +case $DAYS in + 0) echo "It's today! Merry Christmas!";; + [0-9]*) echo "$DAYS days remaining";; + -[0-9]*) echo "Oops, you missed it";; +esac +``` + +在此脚本中,我们获取 12 月 25 日和今天的日期,然后相减。如果结果是正数,我们将显示剩余天数。如果为零,则发出 “Merry Christmas” 的消息,如果为负,那么仅告诉运行脚本的人他们错过了假期。也许他们沉迷在蛋酒中了。 + +case 语句由可打印的语句组成,剩余时间等于 0,或任意数字或以 **-** 符号开头的数字(也就是过去)。 + +对于人们想要关注的任何日期,都可以使用相同方法。实际上,我们可以要求运行脚本的人员提供日期,然后让他们知道从现在到那天还有多少天。这个脚本是这样的。 + +``` +#!/bin/sh + +echo -n "Enter event date (e.g., June 6): " +read dt +EVENT=`date -d "$dt" +%j` +TODAY=`date +%j` +DAYS=`expr $EVENT - $TODAY` + +case $DAYS in + 0) echo "It's today!";; + [0-9]*) echo "$DAYS days remaining";; + -[0-9]*) echo "Oops, you missed it";; +esac +``` + +使用此脚本会遇到的一个问题,如果运行该脚本的人希望知道到第二年这个特殊日子还有多少天,他们会感到失望。即使他们输入日期时提供了年,date -d 命令仍将仅提供金年中的天数,而不会提供从现在到那时的天数。 + +计算从今天到某年的日期之间的天数可能有些棘手。你需要包括所有中间年份,并注意那些闰年。 + +### 使用 Unix(Epoch)时间 + +计算从现在到某个特殊日期之间的天数的另一种方法是利用 Unix 系统存储日期的方法。如果将自 1970 年 1 月 1 日开始的秒数转换为天数,那么就可以很容易地执行此操作,如下脚本所示: + +``` +#!/bin/bash + +echo -n "Enter target date (e.g., Mar 18 2021)> " +read target_date +today=`echo $(($(date --utc --date "$1" +%s)/86400))` +target=`echo $(($(date --utc --date "$target_date" +%s)/86400))` +days=`expr $target - $today` +echo "$days days until $target_date" +``` + +解释一下,86400 是一天中的秒数。将自纪元开始以来的秒数除该数即为天数。 + +``` +$ ./countdown +Enter target date (e.g., Mar 18 2021)> Mar 18 2020 +104 days until Mar 18 2020 +``` + +加入 [Facebook][3] 和 [LinkedIn][4] 上的 Network World 社区,评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 26fd08dfe446fe3907f0be71132eeee9b8625bbb Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 13 Dec 2019 09:06:37 +0800 Subject: [PATCH 072/676] translating --- .../tech/20191211 Annotate screenshots on Linux with Ksnip.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md b/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md index 23b2107505..1393e7ebcb 100644 --- a/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md +++ b/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b84fff53e22456fd6c30b5b880e6f03d771557da Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Dec 2019 09:38:34 +0800 Subject: [PATCH 073/676] TSL --- ...job interview questions you should know.md | 292 ------------------ ...job interview questions you should know.md | 236 ++++++++++++++ 2 files changed, 236 insertions(+), 292 deletions(-) delete mode 100644 sources/tech/20190725 24 sysadmin job interview questions you should know.md create mode 100644 translated/tech/20190725 24 sysadmin job interview questions you should know.md diff --git a/sources/tech/20190725 24 sysadmin job interview questions you should know.md b/sources/tech/20190725 24 sysadmin job interview questions you should know.md deleted file mode 100644 index c9530f3a61..0000000000 --- a/sources/tech/20190725 24 sysadmin job interview questions you should know.md +++ /dev/null @@ -1,292 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (24 sysadmin job interview questions you should know) -[#]: via: (https://opensource.com/article/19/7/sysadmin-job-interview-questions) -[#]: author: (DirectedSoul https://opensource.com/users/directedsoul) - -24 sysadmin job interview questions you should know -====== -Have a sysadmin job interview coming up? Read this article for some -questions you might encounter and possible answers. -![Question and answer.][1] - -As a geek who always played with computers, a career after my masters in IT was a natural choice. So, I decided the sysadmin path was the right one. In the process of my career, I have grown quite familiar with the job interview process. Here is a look at what to expect, the general career path, and a set of common questions and my answers to them. - -### Typical sysadmin tasks and duties - -Organizations need someone who understands the basics of how a system works so that they can keep their data safe, and keep their services running smoothly. You might ask: "Wait, isn’t there more that a sysadmin can do?" - -You are right. Now, in general, let’s look at what might be a typical sysadmin’s day-to-day tasks. Depending on their company’s needs and the person’s skill level, a sysadmin’s tasks vary from managing desktops, laptops, networks, and servers, to designing the organization’s IT policies. Sometimes sysadmins are even in charge of purchasing and placing orders for new IT equipment. - -Those seeking system administration as their career paths might find it difficult to keep their skills and knowledge up to date, as rapid changes in the IT field are inevitable. The next natural question that arises out of anyone’s mind is how IT professionals keep up with the latest updates and skills. - -### Low difficulty questions - -Here are some of the more basic questions you will encounter, and my answers: - - 1. What are the first five commands you type on a *nix server after login? - - - -> * **lsblk** to see information on all block devices -> * **who** to see who is logged into the server -> * **top** to get a sense of what is running on the server -> * **df -khT** to view the amount of disk space available on the server -> * **netstat** to see what TCP network connections are active -> - - - 2. How do you make a process run in the background, and what are the advantages of doing so? - - - -> You can make a process run in the background by adding the special character **&** at the end of the command. Generally, applications that take too long to execute, and don’t require user interaction are sent to the background so that we can continue our work in the terminal. ([Citation][2]) - - 3. Is running these commands as root a good or bad idea? - - - -> Running (everything) as root is bad due to two major issues. The first is _risk_. Nothing prevents you from making a careless mistake when you are logged in as **root**. If you try to change the system in a potentially harmful way, you need to use **sudo**, which introduces a pause (while you’re entering the password) to ensure that you aren’t about to make a mistake. -> -> The second reason is _security_. Systems are harder to hack if you don’t know the admin user’s login information. Having access to root means you already have one half of the working set of admin credentials. - - 4. What is the difference between **rm** and **rm -rf**? - - - -> The **rm** command by itself only deletes the named files (and not directories). With **-rf** you add two additional features: The **-r**, **-R**, or --**recursive** flag recursively deletes the directory’s contents, including hidden files and subdirectories, and the **-f**, or --**force**, flag makes **rm** ignore nonexistent files, and never prompt for confirmation. - - 5. **Compress.tgz** has a file size of approximately 15GB. How can you list its contents, and how do you list them only for a specific file? - - - -> To list the file’s contents: -> -> **tar tf archive.tgz** -> -> To extract a specific file: -> -> **tar xf archive.tgz filename** - -### Medium difficulty questions - -Here are some harder questions you might encounter, and my answers: - - 6. What is RAID? What is RAID 0, RAID 1, RAID 5, RAID 6, and RAID 10? - - - -> A RAID (Redundant Array of Inexpensive Disks) is a technology used to increase the performance and/or reliability of data storage. The RAID levels are: -> -> * RAID 0: Also known as disk striping, which is a technique that breaks up a file, and spreads the data across all of the disk drives in a RAID group. There are no safeguards against failure. ([Citation][3]) -> * RAID 1: A popular disk subsystem that increases safety by writing the same data on two drives. Called _mirroring_, RAID1 does not increase write performance, but read performance may increase up to the sum of each disks’ performance. Also, if one drive fails, the second drive is used, and the failed drive is manually replaced. After replacement, the RAID controller duplicates the contents of the working drive onto the new one. -> * RAID 5: A disk subsystem that increases safety by computing parity data and increasing speed. RAID 5 does this by interleaving data across three or more drives (striping). Upon failure of a single drive, subsequent reads can be calculated from the distributed parity such that no data is lost. -> * RAID 6: Which extends RAID 5 by adding another parity block. This level requires a minimum of four disks, and can continue to execute read/write with any two concurrent disk failures. RAID 6 does not have a performance penalty for reading operations, but it does have a performance penalty on write operations because of the overhead associated with parity calculations. -> * RAID 10: Also known as RAID 1+0, RAID 10 combines disk mirroring and disk striping to protect data. It requires a minimum of four disks, and stripes data across mirrored pairs. As long as one disk in each mirrored pair is functional, data can be retrieved. If two disks in the same mirrored pair fail, all data will be lost because there is no parity in the striped sets. ([Citation][4]) -> - - - 7. Which port is used for the **ping** command? - - - -> The **ping** command uses ICMP. Specifically, it uses ICMP echo requests and ICMP echo reply packets. -> -> ICMP does not use either UDP or TCP communication services: Instead, it uses raw IP communication services. This means that the ICMP message is carried directly in an IP datagram data field. - - 8. What is the difference between a router and a gateway? What is the default gateway? - - - -> _Router_ describes the general technical function (layer 3 forwarding), or a hardware device intended for that purpose, while _gateway_ describes the function for the local segment (providing connectivity to elsewhere). You could also state that you "set up a router as a gateway." Another term is _hop_, which describes forwarding between subnets. -> -> The term _default gateway_ is used to mean the router on your LAN, which has the responsibility of being the first point of contact for traffic to computers outside the LAN. - - 9. Explain the boot process for Linux. - - - -> BIOS -> Master Boot Record (MBR) -> GRUB -> the kernel -> init -> runlevel - - 10. How do you check the error messages while the server is booting up? - - - -> Kernel messages are always stored in the kmsg buffer, visible via the **dmesg** command. -> -> Boot issues and errors call for a system administrator to look into certain important files, in conjunction with particular commands, which are each handled differently by different versions of Linux: -> -> * **/var/log/boot.log** is the system boot log, which contains all that unfolded during the system boot. -> * **/var/log/messages** stores global system messages, including the messages logged during system boot. -> * **/var/log/dmesg** contains kernel ring buffer information. -> - - - 11. What is the difference between a symbolic link and a hard link? - - - -> A _symbolic_ or _soft link_ is an actual link to the original file, whereas a _hard link_ is a mirror copy of the original file. If you delete the original file, the soft link has no value, because it then points to a non-existent file. In the case of a hard link, it is entirely the opposite. If you delete the original file, the hard link still contains the data from the original file. ([Citation][5]) - - 12. How do you change kernel parameters? What kernel options might you need to tune? - - - -> To set the kernel parameters in Unix-like systems, first edit the file **/etc/sysctl.conf**. After making the changes, save the file and run the **sysctl -p** command. This command makes the changes permanent without rebooting the machine - - 13. Explain the **/proc** filesystem. - - - -> The **/proc** filesystem is virtual, and provides detailed information about the kernel, hardware, and running processes. Since **/proc** contains virtual files, it is called the _virtual file system_. These virtual files have unique qualities. Most of them are listed as zero bytes in size. -> -> Virtual files such as **/proc/interrupts**, **/proc/meminfo**, **/proc/mounts** and **/proc/partitions** provide an up-to-the-moment glimpse of the system’s hardware. Others, such as **/proc/filesystems** and the **/proc/sys** directory provide system configuration information and interfaces. - - 14. How do you run a script as another user without their password? - - - -> For example, if you were editing the sudoers file (such as **/private/etc/sudoers**), you might use **visudo** to add the following: -> -> [**user1 ALL=(user2) NOPASSWD: /opt/scripts/bin/generate.sh**][2] - - 15. What is the UID 0 toor account? Have you been compromised? - - - -> The toor user is an alternative superuser account, where toor is root spelled backward. It is intended to be used with a non-standard shell, so the default shell for root does not need to change. -> -> This purpose is important. Shells which are not part of the base distribution, but are instead installed from ports or packages, are installed in **/usr/local/bin**; which, by default, resides on a different file system. If root’s shell is located in **/usr/local/bin** and the file system containing **/usr/local/bin** is not mounted, root could not log in to fix a problem, and the sysadmin would have to reboot into single-user mode to enter the shell’s path. - -### Advanced questions - -Here are the even more difficult questions you may encounter: - - 16. How does **tracert** work and what protocol does it use? - - - -> The command **tracert**—or **traceroute** depending on the operating system—allows you to see exactly what routers you touch as you move through the chain of connections to your final destination. If you end up with a problem where you can’t connect to or **ping** your final destination, a **tracert** can help in that you can tell exactly where the chain of connections stops. ([Citation][6]) -> -> With this information, you can contact the correct people; whether it be your own firewall, your ISP, your destination’s ISP, or somewhere in the middle. The **tracert** command—like **ping**—uses the ICMP protocol, but also can use the first step of the TCP three-way handshake to send SYN requests for a response. - - 17. What is the main advantage of using **chroot**? When and why do we use it? What is the purpose of the **mount /dev**, **mount /proc**, and **mount /sys** commands in a **chroot** environment?  - - - -> An advantage of having a **chroot** environment is that the filesystem is isolated from the physical host, since **chroot** has a separate filesystem inside your filesystem. The difference is that **chroot** uses a newly created root (**/**) as its root directory. -> -> A **chroot** jail lets you isolate a process and its children from the rest of the system. It should only be used for processes that don’t run as **root**, as **root** users can break out of the jail easily. -> -> The idea is that you create a directory tree where you copy or link in all of the system files needed for the process to run. You then use the **chroot()** system call to tell it the root directory now exists at the base of this new tree, and then start the process running in that **chroot**’d environment. Since the command then can’t reference paths outside the modified root directory, it can’t perform operations (read, write, etc.) maliciously on those locations. ([Citation][7]) - - 18. How do you protect your system from getting hacked? - - - -> By following the principle of least privileges and these practices: -> -> * Encrypt with public keys, which provides excellent security. -> * Enforce password complexity. -> * Understand why you are making exceptions to the rules above. -> * Review your exceptions regularly. -> * Hold someone to account for failure. (It keeps you on your toes.) ([Citation][8]) -> - - - 19. What is LVM, and what are the advantages of using it? - - - -> LVM, or Logical Volume Management, uses a storage device management technology that gives users the power to pool and abstract the physical layout of component storage devices for easier and flexible administration. Using the device mapper Linux kernel framework, the current iteration (LVM2) can be used to gather existing storage devices into groups and allocate logical units from the combined space as needed. - - 20. What are sticky ports? - - - -> Sticky ports are one of the network administrator’s best friends and worst headaches. They allow you to set up your network so that each port on a switch only permits one (or a number that you specify) computer to connect on that port, by locking it to a particular MAC address. - - 21. Explain port forwarding? - - - -> When trying to communicate with systems on the inside of a secured network, it can be very difficult to do so from the outside—and with good reason. Therefore, the use of a port forwarding table within the router itself, or other connection management device, can allow specific traffic to automatically forward to a particular destination. For example, if you had a web server running on your network and you wanted to grant access to it from the outside, you would set up port forwarding to port 80 on the server in question. This would mean that anyone entering your IP address in a web browser would connect to the server’s website immediately. -> -> Please note, it is usually not recommended to allow access to a server from the outside directly into your network. - - 22. What is a false positive and false negative in the case of IDS? - - - -> When the Intrusion Detection System (IDS) device generates an alert for an intrusion which has actually not happened, this is false positive. If the device has not generated any alert and the intrusion has actually happened, this is the case of a false negative. - - 23. Explain **:(){ :|:& };:** and how to stop this code if you are already logged into the system? - - - -> This is a fork bomb. It breaks down as follows: -> -> * **:()** defines the function, with **:** as the function name, and the empty parenthesis shows that it will not accept any arguments. -> * **{ }** shows the beginning and end of the function definition. -> * **:|:** loads a copy of the function **:** into memory, and pipes its output to another copy of the **:** function, which also has to be loaded into memory. -> * **&** makes the previous item a background process, so that the child processes will not get killed even though the parent gets auto-killed. -> * **:** at the end executes the function again, and hence the chain reaction begins. -> - -> -> The best way to protect a multi-user system is to use Privileged Access Management (PAM) to limit the number of processes a user can use. -> -> The biggest problem with a fork bomb is the fact it takes up so many processes. So, we have two ways of attempting to fix this if you are already logged into the system. One option is to execute a SIGSTOP command to stop the process, such as: -> -> **killall -STOP -u user1** -> -> If you can’t use the command line due to all processes being used, you will have to use **exec** to force it to run: -> -> **exec killall -STOP -u user1** -> -> With fork bombs, your best option is preventing them from becoming too big of an issue in the first place - - 24. What is OOM killer and how does it decide which process to kill first? - - - -> If memory is exhaustively used up by processes to the extent that possibly threatens the system’s stability, then the out of memory (OOM) killer comes into the picture. -> -> An OOM killer first has to select the best process(es) to kill. _Best_ here refers to the process which will free up the maximum memory upon being killed, and is also the least important to the system. The primary goal is to kill the least number of processes to minimize the damage done, and at the same time maximize the amount of memory freed. -> -> To facilitate this goal, the kernel maintains an oom_score for each of the processes. You can see the oom_score of each of the processes in the **/proc** filesystem under the **pid** directory: -> -> **$ cat /proc/10292/oom_score** -> -> The higher the value of oom_score for any process, the higher its likelihood is of being killed by the OOM Killer in an out-of-memory situation. ([Citation][9]) - -### Conclusion - -System administration salaries have a [wide range][10] with some sites mentioning $70,000 to $100,000 a year, depending on the location, the size of the organization, and your education level plus years of experience. In the end, the system administration career path boils down to your interest in working with servers and solving cool problems. Now, I would say go ahead and achieve your dream path. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/sysadmin-job-interview-questions - -作者:[DirectedSoul][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/directedsoul -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_HowToFish_520x292.png?itok=DHbdxv6H (Question and answer.) -[2]: https://github.com/trimstray/test-your-sysadmin-skills -[3]: https://www.waytoeasylearn.com/2016/05/netapp-filer-tutorial.html -[4]: https://searchstorage.techtarget.com/definition/RAID-10-redundant-array-of-independent-disks -[5]: https://www.answers.com/Q/What_is_hard_link_and_soft_link_in_Linux -[6]: https://www.wisdomjobs.com/e-university/network-administrator-interview-questions.html -[7]: https://unix.stackexchange.com/questions/105/chroot-jail-what-is-it-and-how-do-i-use-it -[8]: https://serverfault.com/questions/391370/how-to-prevent-zero-day-attacks -[9]: https://unix.stackexchange.com/a/153586/8369 -[10]: https://blog.netwrix.com/2018/07/23/systems-administrator-salary-in-2018-how-much-can-you-earn/ diff --git a/translated/tech/20190725 24 sysadmin job interview questions you should know.md b/translated/tech/20190725 24 sysadmin job interview questions you should know.md new file mode 100644 index 0000000000..9650f4fd9d --- /dev/null +++ b/translated/tech/20190725 24 sysadmin job interview questions you should know.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (24 sysadmin job interview questions you should know) +[#]: via: (https://opensource.com/article/19/7/sysadmin-job-interview-questions) +[#]: author: (DirectedSoul https://opensource.com/users/directedsoul) + +24 个必知必会的系统管理员面试问题 +====== + +> 即将进行系统管理员工作面试吗? 阅读本文,了解你可能会遇到的一些问题以及可能的答案。 + +![Question and answer.][1] + +作为一个经常与计算机打交道的极客,在硕士毕业后在 IT 行业选择我的职业是很自然的选择。因此,我认为走上系统管理员之路是正确的路径。在我的职业生涯中,我对求职面试过程非常熟悉。现在来看一下该职位的预期、职业发展道路,以及一系列常见问题和我的回答。 + +### 系统管理员的典型任务和职责 + +组织需要了解系统工作原理的人员,以确保数据安全并保持服务平稳运行。你可能会问:“等等,是不是系统管理员还能做更多的事情?” + +你是对的。现在,一般来说,让我们看一下典型的系统管理员的日常任务。根据公司的需求和人员的技能水平,系统管理员的任务从管理台式机、笔记本电脑、网络和服务器到设计组织的 IT 策略不等。有时,系统管理员甚至负责购买和订购新的 IT 设备。 + +那些寻求系统管理工作作为其职业道路的人可能会发现,由于 IT 领域的快速变化是不可避免的,因此难以保持其技能和知识的最新状态。所有人都会想到的下一个自然而然的问题是 IT 专业人员如何掌握最新的更新和技能。 + +### 小意思 + +这是你将遇到的一些最基本的问题,以及我的答案: + +1、在 *nix 服务器上登录后键入的前五个命令是什么? + +> * `lsblk` 以查看所有的块设备信息 +> * `who` 查看谁登录到服务器 +> * `top`,以了解服务器上正在运行的进程 +> * `df -khT` 以查看服务器上可用的磁盘容量 +> * `netstat` 以查看哪些 TCP 网络连接处于活动状态 + +2、如何使进程在后台运行,这样做的好处是什么? + +> 你可以通过在命令末尾添加特殊字符 `&` 来使进程在后台运行。通常,执行时间太长并且不需要用户交互的应用程序会放到后台,以便我们可以在终端中继续工作。([引文][2]) + +3、以 root 用户身份运行这些命令是好事还是坏事? + +> 由于两个主要问题,以 root 身份运行(任何命令)是不好的。第一个是*风险*。当你以 **root** 身份登录时,无法避免你犯粗心大意的错误。如果你尝试以带有潜在危害的方式更改系统,则需要使用 `sudo`,它会引入一个暂停(在你输入密码时),以确保你不会犯错。 +> +> 第二个原因是*安全*。如果你不知道管理员用户的登录信息,则系统更难被攻击。拥有 root 的访问权限意味着你已经拥有管理员凭据工作集的一半。 + +4、`rm` 和 `rm -rf` 有什么区别? + +> `rm` 命令本身仅删除指明的文件(而不删除目录)。使用 `-rf` 标志,你添加了两个附加功能:`-r`、`-R` 或 `--recursive` 标志递归删除目录的内容,包括隐藏的文件和子目录;而 `-f`或 `--force` 标志使 `rm` 忽略不存在的文件,并且从不提示你进行确认。 + +5、有一个大小约为 15GB 的 `Compress.tgz` 文件。你如何列出其内容,以及如何仅提取出特定文件? + +> 要列出文件的内容: +> +> `tar tf archive.tgz` +> +> 要提取特定文件: +> +> `tar xf archive.tgz filename` + +### 中等意思 + +这是你可能会遇到的一些较难的问题,以及我的答案: + +6、什么是 RAID?什么是 RAID 0、RAID 1、RAID 5、RAID 6 和 RAID 10? + +> RAID(廉价磁盘冗余阵列Redundant Array of Inexpensive Disks)是一种用于提高数据存储性能和/或可靠性的技术。RAID 级别为: +> +> * RAID 0:也称为磁盘条带化,这是一种分解文件并将数据分布在 RAID 组中所有磁盘驱动器上的技术。它没有防止磁盘失败的保障。([引文][3]) +> * RAID 1:一种流行的磁盘子系统,通过在两个驱动器上写入相同的数据来提高安全性。 RAID 1 被称为*镜像*,它不会提高写入性能,但读取性能可能会提高到每个磁盘性能的总和。另外,如果一个驱动器发生故障,则使用第二个驱动器,发生故障的驱动器要手动更换。更换后,RAID 控制器将可工作的驱动器的内容复制到新驱动器上。 +> * RAID 5:一种磁盘子系统,可通过计算奇偶校验数据来提高安全性和提高速度。RAID 5 通过跨三个或更多驱动器交错数据(条带化)来实现此目的。在单个驱动器发生故障时,后续读取可以从分布式奇偶校验计算出,从而不会丢失任何数据。 +> * RAID 6:通过添加另一个奇偶校验块来扩展 RAID 5。此级别至少需要四个磁盘,并且可以在任何两个并发磁盘故障的情况下继续执行读/写操作。RAID 6 不会对读取操作造成性能损失,但由于与奇偶校验计算相关的开销,因此确实会对写入操作造成性能损失。 +> * RAID 10:RAID 10 也称为 RAID 1 + 0,它结合了磁盘镜像和磁盘条带化功能来保护数据。它至少需要四个磁盘,并且跨镜像对对数据进行条带化。只要每个镜像对中的一个磁盘起作用,就可以检索数据。如果同一镜像对中的两个磁盘发生故障,则所有数据将丢失,因为带区集中没有奇偶校验。([引文][4]) + +7、`ping` 命令使用哪个端口? + +> `ping` 命令使用 ICMP。具体来说,它使用 ICMP 回显请求和 ICMP 回显应答包。 +> +> ICMP 不使用 UDP 或 TCP 通信服务:相反,它使用原始的 IP 通信服务。这意味着,ICMP 消息直接承载在 IP 数据报数据字段中。 + +8、路由器和网关之间有什么区别? 什么是默认网关? + +> *路由器*描述的是一种通用技术功能(第 3 层转发)或用于该目的的硬件设备,而*网关*描述的是本地网段的功能(提供到其他地方的连接性)。你还可以说“将路由器设置为网关”。另一个术语是“跳”,它描述了子网之间的转发。 +> +>术语*默认网关*表示局域网上的路由器,它的责任是作为向局域网外部计算机通信的第一个联系点。 + +9、解释一下 Linux 的引导过程。 + +> BIOS -> 主引导记录(MBR) -> GRUB -> 内核 -> 初始化 -> 运行级 + +10、服务器启动时如何检查错误消息? + +> 内核消息始终存储在 kmsg 缓冲区中,可通过 `dmesg` 命令查看。 +> +> 引导的问题和错误要求系统管理员结合某些特定命令来查看某些重要文件,这些文件不同版本的 Linux 处理不同: +> +> * `/var/log/boot.log` 是系统引导日志,其中包含系统引导过程中展开的所有内容。 +> * `/var/log/messages` 存储全局系统消息,包括系统引导期间记录的消息。 +> * `/var/log/dmesg` 包含内核环形缓冲区信息。 + +11、符号链接和硬链接有什么区别? + +> *符号链接*或*软链接*实际是是到原始文件的链接,而*硬链接*是原始文件的镜像副本。如果删除原始文件,则该软链接就没有用了,因为它指向的文件不存在了。如果是硬链接,则完全相反。如果删除原始文件,则硬链接仍然包含原始文件中的数据。([引文][5]) + +12、如何更改内核参数?你可能需要调整哪些内核选项? + +> 要在类 Unix 系统中设置内核参数,请首先编辑文件 `/etc/sysctl.conf`。进行更改后,保存文件并运行 `sysctl -p` 命令。此命令使更改永久生效,而无需重新启动计算机 + +13、解释一下 `/proc` 文件系统。 + +> `/proc` 文件系统是虚拟的,并提供有关内核、硬件和正在运行的进程的详细信息。由于 `/proc` 包含虚拟文件,因此称为“虚拟文件系统”。这些虚拟文件具有独特性。其中大多数列为零字节。 +> +> 虚拟文件,例如 `/proc/interrupts`、`/proc/meminfo`、`/proc/mounts` 和 `/proc/partitions`,提供了系统硬件的最新信息。其他诸如 `/proc/filesystems` 和 `/proc/sys` 目录提供系统配置信息和接口。 + +14、如何在没有密码的情况下以其他用户身份运行脚本? + +> 例如,如果你可以编辑 sudoers 文件(例如 `/private/etc/sudoers`),则可以使用 `visudo` 添加以下[内容][2]: +> +> `user1 ALL =(user2)NOPASSWD:/opt/scripts/bin/generate.sh` +> + +15、什么是 UID 0 toor 帐户?是被入侵了么? + +> `toor` 用户是备用的超级用户帐户,其中 `toor` 是 `root` 反向拼写。它预期与非标准 shell 一起使用,因此 `root` 的默认 shell 不需要更改。 +> +> 此用途很重要。这些 shell 不是基本发行版的一部分,而是从 ports 或软件包安装的,它们安装在 `/usr/local/bin` 中,默认情况下,位于其他文件系统上。如果 root 的 shell 位于 `/usr/local/bin` 中并且未挂载包含 `/usr/local/bin` 的文件系统,则 root 无法登录以解决问题,并且系统管理员必须重新启动进入为单用户模式来输入 shell 程序的路径。 + +### 小目标? + +这是你可能会遇到的甚至更困难的问题: + +16、`tracert` 如何工作,使用什么协议? + +> 命令 `tracert`(或 `traceroute`,具体取决于操作系统)使你可以准确地看到在连接到最终目的地的连接链条中触及的路由器。如果你遇到无法连接或无法 `ping` 通最终目的地的问题,则可以使用 `tracert` 来帮助你确定连接链在何处停止。 ([引文][6]) +> +> 通过此信息,你可以联系正确的人;无论是你自己的防火墙、ISP、目的地的 ISP 还是中间的某个位置。 `tracert` 命令像 `ping` 一样使用 ICMP 协议,但也可以使用 TCP 三步握手的第一步来发送 SYN 请求以进行响应。 + +17、使用 `chroot` 的主要优点是什么?我们何时以及为什么使用它?在 chroot 环境中,`mount /dev`、`mount /proc` 和 `mount /sys` 命令的作用是什么? + +> chroot 环境的优点是文件系统与物理主机是隔离的,因为 chroot 在文件系统内部有一个单独的文件系统。区别在于 `chroot` 使用新创建的根目录(`/`)作为其根目录。 +> +> chroot 监狱可让你将进程及其子进程与系统其余部分隔离。它仅应用于不以 root 身份运行的进程,因为 root 用户可以轻松地脱离监狱。 +> +> 该思路是创建一个目录树,在其中复制或链接运行该进程所需的所有系统文件。然后,你可以使用 `chroot()` 系统调用来告诉它根目录现在位于此新树的基点上,然后启动在该 chroot 环境中运行的进程。由于该命令因此而无法引用修改后的根目录之外的路径,因此它无法在这些位置上恶意执行操作(读取、写入等)。([引文][7]) + +18、如何保护你的系统免遭黑客攻击? + +> 遵循最低特权原则和这些做法: +> +> * 使用公钥加密,它可提供出色的安全性。 +> * 增强密码复杂性。 +> * 了解为什么要对上述规则设置例外。 +> * 定期检查你的例外情况。 +> * 让具体的人对失败负责。(它使你保持警惕。)([引文][8]) + +19、什么是 LVM,使用 LVM 有什么好处? + +> LVM(逻辑卷管理)使用一种存储设备管理技术,该技术使用户能够合并和抽象化组件存储设备的物理布局,从而可以更轻松、灵活地进行管理。使用设备映射器 Linux 内核框架,当前迭代(LVM2)可用于将现有存储设备收集到组中,并根据需要从组合的空间分配逻辑单元。 + +20、什么是粘性端口? + +> 粘性端口是网络管理员最好的朋友,也是最头痛的事情之一。它们允许你设置网络,以便通过将交换机上的每个端口锁定到特定的 MAC 地址,仅允许一台(或你指定的数字)计算机在该端口上进行连接。 + +21、解释一下端口转发? + +> 尝试与安全的网络内部的系统进行通信时,从外部进行通信可能非常困难,这是很显然的。因此,在路由器本身或其他连接管理设备中使用端口转发表可以使特定流量自动转发到特定目的地。例如,如果你的网络上运行着一台 Web 服务器,并且想从外部授予对该服务器的访问权限,则可以将端口转发设置为该服务器上的端口 80。这意味着在网络浏览器中输入你的(外网)IP 地址的任何人都将立即连接到服务器的网站。 +> +> 请注意,通常不建议允许从你的网络外部直接访问服务器。 + +22、对于 IDS,误报和漏报是什么? + +> 当入侵检测系统(IDS)设备为实际上没有发生的入侵生成警报时,这是误报(假阳性)false positive。如果设备未生成任何警报,而入侵实际上已发生,则为漏报(假阴性)。 + +23、解释一下 `:(){ :|:& };:`,如果已经登录系统,如何停止此代码? + +> 这是一枚复刻炸弹。它分解如下: +> +> * `:()` 定义了函数,以 `:` 作为函数名,并且空括号表示它将不接受任何参数。 +> * `{}` 是函数定义的开始和结束。 +> * `:|:` 将函数 `:` 的副本加载到内存中,并将其输出通过管道传递给函数 `:` 的另一个副本,该副本也必须加载到内存中。 +> * `&` 使前一个命令行成为后台进程,因此即使父进程被自动杀死,子进程也不会被杀死。 +> * `:` 再次执行该函数,因此连锁反应开始。 +> +> 保护多用户系统的最佳方法是使用特权访问管理(PAM)来限制用户可以使用的进程数。 +> +> 复刻炸弹的最大问题是它发起了太多进程。因此,如果你已经登录系统,我们有两种尝试解决此问题的方法。一种选择是执行一个 `SIGSTOP` 命令来停止进程,例如: +> +> `killall -STOP -u user1` +> +> 如果由于占用了所有进程而无法使用命令行,则必须使用 `exec` 强制其运行: +> +> `exec killall -STOP -u user1` +> +> 对于复刻炸弹,最好的选择是防患于未然。 + +24、什么是 OOM 杀手,它如何决定首先杀死哪个进程? + +> 如果内存被进程彻底耗尽,可能会威胁到系统的稳定性,那么内存不足out of memory(OOM)杀手就登场了。 +> +> OOM 杀手首先必须选择要杀死的最佳进程。*最佳*在这里指的是在被杀死时将释放最大内存的进程,并且对系统来说最不重要。主要目标是杀死最少数量的进程,以最大程度地减少造成的损害,同时最大化释放的内存量。 +> +> 为了实现此目标,内核为每个进程维护一个 `oom_score`。你可以在 `/proc` 文件系统中的 `pid` 目录下的看到每个进程的 `oom_score`: +> +> `$ cat /proc/10292/oom_score` +> +> 任何进程的 `oom_score` 值越高,在内存不足的情况下被 OOM 杀手杀死的可能性就越高。 ([引文][9]) + +### 总结 + +系统管理人员的薪水[差别很大][10],有些网站上说年薪在 70,000 到 100,000 美元之间,具体取决于地点、组织的规模以及你的教育水平以及多年的工作经验。最后,系统管理的职业道路归结为你对使用服务器和解决那些酷问题的兴趣。现在,我要说,继续前进,实现你的梦想之路吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/sysadmin-job-interview-questions + +作者:[DirectedSoul][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/directedsoul +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_HowToFish_520x292.png?itok=DHbdxv6H (Question and answer.) +[2]: https://github.com/trimstray/test-your-sysadmin-skills +[3]: https://www.waytoeasylearn.com/2016/05/netapp-filer-tutorial.html +[4]: https://searchstorage.techtarget.com/definition/RAID-10-redundant-array-of-independent-disks +[5]: https://www.answers.com/Q/What_is_hard_link_and_soft_link_in_Linux +[6]: https://www.wisdomjobs.com/e-university/network-administrator-interview-questions.html +[7]: https://unix.stackexchange.com/questions/105/chroot-jail-what-is-it-and-how-do-i-use-it +[8]: https://serverfault.com/questions/391370/how-to-prevent-zero-day-attacks +[9]: https://unix.stackexchange.com/a/153586/8369 +[10]: https://blog.netwrix.com/2018/07/23/systems-administrator-salary-in-2018-how-much-can-you-earn/ From 371c882d4077e73919e5ef77c47b8c6be96f6d2b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Dec 2019 10:02:37 +0800 Subject: [PATCH 074/676] PRF @wxy --- ...les to Securely Transfer Files in Linux.md | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md index 39851d35b6..7cc6b2a570 100644 --- a/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md +++ b/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (14 SCP Command Examples to Securely Transfer Files in Linux) @@ -10,7 +10,9 @@ 在 Linux 上安全传输文件的 14 SCP 命令示例 ====== -SCP(Secure Copy)是 Linux 和 Unix 之类的系统中的命令行工具,用于通过网络安全地跨系统传输文件和目录。当我们使用 `scp` 命令将文件和目录从本地系统复制到远程系统时,则在后端与远程系统建立 ssh 连接。换句话说,我们可以说 `scp` 在后端使用了相同的 SSH 安全机制,它需要密码或密钥进行身份验证。 +![](https://img.linux.net.cn/data/attachment/album/201912/13/100239f31is1ios31vvoo3.jpg) + +SCP(安全复制Secure Copy)是 Linux 和 Unix 之类的系统中的命令行工具,用于通过网络安全地跨系统传输文件和目录。当我们使用 `scp` 命令将文件和目录从本地系统复制到远程系统时,则在后端与远程系统建立了 ssh 连接。换句话说,我们可以说 `scp` 在后端使用了相同的 SSH 安全机制,它需要密码或密钥进行身份验证。 ![scp-command-examples-linux][2] @@ -33,13 +35,13 @@ SCP(Secure Copy)是 Linux 和 Unix 之类的系统中的命令行工具, * `-C` 启用压缩 * `-i` 指定识别文件或私钥 * `-l` 复制时限制带宽 -* `-P` 目标主机的 ssh 端口号 +* `-P` 指定目标主机的 ssh 端口号 * `-p` 复制时保留文件的权限、模式和访问时间 * `-q` 禁止 SSH 警告消息 * `-r` 递归复制文件和目录 * `-v` 详细输出 -现在让我们跳入示例!!!! +现在让我们跳入示例! ### 示例:1)使用 scp 将文件从本地系统复制到远程系统 @@ -56,7 +58,7 @@ jdk-linux-x64_bin.rpm 100% 10MB 27.1MB/s 00:00 ### 示例:2)使用 scp 将文件从远程系统复制到本地系统 -假设我们想将文件从远程系统复制到 `/tmp` 文件夹下的本地系统,执行以下 `scp` 命令, +假设我们想将文件从远程系统复制到本地系统下的 `/tmp` 文件夹,执行以下 `scp` 命令, ``` [root@linuxtechi ~]$ scp root@linuxtechi:/root/Technical-Doc-RHS.odt /tmp @@ -69,7 +71,7 @@ Technical-Doc-RHS.odt 100% 1109KB 31.8MB/s 00:00 ### 示例:3)使用 scp 传输文件时的详细输出(-v) -在 `scp` 命令中,我们可以使用 `-v` 选项启用详细输出,使用详细输出,我们可以轻松地发现后台确切发生了什么。这对于调试连接、认证和配置问题非常有用。 +在 `scp` 命令中,我们可以使用 `-v` 选项启用详细输出。使用详细输出,我们可以轻松地发现后台确切发生了什么。这对于调试连接、认证和配置等问题非常有用。 ``` root@linuxtechi ~]$ scp -v jdk-linux-x64_bin.rpm root@linuxtechi:/opt @@ -119,7 +121,7 @@ jdk-linux-x64_bin.rpm 100% 10MB 25.3MB/s 00:00 ### 示例:6)递归复制文件和目录(-r) -在 `scp` 命令中使用 `-r` 选项将整个目录从一个系统递归复制到另一个系统,示例如下所示: +在 `scp` 命令中使用 `-r` 选项将整个目录从一个系统递归地复制到另一个系统,示例如下所示: ``` [root@linuxtechi ~]$ scp -r Downloads root@linuxtechi:/opt @@ -135,7 +137,7 @@ drwxr-xr-x. 2 root root 75 Oct 19 12:10 /opt/Downloads ### 示例:7)通过启用压缩来提高传输速度(-C) -在 `scp` 命令中,我们可以通过使用 `-C` 选项启用压缩来提高传输速度,它将自动在源上启用压缩并在目标主机上启用解压缩。 +在 `scp` 命令中,我们可以通过使用 `-C` 选项启用压缩来提高传输速度,它将自动在源主机上启用压缩并在目标主机上解压缩。 ``` root@linuxtechi ~]$ scp -r -C Downloads root@linuxtechi:/mnt @@ -145,7 +147,7 @@ root@linuxtechi ~]$ scp -r -C Downloads root@linuxtechi:/mnt ### 示例:8)复制时限制带宽(-l) -在 `scp` 命令中使用 `-l` 选项设置复制时对带宽使用的限制。带宽以 Kbit/s 为单位指定,示例如下所示, +在 `scp` 命令中使用 `-l` 选项设置复制时对带宽使用的限制。带宽以 Kbit/s 为单位指定,示例如下所示: ``` [root@linuxtechi ~]$ scp -l 500 jdk-linux-x64_bin.rpm root@linuxtechi:/var @@ -159,7 +161,7 @@ root@linuxtechi ~]$ scp -r -C Downloads root@linuxtechi:/mnt [root@linuxtechi ~]$ scp -P 2022 jdk-linux-x64_bin.rpm root@linuxtechi:/var ``` -在上面的示例中,远程主机的 ssh 端口为 “2022” +在上面的示例中,远程主机的 ssh 端口为 “2022”。 ### 示例:10)复制时保留文件的权限、模式和访问时间(-p) @@ -182,7 +184,7 @@ jdk-linux-x64_bin.rpm 100% 10MB 13.5MB/s 00:00 ### 示例:12)在传输时使用 scp 中的识别文件(-i) -在大多数 Linux 环境中,首选基于密钥的身份验证。在 scp 命令中,我们使用 `-i` 选项指定识别文件(私钥文件),示例如下所示: +在大多数 Linux 环境中,首选基于密钥的身份验证。在 `scp` 命令中,我们使用 `-i` 选项指定识别文件(私钥文件),示例如下所示: ``` [root@linuxtechi ~]$ scp -i my_key.pem -r Downloads root@linuxtechi:/root @@ -207,15 +209,15 @@ index.html 100% 85KB 6.6MB/s 00:00 ### 示例:14)在 scp 命令中使用其他加密方式(-c) -默认情况下,`scp` 使用 AES-128 加密方式来加密文件。如果你想在 `scp` 命令中使用其他加密方式,请使用 `-c` 选项,后接加密方式名称, +默认情况下,`scp` 使用 AES-128 加密方式来加密文件。如果你想在 `scp` 命令中使用其他加密方式,请使用 `-c` 选项,后接加密方式名称。 -假设我们要在用 `scp`命令传输文件时使用 3des-cbc 加密方式,请运行以下 `scp` 命令: +假设我们要在用 `scp` 命令传输文件时使用 3des-cbc 加密方式,请运行以下 `scp` 命令: ``` [root@linuxtechi ~]# scp -c 3des-cbc -r Downloads root@linuxtechi:/root ``` -使用以下命令列出 `ssh` 和 `scp` 加密方式: +使用以下命令列出 `ssh` 和 `scp` 支持的加密方式: ``` [root@linuxtechi ~]# ssh -Q cipher localhost | paste -d , -s - @@ -232,7 +234,7 @@ via: https://www.linuxtechi.com/scp-command-examples-in-linux/ 作者:[Pradeep Kumar][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8f5d784967fa1cdcff576a0acef24c23927b7c68 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Dec 2019 10:03:12 +0800 Subject: [PATCH 075/676] PUB @wxy https://linux.cn/article-11669-1.html --- ...CP Command Examples to Securely Transfer Files in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md (99%) diff --git a/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/published/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md similarity index 99% rename from translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md rename to published/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md index 7cc6b2a570..9fafdca9cf 100644 --- a/translated/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md +++ b/published/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11669-1.html) [#]: subject: (14 SCP Command Examples to Securely Transfer Files in Linux) [#]: via: (https://www.linuxtechi.com/scp-command-examples-in-linux/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) From 60e651de5f97c7fa2d91da6e854ee146a73933fb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Dec 2019 13:37:13 +0800 Subject: [PATCH 076/676] PRF @geekpi --- ...1206 Pekwm- A lightweight Linux desktop.md | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md b/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md index 58f025dc21..2e43e6021b 100644 --- a/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md +++ b/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Pekwm: A lightweight Linux desktop) @@ -9,12 +9,14 @@ Pekwm:一个轻量级的 Linux 桌面 ====== -本文是 24 天 Linux 桌面特别系列的一部分。如果你是一个觉得传统桌面会妨碍你的极简主义者,那么试试 Pekwm Linux 桌面。 -![Penguin with green background][1] -假设你想要一个轻量级桌面环境,它的功能足以在屏幕上显示图形,移动一些窗口,而没有其他东西。你会发现传统桌面的通知、任务栏和系统托盘会妨碍你的工作。你想主要通过终端工作,但也希望运行图形应用。如果听起来像你,那么 [Pekwm][2] 可能是你一直在寻找的东西。 +> 本文是 24 天 Linux 桌面特别系列的一部分。如果你是一个觉得传统桌面会妨碍你的极简主义者,那么试试 Pekwm Linux 桌面。 -Pekwm 的灵感大概来自于 Window Maker 和 Fluxbox 等。它提供了一个应用菜单,窗口装饰,而不是一大堆其他东西。它非常适合极简主义者,即那些希望节省资源的用户和喜欢在终端工作的用户。 +![](https://img.linux.net.cn/data/attachment/album/201912/13/133626l5t2z2awjstu9zbe.png) + +假设你想要一个轻量级桌面环境,它只需要能在屏幕上显示图形、四处移动窗口,而别无杂物。你会发现传统桌面的通知、任务栏和系统托盘会妨碍你的工作。你想主要通过终端工作,但也希望运行图形应用。如果听起来像是你的想法,那么 [Pekwm][2] 可能是你一直在寻找的东西。 + +Pekwm 的灵感大概来自于 Window Maker 和 Fluxbox 等。它提供了一个应用菜单、窗口装饰、而不是一大堆其他东西。它非常适合极简主义者,即那些希望节省资源的用户和喜欢在终端工作的用户。 从发行版仓库安装 Pekwm。安装后,请先退出当前桌面会话,以便可以登录到新桌面。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,具体取决于你的设置)将继续登录到以前的桌面,因此需要在登录之前修改它。 @@ -26,10 +28,10 @@ Pekwm 的灵感大概来自于 Window Maker 和 Fluxbox 等。它提供了一个 ![Selecting your desktop in KDM][4] -第一次登录 Pekwm 时,你可能会看到黑屏。信不信由你,这是正常的。你看到的是一个空白桌面,没有背景壁纸。你可以使用 **feh** 命令设置壁纸(你可能需要从仓库中安装它)。此命令有几个用于设置背景的选项,包括 **\--bg-fill** 用壁纸填充屏幕,**\--bg-scale** 缩放到合适大小,等等。 +第一次登录 Pekwm 时,你可能会看到黑屏。可能难以置信,但这是正常的。你看到的是一个空白桌面,没有背景壁纸。你可以使用 `feh` 命令设置壁纸(你可能需要从仓库中安装它)。此命令有几个用于设置背景的选项,包括 `--bg-fill` 用壁纸填充屏幕,`--bg-scale` 缩放到合适大小,等等。 ``` -`$ feh --bg-fill ~/Pictures/wallpapers/mybackground.jpg` +$ feh --bg-fill ~/Pictures/wallpapers/mybackground.jpg ``` ### 应用菜单 @@ -40,13 +42,13 @@ Pekwm 的灵感大概来自于 Window Maker 和 Fluxbox 等。它提供了一个 ### 配置 -Pekwm 主要通过保存在 **$HOME/.pekwm**. 的文本配置文件配置。**menu** 文件定义你的应用菜单,**keys** 文件定义键盘快捷键,等等。 +Pekwm 主要通过保存在 `$HOME/.pekwm` 下的文本配置文件来配置。`menu` 文件定义你的应用菜单,`keys` 文件定义键盘快捷键,等等。 -**start** 文件是在 Pekwm 启动后执行的 shell 脚本。它类似于传统 Unix 系统上的 **rc.local**。它故意放在最后一行,因此这里的东西将覆盖之前的一切。这是一个重要文件,它可能是你要设置背景的地方,以便_你的_选择会覆盖正在使用的主题的默认值。 +`start` 文件是在 Pekwm 启动后执行的 shell 脚本。它类似于传统 Unix 系统上的 `rc.local`。它故意放在最后执行的,因此这里的东西将覆盖之前的一切。这是一个重要文件,它可能是你要设置背景的地方,以便*你的*选择会覆盖正在使用的主题的默认值。 -**start** 文件也是可以启动 dockapp 的地方。dockapp 是 一种小程序,它在 Window Maker 和 Fluxbox 引起了人们的关注。它们通常有网络监视器、时钟、音频设置和其他你能会在系统托盘或作为一个 KDE plasmoid 或者完整桌面环境中看到的小部件。你可能会在发行版仓库中找到一些 dockapp,或者可以在 [dockapps.net][6] 上在线查找它们。 +`start` 文件也是可以启动 dockapp 的地方。dockapp 是一种小程序,它在 Window Maker 和 Fluxbox 引起了人们的关注。它们通常有网络监视器、时钟、音频设置,和其它你可能会在系统托盘或作为一个 KDE plasmoid 或者完整桌面环境中看到的小部件。你可能会在发行版仓库中找到一些 dockapp,或者可以在 [dockapps.net][6] 上在线查找它们。 -你可以在启动时运行 dockapp,将它们列在 **start** 文件中,跟上 **&** 符号: +你可以在启动时运行 dockapp,将它们列在 `start` 文件中,跟上 `&` 符号: ``` @@ -55,15 +57,15 @@ wmnd & bubblemon -d & ``` -**start** 文件必须[设置为可执行][7],才能在 Pekwm 启动时运行。 +`start` 文件必须[设置为可执行][7],才能在 Pekwm 启动时运行。 ``` -`$ chmod +x $HOME/.pekwm/start` +$ chmod +x $HOME/.pekwm/start ``` ### 功能 -Pekwm 的功能不多,但这就是它的美。如果你希望在桌面上运行额外的服务,那么由你来启动这些服务。如果你仍在学习 Linux,这是了解那些与完整的桌面环境捆绑在一起时通常不会考虑的微小 GUI 组件的好方法(像是[任务栏][8])。这也习惯一些 Linux 命令(例如 [nmcli][9])的好方法。 +Pekwm 的功能不多,但这就是它的美。如果你希望在桌面上运行额外的服务,那么由你来启动这些服务。如果你仍在学习 Linux,这是了解那些与完整的桌面环境捆绑在一起时通常不会注意到的微小 GUI 组件的好方法(像是[任务栏][8])。这也习惯一些 Linux 命令(例如 [nmcli][9])的好方法。 Pekwm 是一个有趣的窗口管理器。它分散、简洁、轻巧。请试试看! @@ -74,7 +76,7 @@ via: https://opensource.com/article/19/12/pekwm-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 83d65b335080498a1718e160a9f9e3b37f24bd7a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Dec 2019 13:37:39 +0800 Subject: [PATCH 077/676] PUB @geekpi https://linux.cn/article-11670-1.html --- .../20191206 Pekwm- A lightweight Linux desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191206 Pekwm- A lightweight Linux desktop.md (98%) diff --git a/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md b/published/20191206 Pekwm- A lightweight Linux desktop.md similarity index 98% rename from translated/tech/20191206 Pekwm- A lightweight Linux desktop.md rename to published/20191206 Pekwm- A lightweight Linux desktop.md index 2e43e6021b..099fe46553 100644 --- a/translated/tech/20191206 Pekwm- A lightweight Linux desktop.md +++ b/published/20191206 Pekwm- A lightweight Linux desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11670-1.html) [#]: subject: (Pekwm: A lightweight Linux desktop) [#]: via: (https://opensource.com/article/19/12/pekwm-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From f205333fc20f835d2980d1448a22576d262c62ec Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Dec 2019 14:07:19 +0800 Subject: [PATCH 078/676] PRF @geekpi --- ...91209 Counting down the days using bash.md | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/translated/tech/20191209 Counting down the days using bash.md b/translated/tech/20191209 Counting down the days using bash.md index 83d656596b..e043997727 100644 --- a/translated/tech/20191209 Counting down the days using bash.md +++ b/translated/tech/20191209 Counting down the days using bash.md @@ -1,35 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Counting down the days using bash) [#]: via: (https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -用 bash 倒计时 +用 bash 倒计时日期 ====== -需要知道重要事件发生前有多少天吗?让 Linux bash 和 date 命令可以帮助你! + +> 需要知道重要事件发生前有多少天吗?让 Linux bash 和 date 命令可以帮助你! + +![](https://img.linux.net.cn/data/attachment/album/201912/13/140725vdc3c7zj0o7ozc7j.jpg) 随着即将来临的重要假期,你可能需要提醒你还要准备多久。 -幸运的是,你可以从 **date** 命令获得很多帮助。在本篇中,我们将研究 **date** 和 bash 脚本如何告诉你从今天到你预期的事件之间有多少天。 +幸运的是,你可以从 `date` 命令获得很多帮助。在本篇中,我们将研究 `date` 和 bash 脚本如何告诉你从今天到你预期的事件之间有多少天。 -首先,有几个提示如何进行。**date** 命令的 **%j** 选项将以 1 至 366 之间的数字显示当前日期。如你所想的一样,1 月 1 日将显示为 1,12 月 31 日将显示为 365 或 366,这取决于是否是闰年。继续尝试。你应该会看到以下内容: +首先,在进行之前有几个提示。`date` 命令的 `%j` 选项将以 1 至 366 之间的数字显示当前日期。如你所想的一样,1 月 1 日将显示为 1,12 月 31 日将显示为 365 或 366,这取决于是否是闰年。继续尝试。你应该会看到以下内容: ``` $ date +%j 339 ``` -但是,你可以通过以下方式,在 **date** 命令中得到一年中_任何_一天的数字: +但是,你可以通过以下方式,在 `date` 命令中得到一年中*任何*一天的数字: ``` $ date -d "Mar 18" +%j 077 ``` -要记住的是,即使该日期是过去的日期,此命令也会向你显示_当年_的日期。但是,你可以在命令中添加年来修复该问题: +要记住的是,即使该日期是过去的日期,上面命令也会向你显示*当年*的日期。但是,你可以在命令中添加年来修复该问题: ``` $ date -d "Apr 29" +%j @@ -58,7 +61,7 @@ esac 在此脚本中,我们获取 12 月 25 日和今天的日期,然后相减。如果结果是正数,我们将显示剩余天数。如果为零,则发出 “Merry Christmas” 的消息,如果为负,那么仅告诉运行脚本的人他们错过了假期。也许他们沉迷在蛋酒中了。 -case 语句由可打印的语句组成,剩余时间等于 0,或任意数字或以 **-** 符号开头的数字(也就是过去)。 +`case` 语句由用来打印信息的语句组成,当剩余时间等于 0,或任意数字或以 `-` 符号开头的数字(也就是过去)分别打印不同的信息。 对于人们想要关注的任何日期,都可以使用相同方法。实际上,我们可以要求运行脚本的人员提供日期,然后让他们知道从现在到那天还有多少天。这个脚本是这样的。 @@ -78,11 +81,11 @@ case $DAYS in esac ``` -使用此脚本会遇到的一个问题,如果运行该脚本的人希望知道到第二年这个特殊日子还有多少天,他们会感到失望。即使他们输入日期时提供了年,date -d 命令仍将仅提供金年中的天数,而不会提供从现在到那时的天数。 +使用此脚本会遇到的一个问题,如果运行该脚本的人希望知道到第二年这个特殊日子还有多少天,他们会感到失望。即使他们输入日期时提供了年,`date -d` 命令仍将仅提供今年中的天数,而不会提供从现在到那时的天数。 计算从今天到某年的日期之间的天数可能有些棘手。你需要包括所有中间年份,并注意那些闰年。 -### 使用 Unix(Epoch)时间 +### 使用 Unix 纪元时间 计算从现在到某个特殊日期之间的天数的另一种方法是利用 Unix 系统存储日期的方法。如果将自 1970 年 1 月 1 日开始的秒数转换为天数,那么就可以很容易地执行此操作,如下脚本所示: @@ -97,7 +100,7 @@ days=`expr $target - $today` echo "$days days until $target_date" ``` -解释一下,86400 是一天中的秒数。将自纪元开始以来的秒数除该数即为天数。 +解释一下,86400 是一天中的秒数。将自 Unix 纪元开始以来的秒数除该数即为天数。 ``` $ ./countdown @@ -105,8 +108,6 @@ Enter target date (e.g., Mar 18 2021)> Mar 18 2020 104 days until Mar 18 2020 ``` -加入 [Facebook][3] 和 [LinkedIn][4] 上的 Network World 社区,评论热门主题。 - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html @@ -114,7 +115,7 @@ via: https://www.networkworld.com/article/3487712/counting-down-the-days-using-b 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 29fdd2cb7fbf754d9427eb1b72d72268a584a220 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Dec 2019 14:07:56 +0800 Subject: [PATCH 079/676] PUB @geekpi https://linux.cn/article-11672-1.html --- .../20191209 Counting down the days using bash.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191209 Counting down the days using bash.md (98%) diff --git a/translated/tech/20191209 Counting down the days using bash.md b/published/20191209 Counting down the days using bash.md similarity index 98% rename from translated/tech/20191209 Counting down the days using bash.md rename to published/20191209 Counting down the days using bash.md index e043997727..d68dc742b6 100644 --- a/translated/tech/20191209 Counting down the days using bash.md +++ b/published/20191209 Counting down the days using bash.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11672-1.html) [#]: subject: (Counting down the days using bash) [#]: via: (https://www.networkworld.com/article/3487712/counting-down-the-days-using-bash.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 007c9a55f0880e5ec6a713399a3fd5d0b2e7856c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 13 Dec 2019 22:36:48 +0800 Subject: [PATCH 080/676] APL --- sources/tech/20191206 5 cool terminal pagers in Fedora.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191206 5 cool terminal pagers in Fedora.md b/sources/tech/20191206 5 cool terminal pagers in Fedora.md index 3797e9a6ea..91e2a31544 100644 --- a/sources/tech/20191206 5 cool terminal pagers in Fedora.md +++ b/sources/tech/20191206 5 cool terminal pagers in Fedora.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c05b8aa3b550526de34008448fd66f9b54225b43 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Dec 2019 01:20:38 +0800 Subject: [PATCH 081/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191212=207=20wa?= =?UTF-8?q?ys=20to=20remember=20Linux=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191212 7 ways to remember Linux commands.md --- ...91212 7 ways to remember Linux commands.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sources/tech/20191212 7 ways to remember Linux commands.md diff --git a/sources/tech/20191212 7 ways to remember Linux commands.md b/sources/tech/20191212 7 ways to remember Linux commands.md new file mode 100644 index 0000000000..18c06e8dca --- /dev/null +++ b/sources/tech/20191212 7 ways to remember Linux commands.md @@ -0,0 +1,32 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 ways to remember Linux commands) +[#]: via: (https://www.linux.com/tutorials/7-ways-to-remember-linux-commands/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +7 ways to remember Linux commands +====== + +Some Linux commands are very easy to remember. The names may have only a couple letters and they often relate directly to what you want to do – like cd for changing directories or pwd for displaying the present working directory. Others can be very difficult to remember, especially if what you want to do relies on using a series of options. + +So, let’s look at some commands and tricks that can help you remember commands that do just what you need them to do and that make issuing those commands so much easier. + +[Source: [Network World][1]] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/tutorials/7-ways-to-remember-linux-commands/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3489537/7-ways-to-remember-linux-commands.html From 8ab1b5286e7543cea5cee7e7fede441ba7274527 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Dec 2019 01:39:45 +0800 Subject: [PATCH 082/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191212=20Compan?= =?UTF-8?q?ies=20Prefer=20Hybrid=20Cloud=20to=20Escape=20Public=20Cloud=20?= =?UTF-8?q?Data=20Grabbity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md --- ...ud to Escape Public Cloud Data Grabbity.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/tech/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md diff --git a/sources/tech/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md b/sources/tech/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md new file mode 100644 index 0000000000..3b58213cf7 --- /dev/null +++ b/sources/tech/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity) +[#]: via: (https://www.linux.com/articles/companies-prefer-hybrid-cloud-to-escape-public-cloud-data-grabbity/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity +====== + +[![][1]][2] + +[![][1]][2] + +As the cloud native space is maturing, customers have started to discern the pros and cons of public cloud. They can see not just the facade of convenience and promised cost savings, but also the bills piling up and having to hand over critical business data to public cloud companies. + +[Red Hat recently conducted a global customer survey][3] about this and results indicate that customers prefer hybrid cloud over public cloud. More than 31% respondents actually used the term hybrid cloud as their cloud strategy. + +Rob Hirschfeld, founder and CEO of RackN and attendee of the recent [Gartner IT Infrastructure, Operations & Cloud Strategies Conference][4], noticed a similar tone. “Discussions and data from the Gartner IO Summit support that hybrid is preferred. There’s just so much existing infrastructure that it’s not practical to be ‘pure’ anything! It’s not so much that they want hybrid but that it’s the reality they are facing.” + +There are many reasons why customers prefer hybrid over public cloud or pure private cloud. Red Hat says it boils down to three factors: data security, cost benefits, and data integration. + +“Everyone accepts that cloud is secure; however, operators are starting to question how well they can control their data in cloud. Also, some of them don’t trust the cloud vendors, especially with some of the new analytics services,” said Hirschfeld. + +Hybrid cloud enables customers to balance all three factors highlighted in the Red Hat survey. They can move pieces of their infrastructure between public and private cloud depending on the need. It lets them reap the benefits of public cloud without having to compromise their data. + +Although 31% might seem like a small number, it doesn’t mean that the remaining 69% is running their workloads on public cloud. In fact, only 12% described themselves as having either a public cloud first strategy or a strategy to standardize on a single public cloud. Red Hat says 6% described their strategy as multi-cloud based on multiple public clouds, while 21% have a private cloud first strategy. + +In particular, EMEA respondents described themselves as having a private cloud strategy, not hybrid. This region is concerned about handing over their data to US-based cloud companies, given its current political landscape. A simple embargo on your country will cut your entire business out of the public cloud run by Google, AWS, and Azure. Some of the biggest use cases in this region involve companies building their own private and public cloud using OpenStack. + +Perhaps the most worrisome finding is that there are still companies without any concrete cloud strategy. Around 17% of the respondents were still working on a plan, while 12% respondents didn’t have any plan at all. Unfortunately, these companies are so far behind the curve that their future hangs in the balance. Hirschfeld warns that there is an urgency to cut their technical debt and embrace cloud now or they will find it hard to survive in the modern world. + +In fact, Hirschfeld states that you need to have a cloud strategy even if you don’t use cloud. “The reality is that cloud is the default deployment choice for everything — from demos and proof-of-concept to training — because it’s predictable and accessible.” Teams must adapt to the patterns, even if they are not adopting. + +The Red Hat survey found that companies do recognize the importance of building up technical skills. When asked to choose their top non-IT funding priorities, respondents chose both technical skills training (16%) and a digital transformation strategy (16%). + +However, new technologies and jargon are emerging at such a fast pace that it’s virtually impossible to find experts (or even skilled professionals) in technologies that were open-sourced at CNCF just a month ago. The hype/adoption curve is so accelerated that it has gotten silly. Therefore, porting to the latest shiny requires evaluation. + +“The reality is that new projects, even Kubernetes, still need baking time for scale operations. If there are not enough people with knowledge, then it’s OK (really, it’s required) to pick your battles or slow your adoption,” said Hirschfeld. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/companies-prefer-hybrid-cloud-to-escape-public-cloud-data-grabbity/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2019/12/computer-2930704_1280-1068x634.jpg (computer-2930704_1280) +[2]: https://www.linux.com/wp-content/uploads/2019/12/computer-2930704_1280.jpg +[3]: https://www.redhat.com/en/blog/red-hat-global-customer-tech-outlook-2020-hybrid-cloud-leads-strategy-aiml-leaps-forefront +[4]: https://www.gartner.com/en/conferences/na/infrastructure-operations-cloud-us From eaf1c7de53760f0f1c74b090ecca2ac7544cae91 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Dec 2019 01:40:24 +0800 Subject: [PATCH 083/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191214=20Make?= =?UTF-8?q?=20VLC=20More=20Awesome=20With=20These=20Simple=20Tips?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md --- ...VLC More Awesome With These Simple Tips.md | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md diff --git a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md new file mode 100644 index 0000000000..de91a1105b --- /dev/null +++ b/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make VLC More Awesome With These Simple Tips) +[#]: via: (https://itsfoss.com/simple-vlc-tips/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Make VLC More Awesome With These Simple Tips +====== + +[VLC][1] is one of the [best open source video players][2], if not the best. What most people don’t know about it is that it is a lot more than just a video player. + +You can do a lot of complex tasks like broadcasting live videos, capturing devices etc. Just open its menu and you’ll see how many options it has. + +It’s FOSS has a detailed tutorial discussing some of the [pro VLC tricks][3] but those are way too complicated for normal users. + +This is why I am writing another article to show you some of the simple tips that you can use with VLC. + +### Do more with VLC with these simple tips + +Let’s see what can you do with VLC other than just playing a video file. + +#### 1\. Watch YouTube videos with VLC + +![][4] + +If you do not want to watch the annoying advertisements on [YouTube][5] or simply want a distraction-free experience for watching a YouTube video, you can use VLC. + +Yes, it is very easy to stream a YouTube video on VLC. + +Simply launch the VLC player, head to the Media settings and click on “**Open Network Stream**” or **CTRL + N** as a shortcut to that. + +![][6] + +Next, you just have to paste the URL of the video that you want to watch. There are some options to tweak – usually, you should not bother using them. But, if you are curious you can click on the “**Advanced options**” to explore. + +You can also add subtitles to the YouTube videos this way. However, an easier way to [watch YouTube or any online video with subtitles is using Penguin subtitle player][7]. + +#### 2\. Convert videos to different formats + +![][8] + +You can [use ffmpeg to convert videos in Linux command line][9]. You can also use a graphical tool like [HandBrake to convert video formats][10]. + +But if you do not want a separate app to transcode videos, you can use VLC media player to get the job done. + +To do that, just head on to the Media option on VLC and then click on “**Convert/Save**” or press CTRL + R as a shortcut to get there while you have VLC media player active. + +Next, you will need to either import the video from your computer/disk or paste the URL of the video that you want to save/convert. + +Whatever your input source is – just hit the “**Convert/Save**” button after selecting the file. + +Now, you will find another window that gives you the option to change the “**Profile**” from the settings. Click on it and choose a format that you’d like the video to be converted to (and saved). + +You can also change the storage path for the converted file by setting the destination folder at the bottom of the screen before converting it. + +#### 3\. Record Audio/Video From Source + +![Vlc Advanced Controls][11] + +Do you want to record the audio/video you’re playing on VLC Media Player? + +If yes, there’s an easy solution to that. Simply navigate your way through **View->click on “Advanced Controls”**. + +Once you do that, you should observe new buttons (including a red record button in your VLC player). + +#### 4\. Download subtitles automatically + +![][12] + +Yes, you can [automatically download subtitles with VLC][13]. You do not even have to look for it on a separate website. You just have to navigate your way to **View->VLSub**. + +By default, it is deactivated, so when you click on the option it gets activated and lets you search/download the subtitles you wanted. + +[VLC also lets you synchronize the subtitles][14] with simple keyboard shortcuts. + +#### 5\. Take A Snapshot + +![][15] + +With VLC, you can get some screenshots/images of the video while watching it. + +You just need to right-click on the player while the video is playing/paused, you will notice a bunch of options now, navigate through **Video->Take Snapshot**. + +If you have an old version installed, you might observe the snapshot option right after performing a right-click. + +#### Bonus Tip: Add Audio/Video Effects to a video + +From the menu, go to the “**Tools**” option. Now, click on “**Effects and Filters**” or simply press **CTRL + E** from the VLC player window to open up the option. + +Here, you can observe audio effects and video effects that you can add to your video. You may not be able to see all the changes in real-time, so you will have to tweak it and save it in order to see what happens. + +![][16] + +I’ll suggest keeping a backup of the original video before you modify the video. + +#### What’s your favorite VLC tip? + +I shared some of my favourite VLC tips. Do you know some cool tip that you use regularly with VLC? Why not share it with us? I may add it to the list here. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/simple-vlc-tips/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.videolan.org/ +[2]: https://itsfoss.com/video-players-linux/ +[3]: https://itsfoss.com/vlc-pro-tricks-linux/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-stream.jpg?ssl=1 +[5]: https://www.youtube.com/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-play.jpg?ssl=1 +[7]: https://itsfoss.com/penguin-subtitle-player/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-video-convert.jpg?ssl=1 +[9]: https://itsfoss.com/ffmpeg/ +[10]: https://itsfoss.com/handbrake/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-advanced-controls.png?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-subtitles-automatic.png?ssl=1 +[13]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/ +[14]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-snapshot.png?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-effects-screenshot.jpg?ssl=1 From 19a0dfcbbba50fd363ffcb773d7efa3ad71e820e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Dec 2019 01:41:22 +0800 Subject: [PATCH 084/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191213=20Why=20?= =?UTF-8?q?you=20need=20to=20know=20about=20Seeed=20hardware=20devices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191213 Why you need to know about Seeed hardware devices.md --- ...ed to know about Seeed hardware devices.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20191213 Why you need to know about Seeed hardware devices.md diff --git a/sources/tech/20191213 Why you need to know about Seeed hardware devices.md b/sources/tech/20191213 Why you need to know about Seeed hardware devices.md new file mode 100644 index 0000000000..eec34577da --- /dev/null +++ b/sources/tech/20191213 Why you need to know about Seeed hardware devices.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why you need to know about Seeed hardware devices) +[#]: via: (https://opensource.com/article/19/12/seeeduino-nano-review) +[#]: author: (Alan Smithee https://opensource.com/users/alansmithee) + +Why you need to know about Seeed hardware devices +====== +Learn how Seeed microcontrollers solve the problem of building modular +projects. +![Multi-colored and directional network computer cables][1] + +The microcontroller craze doesn't seem to be dying down—and that's a good thing because these products consistently succeed where the mobile market consistently fails: Users get open software _and hardware_, a portable form factor, and a wide choice of vendors and products that are built to last. + +Among the best of the open hardware and software vendors is [Seeed][2], the self-proclaimed "IoT Hardware Enabler." I recently started seeing the Seeed logo on projects, so I contacted the company to learn about the interesting things they're doing. In response, they generously sent me one of their latest products: the [Seeeduino Nano][3], a compact board that the company says is fully compatible with the Arduino Nano but at half the price and a quarter the size, along with a sample sensor to get me started. + +I spent a few days with it, and I'm already working on a project to improve my home garden and thinking of several others for home automation. Far from just another Arduino-like product, the Seeeduino Nano solves several problems new makers face when they get a microcontroller and want to use it. + +### What do I do with this? + +The most common problem I hear from people underwhelmed by the Raspberry Pi, Arduino, or similar microcontroller is that they excitedly got a board, stepped through its tutorial, and then realized they didn't know what to do with it. As computer users, we're not used to purpose-driven devices. You get a computer-like device and use it for many purposes, so it feels strange to get a computing device and build it into a project. + +It can also be a little overwhelming to get a microcontroller. It's full of potential, but it's also just a microcontroller. It can be intimidating to figure out what kind of project to start when you have a device that apparently is capable of anything. + +Seeed has a line of input and output peripherals (they call it Grove) that are easy to connect and provide an easy way to modularly build projects based on what kind of information you want to process. There's nothing special about the Grove modules compared to sensors or servos you can get for any other device, but Seeed makes what can sometimes seem to be an overwhelming number of choices a lot more navigable. And better yet, Seeed provides libraries for each Grove module, so you'll never buy a part for your project then find that you don't know how to make your controller recognize it. + +Because Seeed sent me a temperature and humidity sensor, my potential projects, at least in the short term, became highly focused. I knew I'd be designing either a thermometer and humidity detector for my home or a moisture monitor for some of my favorite plants. Based on the other Grove modules, I've come up with several more projects, too. + +### Clean connectors + +What makes the Grove modules especially nice is that they're based around I2C connectors. That means you can turn this: + +![Cables and pins and alligator clips][4] + +into this: + +![The Seeeduino Nano with a Grove module connected][5] + +Of course, you can also solve that problem with any number of attachments for a Pi or Arduino or whatever product you happen to own, but the Seeed and Grove are built for one another, so if you're embarking on a new project, this is an easy way to keep things under control from the start. + +### Small footprint + +The Seeeduino Nano is small. It's just 18mm by 43mm (that's about 1.5" by 1"), yet it has eight analog pins, 14 digital pins, and features the ATmega328P 8-bit AVR microcontroller. If your project has space issues, this is a great option. + +![Seeeduino Nano microcontroller][6] + +The sensors tend to be small, too. Size varies depending on what you purchase, but they're generally designed to save space. + +![The Grove temperature and humidity pro \(left\) and a US quarter \(right\)][7] + +### Setup + +Getting started with the Seeeduino Nano was as easy as getting started with an Arduino. That's not always the case with Arduino-like products, because some of them assume you know the components they're built from. You might get a microcontroller, download the Arduino IDE, and discover that the product you purchased isn't an option in the Board menu, leaving you to guess which Arduino board yours is equivalent to. Seeed leaves nothing to chance and provides board definitions for all of its products. You have to import them yourself since they don't ship with the Arduino IDE, but the [Seeed wiki][8] provides instructions on how to do that through the IDE's Board Manager interface. + +After you've imported the board definition, you can either start with the ritual flashing of the Blink code onto your device or just code in the Arduino IDE as usual. There are instructions on the Seeed wiki for that, too. + +### Code + +In addition to board definitions, Seeed provides sample code for each Grove module, so you know how to send data to the module or gather data from it. I was using the Temperature and Humidity Pro sensor, which requires the [DHT library][9]. Seeed provides the library along with a DHTtester [project][10], and instructions on how to install it are on its wiki. + +The only thing Seeed doesn't provide is the name of the correct input pin for the Grove module. The project's example code, written by [LadyAda][11], uses the first analog pin (A0), but, on the Seeeduino Nano, the Grove attaches to what turns out to be A5. This is difficult to tell by looking at it, because the Grove physically attaches to the I2C plug, with no indication of what pin it's connected to. However, the Seeed is open source, so you can either look at the specs for the board, or you can just do what these kinds of gadgets beg you to do: experiment! + +In the end, the basic code to get information from the Grove humidity and temperature sensor is about 20 lines of code (25 if you build in sanity checks, as LadyAda's code does): + + +``` +// public domain code by ladyada +#include "DHT.h" +#define DHTPIN A5 +#define DHTTYPE DHT22 + +DHT dht(DHTPIN, DHTTYPE); + +void setup() { +  Serial.begin(9600); +  dht.begin(); } + +void loop() { +  float h = dht.readHumidity(); +  float t = dht.readTemperature(); +  Serial.print("Humidity: "); +  Serial.print(h); +  Serial.print(" %\t"); +  Serial.print("Temperature: "); +  Serial.print(t); +  Serial.println(" *C"); } +``` + +### Open source everything + +The Seeeduino is open source, from the [downloadable Eagle file][12] to the [software][13] that helps you drive it. It's a dream platform for new users who feel overwhelmed by confusing and disparate choices or for experienced makers who have moved on from a prototype and are ready to build a neatly organized and cleanly wired project. If you've got a budding inventor in your life, let Seeed help seed their projects. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/seeeduino-nano-review + +作者:[Alan Smithee][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alansmithee +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: http://seeedstudio.com +[3]: http://wiki.seeedstudio.com/Seeeduino-Nano/ +[4]: https://opensource.com/sites/default/files/uploads/rpi-mess.jpg (Cables and pins and alligator clips) +[5]: https://opensource.com/sites/default/files/uploads/seeeduino-grove.jpg (The Seeeduino Nano with a Grove module connected) +[6]: https://opensource.com/sites/default/files/uploads/seeeduino-nano-wiki_0.jpg (Seeeduino Nano microcontroller) +[7]: https://opensource.com/sites/default/files/uploads/tempandhumid.jpg (The Grove temperature and humidity pro (left) and a US quarter (right)) +[8]: http://wiki.seeedstudio.com/ +[9]: https://github.com/Seeed-Studio/Grove_Temperature_And_Humidity_Sensor/releases +[10]: https://project.seeedstudio.com/ +[11]: https://www.adafruit.com +[12]: https://github.com/SeeedDocument/Seeeduino-Nano/raw/master/res/Seeeduino%20nano.zip +[13]: https://github.com/Seeed-Studio From 61675c9c15dbec8481caa65616018766c569ddff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Dec 2019 01:42:02 +0800 Subject: [PATCH 085/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191213=20What?= =?UTF-8?q?=20GNOME=202=20fans=20love=20about=20the=20Mate=20Linux=20deskt?= =?UTF-8?q?op?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md --- ... fans love about the Mate Linux desktop.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md diff --git a/sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md b/sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md new file mode 100644 index 0000000000..80ecf157a1 --- /dev/null +++ b/sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What GNOME 2 fans love about the Mate Linux desktop) +[#]: via: (https://opensource.com/article/19/12/mate-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +What GNOME 2 fans love about the Mate Linux desktop +====== +This article is part of a special series of 24 days of Linux desktops. +If you remember GNOME 2 fondly, the Mate Linux desktop will fulfill your +need for nostalgia. +![Linux keys on the keyboard for a desktop computer][1] + +Stop me if you've heard this one before: When GNOME 3 was first released, many GNOME users were not ready to give up GNOME 2. The [Mate][2] (named after the _yerba mate_ plant) project began as an effort to continue the GNOME 2 desktop, at first using GTK 2 (the toolkit GNOME 2 was based upon) and later incorporating GTK 3. The desktop became wildly popular, due in no small part to Linux Mint's prompt adoption of it, and since then, it has become commonly available on Fedora, Ubuntu, Slackware, Arch, and many other Linux distributions. Today, Mate continues to deliver a traditional desktop environment that looks and feels exactly like GNOME 2 did, using the GTK 3 toolkit. + +You may find Mate included in the software repository of your Linux distribution, or you can download and [install][3] a distribution that ships Mate as its default desktop. Before you do, though, be aware that it is meant to provide a full desktop experience, so many Mate apps are installed along with the desktop. If you're running a different desktop, you may find yourself with redundant applications (two PDF readers, two media players, two file managers, and so on). If you just want to try the Mate desktop, you can install a Mate-based distribution in a virtual machine, such as [GNOME Boxes][4]. + +### Mate desktop tour + +The Mate project doesn't just evoke GNOME 2; it _is_ GNOME 2. If you were a fan of the Linux desktop back in the mid-'00s, at the very least, you'll find Mate nostalgic. I was not a fan of GNOME 2 and tended to use KDE instead, but there's one place I can't imagine without GNOME 2: [OpenSolaris][5]. The OpenSolaris project didn't last long, coming to prominence when Ian Murdock joined Sun Microsystems just before it was subsumed by Oracle, but I was a low-level Solaris admin at the time and used OpenSolaris to teach myself more about that flavor of Unix. It was the only platform where I used GNOME 2 (because I didn't know how to change the desktop at first and then just got used to it), and today the [OpenIndiana project][6], a community continuation of OpenSolaris, uses GNOME 2 by way of the Mate desktop. + +![Mate on OpenIndiana][7] + +Mate's layout consists of three menus in the top-left corner: Applications, Places, and System. The Applications menu provides quick access to all application launchers installed on the system. The Places menu provides quick access to common locations, such as your home directory, a network folder, and so on. The System menu contains global options, such as shutdown and suspend. In the upper-right corner is a system tray, and there's a taskbar and a virtual desktop pager at the bottom of the screen. + +It's a slightly peculiar configuration, as far as desktop design goes. It borrows equal parts from earlier Linux desktops, the Mac Finder, and Windows, but creates a unique configuration that's intuitive and somehow familiar. Mate intentionally resists deviation from this model, and that's exactly the way its users prefer it. + +### Mate and open source + +Mate is one of the most direct examples of how open source empowers developers to fight against a project's end of life. On paper, GNOME 2 was superseded by GNOME 3, yet it lives on because one developer forked the code and carried on. Momentum grew, more developers joined, and the desktop that users love is healthier than ever. Not all software gets a second chance at life, but the option is always there with open source, and it's always absent otherwise. + +Using and supporting open source means supporting user and developer freedom. And the Mate desktop is a powerful example of what happens when it works. + +Exploring different desktops is a good thing. I’ve recently converted to GNOME 3 ("hallowed be its... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/mate-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer) +[2]: https://mate-desktop.org/ +[3]: https://mate-desktop.org/install/ +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://en.wikipedia.org/wiki/OpenSolaris +[6]: https://www.openindiana.org/documentation/faq/#what-is-openindiana +[7]: https://opensource.com/sites/default/files/uploads/advent-mate-openindiana_675px.jpg (Mate on OpenIndiana) From 7e473e92e53094086ca0d7551efc8bff9de44da5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 14 Dec 2019 01:42:16 +0800 Subject: [PATCH 086/676] add done: 20191213 What GNOME 2 fans love about the Mate Linux desktop.md --- ...w to generate code with Apache Velocity.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20191213 How to generate code with Apache Velocity.md diff --git a/sources/tech/20191213 How to generate code with Apache Velocity.md b/sources/tech/20191213 How to generate code with Apache Velocity.md new file mode 100644 index 0000000000..ad431b0a55 --- /dev/null +++ b/sources/tech/20191213 How to generate code with Apache Velocity.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to generate code with Apache Velocity) +[#]: via: (https://opensource.com/article/19/12/generate-code-apache-velocity) +[#]: author: (Girish Managoli https://opensource.com/users/gammay) + +How to generate code with Apache Velocity +====== +Get started with Velocity, an open source, Java-based template engine +and code generator that converts templates into source code. +![Binary code on a computer screen][1] + +Apache [Velocity][2] is an open source, Java-based template engine and code generator that converts templates into source code. Because it is implemented in Java, it is capable of interpreting varied templates and generating code for any language (web, service, SQL, scripts, etc.), although it seems to be oriented mostly toward web development. + +## Velocity's structure + +Velocity's structure is comprised of an engine and tools. Its core is the Velocity Engine, which uses the defined template, interprets the template language, and generates the code. + +Templates are defined with Velocity Template Language ([VTL][3]), a simple language with effective directives. VTL statements are directives or variables, and variables can be standalone or class methods. + +Examples of VTL expressions include: + + +``` +`package ${packagename};`[/code] | Inserts a package statement in Java where the package name is defined as **packagename** +---|--- +``` +`public ${classname} implements Serializable {`[/code] | Adds a class with name **classname** + +``` + #foreach( $property in $properties ) + public ${property.fieldType} get${property.getField()}() { +     return this.${property.fieldName}; + } +#end [/code] | Creates getter methods for all defined properties + +Velocity tools are collections of basic user-friendly capabilities. There are [GenericTools][4], a "set of classes that provide basic infrastructure for using tools in standard Java SE Velocity projects, as well as a set of tools for use in generic Velocity templates." They include DateTool, MathTool, NumberTool, SortTool, and XmlTool. There are also [VelocityView][5] tools, which include "all of the GenericTools and adds infrastructure and specialized tools for using Velocity in the view layer of web applications (Java EE projects)." VelocityView tools include BrowserTool, CookieTool, and ImportTool + +## Velocity advantages and disadvantages + +Velocity is easy to use and has the capability to generate any language. On the downside, there is a learning curve to understand and apply its template language. Velocity is morphology- and ontology-free. It has no knowledge of the design capability of the module it generates. As a practical example, Velocity may use a template for a controller (e.g., Model-View-Controller or an architecture style) and generate the code, but it has no awareness of the concept of a controller. This is both an advantage and disadvantage, with a generator being simple and easy to use but with no awareness of the design's aptitude. + +## Using Velocity + +Velocity's Java library is available on the [Maven repository][6]. To use the .jar file, define Velocity's latest version in your Maven build config. (Velocity 1.7 is the latest version, as of this writing.) For example, enter the following in your Maven Project Object Model (POM): +``` + + +<dependency> +        <groupId>org.apache.velocity</groupId> +        <artifactId>velocity</artifactId> +        <version>1.7</version> +</dependency> + +``` +### Java Hello World example + +To generate code, you need two things: + + 1. The **Velocity template** to be used for generation, e.g., java_example.vm: [code] public class ${className} { + +    public static void main([String][7][] args) { +        [System][8].out.println("${message}"); +    } + +} +``` + + + + 2. The **Velocity generator** that uses the template to generate code, e.g., VelocityStartGenerator.java: [code] public class VelocityStartGenerator { +  +    static [String][7] inputTemplate = "java_example.vm"; +    static [String][7] className = "VelocityExample"; +    static [String][7] message = "Hello World!"; +    static [String][7] outputFile = className + ".java"; +        +    public static void main([String][7][] args) throws [IOException][9] { +        +        VelocityEngine velocityEngine = new VelocityEngine(); +        velocityEngine.init(); +      +        VelocityContext context = new VelocityContext(); +        context.put("className", className); +  \ No newline at end of file From 0a9b4670b7a04e94e3ecdbb041061164e307611d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 14 Dec 2019 10:12:30 +0800 Subject: [PATCH 087/676] Rename sources/tech/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md to sources/talk/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md --- ...es Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md (100%) diff --git a/sources/tech/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md b/sources/talk/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md similarity index 100% rename from sources/tech/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md rename to sources/talk/20191212 Companies Prefer Hybrid Cloud to Escape Public Cloud Data Grabbity.md From e6c3118c2ac715f7abff769a733bfd3e706034df Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Sat, 14 Dec 2019 11:07:33 +0800 Subject: [PATCH 088/676] translating --- sources/tech/20190322 Easy means easy to debug.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190322 Easy means easy to debug.md b/sources/tech/20190322 Easy means easy to debug.md index 4b0b4d52d2..e6cafacb66 100644 --- a/sources/tech/20190322 Easy means easy to debug.md +++ b/sources/tech/20190322 Easy means easy to debug.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( luming) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From aff24a1fa12424b4a56b0b48e1cb35d8ee1508b9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Dec 2019 11:24:16 +0800 Subject: [PATCH 089/676] TSL --- ...191206 5 cool terminal pagers in Fedora.md | 110 ------------------ ...191206 5 cool terminal pagers in Fedora.md | 103 ++++++++++++++++ 2 files changed, 103 insertions(+), 110 deletions(-) delete mode 100644 sources/tech/20191206 5 cool terminal pagers in Fedora.md create mode 100644 translated/tech/20191206 5 cool terminal pagers in Fedora.md diff --git a/sources/tech/20191206 5 cool terminal pagers in Fedora.md b/sources/tech/20191206 5 cool terminal pagers in Fedora.md deleted file mode 100644 index 91e2a31544..0000000000 --- a/sources/tech/20191206 5 cool terminal pagers in Fedora.md +++ /dev/null @@ -1,110 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 cool terminal pagers in Fedora) -[#]: via: (https://fedoramagazine.org/5-cool-terminal-pagers-in-fedora/) -[#]: author: (Jacob Burns https://fedoramagazine.org/author/jaek/) - -5 cool terminal pagers in Fedora -====== - -![][1] - -Large files like logs or source code can run into the thousands of lines. That makes navigating them difficult, particularly from the terminal. Additionally, most terminal emulators have a scrollback buffer of only a few hundred lines. That can make it impossible to browse large files in the terminal using utilities which print to standard output like _cat_, _head_ and _tail_. In the early days of computing, programmers solved these problems by developing utilities for displaying text in the form of virtual “pages” — utilities imaginatively described as _pagers_. - -Pagers offer a number of features which make text file navigation much simpler, including scrolling, search functions, and the ability to feature as part of a [pipeline][2] of commands. In contrast to most text editors, some terminal pagers do not require loading the entire file for viewing, which makes them faster, especially for very large files. - -In the modern era of Linux computing, terminal emulators are more sophisticated than ever. They offer support for a kaleidoscope of colors, terminal resizing, as well as a host of other features to make parsing text on screen easier and more efficient. Terminal pagers have undergone a similar evolution, from extremely simple UNIX utilities like _pg_ and _more_, to sophisticated programs with a wide range of features, covering any number of use cases. With this in mind, we’ve put together a list of some of the most popular terminal paging utilities — more or less. - -### More - -_more_ is one of the earliest pagers, initially featured in version 3.0 BSD. The first implementation of _more_ was written in 1978 by [Daniel Halbert][3]. Since then, _more_ has become a ubiquitous feature of many operating systems, including Windows, OS/2, MacOS and most linux distributions. - -_more_ is a very lightweight utility. The version featured in util-linux runs to just under 2100 lines of C. However, this small footprint comes at a price. Most versions of _more_ feature relatively limited functionality, with no support for backwards scroll or search. Commands are similarly stripped back: press enter to scroll one line, or space to scroll one page. Some other useful commands include: - - * Press v while reading to open the current file in your default terminal editor. - * ‘/_pattern_‘ let’s you search for the next occurrence of _pattern_. - * :n and :p will open the next and previous files respectively when more is called with more than one file as arguments - - - -### Less - -_less_ was initially conceived as a successor to _more_, addressing some of its limitations. Building on the functionality of _more_, _less_ adds a number of useful features including backwards scroll, backwards search. It is also more amenable to window resizing. - -Navigation in _less_ is similar to _more_, though _less_ borrows a few useful commands from the _vi_ editor as well. Users can navigate the document using the familiar home row navigational keys. A glance at the man page for _less_ reveals a fairly rich repertoire of available commands. Some particularly useful examples include: - - * ?_pattern_ lets you search backwards in the file for _pattern_ - * &_pattern_ shows only lines which feature _pattern_. This is particularly useful for those who find themselves issuing **$ grep pattern | less** regularly. - * Calling less with the -s (–sqeueeze-blank-lines) flag allows you to view text files with large gaps. Multiple newline characters are reduced to single breaks. - * s _filename_, called from within the program, saves input to _filename_ (if input is a pipe). - * Alternatively, calling less with the -o _filename_ flag will save the input of less to _filename._ - - - -With this enhanced functionality comes a little extra weight. The version of _less_ that ships with Fedora at the time of writing clocks in at around 25000 lines of source code. Granted, for all but the most storage constrained systems, this is a non-issue. Besides, _less_ is more than _more_. - -### Most - -While _less_ aims to expand on the existing capabilities of _more_, _most_ takes a different approach. Rather than expanding on the traditional single file view, _most_ gives users the ability to split their view into “windows.” Each window contains different files in different viewing modes. -Significantly, _most_ takes into account the width of its input text. The default viewing mode doesn’t wrap text (-S in less), a feature particularly useful when dealing with “wide” files. While these design decisions might represent a significant departure from tradition for some users, the end result is very powerful. - -In addition to the navigation commands offered by _more_, _most_ uses intuitive mnemonics for file navigation. For example, _**t**_ moves to the **t**op of a file, and _**b**_ moves to the bottom. As a result, users unfamiliar with _vi_ and its descendants will find most to be refreshingly simple. - -The distinguishing feature of _most_ is its ability to split windows and contexts quickly and easily. For example, one could open two distinct text files using the following: - -``` -$ most textFile1.txt textFile2.txt -``` - -In order to split the screen horizontally, use the key combos **Ctrl+x, 2** or **Ctrl+w, 2**. The command _:n_ will open the next file argument in a given window, offering a split screen view of two files: - -![][4] - -If you turn wrap off in one window, it does not affect the behavior of other windows. The \ character indicates a wrap or fold, while the $ character indicates that the file extends past the limitations of the current window. - -### pspg - -Those who work with SQL databases often need to be able to examine the contents of our databases at a glance. The command line interfaces for many popular open source DBMS’s, such as MySQL and PostGreSQL, use the system default pager to view outputs that don’t fit on a single screen. Utilities like _more_ and _less_ are designed around the idea of presenting text files, but for more structured data, leave something to be desired. Naive text paginating programs have no concept of broad, tabular data, which can be frustrating when dealing with large queries. - -[pspg][5] attempts to address this by offering users the ability to freeze columns while viewing, sort data _in situ_, and colourize output. While _pspg_ was intended initially to serve as a pager replacement for _psql_ specifically, the program also supports the viewing of CSV data, and is a suitable drop-in replacement for _mysql_ and _pgcli_. - -### Vim - -In a modern, technicolor terminal, the idea of endless pages of drab grey on black text can feel like something of an anachronism. The syntax highlighting options offered by powerful text editors like _vim_ can be useful for browsing source code. Furthermore, the search functions offered by _vim_ vastly outclass the competition. With this in mind, _vim_ ships with a shell script _less.sh_ that lets _vim_ serve as a replacement for conventional pagers. - -To set _vim_ as [the default pager][6] for man pages, add the following to your shell’s config (such as _~/.bashrc_ if using the default bash shell): - -``` -export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -\"" -``` - -Alternatively, to set _vim_ as the default pager system-wide, locate the _less.sh_ script. (You can find it at _/usr/share/vim/vim81/macros/_ on current Fedora systems.) Export this location as the variable _PAGER_ to set it as default, or under an alias to invoke it explicitly. - -* * * - -_Photo by [Cathy Mü][7] on [Unsplash][8]._ - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/5-cool-terminal-pagers-in-fedora/ - -作者:[Jacob Burns][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/jaek/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/5-pagers-816x345.jpg -[2]: https://fedoramagazine.org/command-line-quick-tips-using-pipes-to-connect-tools/ -[3]: https://danhalbert.org/more.html -[4]: https://fedoramagazine.org/wp-content/uploads/2019/11/image-2.png -[5]: https://github.com/okbob/pspg -[6]: https://zameermanji.com/blog/2012/12/30/using-vim-as-manpager/ -[7]: https://unsplash.com/@zyljosa?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText -[8]: https://unsplash.com/s/photos/pages?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/translated/tech/20191206 5 cool terminal pagers in Fedora.md b/translated/tech/20191206 5 cool terminal pagers in Fedora.md new file mode 100644 index 0000000000..6e5825ef44 --- /dev/null +++ b/translated/tech/20191206 5 cool terminal pagers in Fedora.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 cool terminal pagers in Fedora) +[#]: via: (https://fedoramagazine.org/5-cool-terminal-pagers-in-fedora/) +[#]: author: (Jacob Burns https://fedoramagazine.org/author/jaek/) + +5 最酷的终端分页器 +====== + +![][1] + +像日志或源代码这样的大文件可能会多达成千上万行,这使得在文件内导航非常困难,尤其是在终端上。此外,大多数终端仿真器的回滚缓冲区只有几百行。这可能使得无法使用打印到标准输出的实用程序(例如 `cat`、`head` 和 `tail`)在终端中浏览大型文件。在计算的早期,程序员通过开发用于以虚拟“页面”形式显示文本的实用程序来解决这些问题,该实用程序被形象地描述为分页器pager。 + +*分页器*提供了许多使文本文件导航更加简单的功能,包括滚动、搜索功能,以及作为命令[管道][2]的一部分而具有的功能。与大多数文本编辑器相比,某些终端分页器不需要加载整个文件即可查看,这使它们更快,特别是对于非常大的文件。 + +在现代 Linux 计算时代,终端仿真器比以往更加复杂。它们提供了对缤纷的色彩、终端大小调整以及许多其它功能的支持,这些功能使得辨析屏幕上的文本变得更加轻松和高效。从诸如 `pg` 和 `more` 这样极其简单的 UNIX 实用程序,到涵盖各种使用场景的、功能广泛的复杂程序,终端分页器经历了类似的演变。考虑到这一点,我们或多或少地汇总了一些最受欢迎的终端分页实用程序的列表。 + +### more + +`more` 是最早的分页器之一,最初在 3.0 BSD 版本中出现。`more` 的第一个实现由 [Daniel Halbert][3] 编写于 1978 年。从那时起,`more` 已成为许多操作系统的普遍功能,包括 Windows、OS/2,MacOS 和大多数 Linux 发行版。 + +`more` 是一个非常轻量级的实用程序。util-linux 软件包中提供的版本只有不到 2100 行的 C 语言。但是,这种较小的大小是有代价的。`more` 的大多数版本的功能相对有限,不支持向后滚动或搜索。命令也同样被精简:按回车键可滚动一行,或按空格键滚动一页。其他一些有用的命令包括: + +* 在阅读时按 `v` 键以在默认的终端编辑器中打开当前文件。 +* `/模式` 可以让你搜索下一个出现的“模式”。 +* 以多个文件作为参数调用 `more` 时,`:n` 和 `:p` 将分别打开下一个和上一个文件 +   +### less + +`less` 最初被认为是 `more` 的继承者,解决了它的一些局限性。`less` 以 `more` 的功能为基础,增加了许多有用的功能,包括向后滚动、向后搜索。它也更适合窗口大小调整。 + +`less` 中的导航与 `more` 类似,尽管 `less` 也从 `vi` 编辑器借用了一些有用的命令。用户可以使用熟悉的 home 行导航键浏览文档。看一眼 `less` 的手册页,就会发现相当多的可用命令。一些特别有用的示例包括: + +* `?模式` 可让你在文件中向后搜索“模式”。 +* `&模式` 仅显示具有“模式”特征的行。这对于发现自己经常要使用 `$ grep 模式 | less` 的人特别有用。 +* 使用 `-s`(`–sqeueeze-blank-lines`)标志来调用 `less`,使你可以查看空白较大的文本文件。 多个换行符被简化为单个中断。 +* 在程序中调用的 `s 文件名` 将输入保存到 `文件名`中(如果输入来自管道)。 +* 或者,使用 `-o 文件名` 标志来调用 `less` 将把 `less` 的输入保存到 `文件名` 中。 +   +随着这些增强的功能也带来了体积的略微增大。在写作本文时,Fedora 随附的 `less` 版本大约有 25000 行源代码。当然,除非是受存储限制最大的系统,其它的所有系统上这都不是问题。此外,`less` 比 `more` 功能更多。 + +### most + +`less` 旨在扩展 `more` 的现有功能,而 `most` 采用另一种方法。`most` 不是在传统的单个文件视图上进行扩展,而是使用户能够将其视图拆分为“窗口”。每个窗口以不同的查看模式包含不同的文件。 + +重要的是,`most` 考虑了其输入文本的宽度。默认的查看模式是不换行的(`less` 中的 `-S` 参数),此功能在处理“宽”文件时特别有用。尽管对于某些用户来说,这些设计决策可能代表着与传统的重大偏离,但最终结果却非常强大。 + +除了 `more` 提供的导航命令外,`most` 使用直观的助记符进行文件导航。例如,`t` 移至文件的顶部(Top),而 `b` 移至底部(Bottom)。这样,不熟悉 `vi` 及其后代的用户会发现 `most` 非常简单好用。 + +`most` 的与众不同之处在于它能够快速轻松地拆分窗口和上下文。例如,可以使用以下命令打开两个不同的文本文件: + +``` +$ most textFile1.txt textFile2.txt +``` + +为了水平拆分屏幕,请使用组合键 `Ctrl+x, 2` 或 `Ctrl+w, 2`。 `:n` 命令将在给定窗口中打开下一个文件参数,提供两个文件的分屏视图: + +![][4] + +如果在一个窗口中关闭自动换行,它不会影响其他窗口的行为。`\` 字符表示换行或折叠,而 `$` 字符表示文件超出了当前窗口的限制。 + +### pspg + +使用 SQL 数据库的人员通常需要能够一目了然地检查我们数据库的内容。许多流行的开源 DBMS(例如 MySQL 和 PostGreSQL)的命令行界面都使用系统默认的分页器来查看无法显示在单个屏幕上的输出。诸如`more` 和 `less` 之类的实用程序是围绕呈现文本文件的想法而设计的,但是对于更结构化的数据,还有一些不足之处。天真的文本分页程序没有宽的表格数据的概念,当处理大型查询时,这可能会令人感到沮丧。 + +[pspg][5] 试图通过为用户提供在查看时冻结列、*原位*排序数据并为输出着色的功能来解决此问题。尽管`pspg` 最初是专门用作 `psql` 的分页器的替代品,但该程序还支持查看 CSV 数据,并且是 `mysql` 和 `pgcli` 的合适的直接替代品。 + +### Vim + +在现代的颜色鲜明的终端中,无休止的黑色页面上的黑色文字感觉太过时了。强大的文本编辑器(如`vim` )提供的语法高亮显示选项对于浏览源代码很有用。此外,`vim` 提供的搜索功能远远超过了竞争对手。考虑到这一点,`vim` 附带了一个 shell 脚本 `less.sh`,该脚本可以使 `vim` 替代传统的分页器。 + +要将 `vim` 设置为手册页的[默认分页器][6],请将以下内容添加到 shell 的配置中(如果使用默认的bash shell 的话是 `~/.bashrc`): + +``` +export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -\"" +``` + +或者,要将 `vim` 设置为系统范围内的默认分页器,请找到 `less.sh` 脚本。(你可以在当前 Fedora 系统上的 `/usr/share/vim/vim81/macros/` 找到它。)将此位置导出为变量 `PAGER` 以将其设置为默认值,或者将其设置为别名以显式调用它。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/5-cool-terminal-pagers-in-fedora/ + +作者:[Jacob Burns][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/jaek/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/5-pagers-816x345.jpg +[2]: https://fedoramagazine.org/command-line-quick-tips-using-pipes-to-connect-tools/ +[3]: https://danhalbert.org/more.html +[4]: https://fedoramagazine.org/wp-content/uploads/2019/11/image-2.png +[5]: https://github.com/okbob/pspg +[6]: https://zameermanji.com/blog/2012/12/30/using-vim-as-manpager/ +[7]: https://unsplash.com/@zyljosa?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[8]: https://unsplash.com/s/photos/pages?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From baf365cb2c0e0e7e7c35466cc4074188d93c420e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Dec 2019 12:49:46 +0800 Subject: [PATCH 090/676] PRF @wxy --- ...job interview questions you should know.md | 109 +++++++++--------- 1 file changed, 54 insertions(+), 55 deletions(-) diff --git a/translated/tech/20190725 24 sysadmin job interview questions you should know.md b/translated/tech/20190725 24 sysadmin job interview questions you should know.md index 9650f4fd9d..9dbc9aa0ca 100644 --- a/translated/tech/20190725 24 sysadmin job interview questions you should know.md +++ b/translated/tech/20190725 24 sysadmin job interview questions you should know.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (24 sysadmin job interview questions you should know) @@ -10,11 +10,11 @@ 24 个必知必会的系统管理员面试问题 ====== -> 即将进行系统管理员工作面试吗? 阅读本文,了解你可能会遇到的一些问题以及可能的答案。 +> 即将进行系统管理员工作面试吗?阅读本文,了解你可能会遇到的一些问题以及可能的答案。 -![Question and answer.][1] +![](https://img.linux.net.cn/data/attachment/album/201912/14/124906g3vrkr3vrvqdkw7f.jpg) -作为一个经常与计算机打交道的极客,在硕士毕业后在 IT 行业选择我的职业是很自然的选择。因此,我认为走上系统管理员之路是正确的路径。在我的职业生涯中,我对求职面试过程非常熟悉。现在来看一下该职位的预期、职业发展道路,以及一系列常见问题和我的回答。 +作为一个经常与计算机打交道的极客,在硕士毕业后在 IT 行业选择我的职业是很自然的选择。因此,我认为走上系统管理员之路是正确的路径。在我的职业生涯中,我对求职面试过程非常熟悉。现在来看一下对该职位的预期、职业发展道路,以及一系列常见面试问题及我的回答。 ### 系统管理员的典型任务和职责 @@ -22,13 +22,13 @@ 你是对的。现在,一般来说,让我们看一下典型的系统管理员的日常任务。根据公司的需求和人员的技能水平,系统管理员的任务从管理台式机、笔记本电脑、网络和服务器到设计组织的 IT 策略不等。有时,系统管理员甚至负责购买和订购新的 IT 设备。 -那些寻求系统管理工作作为其职业道路的人可能会发现,由于 IT 领域的快速变化是不可避免的,因此难以保持其技能和知识的最新状态。所有人都会想到的下一个自然而然的问题是 IT 专业人员如何掌握最新的更新和技能。 +那些寻求系统管理工作以作为其职业发展道路的人可能会发现,由于 IT 领域的快速变化是不可避免的,因此难以保持其技能和知识的最新状态。所有人都会想到的下一个自然而然的问题是 IT 专业人员如何掌握最新的更新和技能。 -### 小意思 +### 简单的问题 这是你将遇到的一些最基本的问题,以及我的答案: -1、在 *nix 服务器上登录后键入的前五个命令是什么? +**1、你在 \*nix 服务器上登录后键入的前五个命令是什么?** > * `lsblk` 以查看所有的块设备信息 > * `who` 查看谁登录到服务器 @@ -36,21 +36,21 @@ > * `df -khT` 以查看服务器上可用的磁盘容量 > * `netstat` 以查看哪些 TCP 网络连接处于活动状态 -2、如何使进程在后台运行,这样做的好处是什么? +**2、如何使进程在后台运行,这样做的好处是什么?** -> 你可以通过在命令末尾添加特殊字符 `&` 来使进程在后台运行。通常,执行时间太长并且不需要用户交互的应用程序会放到后台,以便我们可以在终端中继续工作。([引文][2]) +> 你可以通过在命令末尾添加特殊字符 `&` 来使进程在后台运行。通常,执行时间太长并且不需要用户交互的应用程序可以放到后台,以便我们可以在终端中继续工作。([引文][2]) -3、以 root 用户身份运行这些命令是好事还是坏事? +**3、以 root 用户身份运行这些命令是好事还是坏事?** -> 由于两个主要问题,以 root 身份运行(任何命令)是不好的。第一个是*风险*。当你以 **root** 身份登录时,无法避免你犯粗心大意的错误。如果你尝试以带有潜在危害的方式更改系统,则需要使用 `sudo`,它会引入一个暂停(在你输入密码时),以确保你不会犯错。 +> 由于两个主要问题,以 root 身份运行(任何命令)是不好的。第一个是*风险*。当你以 **root** 身份登录时,无法避免你由于粗心大意而犯错。如果你尝试以带有潜在危害的方式更改系统,则需要使用 `sudo`,它会引入一个暂停(在你输入密码时),以确保你不会犯错。 > -> 第二个原因是*安全*。如果你不知道管理员用户的登录信息,则系统更难被攻击。拥有 root 的访问权限意味着你已经拥有管理员凭据工作集的一半。 +> 第二个原因是*安全*。如果你不知道管理员用户的登录信息,则系统更难被攻击。拥有 root 的访问权限意味着你已经能够进行管理员身份下的一半工作任务。 -4、`rm` 和 `rm -rf` 有什么区别? +**4、`rm` 和 `rm -rf` 有什么区别?** -> `rm` 命令本身仅删除指明的文件(而不删除目录)。使用 `-rf` 标志,你添加了两个附加功能:`-r`、`-R` 或 `--recursive` 标志递归删除目录的内容,包括隐藏的文件和子目录;而 `-f`或 `--force` 标志使 `rm` 忽略不存在的文件,并且从不提示你进行确认。 +> `rm` 命令本身仅删除指明的文件(而不删除目录)。使用 `-rf` 标志,你添加了两个附加功能:`-r`(或等价的 `-R`、`--recursive`)标志可以递归删除目录的内容,包括隐藏的文件和子目录;而 `-f`(或 `--force`)标志使 `rm` 忽略不存在的文件,并且从不提示你进行确认。 -5、有一个大小约为 15GB 的 `Compress.tgz` 文件。你如何列出其内容,以及如何仅提取出特定文件? +**5、有一个大小约为 15GB 的 `Compress.tgz` 文件。你如何列出其内容,以及如何仅提取出特定文件?** > 要列出文件的内容: > @@ -60,92 +60,91 @@ > > `tar xf archive.tgz filename` -### 中等意思 +### 有点难度的问题 这是你可能会遇到的一些较难的问题,以及我的答案: -6、什么是 RAID?什么是 RAID 0、RAID 1、RAID 5、RAID 6 和 RAID 10? +**6、什么是 RAID?什么是 RAID 0、RAID 1、RAID 5、RAID 6 和 RAID 10?** > RAID(廉价磁盘冗余阵列Redundant Array of Inexpensive Disks)是一种用于提高数据存储性能和/或可靠性的技术。RAID 级别为: > > * RAID 0:也称为磁盘条带化,这是一种分解文件并将数据分布在 RAID 组中所有磁盘驱动器上的技术。它没有防止磁盘失败的保障。([引文][3]) -> * RAID 1:一种流行的磁盘子系统,通过在两个驱动器上写入相同的数据来提高安全性。 RAID 1 被称为*镜像*,它不会提高写入性能,但读取性能可能会提高到每个磁盘性能的总和。另外,如果一个驱动器发生故障,则使用第二个驱动器,发生故障的驱动器要手动更换。更换后,RAID 控制器将可工作的驱动器的内容复制到新驱动器上。 +> * RAID 1:一种流行的磁盘子系统,通过在两个驱动器上写入相同的数据来提高安全性。RAID 1 被称为*镜像*,它不会提高写入性能,但读取性能可能会提高到每个磁盘性能的总和。另外,如果一个驱动器发生故障,则会使用第二个驱动器,发生故障的驱动器需要手动更换。更换后,RAID 控制器会将可工作的驱动器的内容复制到新驱动器上。 > * RAID 5:一种磁盘子系统,可通过计算奇偶校验数据来提高安全性和提高速度。RAID 5 通过跨三个或更多驱动器交错数据(条带化)来实现此目的。在单个驱动器发生故障时,后续读取可以从分布式奇偶校验计算出,从而不会丢失任何数据。 > * RAID 6:通过添加另一个奇偶校验块来扩展 RAID 5。此级别至少需要四个磁盘,并且可以在任何两个并发磁盘故障的情况下继续执行读/写操作。RAID 6 不会对读取操作造成性能损失,但由于与奇偶校验计算相关的开销,因此确实会对写入操作造成性能损失。 > * RAID 10:RAID 10 也称为 RAID 1 + 0,它结合了磁盘镜像和磁盘条带化功能来保护数据。它至少需要四个磁盘,并且跨镜像对对数据进行条带化。只要每个镜像对中的一个磁盘起作用,就可以检索数据。如果同一镜像对中的两个磁盘发生故障,则所有数据将丢失,因为带区集中没有奇偶校验。([引文][4]) -7、`ping` 命令使用哪个端口? +**7、`ping` 命令使用哪个端口?** -> `ping` 命令使用 ICMP。具体来说,它使用 ICMP 回显请求和 ICMP 回显应答包。 +> `ping` 命令使用 ICMP。具体来说,它使用 ICMP 回显请求和应答包。 > > ICMP 不使用 UDP 或 TCP 通信服务:相反,它使用原始的 IP 通信服务。这意味着,ICMP 消息直接承载在 IP 数据报数据字段中。 -8、路由器和网关之间有什么区别? 什么是默认网关? +**8、路由器和网关之间有什么区别?什么是默认网关?** > *路由器*描述的是一种通用技术功能(第 3 层转发)或用于该目的的硬件设备,而*网关*描述的是本地网段的功能(提供到其他地方的连接性)。你还可以说“将路由器设置为网关”。另一个术语是“跳”,它描述了子网之间的转发。 > ->术语*默认网关*表示局域网上的路由器,它的责任是作为向局域网外部计算机通信的第一个联系点。 +> 术语*默认网关*表示局域网上的路由器,它的责任是作为对局域网外部的计算机通信的第一个联系点。 -9、解释一下 Linux 的引导过程。 +**9、解释一下 Linux 的引导过程。** -> BIOS -> 主引导记录(MBR) -> GRUB -> 内核 -> 初始化 -> 运行级 +> BIOS -> 主引导记录(MBR) -> GRUB -> 内核 -> 初始化 -> 运行级 -10、服务器启动时如何检查错误消息? +**10、服务器启动时如何检查错误消息?** > 内核消息始终存储在 kmsg 缓冲区中,可通过 `dmesg` 命令查看。 > -> 引导的问题和错误要求系统管理员结合某些特定命令来查看某些重要文件,这些文件不同版本的 Linux 处理不同: +> 引导出现的问题和错误要求系统管理员结合某些特定命令来查看某些重要文件,这些文件不同版本的 Linux 处理方式不同: > > * `/var/log/boot.log` 是系统引导日志,其中包含系统引导过程中展开的所有内容。 > * `/var/log/messages` 存储全局系统消息,包括系统引导期间记录的消息。 > * `/var/log/dmesg` 包含内核环形缓冲区信息。 -11、符号链接和硬链接有什么区别? +**11、符号链接和硬链接有什么区别?** -> *符号链接*或*软链接*实际是是到原始文件的链接,而*硬链接*是原始文件的镜像副本。如果删除原始文件,则该软链接就没有用了,因为它指向的文件不存在了。如果是硬链接,则完全相反。如果删除原始文件,则硬链接仍然包含原始文件中的数据。([引文][5]) +> *符号链接*(*软链接*)实际是到原始文件的链接,而*硬链接*是原始文件的镜像副本。如果删除原始文件,则该软链接就没有用了,因为它指向的文件不存在了。如果是硬链接,则完全相反。如果删除原始文件,则硬链接仍然包含原始文件中的数据。([引文][5]) -12、如何更改内核参数?你可能需要调整哪些内核选项? +**12、如何更改内核参数?你可能需要调整哪些内核选项?** > 要在类 Unix 系统中设置内核参数,请首先编辑文件 `/etc/sysctl.conf`。进行更改后,保存文件并运行 `sysctl -p` 命令。此命令使更改永久生效,而无需重新启动计算机 -13、解释一下 `/proc` 文件系统。 +**13、解释一下 `/proc` 文件系统。** -> `/proc` 文件系统是虚拟的,并提供有关内核、硬件和正在运行的进程的详细信息。由于 `/proc` 包含虚拟文件,因此称为“虚拟文件系统”。这些虚拟文件具有独特性。其中大多数列为零字节。 +> `/proc` 文件系统是虚拟的,并提供有关内核、硬件和正在运行的进程的详细信息。由于 `/proc` 包含虚拟文件,因此称为“虚拟文件系统”。这些虚拟文件具有独特性。其中大多数显示为零字节。 > > 虚拟文件,例如 `/proc/interrupts`、`/proc/meminfo`、`/proc/mounts` 和 `/proc/partitions`,提供了系统硬件的最新信息。其他诸如 `/proc/filesystems` 和 `/proc/sys` 目录提供系统配置信息和接口。 -14、如何在没有密码的情况下以其他用户身份运行脚本? +**14、如何在没有密码的情况下以其他用户身份运行脚本?** > 例如,如果你可以编辑 sudoers 文件(例如 `/private/etc/sudoers`),则可以使用 `visudo` 添加以下[内容][2]: > > `user1 ALL =(user2)NOPASSWD:/opt/scripts/bin/generate.sh` -> -15、什么是 UID 0 toor 帐户?是被入侵了么? +**15、什么是 UID 0 toor 帐户?是被入侵了么?** > `toor` 用户是备用的超级用户帐户,其中 `toor` 是 `root` 反向拼写。它预期与非标准 shell 一起使用,因此 `root` 的默认 shell 不需要更改。 > -> 此用途很重要。这些 shell 不是基本发行版的一部分,而是从 ports 或软件包安装的,它们安装在 `/usr/local/bin` 中,默认情况下,位于其他文件系统上。如果 root 的 shell 位于 `/usr/local/bin` 中并且未挂载包含 `/usr/local/bin` 的文件系统,则 root 无法登录以解决问题,并且系统管理员必须重新启动进入为单用户模式来输入 shell 程序的路径。 +> 此用途很重要。这些 shell 不是基本发行版的一部分,而是从 ports 或软件包安装的,它们安装在 `/usr/local/bin` 中,默认情况下,位于其他文件系统上。如果 root 的 shell 位于 `/usr/local/bin` 中,并且未挂载包含 `/usr/local/bin` 的文件系统,则 root 无法登录以解决问题,并且系统管理员必须重新启动进入单用户模式来输入 shell 程序的路径。 -### 小目标? +### 更难的问题 这是你可能会遇到的甚至更困难的问题: -16、`tracert` 如何工作,使用什么协议? +**16、`tracert` 如何工作,使用什么协议?** -> 命令 `tracert`(或 `traceroute`,具体取决于操作系统)使你可以准确地看到在连接到最终目的地的连接链条中触及的路由器。如果你遇到无法连接或无法 `ping` 通最终目的地的问题,则可以使用 `tracert` 来帮助你确定连接链在何处停止。 ([引文][6]) +> 命令 `tracert`(或 `traceroute`,具体取决于操作系统)使你可以准确地看到在连接到最终目的地的连接链条中所触及的路由器。如果你遇到无法连接或无法 `ping` 通最终目的地的问题,则可以使用 `tracert` 来帮助你确定连接链在何处停止。([引文][6]) > > 通过此信息,你可以联系正确的人;无论是你自己的防火墙、ISP、目的地的 ISP 还是中间的某个位置。 `tracert` 命令像 `ping` 一样使用 ICMP 协议,但也可以使用 TCP 三步握手的第一步来发送 SYN 请求以进行响应。 -17、使用 `chroot` 的主要优点是什么?我们何时以及为什么使用它?在 chroot 环境中,`mount /dev`、`mount /proc` 和 `mount /sys` 命令的作用是什么? +**17、使用 `chroot` 的主要优点是什么?我们何时以及为什么使用它?在 chroot 环境中,`mount /dev`、`mount /proc` 和 `mount /sys` 命令的作用是什么?** > chroot 环境的优点是文件系统与物理主机是隔离的,因为 chroot 在文件系统内部有一个单独的文件系统。区别在于 `chroot` 使用新创建的根目录(`/`)作为其根目录。 > -> chroot 监狱可让你将进程及其子进程与系统其余部分隔离。它仅应用于不以 root 身份运行的进程,因为 root 用户可以轻松地脱离监狱。 +> chroot 监狱可让你将进程及其子进程与系统其余部分隔离。它仅应用于不以 root 身份运行的进程,因为 root 用户可以轻松地脱离监狱。 > -> 该思路是创建一个目录树,在其中复制或链接运行该进程所需的所有系统文件。然后,你可以使用 `chroot()` 系统调用来告诉它根目录现在位于此新树的基点上,然后启动在该 chroot 环境中运行的进程。由于该命令因此而无法引用修改后的根目录之外的路径,因此它无法在这些位置上恶意执行操作(读取、写入等)。([引文][7]) +> 该思路是创建一个目录树,在其中复制或链接运行该进程所需的所有系统文件。然后,你可以使用 `chroot()` 系统调用来告诉它根目录现在位于此新树的基点上,然后启动在该 chroot 环境中运行的进程。由于该命令因此而无法引用修改后的根目录之外的路径,因此它无法在这些位置上执行恶意操作(读取、写入等)。([引文][7]) -18、如何保护你的系统免遭黑客攻击? +**18、如何保护你的系统免遭黑客攻击?** > 遵循最低特权原则和这些做法: > @@ -155,33 +154,33 @@ > * 定期检查你的例外情况。 > * 让具体的人对失败负责。(它使你保持警惕。)([引文][8]) -19、什么是 LVM,使用 LVM 有什么好处? +**19、什么是 LVM,使用 LVM 有什么好处?** -> LVM(逻辑卷管理)使用一种存储设备管理技术,该技术使用户能够合并和抽象化组件存储设备的物理布局,从而可以更轻松、灵活地进行管理。使用设备映射器 Linux 内核框架,当前迭代(LVM2)可用于将现有存储设备收集到组中,并根据需要从组合的空间分配逻辑单元。 +> LVM(逻辑卷管理)是一种存储设备管理技术,该技术使用户能够合并和抽象化组件存储设备的物理布局,从而可以更轻松、灵活地进行管理。使用设备映射器的 Linux 内核框架,当前迭代(LVM2)可用于将现有存储设备收集到组中,并根据需要从组合的空间分配逻辑单元。 -20、什么是粘性端口? +**20、什么是粘性端口?** > 粘性端口是网络管理员最好的朋友,也是最头痛的事情之一。它们允许你设置网络,以便通过将交换机上的每个端口锁定到特定的 MAC 地址,仅允许一台(或你指定的数字)计算机在该端口上进行连接。 -21、解释一下端口转发? +**21、解释一下端口转发?** -> 尝试与安全的网络内部的系统进行通信时,从外部进行通信可能非常困难,这是很显然的。因此,在路由器本身或其他连接管理设备中使用端口转发表可以使特定流量自动转发到特定目的地。例如,如果你的网络上运行着一台 Web 服务器,并且想从外部授予对该服务器的访问权限,则可以将端口转发设置为该服务器上的端口 80。这意味着在网络浏览器中输入你的(外网)IP 地址的任何人都将立即连接到服务器的网站。 +> 尝试与安全的网络内部的系统进行通信时,从外部进行通信可能非常困难,这是很显然的。因此,在路由器本身或其他连接管理设备中使用端口转发表可以使特定流量自动转发到特定目的地。例如,如果你的网络上运行着一台 Web 服务器,并且想从外部授予对该服务器的访问权限,则可以将端口转发设置为该服务器上的端口 80。这意味着在 Web 浏览器中输入你的(外网)IP 地址的任何人都将立即连接到该服务器的网站。 > > 请注意,通常不建议允许从你的网络外部直接访问服务器。 -22、对于 IDS,误报和漏报是什么? +**22、对于 IDS,误报和漏报是什么?** > 当入侵检测系统(IDS)设备为实际上没有发生的入侵生成警报时,这是误报(假阳性)false positive。如果设备未生成任何警报,而入侵实际上已发生,则为漏报(假阴性)。 -23、解释一下 `:(){ :|:& };:`,如果已经登录系统,如何停止此代码? +**23、解释一下 `:(){ :|:& };:`,如果已经登录系统,如何停止此代码?** > 这是一枚复刻炸弹。它分解如下: > -> * `:()` 定义了函数,以 `:` 作为函数名,并且空括号表示它将不接受任何参数。 +> * `:()` 定义了函数,以 `:` 作为函数名,并且空括号表示它不接受任何参数。 > * `{}` 是函数定义的开始和结束。 > * `:|:` 将函数 `:` 的副本加载到内存中,并将其输出通过管道传递给函数 `:` 的另一个副本,该副本也必须加载到内存中。 > * `&` 使前一个命令行成为后台进程,因此即使父进程被自动杀死,子进程也不会被杀死。 -> * `:` 再次执行该函数,因此连锁反应开始。 +> * `:` 执行该函数,因此连锁反应开始。 > > 保护多用户系统的最佳方法是使用特权访问管理(PAM)来限制用户可以使用的进程数。 > @@ -195,7 +194,7 @@ > > 对于复刻炸弹,最好的选择是防患于未然。 -24、什么是 OOM 杀手,它如何决定首先杀死哪个进程? +**24、什么是 OOM 杀手,它如何决定首先杀死哪个进程?** > 如果内存被进程彻底耗尽,可能会威胁到系统的稳定性,那么内存不足out of memory(OOM)杀手就登场了。 > @@ -205,11 +204,11 @@ > > `$ cat /proc/10292/oom_score` > -> 任何进程的 `oom_score` 值越高,在内存不足的情况下被 OOM 杀手杀死的可能性就越高。 ([引文][9]) +> 任何进程的 `oom_score` 值越高,在内存不足的情况下被 OOM 杀手杀死的可能性就越高。([引文][9]) ### 总结 -系统管理人员的薪水[差别很大][10],有些网站上说年薪在 70,000 到 100,000 美元之间,具体取决于地点、组织的规模以及你的教育水平以及多年的工作经验。最后,系统管理的职业道路归结为你对使用服务器和解决那些酷问题的兴趣。现在,我要说,继续前进,实现你的梦想之路吧! +系统管理人员的薪水[差别很大][10],有些网站上说年薪在 70,000 到 100,000 美元之间,具体取决于地点、组织的规模以及你的教育水平以及多年的工作经验。系统管理的职业道路最终归结为你对使用服务器和解决那些酷问题的兴趣。现在,我要说,继续前进,实现你的梦想之路吧! -------------------------------------------------------------------------------- @@ -218,7 +217,7 @@ via: https://opensource.com/article/19/7/sysadmin-job-interview-questions 作者:[DirectedSoul][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 91f7ab4ea5090522e1e25efe9b1685fae6e3889a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Dec 2019 12:50:14 +0800 Subject: [PATCH 091/676] PUB @wxy https://linux.cn/article-11673-1.html --- ...725 24 sysadmin job interview questions you should know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190725 24 sysadmin job interview questions you should know.md (99%) diff --git a/translated/tech/20190725 24 sysadmin job interview questions you should know.md b/published/20190725 24 sysadmin job interview questions you should know.md similarity index 99% rename from translated/tech/20190725 24 sysadmin job interview questions you should know.md rename to published/20190725 24 sysadmin job interview questions you should know.md index 9dbc9aa0ca..b2b6f9b812 100644 --- a/translated/tech/20190725 24 sysadmin job interview questions you should know.md +++ b/published/20190725 24 sysadmin job interview questions you should know.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11673-1.html) [#]: subject: (24 sysadmin job interview questions you should know) [#]: via: (https://opensource.com/article/19/7/sysadmin-job-interview-questions) [#]: author: (DirectedSoul https://opensource.com/users/directedsoul) From 67acd093821006b64f6b4f8516f36eb16e072e31 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Dec 2019 15:05:14 +0800 Subject: [PATCH 092/676] PRF @geekpi --- ...ng started with the GNOME Linux desktop.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/translated/tech/20191207 Getting started with the GNOME Linux desktop.md b/translated/tech/20191207 Getting started with the GNOME Linux desktop.md index d8c80a5d45..def9a9fb3c 100644 --- a/translated/tech/20191207 Getting started with the GNOME Linux desktop.md +++ b/translated/tech/20191207 Getting started with the GNOME Linux desktop.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with the GNOME Linux desktop) @@ -9,28 +9,30 @@ GNOME Linux 桌面入门 ====== -本文是 24 天 Linux 桌面特别系列的一部分。GNOME 是大多数现代 Linux 发行版的默认桌面,它干净、简单、组织良好。 -![Gnomes in a window.][1] -[GNOME][2] 项目理所应当是 Linux 桌面的宠儿。它起初是专有桌面(当时包括 KDE)的免费开源桌面替代品,此后一直发展强劲。GNOME 采用了[由 GIMP 项目开发][3]的 GTK+,并将其开发为强大的通用 GTK 框架。该项目开创了用户界面的先驱,挑战了桌面“应有”外观的先入之见,并为用户提供了新的范例和选项。 +> 本文是 24 天 Linux 桌面特别系列的一部分。GNOME 是大多数现代 Linux 发行版的默认桌面,它干净、简单、组织良好。 -在大多数主流现代 Linux 发行版(包括RHEL、Fedora、Debian 和 Ubuntu)中,GNOME 作为默认桌面广泛使用。如果你的发行版不提供它的版本,那么你可以从软件仓库中安装 GNOME。但是,在执行此操作之前,请注意,为了提供完整的桌面体验,这会随桌面一起安装许多 GNOME 应用。如果你在用其他桌面,那么你可能会发现有冗余的应用(两个 PDF 阅读器、两个媒体播放器、两个文件管理器,等等)。如果你只想尝试 GNOME 桌面,请考虑在虚拟机,如[GNOME Boxes][4],中安装 GNOME 发行版。 +![](https://img.linux.net.cn/data/attachment/album/201912/14/150510z2227x177x8liwww.jpg) + +[GNOME][2] 项目理所应当是 Linux 桌面的宠儿。它起初是专有桌面(当时包括 KDE)的自由开源的桌面替代品,此后一直发展强劲。GNOME 采用了[由 GIMP 项目开发][3]的 GTK+,并将其开发为强大的通用 GTK 框架。该项目开创了用户界面的先声,挑战了桌面“应有”外观的先入之见,并为用户提供了新的范例和选项。 + +在大多数主流现代 Linux 发行版(包括 RHEL、Fedora、Debian 和 Ubuntu)中,GNOME 作为默认桌面而广泛使用。如果你的发行版不提供它的某个版本,那么你可以从软件仓库中安装 GNOME。但是,在执行此操作之前,请注意,为了提供完整的桌面体验,这会随桌面一起安装许多 GNOME 应用。如果你在用其他桌面,那么你可能会发现有冗余的应用(两个 PDF 阅读器、两个媒体播放器、两个文件管理器,等等)。如果你只想尝试 GNOME 桌面,请考虑在虚拟机,如 [GNOME Boxes][4],中安装 GNOME 发行版。 ### GNOME 功能 -GNOME 桌面很干净,顶部有一个简单的任务栏,右上角的系统托盘中只有很少的项。GNOME 上没有桌面图标,这是设计使然。如果你是在桌面上保存_任何东西_的用户之一,那么你可能会意识到桌面会定期地变得混乱,而且,更糟糕的是,由于你的应用掩盖了桌面,因此桌面永远不会显示出来。 +GNOME 桌面很干净,顶部有一个简单的任务栏,右上角的系统托盘中只有很少的图标。GNOME 上没有桌面图标,这是设计使然。如果你是喜欢在桌面上保存*任何东西*的用户,那么你可能会意识到桌面会定期地变得混乱,而且,更糟糕的是,由于你的应用掩盖了桌面,因此桌面永远不会显示出来。 GNOME 解决了两个问题:(在功能上)没有桌面,并且动态生成新的虚拟工作区,因此你可以在全屏模式下运行应用。如果你常把屏幕弄乱,那么可能需要一些时间来习惯,但实际上,从各个方面来说,这都是一种改进的工作流程。你将学习如何使文件井井有条(或者将它们分散在家目录中),并且可以像在手机上一样快速地在屏幕之间切换。 -当然,并非所有应用都设计为在全屏模式下运行,因此,如果你更喜欢单击窗口,也可以这样做。 +当然,并非所有应用都设计为在全屏模式下运行,因此,如果你更喜欢单击切换窗口,也可以这样做。 ![GNOME running on Debian][5] -GNOME 哲学褒扬了 Canonical 对常见任务的解决方案。在 GNOME 中,你通常不会发现有八种不同的方法来做同一件事。你找到一种或两种官方方法来完成一项任务,你了解了这些方法后,便只需记住这些即​​可。它非常简单,但由于它在 Linux 上运行,因此在技术上也很灵活(毕竟,你不必因为运行 GNOME 桌面而要使用 GNOME 应用)。 +GNOME 哲学褒扬了 Canonical 对常见任务的解决方案。在 GNOME 中,你通常不会发现“回字有四种写法”。你会找到一种或两种官方方法来完成一项任务,你了解了这些方法后,便只需记住这些即​​可。它非常简单,但由于它在 Linux 上运行,因此在技术上也很灵活(毕竟,你不必因为运行 GNOME 桌面而必须要使用 GNOME 应用)。 ### 应用菜单 -要访问名为“活动”的应用菜单,请在桌面的左上角单击。此菜单将占满整个屏幕,屏幕最左侧有一栏常见应用的 dock,并且有一个可以在网格中浏览应用的图标。你可以浏览已安装的应用,或输入软件的头几个字母来过滤列表,之后启动应用。 +要访问名为“活动”的应用菜单,请在桌面的左上角单击。此菜单将占满整个屏幕,屏幕最左侧有一栏常见应用的 dock,或可以在网格中浏览应用的图标。你可以通过浏览已安装的应用,或输入软件的头几个字母来过滤列表,然后来启动应用。 ![GNOME activities][6] @@ -40,7 +42,7 @@ GNOME 不仅是桌面。它是一个桌面以及一组丰富的集成应用, ### GNOME 3 及更高版本 -GNOME 项目进展顺利,还有几个令人兴奋的项目(例如 MATE 和 [Cinnamon][8])。它流行、令人舒适,并且是 Linux 桌面的外观。 +GNOME 项目进展顺利,还有几个令人兴奋的项目(例如 MATE 和 [Cinnamon][8])。它流行、令人舒适,被视为 Linux 桌面的代表。 -------------------------------------------------------------------------------- @@ -49,7 +51,7 @@ via: https://opensource.com/article/19/12/gnome-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From eaed9be1644f21eff8836f17e82c0304e28ceb27 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 14 Dec 2019 15:05:58 +0800 Subject: [PATCH 093/676] PUB @geekpi https://linux.cn/article-11675-1.html --- .../20191207 Getting started with the GNOME Linux desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191207 Getting started with the GNOME Linux desktop.md (98%) diff --git a/translated/tech/20191207 Getting started with the GNOME Linux desktop.md b/published/20191207 Getting started with the GNOME Linux desktop.md similarity index 98% rename from translated/tech/20191207 Getting started with the GNOME Linux desktop.md rename to published/20191207 Getting started with the GNOME Linux desktop.md index def9a9fb3c..d762dbe15c 100644 --- a/translated/tech/20191207 Getting started with the GNOME Linux desktop.md +++ b/published/20191207 Getting started with the GNOME Linux desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11675-1.html) [#]: subject: (Getting started with the GNOME Linux desktop) [#]: via: (https://opensource.com/article/19/12/gnome-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 050871b5d803ef9277c66893c3bf3f49cc3861a8 Mon Sep 17 00:00:00 2001 From: Valonia Kim <34000495+Valoniakim@users.noreply.github.com> Date: Sat, 14 Dec 2019 20:55:19 +0800 Subject: [PATCH 094/676] translated --- ...rcome cultural communication challenges.md | 95 ------------------- 1 file changed, 95 deletions(-) delete mode 100644 sources/talk/20181018 Think global- How to overcome cultural communication challenges.md diff --git a/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md b/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md deleted file mode 100644 index 1244f13079..0000000000 --- a/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md +++ /dev/null @@ -1,95 +0,0 @@ -translating - -Think global: How to overcome cultural communication challenges -====== -Use these tips to ensure that every member of your global development team feels involved and understood. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/people_remote_teams_world.png?itok=_9DCHEel) - -A few weeks ago, I witnessed an interesting interaction between two work colleagues—Jason, who is from the United States; and Raj, who was visiting from India. - -Raj typically calls into a daily standup meeting at 9:00am US Central Time from India, but since he was in the US, he and his teammates headed toward the scrum area for the meeting. Jason stopped Raj and said, “Raj, where are you going? Don’t you always call into the stand-up? It would feel strange if you don’t call in.” Raj responded, “Oh, is that so? No worries,” and headed back to his desk to call into the meeting. - -I went to Raj’s desk. “Hey, Raj, why aren’t you going to the daily standup?” Raj replied, “Jason asked me to call in.” Meanwhile, Jason was waiting for Raj to come to the standup. - -What happened here? Jason was obviously joking when he made the remark about Raj calling into the meeting. But how did Raj miss this? - -Jason’s statement was meant as a joke, but Raj took it literally. This was a clear example of a misunderstanding that occurred due to unfamiliarity with each other’s cultural context. - -I often encounter emails that end with “Please revert back to me.” At first, this phrase left me puzzled. I thought, "What changes do they want me to revert?" Finally, I figured out that “please revert” means “Please reply.” - -In his TED talk, “[Managing Cross Cultural Remote Teams,][1]” Ricardo Fernandez describes an interaction with a South African colleague who ended an IM conversation with “I’ll call you just now.” Ricardo went back to his office and waited for the call. After fifteen minutes, he called his colleague: “Weren’t you going to call me just now?” The colleague responded, “Yes, I was going to call you just now.” That's when Ricardo realized that to his South African colleague, the phrase “just now” meant “sometime in the future.” - -In today's workplace, our colleagues may not be located in the same office, city, or even country. A growing number of tech companies have a global workforce comprised of employees with varied experiences and perspectives. This diversity allows companies to compete in the rapidly evolving technological environment. - -But geographically dispersed teams can face challenges. Managing and maintaining high-performing development teams is difficult even when the members are co-located; when team members come from different backgrounds and locations, that makes it even harder. Communication can deteriorate, misunderstandings can happen, and teams may stop trusting each other—all of which can affect the success of the company. - -What factors can cause confusion in global communication? In her book, “[The Culture Map][2],” Erin Meyer presents eight scales into which all global cultures fit. We can use these scales to improve our relationships with international colleagues. She identifies the United States as a very low-context culture in the communication scale. In contrast, Japan is identified as a high-context culture. - -What does it mean to be a high- or low-context culture? In the United States, children learn to communicate explicitly: “Say what you mean; mean what you say” is a common principle of communication. On the other hand, Japanese children learn to communicate effectively by mastering the ability to “read the air.” That means they are able to read between the lines and pick up on social cues when communicating. - -Most Asian cultures follow the high-context style of communication. Not surprisingly, the United States, a young country composed of immigrants, follows a low-context culture: Since the people who immigrated to the United States came from different cultural backgrounds, they had no choice but to communicate explicitly and directly. - -### The three R’s - -How can we overcome challenges in cross-cultural communication? Americans communicating with Japanese colleagues, for example, should pay attention to the non-verbal cues, while Japanese communicating with Americans should prepare for more direct language. If you are facing a similar challenge, follow these three steps to communicate more effectively and improve relationships with your international colleagues. - -#### Recognize the differences in cultural context - -The first step toward effective cross-cultural communication is to recognize that there are differences. Start by increasing your awareness of other cultures. - -#### Respect the differences in cultural context - -Once you become aware that differences in cultural context can affect cross-cultural communication, the next step is to respect these differences. When you notice a different style of communication, learn to embrace the difference and actively listen to the other person’s point of view. - -#### Reconcile the differences in cultural context - -Merely recognizing and respecting cultural differences is not enough; you must also learn how to reconcile the cultural differences. Understanding and being empathetic towards the other culture will help you reconcile the differences and learn how to use them to better advance productivity. - -### 5 ways to improve communications for cultural context - -Over the years, I have incorporated various approaches, tips, and tricks to strengthen relationships among team members across the globe. These approaches have helped me overcome communication challenges with global colleagues. Here are a few examples: - -#### Always use video conferencing when communicating with global teammates - -Studies show that about 55% of communication is non-verbal. Body language offers many subtle cues that can help you decipher messages, and video conferencing enables geographically dispersed team members to see each other. Videoconferencing is my default choice when conducting remote meetings. - -#### Ensure that every team member gets an opportunity to share their thoughts and ideas - -Although I prefer to conduct meetings using video conferencing, this is not always possible. If video conferencing is not a common practice at your workplace, it might take some effort to get everyone comfortable with the concept. Start by encouraging everyone to participate in audio meetings. - -One of our remote team members, who frequently met with us in audio conferences, mentioned that she often wanted to share ideas and contribute to the meeting but since we couldn’t see her and she couldn’t see us, she had no idea when to start speaking. If you are using audio conferencing, one way to mitigate this is to ensure that every team member gets an opportunity to share their ideas. - -#### Learn from one another - -Leverage your international friends to learn about their cultural context. This will help you interact more effectively with colleagues from these countries. I have friends from South Asia and South America who have helped me better understand their cultures, and this knowledge has helped me professionally. - -For programmers, I recommend conducting code reviews with your global peers. This will help you understand how those from different cultures give and receive feedback, persuade others, and make technical decisions. - -#### Be empathetic - -Empathy is the key to strong relationships. The more you are able to put yourself in someone else's shoes, the better able you will be to gain trust and build long-lasting connections. Encourage “water-cooler” conversations among your global colleagues by allocating the first few minutes of each meeting for small talk. This offers the additional benefit of putting everyone in a more relaxed mindset. If you manage a global team, make sure every member feels included in the discussion. - -#### Meet your global colleagues in person - -The best way to build long-lasting relationships is to meet your team members in person. If your company can afford it, arrange for this to happen. Meeting colleagues with whom you have been working will likely strengthen your relationship with them. The companies I have worked for have a strong record of periodically sending US team members to other countries and global colleagues to the US office. - -Another way to bring teams together is to attend conferences. This not only creates educational and training opportunities, but you can also carve out some in-person team time. - -In today's increasingly global economy, it is becoming more important for companies to maintain a geographically diverse workforce to remain competitive. Although global teams can face communication challenges, it is possible to maintain a high-performing development team despite geographical and cultural differences. Share some of the techniques you use in the comments. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/10/think-global-communication-challenges - -作者:[Avindra Fernando][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/avindrafernando -[b]: https://github.com/lujun9972 -[1]: https://www.youtube.com/watch?v=QIoAkFpN8wQ -[2]: https://www.amazon.com/The-Culture-Map-Invisible-Boundaries/dp/1610392507 From 956ebe7af32ababfeaa62b01b9253ab892383cae Mon Sep 17 00:00:00 2001 From: Valonia Kim <34000495+Valoniakim@users.noreply.github.com> Date: Sat, 14 Dec 2019 21:14:05 +0800 Subject: [PATCH 095/676] translated --- ...rcome cultural communication challenges.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 translated/talk/20181018 Think global- How to overcome cultural communication challenges.md diff --git a/translated/talk/20181018 Think global- How to overcome cultural communication challenges.md b/translated/talk/20181018 Think global- How to overcome cultural communication challenges.md new file mode 100644 index 0000000000..2e6ef612b5 --- /dev/null +++ b/translated/talk/20181018 Think global- How to overcome cultural communication challenges.md @@ -0,0 +1,93 @@ +全球化思考:怎样克服交流中的文化差异 +====== +这有一些建议帮助你的全球化开发团队能够更好地理解你们的讨论并能参与其中。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/people_remote_teams_world.png?itok=_9DCHEel) + +几周前,我见证了两位同事之间一次有趣的互动,他们分别是 Jason,我们的一位美国员工,和 Raj,一位来自印度的访问工作人员。 + +Raj 在印度时,他一般会通过电话参加美国中部时间上午 9 点的每日立会,现在他到美国工作了,就可以和组员们坐在同一间会议室里开会了。Jason 拦下了 Raj,说:“ Raj 你要去哪?你不是一直和我们开电话会议吗?你突然出现在会议室里我还不太适应。” Raj 听了说,“是这样吗?没问题。”就回到自己工位前准备和以前一样参加电话会议了。 + +我去找 Raj,问他为什么不去参加每日立会,Raj 说 Jason 让自己给组员们打电话参会,而与此同时,Jason 也在会议室等着 Raj 来参加立会。 + +到底是哪里出的问题?Jason 明显只是调侃 Raj 终于能来一起开会了,为什么 Raj 没能听懂呢? + +Jason 明显是在开玩笑,但 Raj 把它当真了。这就是在两人互相不了解对方文化语境时发生的一个典型误会。 + +我经常会遇到有人在电子邮件的末尾写“请复原”,最开始我很迷惑,“这有什么需要我复原的内容?”后来我才搞懂,“请复原”其实是“请回复”的意思。 + +在 Ricardo Fernandez 的TED 演讲“[如何管理跨文化团队][1]” 中,他提到了自己与一位南非同事发生的小故事。那位同事用一句“我一会给你打电话。”结束了两人的 IM 会话,Ricardo 回到办公室后就开始等这位同事的电话,十五分钟后他忍不住主动给这位同事打了电话,问他:“你不是说要给我打电话吗?”,这位同事答到:“是啊,我是说以后有机会给你打电话。”这时 Ricardo 才理解那位同事说的“一会”是“以后”的意思。 + +现在是全球化时代,我们的同事很可能不跟我们面对面接触,甚至不在同一座城市,来自不同的国家。越来越多的技术公司拥有全球化的工作场所,和来自世界各地的员工,他们有着不同的背景和经历。这种多样性使得技术公司能够在这个快速发展的科技大环境下拥有更强的竞争力。 + +但是这种地域的多样性也会给团队带来挑战。管理和维持团高性能的团队发展对于同地协作的团队来说就有着很大难度,对于有着多样背景成员的全球化团队来说,无疑更加困难。成员之间的交流会发生延迟,误解时有发生,成员之间甚至会互相怀疑,这些都会影响着公司的成功。 + +到底是什么因素让全球化交流间发生误解呢?我们可以参照 Erin Meyer 的书《[文化地图][2]》,她在书中将全球文化分为八个类型,其中美国文化被分为低语境文化,与之相对的,日本为高语境文化。 + +看到这里你可能会问,高、低语境文化到底是什么意思?美国人从小就教育孩子们简洁表达,“直言不讳”是他们的表达准则;另一边,日本人从小学习在高效处理社交线索的同时进行交流,“察言观色”是他们的交流习惯。 + +大部分亚洲国家的文化都属于高语境文化。作为一个年轻的移民国家,美国毫不意外地拥有着低语境文化。移民来自于世界各地,拥有着不同的文化背景,他们不得不选择简洁而直接的交流方式,这或许就是其拥有低语境文化的原因。 + +### 从文化语境的角度与异国同事交流的三个步骤: + +怎样面临跨文化交流中遇到的挑战?比如说一位美国人与他的日本同事交流,他更应该注重日本同事的非语言线索,同样的日本同事应当更关注美国人直接表达出的信息。如果你也面临类似的挑战,按照下面这三个步骤做,可以帮助你更有效地和异国同事交流,增进与他们的感情。 + +#### 认识到文化语境的差异 + +跨文化交流的第一步是认识到文化差异,跨文化交流从认识其他文化开始。 + +#### 尊重文化语境的差异 + +一旦你意识到了文化语境的差异会影响跨文化交流,你要做的就是尊重这些差异。在你遇到一种不同的交流方式时,学会接受差异,学会积极听取他人意见。 + +#### 调和文化语境的差异 + +只是认识和尊重差异还远远不够,你还需要学会如何调和这些差异。互相理解和换位思考可以增进差异的调和,你还要学着用它们去提高同事间的交流效率,推动生产力。 + +### 五种促进不同文化语境间交流的方法 + +为了加强组员们之间关系,这么多年来我一直在收集各种各样的方法和建议。这些方法帮助我解决了与外国组员间产生的很多交流问题,下面有其中一些例子: + +#### 与外国组员交流时尽量使用视频会议的形式 + +研究表明,交流中约 55% 的内容不是靠语言传递的。肢体语言传达着一种十分微妙的信息,你可以根据它们理解对方的意思,而视频会议中处于异地的组员们能够看到对方的肢体语言。因此,组织远程会议时我一般都会采用视频会议的形式。 + +#### 确保每位成员都有机会分享他们的想法 + +我虽然喜欢开视频会议,但不是每次都能开的成。如果视频会议对你的团队来说并不常用,大家可能要一些时间去适应,你需要积极鼓励大家参与到其中,先从进行语音会议开始。 + +我们有一个外地的组员,每次都和我们进行语音会议,和我们提到她经常会有些想法想要分享,或者想做些贡献,但是我们互相看不到,她不知道该怎样开口。如果你一直在进行语音会议,注意要给组员们足够的时间和机会分享他们的想法。 + +#### 互相学习 + +通过你身边一两名外国朋友来学习他们的文化,你可以把从一位同事身上学到的应用于所有来自这个国家的同事。我有几位南亚和南美的同事,他们帮助我理解他们的文化,而这些也使得我更加专业。 + +对编程人员来说,我建议请你全世界的同行们检查你的代码,这个过程能让你观察到其他文化中人们怎样进行反馈、劝说他人,和最终进行技术决策。 + +#### 学会感同身受 + +同理心是一段牢固关系的核心。你越能换位思考,就越容易获得信任,来建立长久的关系。你可以在每次会议开始之前和大家闲聊几句,这样大家更容易处于一个放松的状态,如果团队中有很多外国人,要确保大家都能参与进来。 + +#### 和你的外国同事们单独见面 + +保持长久关系最好的方法是和你的组员们单独见面。如果你的公司可以报销这些费用,那么努力去和组员们见面吧。和一起工作了很长时间的组员们见面能够使你们的关系更加坚固。我所在的公司就有着周期性交换员工的传统,每隔一段时间,世界各地的员工就会来到美国工作,美国员工再到其他分部工作。 + +另一种聚齐组员们的机会的研讨会。研讨会创造的不仅是学习和培训的机会,你还可以挤出一些时间和组员们培养感情。 + +在如今,全球化经济不断发展,拥有来自不同国家和地区的员工对维持一个公司的竞争力来说越来越重要。即使组员们来自世界各地,团队中会出现一些交流问题,但拥有一支国际化的高绩效团队不是问题。如果你在工作中有什么促进团队交流的小窍门,请在评论中告诉我们吧。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/10/think-global-communication-challenges + +作者:[Avindra Fernando][a] +选题:[lujun9972][b] +译者:[Valoniakim](https://github.com/Valoniakim) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/avindrafernando +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/watch?v=QIoAkFpN8wQ +[2]: https://www.amazon.com/The-Culture-Map-Invisible-Boundaries/dp/1610392507 From dca901f5c0d2c7a7c8ea65d775eb3714b73e881c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Dec 2019 00:54:43 +0800 Subject: [PATCH 096/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191215=20How=20?= =?UTF-8?q?to=20Add=20Border=20Around=20Text=20in=20GIMP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191215 How to Add Border Around Text in GIMP.md --- ...5 How to Add Border Around Text in GIMP.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 sources/tech/20191215 How to Add Border Around Text in GIMP.md diff --git a/sources/tech/20191215 How to Add Border Around Text in GIMP.md b/sources/tech/20191215 How to Add Border Around Text in GIMP.md new file mode 100644 index 0000000000..d691bafb41 --- /dev/null +++ b/sources/tech/20191215 How to Add Border Around Text in GIMP.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Add Border Around Text in GIMP) +[#]: via: (https://itsfoss.com/gimp-text-outline/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Add Border Around Text in GIMP +====== + +This simple tutorial explains the steps to outline text in [GIMP][1]. The text outline helps you highlight text against background of other color. + +![Outlined Text created in GIMP][2] + +Let’s see how can you add a border around your text. + +### Adding text outline in GIMP + +The entire procedure can be described in these easy steps: + + * Create your text and copy its outlined path + * Add a new transparent layer and add the outlined path to this layer + * Change the size of the outline, add a different color to it + + + +That’s all. Don’t worry, I am going to show each steps in detail with proper screenshots. By following this tutorial, you should be able to add outline to text even if you never used GIMP before. + +Just make sure that you have [GIMP installed on Linux][3] or whatever operating system you are using. + +This tutorial has been performed with GIMP 2.10 version. + +#### Step 1: Create your primary text and copy its outline + +Open GIMP and create a new file by going to the top menu->File->New. You can also use Ctrl+N keyboard shortcut. + +![Create New File][4] + +You can select the size of your canvas here. You may also choose if you want white background or a transparent background. It is under the Advanced Options->Color profile. + +I have chosen the default white background. It can be changed later. + +Now select the Text tool from the toolbox in the left sidebar. + +![Adding text in GIMP][5] + +Write the text you want. You can change the font, size and alignment of the text as per your choice. I have kept the default left alignment of the text for this article. + +I have deliberately chose a light color for the text so that it is difficult to read. I’ll add a darker outline to this light text in this tutorial. + +![Text added in GIMP][6] + +When you are done writing your text, right click the text box and select **Path from Text**. + +![Right click on the text box and select ‘Path from Text’][7] + +#### Step 2: Add a transparent layer with the text outline + +Now, go to the top menu, go to Layer and add a new layer. + +![Use Shift+Ctrl+N to add a new layer][8] + +Make sure to add the new layer as transparent. You can give it a suitable name like ‘outline for text’. Click OK to add this transparent layer. + +![Add a transparent layer][9] + +Go to the menu again and this time go to **Select** and click **From path**. You’ll see that your text has been highlighted. + +![Go to Select and choose From Path][10] + +Basically, you just created a transparent layer that has the same text (but transparent) as your original text. What you need to do now is to increase the size of the text on this layer. + +#### Step 3: Adding the text outline by increasing its size and changing its color + +To do that, go to Select in menu once again and this time choose Grow. This will allow you to grow the size of the text on the transparent layer. + +![Grow the selection on the additional layer][11] + +Grow it by 5 or 10 pixel or whatever you prefer. + +![Grow it by 5 or 10 pixel][12] + +What you need to do now is to fill this enlarged selection with a choice of your color. Since my original text is of light color, I am going to use back color for the outline here. + +**Select your main image layer** if it’s not already selected. The layers are visible at the right sidebar. Then go to the toolbox and select the bucket fill tool. Select the desired color you want for the outline. + +Now use the tool to fill black color to your selection. Mind that you fill the outer outline of the text, not the text itself. + +![Fill the outline of the text with a different color][13] + +You are pretty much done here. Use Ctrl+Shift+A to de-select your current selection. + +![Outline added to the text][14] + +So now you have successfully added outline to your text in GIMP. It is on white background and if you want a transparent background, just delete the background layer from the layer menu in the right sidebar. + +![Remove the white background layer if you want a transparent background][15] + +If you are happy with the result, save the file as PNG file (to keep transparent background) or whichever file format you prefer. + +**Did you make it work?** + +That’s it. That’s all you need to do to add a text outline in GIMP. + +I hope you find this GIMP tutorial helpful. You may want to check out another [simple tutorial about adding a watermark in GIMP][16]. + +If you have questions or suggestions, please feel free to leave a comment below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gimp-text-outline/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outlined_text_GIMP.png?ssl=1 +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/create_outline_text_gimp_1.jpeg?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_2.jpg?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp-3.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_4.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_5.jpg?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_6.jpg?ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_7.jpg?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_8.jpg?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_9.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_10.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_11.jpg?ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_12.jpg?ssl=1 +[16]: https://itsfoss.com/add-watermark-gimp-linux/ From bd2fff1b3f4f1d41e932c121c546b70cad155d37 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Dec 2019 00:55:26 +0800 Subject: [PATCH 097/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191214=20Get=20?= =?UTF-8?q?started=20with=20Lumina=20for=20your=20Linux=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191214 Get started with Lumina for your Linux desktop.md --- ...rted with Lumina for your Linux desktop.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20191214 Get started with Lumina for your Linux desktop.md diff --git a/sources/tech/20191214 Get started with Lumina for your Linux desktop.md b/sources/tech/20191214 Get started with Lumina for your Linux desktop.md new file mode 100644 index 0000000000..f3bf864b3a --- /dev/null +++ b/sources/tech/20191214 Get started with Lumina for your Linux desktop.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Lumina for your Linux desktop) +[#]: via: (https://opensource.com/article/19/12/linux-lumina-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Get started with Lumina for your Linux desktop +====== +This article is part of a special series of 24 days of Linux desktops. +The Lumina desktop is a shortcut to a quick and sensible Fluxbox-based +desktop with all the things you can't live without. +![Lightbulb][1] + +For a good number of years, there was a desktop operating system (OS) based on FreeBSD called PC-BSD. It was intended as an OS for general use, which was noteworthy because BSD development mostly focuses on servers. For most of its life, PC-BSD shipped with the KDE desktop by default, but the more KDE came to depend on Linux-specific technology, the more PC-BSD migrated away from it. PC-BSD became [Trident][2], and its default desktop is [Lumina][3], a collection of widgets written to use the same Qt toolkit that KDE is based upon, running on the Fluxbox window manager. + +You may find the Lumina desktop in your Linux distribution's software repository or in BSD's ports tree. If you install Lumina and you're already running another desktop, you may find yourself with redundant applications (two PDF readers, two file managers, and so on) because Lumina includes a few integrated applications. If you just want to try the Lumina desktop, you can install a Lumina-based BSD distribution in a virtual machine, such as [GNOME Boxes][4]. + +If you install Lumina on your current OS, you must log out of your current desktop session so you can log into your new one. By default, your session manager (SDDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +With GDM: + +![Selecting your desktop in GDM][5] + +With SDDM: + +![Selecting your desktop in KDM][6] + +### Lumina desktop + +Lumina delivers a simple and lightweight desktop environment. There's a panel at the bottom of the screen containing an application menu on the left, a taskbar in the middle, and a system tray on the right. There are icons on the desktop providing quick access to common applications and locations. + +In addition to this basic desktop structure, Lumina features a custom file manager, PDF viewer, screenshot tool, media player, text editor, and archive tool. There's also a configuration utility to help you customize your Lumina desktop, and you can find further configuration options by right-clicking on the desktop. + +![Lumina desktop running on Project Trident][7] + +Lumina is very similar to several Linux lightweight desktops, especially LXQT, except without any reliance upon Linux-based desktop frameworks like ConsoleKit, PolicyKit, D-Bus, or systemd. Whether or not that holds any advantage for you depends on the OS you're running. After all, if you're already running Linux with access to those features, using a desktop that doesn't utilize them may not make much sense and cost you features. If you're running BSD, then running Fluxbox with Lumina widgets could mean not having to install the Linux-compatible libraries from ports. + +### Why you should use Lumina + +Lumina is simple enough in design that it doesn't have many features you can't implement on your own by installing Fluxbox along with your favorite components ([PCManFM][8] for file management, a variety of [LXQt apps][9], [Tint2][10] for a panel, and so on). But this is open source, and users of open source love to find ways to avoid reinventing the wheel (almost as much as we love reinventing the wheel). + +The Lumina desktop is a shortcut to a quick and sensible Fluxbox-based desktop with all the things you can't live without and very few of the finer details you'll want to configure yourself. Give the Lumina desktop a try to see if it's the desktop for you. + +KDE originally stood for Kool Desktop Environment, but is now known by many as the K Desktop... + +A brief overview of PC-BSD and thoughts about the distribution. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-lumina-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb) +[2]: https://project-trident.org/ +[3]: https://lumina-desktop.org/ +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://opensource.com/sites/default/files/uploads/advent-gdm_400x400_1.jpg (Selecting your desktop in GDM) +[6]: https://opensource.com/sites/default/files/uploads/advent-kdm_400x400_1.jpg (Selecting your desktop in KDM) +[7]: https://opensource.com/sites/default/files/uploads/advent-lumina.jpg (Lumina desktop running on Project Trident) +[8]: https://wiki.lxde.org/en/PCManFM +[9]: http://lxqt.org +[10]: https://opensource.com/article/19/1/productivity-tool-tint2 From 17c76bd27a861b62b6b0447313ede0ef2d991670 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Dec 2019 00:55:53 +0800 Subject: [PATCH 098/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191214=20Annual?= =?UTF-8?q?=20release=20cycle=20for=20Python,=20new=20Python=20Software=20?= =?UTF-8?q?Foundation=20fellows=20from=20Africa,=20and=20more=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md --- ...n fellows from Africa, and more updates.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md diff --git a/sources/tech/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md b/sources/tech/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md new file mode 100644 index 0000000000..85aef63325 --- /dev/null +++ b/sources/tech/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates) +[#]: via: (https://opensource.com/article/19/12/python-news-december) +[#]: author: (Christian Heimes https://opensource.com/users/christian-heimes) + +Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates +====== +Find out what's going on in the Python community in December. +![Python in a coffee cup.][1] + +The Python Software Foundation (PSF) is a nonprofit organization behind the Python programming language. I am fortunate to be a PSF Fellow (honorable member for life,) a Python core developer, and the liaison between my company, Red Hat, and the PSF. Part of that liaison work is providing updates on what’s happening in the Python community. Here’s a look at what we have going on in December. + +### Upcoming events + +A significant part of the Python community is its in-person events. These events are where users and contributors intermingle and learn together. Here are the big announcements of upcoming opportunities to connect. + +#### PyCon US 2020 + +[PyCon US][2] is by far the largest annual Python event. The next PyCon is April 15-23, 2020, in Pittsburgh. The call for proposals is open to all until December 20, 2019. I’m planning to attend PyCon for the conference and its [famous post-con sprints][3]. + +#### EuroPython + +EuroPython is the largest Python conference in Europe with about 1,000 attendees in the last years. [EP20][4] will be held in Dublin, Ireland, July 20-26, 2020. As a liaison for Red Hat, I’m proud to say that Red Hat sponsored EP18 in Edinburgh and donated the sponsoring tickets to Women Who Code Scotland. + +#### PyData + +[PyData][5] is a separate nonprofit related to the Python community through a focus on data science. They host many international events throughout the year, with upcoming events in [Austin, Texas][6], and [Warsaw, Poland][7] before the end of the year. + +### New PSF fellows from Africa + +The PSF promotes a few members to fellow every quarter. Yesterday, twelve new PSF fellows were [announced][8]. + +I’d like to highlight the four new fellows from Ghana, who are also the organizers of the first pan-African [PyCon Africa][9], which took place in August 2019 in Accra, Ghana. The Python community in Africa is growing at an amazing speed. PyCon Africa 2020 will be in Accra again, and I’m planning to spend my summer vacation there. + +### Annual release cycle for Python + +Python used to release a new major version about every 18 months. This timeline will change with the Python 3.9 release. With [PEP 602,][10] a new major version of Python will be released annually in October. The new cadence means fewer changes between releases and more predictable release dates. October was chosen to align with Linux distribution releases such as Fedora. Miro Hrončok from the Python maintenance team joined the discussion and has helped to find a convenient release date for us; for more details, please see . + +### Steering council election + +The Python Steering Council governs the development of Python. It was established after [Guido van Rossum stepped down][11] as benevolent dictator for life. Python core developers elect a new steering council for every major Python release. For the upcoming term, nine candidates were nominated for five seats on the council (with Guido being nominated, but [withdrawing][12]). See for all the details. Election results are expected to be announced mid-December. + +That covers what’s new in the Python community for December. Stay tuned for more updates in the future and mark your calendars for the conferences mentioned above. + +So you have a great business idea for a wonderful IT product or service, and you want to build your... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/python-news-december + +作者:[Christian Heimes][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/christian-heimes +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) +[2]: https://us.pycon.org/2020/ +[3]: https://opensource.com/article/19/5/pycon-developer-sprints +[4]: https://www.europython-society.org/post/188741002380/europython-2020-venue-and-location-selected +[5]: https://pydata.org/ +[6]: https://pydata.org/austin2019/ +[7]: https://pydata.org/warsaw2019/ +[8]: https://pyfound.blogspot.com/2019/11/python-software-foundation-fellow.html +[9]: https://africa.pycon.org/ +[10]: https://www.python.org/dev/peps/pep-0602/ +[11]: https://opensource.com/article/19/6/command-line-heroes-python +[12]: https://discuss.python.org/t/steering-council-nomination-guido-van-rossum-2020-term/2657/11 From 2035f5399f5ac7bac091595197b87f6781faa6f2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Dec 2019 00:59:44 +0800 Subject: [PATCH 099/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191213=20Space-?= =?UTF-8?q?data-as-a-service=20gets=20going?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191213 Space-data-as-a-service gets going.md --- ...1213 Space-data-as-a-service gets going.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 sources/talk/20191213 Space-data-as-a-service gets going.md diff --git a/sources/talk/20191213 Space-data-as-a-service gets going.md b/sources/talk/20191213 Space-data-as-a-service gets going.md new file mode 100644 index 0000000000..c2c840e831 --- /dev/null +++ b/sources/talk/20191213 Space-data-as-a-service gets going.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Space-data-as-a-service gets going) +[#]: via: (https://www.networkworld.com/article/3489484/space-data-as-a-service-gets-going.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Space-data-as-a-service gets going +====== +Development of IoT services in space will require ruggedized edge computing. OrbitsEdge, a vendor has announced a deal with HPE for development. +[REUTERS/Joe Skipper/File Photo][1] + +Upcoming space commercialization will require hardened edge-computing environments in a small footprint with robust links back to Earth, says vendor [OrbitsEdge][2], which recently announced that it had started collaborating with Hewlett Packard Enterprise on computing-in-orbit solutions. + +OrbitsEdge says it’s the first to provide a commercial [data-center][3] environment for installing in orbit, and will be using HPE’s Edgeline Converged Edge System in a hardened, satellite [micro-data-center][4] platform that it’s selling called SatFrame. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][5] + +The idea is “to run analytics such as artificial intelligence (AI) on the vast amounts of data that will be created as space is commercialized,” says Barbara Stinnett, CEO of OrbitsEdge, in a [press release][6]. + +[][7] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][7] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +### Why data in space? + +[IoT][8] data collection along with analysis and experimental testing are two examples of space industrialization that the company gives as use cases for its micro-data center product. However, commercial use of space also includes imagery, communications, weather forecasting and navigation. Space tourism and commercial recovery of space resources, such as mined raw materials from asteroids are likely to be future space-uses, too. + +Also, manufacturing – taking advantage of vacuums and zero-gravity environments – is among the economic activities that could take advantage of number crunching in orbit. + +Additionally, [Cloud Constellation Corp., a company I wrote about in 2017, unrelated to OrbitsEdge or HPE, reckons highly sensitive data should be stored isolated][9] [in][9] [space][9]. That would be the “ultimate air-gap security,” it describes its [SpaceBelt][10] product. + +### Why edge in space? + +OrbitsEdge believes that data must be processed where it is collected, in space, in order to reduce transmission bottlenecks as streams are piped back to Earth stations. “Due to the new wave of low-cost commercial space activity, the bottleneck will get worse,” the company explains on its website. + +What it means is that getting satellites into space is now cheap and is getting cheaper (due primarily to reusable rocket technology), but that there’s a problem getting the information back to traditional cloud environments on the surface of the Earth; there’s not enough backhaul data capacity, and that increases processing costs. Therefore, the cloud needs to move to the data-collection point: It’s “IoT above the cloud,” ObitsEdge cleverly taglines. + +### How it works + +Satellite-mounted solar arrays collect power from the sun. They fill batteries to be used when the satellite is in the shadow of Earth. + +Cooling- and radiation-shielding protect a standard 5U, 19-inch server rack. There’s a separate rack for the avionics. Then integrated, traditional space-to-space, and space-to-ground radio communications handle the comms. Future-proofing is also considered: laser data pipes, too, could be supported, the company says. + +#### On Earth option + +Interestingly, the company is also pitching its no-maintenance, low Earth orbit (LEO)-geared product as being suitable for terrestrial extreme environments, too. OrbitsEdge claims that SatFrame is robust enough for extreme chemical and temperature environments on Earth. Upselling, it also says that one could combine two micro-data centers: a LEO SatFrame running HPE’s Edgeline, communicating with another one in an extreme on-Earth location—one at the Poles, maybe. + +“To keep up with the rate of change and the number of satellites being launched into low Earth orbit, new services have to be made available,” OrbitsEdge says. “Shipping data back to terrestrial clouds is impractical, however today it is the only choice,” it says. + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489484/space-data-as-a-service-gets-going.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3489484/Reuters +[2]: https://orbitsedge.com/ +[3]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[4]: https://www.networkworld.com/article/3445382/10-hot-micro-data-center-startups-to-watch.html +[5]: https://www.networkworld.com/newsletters/signup.html +[6]: https://orbitsedge.com/press-releases/f/orbitsedge-oem-agreement-with-hewlett-packard-enterprise +[7]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[8]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[9]: https://www.networkworld.com/article/3200242/data-should-be-stored-data-in-space-firm-says.html +[10]: http://spacebelt.com/ +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world From 0a529cf5e00dc932a294faab0c0a4241a67ed1c9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Dec 2019 01:02:02 +0800 Subject: [PATCH 100/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191213=20What?= =?UTF-8?q?=E2=80=99s=20hot=20at=20the=20edge=20for=202020=3F=20Everything?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191213 What-s hot at the edge for 2020- Everything.md --- ...-s hot at the edge for 2020- Everything.md | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sources/talk/20191213 What-s hot at the edge for 2020- Everything.md diff --git a/sources/talk/20191213 What-s hot at the edge for 2020- Everything.md b/sources/talk/20191213 What-s hot at the edge for 2020- Everything.md new file mode 100644 index 0000000000..5f15b10d12 --- /dev/null +++ b/sources/talk/20191213 What-s hot at the edge for 2020- Everything.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What’s hot at the edge for 2020? Everything) +[#]: via: (https://www.networkworld.com/article/3489938/what-s-hot-at-the-edge-for-2020-everything.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +What’s hot at the edge for 2020? Everything +====== +From SD-WAN and cloud interconnection to security, the edge will be one active place in 2020 +Thinkstock + +Few areas of the enterprise face as much churn as the edge of the network.  Experts say a variety of challenges drive this change – from increased [SD-WAN][1] access demand to cloud interconnected resources and [IoT][2], the traditional perimeter of the enterprise is shifting radically and will continue to do so throughout 2020. + +One indicator: Gartner research that says by 2023, more than 50% of enterprise-generated data will be created and processed outside the [data center][3] or cloud, up from less than 10% in 2019. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +Hand-in-hand with that change is a shift in what technologies are supported at the edge of the network – and that means information processing, content collection and delivery are placed closer to the sources, repositories and consumers of this information. Edge networking tries to keep the traffic and processing local to reduce latency, exploit the capabilities of the edge and enable greater autonomy at the edge, [Gartner says][5]. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The scope of enterprise WAN networks is broadening. No longer is it only from a branch edge to a data-center edge. Now the boundaries have shifted across the LAN from individual clients and devices on the one end and across the WAN to individual containers in data centers or clouds on the other, said Sanjay Uppal, vice president and general manager of VMware’s VeloCloud Business Unit. “This broadening of the WAN scope is a direct consequence of the democratization of data generation and the need to secure that data. So, we end up with edges at clients, servers, devices, branches, private data centers, public data centers, telco POP, RAN and the list goes on. Additionally, with IoT and mobility taking hold at the enterprise, the edge is moving out from the traditional ‘branch’ to the individual clients and devices.” + +“The evolution of business applications from monolithic constructs to flexible containerized workloads necessitates the evolution of the edge itself to move closer to the application data,” Uppal said. “This, in turn, requires the enterprise network to adjust and meet and exceed the requirements of the modern enterprise.” + +Such changes will ultimately make defining what constitutes the edge of the network more difficult. + +“With increased adoption of cloud-delivered services, unmanaged mobile and IoT devices, and integration of networks outside the enterprise (particularly partners), the edge is more difficult to define. Each of these paradigms extend the boundaries of today's organizations,” said Martin Kuppinger,  principal analyst with [KuppingerCole Analysts A][7]G.  “On the other hand, there is a common perception that there is no such perimeter anymore with statements such as “the device is the perimeter” or “identity is the new perimeter”. To some extent, all of this is true – and wrong. There still might be perimeters in defined micro-segments. But there is not that one, large perimeter anymore.” + +The enterprise is not the only arena that will see continued change in 2020, there are big changes afoot on the WAN was well.  + +Analysts from [IDC wrote][8] earlier this year that traditional enterprise WANs are increasingly not meeting the needs of digital businesses, especially as it relates to supporting SaaS apps and multi- and [hybrid-cloud][9] usage. Enterprises are interested in easier management of multiple connection types across their WAN to improve application performance and end-user experience – hence the growth of SD-WAN technologies. + +“The market for branch-office WAN-edge functionality continues to shift from dedicated routing, security and WAN optimization appliances to feature-rich software-defined WAN and, to a lesser extent, [universal customer-premises equipment] platforms,” [Gartner wrote][10].  “SD-WAN is replacing routing and adding application-aware path selection among multiple links, centralized orchestration and native security, as well as other functions. Consequently, it includes incumbent and emerging vendors from multiple markets (namely routing, security, WAN optimization and SD-WAN), each bringing its own differentiators and limitations.” + +One of the biggest changes for 2020 could come around the SD-WAN. One of the drivers stems from the relationships that networking vendors such as Cisco, VMware, Juniper, Arista and others have with the likes of Amazon Web Services, Microsoft Azure, Google Anthos and IBM RedHat.  + +An indicator of those changes came this month when AWS announced a slew of services for its cloud offering that included new integration technologies such as [AWS Transit Gateway][11], which lets customers connect their Amazon Virtual Private Clouds (VPCs) and their on-premises networks to a single gateway. Aruba, Aviatrix Cisco, Citrix Systems, Silver Peak and Versa already announced support for the technology which promises to simplify and enhance the performance of SD-WAN integration with AWS cloud resources. + +The ecosystem around this type of cloud interconnection is likely one of the hottest areas of growth for 2020, experts say. + +SD-WAN is critical for businesses adopting cloud services, acting as a connective tissue between the campus, branch, IoT, data center and cloud, said Sachin Gupta, senior vice president, product management, with Cisco Enterprise Networking in a recent [Network World][12] article. “It brings all the network domains together and delivers the outcomes business requires." + +"It must align user and device policies, and provide assurance to meet application service-level agreements. It must deliver robust security to every device and every cloud that the enterprise’s data touches.” The AWS Transit Gateway will let IT teams implement consistent network and data security rules, he said. + +All of these edge transformations will most certainly bring with it security challenges. Kuppinger noted a few including: + + * Has "shadow IT" subscribed to SaaS, which now contains important business data? How is it managed? + * Does the IT department use IaaS for dev/test or pre-production? Is it loaded with copies of production data? How is that controlled? + * Does IT use IaaS and PaaS for line-of-business applications? Is it managed centrally like legacy applications? + * Does the enterprise allow BYOD? Are unified endpoint-management or mobile anti-malware solutions mandated for such devices? + * Are IoT devices on the networks? Are they outside of your networks, but delivering critical services for customers? + * Are third-party risks enumerated and controlled? + + + +“Each of these situations is beyond the traditional edge and can increase your enterprise attack surface and risk,” Kuppinger said. “Once identified, enterprises must figure out how to secure the edges and get more complete visibility to all risks and mitigations. New tools may be needed. Some organizations may choose to engage more managed security services,” he said. + +The perimeter needs to be everywhere and hence the advent of the zero-trust architecture, VMware’s Uppal said. “This requires an end-to-end view where posture is checked at the edge, and based on that assessment network traffic is segmented both to reduce the attack surface and also the blast radius. i.e., first reduce the likelihood that something is going to go wrong, but if it does then minimize the impact,” Uppal said.  + +“As traffic traverses the network, security services, both letting through the good while blocking the bad are inserted based on policy. Here again the network of cloud services that dynamically sequences security based on business policy is critical,” Uppal said.  + +Going forward enterprise organizations might need to focus less on the network itself. “Protect the services, protect the communication between devices and services, protect the devices and the identities of the users accessing these devices. This is very much what the “[zero trust][13]” paradigm has in mind – notably, this is not primarily “zero-trust networks”, but zero trust at all levels,” Kuppinger said. + +“The most important learning is: Protecting just the network at its edge is not sufficient anymore. If there is a defined network – either physical such as in OT or virtual such as in many data centers – this adds to protection,” Kuppinger said. + +The mixture of cloud and security services at the edge will lead to another trend in 2020, one that Gartner calls secure access service edge (SASE) which is basically the melding of network and security-as-a-service capabilities into a cloud-delivered package. By 2024, at least 40% of enterprises will have explicit strategies to adopt [SASE][14], up from less than 1% at year-end 2018, Gartner says.  + +“SASE is in the early stages of development,” Gartner says. “Its evolution and demand are being driven by the needs of digital business transformation due to the adoption of SaaS and other cloud-based services accessed by increasingly distributed and mobile workforces, and to the adoption of edge computing.” + +Early manifestations of SASE are in the form of SD-WAN vendors adding network security capabilities and cloud-based security vendors offering secure web gateways, zero-trust network access and cloud-access security broker services, Gartner says. + +Regardless of what it’s called, it is clear the melding of cloud applications, security and new edge WAN services will be increasing in 2020. + +“We are seeing the rise of microservices in application development, allowing applications to be built based upon a collection of discrete technology elements.  Beyond new application architectures, there are demands for new applications to support IoT initiatives and to push compute closer to the user for lower latency and better application performance,” VMware’s Uppal said. “With the maturation of Kubernetes, what is needed is the next set of application-development and -deployment tools that work cooperatively with the underlying infrastructure, compute, network and storage to serve the needs of that distributed application.” + +[See more predictions about what's big in IT tech for the coming year.][15] + +Join the Network World communities on [Facebook][16] and [LinkedIn][17] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489938/what-s-hot-at-the-edge-for-2020-everything.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[2]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[3]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.html +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://twitter.com/kuppingercole +[8]: https://www.idc.com/getdoc.jsp?containerId=prUS45380319 +[9]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[10]: https://www.networkworld.com/article/3489480/secure-sd-wan-the-security-vendors-and-their-sd-wan-offerings.html +[11]: https://aws.amazon.com/transit-gateway/ +[12]: https://www.networkworld.com/article/3487831/what-s-hot-for-cisco-in-2020.html +[13]: https://www.networkworld.com/article/3487720/the-vpn-is-dying-long-live-zero-trust.html +[14]: https://www.networkworld.com/article/3481519/sase-redefining-the-network-and-security-architecture.html +[15]: https://www.networkworld.com/article/3488562/whats-big-in-it-tech-for-the-coming-year.html +[16]: https://www.facebook.com/NetworkWorld/ +[17]: https://www.linkedin.com/company/network-world From e2958540185aa771b3fd3bea135417025ffdb5ee Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Dec 2019 01:05:00 +0800 Subject: [PATCH 101/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191212=20Liquid?= =?UTF-8?q?=20cooling=20and=20edge=20computing=20are=20featured=20at=20Gar?= =?UTF-8?q?tner=20show?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191212 Liquid cooling and edge computing are featured at Gartner show.md --- ... computing are featured at Gartner show.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/talk/20191212 Liquid cooling and edge computing are featured at Gartner show.md diff --git a/sources/talk/20191212 Liquid cooling and edge computing are featured at Gartner show.md b/sources/talk/20191212 Liquid cooling and edge computing are featured at Gartner show.md new file mode 100644 index 0000000000..26d95b835c --- /dev/null +++ b/sources/talk/20191212 Liquid cooling and edge computing are featured at Gartner show.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Liquid cooling and edge computing are featured at Gartner show) +[#]: via: (https://www.networkworld.com/article/3489467/liquid-cooling-and-edge-computing-are-featured-at-gartner-show.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Liquid cooling and edge computing are featured at Gartner show +====== +Non-traditional hardware makes the news at Gartner’s show focused on data-center operations. +ExaScaler + +Research firm Gartner is holding its IT Infrastructure, Operations, and Cloud Strategies Conference (IOCS) in Las Vegas this week, and a few news announcements from the show give an indication as to where [data-center][1] technology is headed. + +First up, Schneider Electric and Iceotope formally introduced their integrated rack with chassis-based immersive liquid-cooling designs. The deal was [announced][2] in October but now the details are out. In addition to Schneider and Iceotope, the alliance also includes Avnet, an electronic-component distributor. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +The server is optimized for compute-intensive applications such as analytics and artificial intelligence. It combines a high-powered GPU server with Iceotope’s liquid-cooling technology, while Avnet integrates the server with Schneider’s NetShelter liquid-cooled enclosure system for simple deployment into data centers or edge-computing environments. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +This is a big advance because most immersion solutions have been using a bathtub design where the motherboard sat vertically in the immersion fluid and the ports stuck out at the top. It was something of a clumsy design that just begged for spillage. Here, the chassis looks like any other rack-mounted server, but it is enclosed and sealed. + +The system is certified EcoStruxure Ready, meaning it works with Schneider’s enclosures, and comes with next-generation data center management software EcoStruxure IT Expert and digital service EcoStruxure Asset Advisor. + +“This latest development marks a significant step toward industrializing chassis-based immersion solutions which offer the efficiency and effectiveness of tank-based solutions while providing the compatibility and serviceability of more traditional, ‘direct-to-chip’ liquid-cooling designs. Given the growth of compute-intensive applications, we believe this approach is very promising,” said Kevin Brown, CTO and senior vice president of innovation, secure power at Schneider Electric in a statement. + +### Scale Computing: Tiny edge device + +Scale Computing introduced the HE150 at the show, the latest addition to its HC3 Edge product line intended for space-constrained and edge customers. + +The HE150 is a very small device based on the [Intel NUC][5] design, and Scale notes it is about the size of three smartphones, with a width and depth of just over 11 centimeters and a height of just over three centimeters. + +The HE150 appliance is a small, all-flash, [NVMe][6] storage-based compute appliance that supports disaster recovery, high availability clustering, rolling upgrades and integrated data protection. As it is, Scale sells them in three-node clusters. + +Scale also announced it plans to make its HC3 Edge software for Intel NUC-based systems from other hardware suppliers. HC3 Edge software will be available soon for Lenovo’s new Smart Edge portfolio of fan-less, small-form-factor PCs. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489467/liquid-cooling-and-edge-computing-are-featured-at-gartner-show.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: https://www.networkworld.com/article/3444624/schneider-electric-launches-wall-mounted-server-rack.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.intel.com/content/www/us/en/products/boards-kits/nuc.html +[6]: https://www.networkworld.com/article/3280991/what-is-nvme-and-how-is-it-changing-enterprise-storage.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From aa11dc8e054b5c36f910a72351b642f6ff010569 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Dec 2019 01:07:27 +0800 Subject: [PATCH 102/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191212=20Secure?= =?UTF-8?q?=20SD-WAN:=20The=20security=20vendors=20and=20their=20SD-WAN=20?= =?UTF-8?q?offerings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191212 Secure SD-WAN- The security vendors and their SD-WAN offerings.md --- ...rity vendors and their SD-WAN offerings.md | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 sources/talk/20191212 Secure SD-WAN- The security vendors and their SD-WAN offerings.md diff --git a/sources/talk/20191212 Secure SD-WAN- The security vendors and their SD-WAN offerings.md b/sources/talk/20191212 Secure SD-WAN- The security vendors and their SD-WAN offerings.md new file mode 100644 index 0000000000..9d3e799da4 --- /dev/null +++ b/sources/talk/20191212 Secure SD-WAN- The security vendors and their SD-WAN offerings.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Secure SD-WAN: The security vendors and their SD-WAN offerings) +[#]: via: (https://www.networkworld.com/article/3489480/secure-sd-wan-the-security-vendors-and-their-sd-wan-offerings.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +Secure SD-WAN: The security vendors and their SD-WAN offerings +====== +A networking vendor simply can’t jump into this space. Some SD-WANs add stateful packet filters and call this security. +[Gerd Altmann][1] [(CC0)][2] + +During its inception, we had the early adopters and pure SD-WAN players. Soon it became obvious that something was missing, and that missing component was “security.” However, security vendors have highlighted the importance of security from the very beginning. + +Today, the market seems to be moving in the direction where the security vendors are focusing on delivering SD-WAN features around pervasive security. The Magic Quadrant for WAN Edge Infrastructure has made a substantial prediction. It states, “By 2024, 50% of new firewall purchases in distributed enterprises will utilize SD-WAN features with the growing adoption of cloud-based services, up from less than 20% today.” + +Nowadays we have security vendors like Forcepoint, SonicWall and Barracuda that follow the pattern of Fortinet. The vendors offer a built-in security stack to the WAN edge architecture for distributed enterprise use cases. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +### Introducing secure SD-WAN + +Pronouncedly, secure SD-WAN includes the best-of-breed next-generation firewall security, SD-WAN, advanced routing, and WAN optimization to deliver a security-driven WAN edge. It combines the SD-WAN feature and security features together.   + +The secure SD-WAN solution can be placed fully in the branch and the cloud or a hybrid approach can be adopted. For those who don’t want to put everything in the cloud, a hybrid approach could be more viable. + +To me, it is quite interesting seeing how the queries are coming into the analysts and how customers are giving attention to this field. Markedly, Gartner estimates that Fortinet has more than 21,000 WAN edge customers. That’s a considerable user base and makes a compelling case, especially when strong and built-in security capabilities are the key requirements. + +### Adding security to networking + +It is definitely easier for a security company to add new networking features than for an SD-WAN company to add 20 years of advanced security features. We can safely assume that no SD-WAN vendor is going to become a security vendor. + +**[ Now read [20 hot jobs ambitious IT pros should shoot for][4]. ]** + +As the market developed, in due course, some features had to be renamed: when we talk about application identification, encryption, path monitoring, routing protocols and WAN link load balancing. Fundamentally, all of these advanced routing features are not new and specific to SD-WAN. These are not overnight successes and have been in the market even before the market existed. + +However, in some scenarios, maybe you have to implement a proprietary routing protocol across the WAN. In this case, yes, of course, you require a new device. But for most of the part, a comprehensive firewall at the edge will suffice. + +### The firewall at the WAN edge + +Firewalls are evolving into network security platforms, thereby offering SD-WAN capabilities. The Magic Quadrant for Network Firewalls states “The SMB multifunction firewall market grew 10.1% in 2018, with SD-WAN adoption being a strong driver.” + +When you think about it, you will realize that the firewall has been acting as a router for a long time. Essentially, the firewall can provide all the routing protocols to facilitate private WAN, internet and internal routing. This functionality is usually provided by a basic device that just does the routing. However, now we are witnessing the replacement of these by an edge appliance with firewalls. + +Firewalls have resided in the networks for decades. Their role has not just been confined to doing the firewalling but also participating in the routed networks. Time and again, they have been providing a routed WAN edge device. + +### Issues with legacy security design + +How do you integrate security with SD-WAN? Primarily, the common design involves the integration of multiple security point solutions. Now, let’s learn about the aftermath of these point solutions. + +### Complexity + +The point solution only addresses one issue and requires a considerable amount of integration with others. Because of this, they are often service-chained together. Each part must be carefully integrated with the other. + +You must continuously add solutions to the stack, which is likely to result in management overhead and increased complexity. Not to mention the challenges with NOC and SOC team integration. Contrarily, the original selling point for SD-WAN was to reduce complexity and not intensify it. + +If we examine security in the world of SD-WAN; the way it has been geared up at the moment is provided in parts that actually increase complexity. It’s like building a house with individual pieces when you actually just want to buy a house. + +If you analyze, you will find that many SD-WANs are merely bringing in security technologies from other vendors, joined together to sell them to the customers. + +### Associated costs + +Having multiple point solutions often from different vendors dispersed around the network is expensive. There’s never a fixed price. Some security vendors may charge on usage models which you may not have the quantity for yet. So, how do you effectively plan for this when you have multiples?  + +As the costs keep adding up, the security professionals may decide to trade-off certain point solutions due to the associated costs. We know now this is not an effective risk management strategy. Ideally, in terms of security, you don't do something when it is needed; you do it before it is needed. This means threat intelligence is the key, which is often overlooked by many SD-WAN vendors. + +It’s far more critical from both technical and cost perspective to bring each of the security point solution functionalities together under one hood. And to do this, someone that specializes in security from day one would fit the bill. This is why there has been a move to provide SD-WAN features along with advanced security into one comprehensive integrated platform. + +Secure SD-WAN is what combines both network and security into one integrated platform. This leads to no more complex management, licensing issues, high costs or unnecessary service chaining. + +### SD-WAN is not about features + +There is a lot of noise in the SD-WAN market about the features. Let’s face it ‘features really don’t draw much value to create market separation’. Practically, the value proposition for SD-WAN is not about the feature. Everyone is doing a good job in classifying applications and sending them across the best path. Let’s understand the true value proposition for SD-WAN. + +### Performance and scalability + +When it comes to SD-WAN, the bell to ring is often application steering, but if you don’t have, for example, the deep TLS1.3 inspection with solid performance, how can you get accurate identification and make sure your branch is secure? Not enough people are talking about this. + +For this, we need custom SD-WAN-specific application-specific integrated circuits (ASICs). This offers an incredible advantage for the high resource intensive encryption/decryption and overlay scalability. + +With IPSec, there are intensive encrypting operations that consume a lot of CPU and RAM. Therefore, a purpose-built SD-WAN ASIC is built just to do that so it consumes less CPU and RAM per tunnel. + +In general, the scalability stops at 1,000 or 1,500. With the proper ASIC, this number can be scaled to over 100,000, which may be useful for some hub site designs. By using the ASIC, you can run the networking stack and security stack in the same appliance, making a very efficient and cost-effective solution. + +### The importance of threat intelligence + +The next-generation firewall is in the datasheets for many SD-WAN vendors. However, what about the threat detection and threat prevention? A big piece missing from the many SD-WAN vendors is threat intelligence in alliance with threat research. The threat landscape is evolving, so too should the security solution to keep in line with today’s and tomorrow's threats. + +Threat prevention has core features from layer 4 to layer 7 such as IPS, content filtering, deep SSL inspection, and anti-malware. Furthermore, we also have a threat detection piece. Nowadays, you can no longer rely on detecting known threats, you have to detect unknown threats too. So having a stack of both prevention and detection features is very important. With the two features glued together, we can have experienced security research and analyst teams. It is significant to observe whether the SD-WAN vendor has its own threat intelligence. + +For this, we really do need the security company pedigree. The core value for any security vendor comes with their level of intelligence research. This is what creates market separation, not SD-WAN features. + +However, there is another step, which is to confirm if the proposed features have been validated by 3rd parties such as NSS labs. NSS Labs has evaluated some of these security vendors for their SD-WAN leading products on areas such as the quality of experience (QoE) of VoIP and video, performance (WAN impairments and HA), the total cost of ownership (TCO) along with security effectiveness. + +Also, we must question how often does the ‘SD-WAN device providing firewalling’ gets updated with the latest threat information. Is this process carried a few times per day or per week? Some SD-WAN solutions market them as a secure SD-WAN vendor, but if we go back to the point of building effective security, we need a solid threat intelligence team. Do startups have enough manpower to do that? A networking vendor simply can’t jump into this space. Some SD-WANs add stateful packet filters and call this security. + +Let’s be honest, a next-generation firewall can be used by anyone. However, the importance of the breadth of the features, the intelligence they provide and the recognition in the market play a huge role. This is what builds trust in the next-generation firewall in the branch and ensures that the best security posture remains the best. + +When you’re looking for secure SD-WAN vendors, highlight these questions and examine how old their security stack is. Also, assess if they have an experienced threat intelligence team. + +The market is moving towards a secure SD-WAN solution. The industry analysis and the rise of the customer base have a great impact in today’s time. It is not the case that people are recognizing security vendors as strong SD-WAN players. + +However, recognizing the market demands secure SD-WAN in one integrated comprehensive platform. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][5]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489480/secure-sd-wan-the-security-vendors-and-their-sd-wan-offerings.html + +作者:[Matt Conran][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/illustrations/network-control-block-chain-hexagon-4478145/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html +[5]: https://www.networkworld.com/contributor-network/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 49dc6880e98206c7b8e2a7d53a32b350d8c268ed Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 15 Dec 2019 01:08:12 +0800 Subject: [PATCH 103/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191211=20Passiv?= =?UTF-8?q?e=20optical=20LAN:=20Its=20day=20is=20dawning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191211 Passive optical LAN- Its day is dawning.md --- ...Passive optical LAN- Its day is dawning.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/talk/20191211 Passive optical LAN- Its day is dawning.md diff --git a/sources/talk/20191211 Passive optical LAN- Its day is dawning.md b/sources/talk/20191211 Passive optical LAN- Its day is dawning.md new file mode 100644 index 0000000000..4250c357af --- /dev/null +++ b/sources/talk/20191211 Passive optical LAN- Its day is dawning.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Passive optical LAN: Its day is dawning) +[#]: via: (https://www.networkworld.com/article/3489477/passive-optical-lan-its-day-is-dawning.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Passive optical LAN: Its day is dawning +====== + +Getty Images + +The concept of using passive optical LANs in enterprise campuses has been around for years, but hasn’t taken off because most businesses consider all-fiber networks to be overkill for their needs. I’ve followed this market for the better part of two decades, and now I believe we’re on the cusp of seeing POL go mainstream, starting in certain verticals. + +The primary driver of change from copper to optical is that the demands on the network have evolved. Every company now considers its network to be business critical where just a few years ago, it was considered best effort in nature.  Downtime or a congested network meant inconvenienced users, but today they mean the business is likely losing big money. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +There are also a number of new trends driving the evolution of the campus network.  These include: + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + + * Cloud services. The cloud is certainly the way of the future but it’s playing havoc with enterprise networks. As data centers evolved to modernized systems, East-West traffic was superseded by North-South. Today, businesses are connecting direct to cloud for [hybrid-cloud][3] deployments driving more North-South traffic.  Traditional networks can be a bottleneck.  + * [Internet of Things][4] (IoT). [Wi-Fi 6 and 5G][5] will enable more devices to be connected in more places leading to more bandwidth on the network. For the first time in history, wireless speeds will match wired speeds straining the campus network. + * Video of all kinds is on the rise.  Surveillance, collaboration, room systems, streaming and other kinds of video usage are on the rise.  Video requires high-quality, low-latency connectivity. + + + +### Copper is running out of life + +The increased speeds pose quite a predicament for companies. If the organization has Cat5 cabling, the speed is capped at 1Gbps. If Cat6 is deployed, speeds of 10Gbps can be reached but only 55 meter’s distance. If the company wants to reach the full 100M length of copper, Cat6A or higher must be used.  Optical cable has no distance limitations because POL is completely passive and requires no electronics to boost the signal.  Optical cabling can carry petabytes of bandwidth over long distances.  Also, with optical, there’s no concern over what type of cable is being used and having the quality degrade over time.  Lastly, upgrading speeds is easier.  The cabling can stay in place and just the optics get changed out at the ends of the cable making the process simple. + +### POL is a cheaper, longer lasting than copper upgrades + +If businesses are faced with having to upgrade their networks from Cat5 to another type of cabling, it might make sense to look at POL as it can be the foundation for the campus network for years. + +The early adopters of POL are companies that are highly distributed with large campuses and need to get more network services in more places. This includes manufacturing organizations, universities, hospitality, cities and airports. Although I’ve highlighted a few verticals, the fact is that any business can take advantage of POL. + +### POL in a mixed-use development + +At a Huawei conference earlier this year the company showcased the Dubai Creek Harbor project being built by Emaar Properties – a six-square-mile development including residences, offices, retail and cultural facilities. The complex is designed to be fully digital and the network has to support IoT, cloud computing, AI-based analytics and more. + +The project features an optical network built on Huawei’s Campus OptiX solution that simplifies the network as the architecture moves from a three-tier hierarchical design to a two-tier one. That design uses less equipment and reduces power and cooling requirements. Also, the flat, 10Gbps network obviates the need for parallel overlay networks, making it easier to manage and giving it a degree of future-proofing as the network can easily be upgraded. The all-optical network resulted in a 60% improvement in operational efficiency and a deployment time that was cut in half compared a similar network using Ethernet. + +### Cost effective ** + +** + +Although there are many benefits to POL, adoption has been light. The biggest impediment to its adoption is a general lack of awareness and a misunderstanding of cost. The actual cost of fiber cabling is higher than copper, but I’ve talked to many companies that have looked at fully loaded costs and often optical is cheaper. Optical isn’t subject to electromagnetic interference like copper is so there’s no need to lay a pipeline down first. Also, copper cabling requires distribution cabinets to boost the signal and that adds the cost of UPSes, cooling and power that fiber does not. + +North American buyers may not have the same awareness of POL as those in China, where: + + * The engineering standard of POL was released in June, outlining the system, design, cabling, testing and acceptance rules. + * An alliance was established Oct. 22 bringing together a number of companies including Nokia, Huawei, and Yangtze Optical Fiber and Cable. + + + +Both of these will help drive innovation and standardization. + +Copper has been the preferred campus backbone, but businesses are changing and so is the network. It’s not enough to just change the infrastructure but the cabling that connects everything should be looked at and POL used as a next-generation backbone. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489477/passive-optical-lan-its-day-is-dawning.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[4]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[5]: https://www.networkworld.com/article/3402316/when-to-use-5g-when-to-use-wi-fi-6.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 8d31d23ba810e69f07d640d8556644e90a738d03 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 15 Dec 2019 12:34:11 +0800 Subject: [PATCH 104/676] PRF @wxy --- ...191206 5 cool terminal pagers in Fedora.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20191206 5 cool terminal pagers in Fedora.md b/translated/tech/20191206 5 cool terminal pagers in Fedora.md index 6e5825ef44..88b0c802ed 100644 --- a/translated/tech/20191206 5 cool terminal pagers in Fedora.md +++ b/translated/tech/20191206 5 cool terminal pagers in Fedora.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 cool terminal pagers in Fedora) [#]: via: (https://fedoramagazine.org/5-cool-terminal-pagers-in-fedora/) [#]: author: (Jacob Burns https://fedoramagazine.org/author/jaek/) -5 最酷的终端分页器 +5 个最酷的终端分页器 ====== ![][1] -像日志或源代码这样的大文件可能会多达成千上万行,这使得在文件内导航非常困难,尤其是在终端上。此外,大多数终端仿真器的回滚缓冲区只有几百行。这可能使得无法使用打印到标准输出的实用程序(例如 `cat`、`head` 和 `tail`)在终端中浏览大型文件。在计算的早期,程序员通过开发用于以虚拟“页面”形式显示文本的实用程序来解决这些问题,该实用程序被形象地描述为分页器pager。 +像日志或源代码这样的大文件可能会多达成千上万行,这使得在文件内导航非常困难,尤其是在终端上。此外,大多数终端仿真器的回滚缓冲区只有几百行。这可能使得无法使用打印到标准输出的实用程序(例如 `cat`、`head` 和 `tail`)在终端中浏览大型文件。在计算时代的早期,程序员通过开发用于以虚拟“页面”形式显示文本的实用程序来解决这些问题,该实用程序被形象地描述为分页器pager。 -*分页器*提供了许多使文本文件导航更加简单的功能,包括滚动、搜索功能,以及作为命令[管道][2]的一部分而具有的功能。与大多数文本编辑器相比,某些终端分页器不需要加载整个文件即可查看,这使它们更快,特别是对于非常大的文件。 +*分页器*提供了许多使文本文件导航更加简单的功能,包括滚动、搜索功能,以及作为命令[管道][2]的一部分而具有的功能。与大多数文本编辑器相比,某些终端分页器不需要加载整个文件即可查看,这使得它们更快,特别是对于非常大的文件。 -在现代 Linux 计算时代,终端仿真器比以往更加复杂。它们提供了对缤纷的色彩、终端大小调整以及许多其它功能的支持,这些功能使得辨析屏幕上的文本变得更加轻松和高效。从诸如 `pg` 和 `more` 这样极其简单的 UNIX 实用程序,到涵盖各种使用场景的、功能广泛的复杂程序,终端分页器经历了类似的演变。考虑到这一点,我们或多或少地汇总了一些最受欢迎的终端分页实用程序的列表。 +在现代 Linux 计算时代,终端仿真器比以往更加复杂。它们提供了对缤纷的色彩、终端尺寸调整以及许多其它功能的支持,这些功能使得辨析屏幕上的文本变得更加轻松和高效。从诸如 `pg` 和 `more` 这样极其简单的 UNIX 实用程序,到涵盖各种使用场景的、功能广泛的复杂程序,终端分页器也经历了类似的演变。考虑到这一点,我们或“多”或“少”地汇总了一些最受欢迎的终端分页实用程序的列表。 ### more `more` 是最早的分页器之一,最初在 3.0 BSD 版本中出现。`more` 的第一个实现由 [Daniel Halbert][3] 编写于 1978 年。从那时起,`more` 已成为许多操作系统的普遍功能,包括 Windows、OS/2,MacOS 和大多数 Linux 发行版。 -`more` 是一个非常轻量级的实用程序。util-linux 软件包中提供的版本只有不到 2100 行的 C 语言。但是,这种较小的大小是有代价的。`more` 的大多数版本的功能相对有限,不支持向后滚动或搜索。命令也同样被精简:按回车键可滚动一行,或按空格键滚动一页。其他一些有用的命令包括: +`more` 是一个非常轻量级的实用程序。util-linux 软件包中提供的版本只有不到 2100 行的 C 语言代码。但是,这种较小的代码大小是有代价的。大多数版本的 `more` 的功能相对有限,不支持向后滚动或搜索。命令也同样精简:按回车键可滚动一行,或按空格键滚动一页。其他一些有用的命令包括: * 在阅读时按 `v` 键以在默认的终端编辑器中打开当前文件。 * `/模式` 可以让你搜索下一个出现的“模式”。 @@ -32,15 +32,15 @@ `less` 最初被认为是 `more` 的继承者,解决了它的一些局限性。`less` 以 `more` 的功能为基础,增加了许多有用的功能,包括向后滚动、向后搜索。它也更适合窗口大小调整。 -`less` 中的导航与 `more` 类似,尽管 `less` 也从 `vi` 编辑器借用了一些有用的命令。用户可以使用熟悉的 home 行导航键浏览文档。看一眼 `less` 的手册页,就会发现相当多的可用命令。一些特别有用的示例包括: +`less` 中的导航方式与 `more` 类似,尽管 `less` 也从 `vi` 编辑器借用了一些有用的命令。用户可以使用熟悉的主行导航键home row navigational keys(LCTT 译注:指 左手的 `A`、`S`、`D`、`F` 和右手的 `J`、`K`、`L`、`;`,及大拇指所在的空格键)浏览文档。看一眼 `less` 的手册页,就会发现相当多的可用命令。一些特别有用的示例包括: * `?模式` 可让你在文件中向后搜索“模式”。 * `&模式` 仅显示具有“模式”特征的行。这对于发现自己经常要使用 `$ grep 模式 | less` 的人特别有用。 -* 使用 `-s`(`–sqeueeze-blank-lines`)标志来调用 `less`,使你可以查看空白较大的文本文件。 多个换行符被简化为单个中断。 -* 在程序中调用的 `s 文件名` 将输入保存到 `文件名`中(如果输入来自管道)。 +* 使用 `-s`(或 `–sqeueeze-blank-lines`)标志来调用 `less`,使你可以查看空白较大的文本文件。 多个换行符被简化为单个中断行。 +* 在该程序中调用的 `s 文件名` 将输入保存到 `文件名`中(如果输入来自管道)。 * 或者,使用 `-o 文件名` 标志来调用 `less` 将把 `less` 的输入保存到 `文件名` 中。    -随着这些增强的功能也带来了体积的略微增大。在写作本文时,Fedora 随附的 `less` 版本大约有 25000 行源代码。当然,除非是受存储限制最大的系统,其它的所有系统上这都不是问题。此外,`less` 比 `more` 功能更多。 +随着这些增强的功能也带来了体积的略微增大。在写作本文时,Fedora 随附的 `less` 版本大约有 25000 行源代码。当然,除非是受存储限制最大的系统,在所有其它的系统上这都不是问题。`less` 比 `more` 功能更多。 ### most @@ -48,7 +48,7 @@ 重要的是,`most` 考虑了其输入文本的宽度。默认的查看模式是不换行的(`less` 中的 `-S` 参数),此功能在处理“宽”文件时特别有用。尽管对于某些用户来说,这些设计决策可能代表着与传统的重大偏离,但最终结果却非常强大。 -除了 `more` 提供的导航命令外,`most` 使用直观的助记符进行文件导航。例如,`t` 移至文件的顶部(Top),而 `b` 移至底部(Bottom)。这样,不熟悉 `vi` 及其后代的用户会发现 `most` 非常简单好用。 +除了 `more` 提供的导航命令外,`most` 使用直观的助记符进行文件导航。例如,`t` 移至文件的顶部(Top),而 `b` 移至底部(Bottom)。这样,不熟悉 `vi` 及其衍生品的用户会发现 `most` 非常简单好用。 `most` 的与众不同之处在于它能够快速轻松地拆分窗口和上下文。例如,可以使用以下命令打开两个不同的文本文件: @@ -60,17 +60,17 @@ $ most textFile1.txt textFile2.txt ![][4] -如果在一个窗口中关闭自动换行,它不会影响其他窗口的行为。`\` 字符表示换行或折叠,而 `$` 字符表示文件超出了当前窗口的限制。 +如果在一个窗口中关闭自动换行,它不会影响其他窗口的行为。(行末的)`\` 字符表示换行或折叠,而 `$` 字符表示文件超出了当前窗口的限制。 ### pspg -使用 SQL 数据库的人员通常需要能够一目了然地检查我们数据库的内容。许多流行的开源 DBMS(例如 MySQL 和 PostGreSQL)的命令行界面都使用系统默认的分页器来查看无法显示在单个屏幕上的输出。诸如`more` 和 `less` 之类的实用程序是围绕呈现文本文件的想法而设计的,但是对于更结构化的数据,还有一些不足之处。天真的文本分页程序没有宽的表格数据的概念,当处理大型查询时,这可能会令人感到沮丧。 +使用 SQL 数据库的人员通常需要能够一目了然地检查数据库的内容。许多流行的开源 DBMS(例如 MySQL 和 PostGreSQL)的命令行界面都使用系统默认的分页器来查看无法显示在单个屏幕上的输出。诸如 `more` 和 `less` 之类的实用程序是围绕呈现文本文件的想法而设计的,但是对于更结构化的数据,还有一些不足之处。天真的文本分页程序没有宽的表格数据的概念,当处理大型查询时,这可能会令人感到沮丧。 [pspg][5] 试图通过为用户提供在查看时冻结列、*原位*排序数据并为输出着色的功能来解决此问题。尽管`pspg` 最初是专门用作 `psql` 的分页器的替代品,但该程序还支持查看 CSV 数据,并且是 `mysql` 和 `pgcli` 的合适的直接替代品。 ### Vim -在现代的颜色鲜明的终端中,无休止的黑色页面上的黑色文字感觉太过时了。强大的文本编辑器(如`vim` )提供的语法高亮显示选项对于浏览源代码很有用。此外,`vim` 提供的搜索功能远远超过了竞争对手。考虑到这一点,`vim` 附带了一个 shell 脚本 `less.sh`,该脚本可以使 `vim` 替代传统的分页器。 +在现代的颜色鲜明的终端中,无休止的黑色页面上的灰色文字感觉太过时了。强大的文本编辑器(如 `vim`)提供的语法高亮显示选项对于浏览源代码很有用。此外,`vim` 提供的搜索功能远远超过了竞争对手。考虑到这一点,`vim` 附带了一个 shell 脚本 `less.sh`,该脚本可以使 `vim` 替代传统的分页器。 要将 `vim` 设置为手册页的[默认分页器][6],请将以下内容添加到 shell 的配置中(如果使用默认的bash shell 的话是 `~/.bashrc`): @@ -87,7 +87,7 @@ via: https://fedoramagazine.org/5-cool-terminal-pagers-in-fedora/ 作者:[Jacob Burns][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 206f5ed85c5b435f8bcc3fcca22608d07437f0ab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 15 Dec 2019 12:34:43 +0800 Subject: [PATCH 105/676] PUB @wxy https://linux.cn/article-11676-1.html --- .../20191206 5 cool terminal pagers in Fedora.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191206 5 cool terminal pagers in Fedora.md (99%) diff --git a/translated/tech/20191206 5 cool terminal pagers in Fedora.md b/published/20191206 5 cool terminal pagers in Fedora.md similarity index 99% rename from translated/tech/20191206 5 cool terminal pagers in Fedora.md rename to published/20191206 5 cool terminal pagers in Fedora.md index 88b0c802ed..8126cbc54d 100644 --- a/translated/tech/20191206 5 cool terminal pagers in Fedora.md +++ b/published/20191206 5 cool terminal pagers in Fedora.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11676-1.html) [#]: subject: (5 cool terminal pagers in Fedora) [#]: via: (https://fedoramagazine.org/5-cool-terminal-pagers-in-fedora/) [#]: author: (Jacob Burns https://fedoramagazine.org/author/jaek/) From 7cd65cf6fe2324d57ae68af87ea9a245a1d1a264 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 15 Dec 2019 15:05:29 +0800 Subject: [PATCH 106/676] Rename sources/tech/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md to sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md --- ...n Software Foundation fellows from Africa, and more updates.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md (100%) diff --git a/sources/tech/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md b/sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md similarity index 100% rename from sources/tech/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md rename to sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md From b61ea44f563f6766d56002b2210383f60c4b85f3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 15 Dec 2019 15:26:21 +0800 Subject: [PATCH 107/676] PRF @lxbwolf --- ...High CPU Consumption Processes in Linux.md | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md b/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md index 828494d8fd..407a065dbc 100644 --- a/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md +++ b/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md @@ -1,20 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Find High CPU Consumption Processes in Linux) [#]: via: (https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Linux 中怎么找出 CPU 占用高的进程 +如何在 Linux 中找出 CPU 占用高的进程 ====== -在之前的文章中我们已经讨论过 [Linux 中怎么找出消耗内存高的进程][1] 。你可能也会遇到在 Linux 系统中找出 CPU 占用高的进程的情形。如果是这样,那么你需要列出系统中 CPU 占用高的进程的列表来确定。我认为只有两种方法能实现:使用 [top 命令][2] 和 [ps 命令][3]。出于一些理由,我更倾向于用 top 命令而不是 ps 命令。但是两个工具都能达到你要的目的,所以你可以根据需求决定使用哪个。这两个工具都被 Linux 系统管理员广泛使用。 +![](https://img.linux.net.cn/data/attachment/album/201912/15/152614cp9bjmfwpofwvsx1.jpg) + +在之前的文章中我们已经讨论过 [如何在 Linux 中找出内存消耗最大的进程][1]。你可能也会遇到在 Linux 系统中找出 CPU 占用高的进程的情形。如果是这样,那么你需要列出系统中 CPU 占用高的进程列表来确定。我认为只有两种方法能实现:使用 [top 命令][2] 和 [ps 命令][3]。出于一些理由,我更倾向于用 `top` 命令而不是 `ps` 命令。但是两个工具都能达到你要的目的,所以你可以根据需求决定使用哪个。这两个工具都被 Linux 系统管理员广泛使用。 ### 1) 怎样使用 top 命令找出 Linux 中 CPU 占用高的进程 -在所有监控 Linux 系统性能的工具中,Linux 的 top 命令是最好的也是最知名的。top 命令提供了 Linux 系统运行中的进程的动态实时视图。它能显示系统的概览信息,和 Linux 内核当前管理的进程列表。它显示了大量的系统信息,如 CPU 使用,内存使用,交换内存,运行的进程数,目前系统开机时间,系统负载,缓冲区大小,缓存大小,进程 PID等等。默认情况下,top 命令的输出结果按 CPU 占用进行排序,每 5 秒中更新一次结果。如果你想要一个更清晰的视图来更深入的分析结果,[以批次档模式运行 top 命令][4] 是最好的方法。同时,你需要 [理解 top 命令输出结果的含义][5] ,这样才能解决系统的性能问题。 +在所有监控 Linux 系统性能的工具中,Linux 的 `top` 命令是最好的也是最知名的一个。`top` 命令提供了 Linux 系统运行中的进程的动态实时视图。它能显示系统的概览信息和 Linux 内核当前管理的进程列表。它显示了大量的系统信息,如 CPU 使用、内存使用、交换内存、运行的进程数、目前系统开机时间、系统负载、缓冲区大小、缓存大小、进程 PID 等等。默认情况下,`top` 命令的输出结果按 CPU 占用进行排序,每 5 秒中更新一次结果。如果你想要一个更清晰的视图来更深入的分析结果,[以批处理模式运行 top 命令][4] 是最好的方法。同时,你需要 [理解 top 命令输出结果的含义][5] ,这样才能解决系统的性能问题。 ``` # top -b | head -50 @@ -47,25 +49,23 @@ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 上面的命令的各部分解释: - * **top :** 命令 - * **-b :** 批次档模式 - * **head -50:** 显示输出结果的前 50 个 - * **PID :** 进程的 ID - * **USER :** 进程的归属者 - * **PR :** 进程的等级 - * **NI :** 进程的 NICE 值 - * **VIRT :** 进程使用的虚拟内存 - * **RES :** 进程使用的物理内存 - * **SHR :** 进程使用的共享内存 - * **S :** 这个值表示进程的状态: S=睡眠 R=运行 Z=僵尸进程 - * **%CPU :** 进程占用的 CPU 比例 - * **%MEM :** 进程使用的 RAM 比例 - * **TIME+ :** 进程运行了多长时间 - * **COMMAND :** 进程名字 + * `top`:命令 + * `-b`:批次档模式 + * `head -50`:显示输出结果的前 50 个 + * `PID`:进程的 ID + * `USER`:进程的归属者 + * `PR`:进程的等级 + * `NI`:进程的 NICE 值 + * `VIRT`:进程使用的虚拟内存 + * `RES`:进程使用的物理内存 + * `SHR`:进程使用的共享内存 + * `S`:这个值表示进程的状态: `S` = 睡眠,`R` = 运行,`Z` = 僵尸进程 + * `%CPU`:进程占用的 CPU 比例 + * `%MEM`:进程使用的 RAM 比例 + * `TIME+`:进程运行了多长时间 + * `COMMAND`:进程名字 - - -如果你想看命令的完整路径而不是命令名字,以运行下面的格式 top 命令: +如果你想看命令的完整路径而不是命令名字,以运行下面的格式 `top` 命令: ``` # top -c -b | head -50 @@ -99,7 +99,7 @@ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ### 2) 怎样使用 ps 命令找出 Linux 中 CPU 占用高的进程 -ps 是 `process status`(进程状态)的缩写,它能显示系统中活跃的/运行中的进程的信息。它提供了当前进程及其详细信息,诸如用户名、用户 ID、CPU 使用率、内存使用、进程启动日期时间、命令名等等的快照。 +`ps` 是进程状态process status的缩写,它能显示系统中活跃的/运行中的进程的信息。它提供了当前进程及其详细信息,诸如用户名、用户 ID、CPU 使用率、内存使用、进程启动日期时间、命令名等等的快照。 ``` # ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%cpu | head @@ -118,20 +118,18 @@ ps 是 `process status`(进程状态)的缩写,它能显示系统中活跃 上面的命令的各部分解释: - * **ps :** 命令名字 - * **-e :** 选择所有进程 - * **-o :** 自定义输出格式 - * **–sort=-%cpu :** 基于 CPU 使用率对输出结果排序 - * **head :** 显示结果的前 10 行 - * **PID :** 进程的 ID - * **PPID :** 父进程的 ID - * **%MEM :** 进程使用的 RAM 比例 - * **%CPU :** 进程占用的 CPU 比例 - * **Command :** 进程名字 + * `ps`:命令名字 + * `-e`:选择所有进程 + * `-o`:自定义输出格式 + * `–sort=-%cpu`:基于 CPU 使用率对输出结果排序 + * `head`:显示结果的前 10 行 + * `PID`:进程的 ID + * `PPID`:父进程的 ID + * `%MEM`:进程使用的 RAM 比例 + * `%CPU`:进程占用的 CPU 比例 + * `Command`:进程名字 - - -如果你只想看命令名字而不是命令的绝对路径,以运行下面的格式 ps 命令: +如果你只想看命令名字而不是命令的绝对路径,以运行下面的格式 `ps` 命令: ``` # ps -eo pid,ppid,%mem,%cpu,comm --sort=-%cpu | head @@ -155,13 +153,13 @@ via: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linu 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ +[1]: https://linux.cn/article-11542-1.html [2]: https://www.2daygeek.com/linux-top-command-linux-system-performance-monitoring-tool/ [3]: https://www.2daygeek.com/linux-ps-command-find-running-process-monitoring/ [4]: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/ From c5473db37d055af37faeb5de3d73603ba627751a Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Sun, 15 Dec 2019 16:53:57 +0800 Subject: [PATCH 108/676] translated --- .../tech/20190322 Easy means easy to debug.md | 83 ------------------- .../tech/20190322 Easy means easy to debug.md | 74 +++++++++++++++++ 2 files changed, 74 insertions(+), 83 deletions(-) delete mode 100644 sources/tech/20190322 Easy means easy to debug.md create mode 100644 translated/tech/20190322 Easy means easy to debug.md diff --git a/sources/tech/20190322 Easy means easy to debug.md b/sources/tech/20190322 Easy means easy to debug.md deleted file mode 100644 index e6cafacb66..0000000000 --- a/sources/tech/20190322 Easy means easy to debug.md +++ /dev/null @@ -1,83 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( luming) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Easy means easy to debug) -[#]: via: (https://arp242.net/weblog/easy.html) -[#]: author: (Martin Tournoij https://arp242.net/) - - -What does it mean for a framework, library, or tool to be “easy”? There are many possible definitions one could use, but my definition is usually that it’s easy to debug. I often see people advertise a particular program, framework, library, file format, or something else as easy because “look with how little effort I can do task X, this is so easy!” That’s great, but an incomplete picture. - -You only write software once, but will almost always go through several debugging cycles. With debugging cycle I don’t mean “there is a bug in the code you need to fix”, but rather “I need to look at this code to fix the bug”. To debug code, you need to understand it, so “easy to debug” by extension means “easy to understand”. - -Abstractions which make something easier to write often come at the cost of make things harder to understand. Sometimes this is a good trade-off, but often it’s not. In general I will happily spend a little but more effort writing something now if that makes things easier to understand and debug later on, as it’s often a net time-saver. - -Simplicity isn’t the only thing that makes programs easier to debug, but it is probably the most important. Good documentation helps too, but unfortunately good documentation is uncommon (note that quality is not measured by word count!) - -This is not exactly a novel insight; from the 1974 The Elements of Programming Style by Brian W. Kernighan and P. J. Plauger: - -> Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it? - -A lot of stuff I see seems to be written “as clever as can be” and is consequently hard to debug. I’ll list a few examples of this pattern below. It’s not my intention to argue that any of these things are bad per se, I just want to highlight the trade-offs in “easy to use” vs. “easy to debug”. - - * When I tried running [Let’s Encrypt][1] a few years ago it required running a daemon as root(!) to automatically rewrite nginx files. I looked at the source a bit to understand how it worked and it was all pretty complex, so I was “let’s not” and opted to just pay €10 to the CA mafia, as not much can go wrong with putting a file in /etc/nginx/, whereas a lot can go wrong with complex Python daemons running as root. - -(I don’t know the current state/options for Let’s Encrypt; at a quick glance there may be better/alternative ACME clients that suck less now.) - - * Some people claim that systemd is easier than SysV init.d scripts because it’s easier to write systemd unit files than it is to write shell scripts. In particular, this is the argument Lennart Poettering used in his [systemd myths][2] post (point 5). - -I think is completely missing the point. I agree with Poettering that shell scripts are hard – [I wrote an entire post about that][3] – but by making the interface easier doesn’t mean the entire system becomes easier. Look at [this issue][4] I encountered and [the fix][5] for it. Does that look easy to you? - - * Many JavaScript frameworks I’ve used can be hard to fully understand. Clever state keeping logic is great and all, until that state won’t work as you expect, and then you better hope there’s a Stack Overflow post or GitHub issue to help you out. - - * Docker is great, right up to the point you get: - -``` - ERROR: for elasticsearch Cannot start service elasticsearch: -oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:258: -applying cgroup configuration for process caused \"failed to write 898 to cgroup.procs: write -/sys/fs/cgroup/cpu,cpuacct/docker/b13312efc203e518e3864fc3f9d00b4561168ebd4d9aad590cc56da610b8dd0e/cgroup.procs: -invalid argument\"" -``` - -or - -``` -ERROR: for elasticsearch Cannot start service elasticsearch: EOF -``` - -And … now what? - - * Many testing libraries can make things harder to debug. Ruby’s rspec is a good example where I’ve occasionally used the library wrong by accident and had to spend quite a long time figuring out what exactly went wrong (as the errors it gave me were very confusing!) - -I wrote a bit more about that in my [Testing isn’t everything][6] post. - - * ORM libraries can make database queries a lot easier, at the cost of making things a lot harder to understand once you want to solve a problem. - - - - - --------------------------------------------------------------------------------- - -via: https://arp242.net/weblog/easy.html - -作者:[Martin Tournoij][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://arp242.net/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Let%27s_Encrypt -[2]: http://0pointer.de/blog/projects/the-biggest-myths.html -[3]: https://arp242.net/weblog/shell-scripting-trap.html -[4]: https://unix.stackexchange.com/q/185495/33645 -[5]: https://cgit.freedesktop.org/systemd/systemd/commit/?id=6e392c9c45643d106673c6643ac8bf4e65da13c1 -[6]: /weblog/testing.html -[7]: mailto:martin@arp242.net -[8]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/translated/tech/20190322 Easy means easy to debug.md b/translated/tech/20190322 Easy means easy to debug.md new file mode 100644 index 0000000000..58ac5ffcf6 --- /dev/null +++ b/translated/tech/20190322 Easy means easy to debug.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( luming) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Easy means easy to debug) +[#]: via: (https://arp242.net/weblog/easy.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +简单就是易于调试 +====== +对于框架、库或者工具来说,怎样做才算是“简单”?也许有很多的定义,但我的理解通常是易于调试。我经常见到人们宣传某个特定的程序、框架、库、文件格式是简单的,因为它们会说“看,我只需要这么一点工作量就能够完成某项工作,这太简单了”。非常好,但并不完善。 + +你可能只编写一次软件,但几乎总要经历好几个调试周期。注意我说的调试周期并不意味着“代码里面有 bug 你需要修复”,而是说“我需要再看一下这份代码来修复 bug”。为了调试代码,你需要理解它,因此“易于调试”延伸来讲就是“易于理解”。 + +抽象使得程序易于编写,但往往是以难以理解为代价。有时候这是一个很好的折中,但通常不是。大体上,如果能使程序在日后易于理解和调试,我很乐意花更多的时间来写一些东西,因为这样可以省时间。 + +简洁并不是让程序易于调试的唯一方法,但它也许是最重要的。良好的文档也是,但不幸的是它太少了。(注意,质量并不取决于字数!) + +这种影响是真是存在的。难以调试的程序会有更多的 bug,即使最初的 bug 数量与易于调试的程序完全相同,这简简单单是因为修复 bug 更加困难、更花时间。 + +在公司的环境中,把时间花在难以修复的 bug 上通常被认为是不划算的投资。而在开源的环境下,人们花的时间会更少。(大多数项目都有一个或多个定期的维护者,但成百上千的贡献者提交的仅只是几个补丁) + +这并不全是 1974 年由 Brian W. Kernighan 和 P. J. Plauger 合著的小说《编程风格的元素》中的观点: + +> 每个人都知道调试比起编写程序困难两倍。当你写程序的时候耍小聪明,那么将来应该怎么去调试? + +我见过许多写起来精妙,但却导致难以调试的代码。我会在下面列出几种样例。争论这些东西本身有多坏并不是我的本意,我仅想强调对于“易于使用”和“易于调试”之间的折中。 + * ORM对象关系映射 库可以让数据库查询变得简单,代价是一旦你想解决某个问题,事情就变得难以理解。 + +* 许多测试框架让调试变得困难。Ruby 的 rspec 就是一个很好的例子。有一次我不小心使用错了,结果花了很长时间搞清楚哪里出了问题(因为它给出错误提示非常含糊)。 + +我在《[测试并非万能][1]》这篇文章中写了更多关于以上的例子。 + +* 我用过的许多 JavaScript 框架都很难完全理解。Clever(LCTT 译注:一种 JS 框架)的声明语句一向很有逻辑,直到某条语句和你的预期不符,这时你就只能指望 Stack Overflow 上的某篇文章或 GitHub 上的某个回帖来帮助你了。 + +这些函数库确实让任务变得非常简单,使用它们也没有什么错。但通常人们都过于关注“易于使用”而忽视了“易于调试”这一点。 + +* Docker 非常棒,并且让许多事情变得非常简单,直到你看到了这条提示: +``` + ERROR: for elasticsearch Cannot start service elasticsearch: +oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:258: +applying cgroup configuration for process caused \"failed to write 898 to cgroup.procs: write +/sys/fs/cgroup/cpu,cpuacct/docker/b13312efc203e518e3864fc3f9d00b4561168ebd4d9aad590cc56da610b8dd0e/cgroup.procs: +invalid argument\"" +``` +或者这条: +``` +ERROR: for elasticsearch Cannot start service elasticsearch: EOF +``` +那么...现在看起来呢? +* `Systemd` 比起 `SysV`、`init.d` 脚本更加简单,因为编写 `systemd` 单元文件比起编写 `shell` 脚本更加方便。这也是 Lennart Poetterin 在他的 [systemd 神话][2] 中解释 `systemd` 为何简单时使用的论点。 + +我非常赞同 Poettering 的观点——也可以看 [shell 脚本陷阱][3] 这篇文章。但是这种角度并不全面。单元文件简单的背后意味着 `systemd` 作为一个整体要复杂的多,并且用户确实会受到它的影响。看看我遇到的这个[问题][4]和为它所做的[修复][5]。看起来很简单吗? + + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/easy.html + +作者:[Martin Tournoij][a] +选题:[lujun9972][b] +译者:[LuuMing](https://github.com/LuuMing) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://arp242.net/ +[b]: https://github.com/lujun9972 +[1]: https://www.arp242.net/testing.html +[2]: http://0pointer.de/blog/projects/the-biggest-myths.html +[3]:https://www.arp242.net/shell-scripting-trap.html +[4]:https://unix.stackexchange.com/q/185495/33645 +[5]:https://cgit.freedesktop.org/systemd/systemd/commit/?id=6e392c9c45643d106673c6643ac8bf4e65da13c1 \ No newline at end of file From b9d81acae2a16045c4e7696356aeda296fac8cce Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 15 Dec 2019 19:05:49 +0800 Subject: [PATCH 109/676] PUB @lxbwolf https://linux.cn/article-11678-1.html --- ...211 How to Find High CPU Consumption Processes in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191211 How to Find High CPU Consumption Processes in Linux.md (99%) diff --git a/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md b/published/20191211 How to Find High CPU Consumption Processes in Linux.md similarity index 99% rename from translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md rename to published/20191211 How to Find High CPU Consumption Processes in Linux.md index 407a065dbc..69516fa8b8 100644 --- a/translated/tech/20191211 How to Find High CPU Consumption Processes in Linux.md +++ b/published/20191211 How to Find High CPU Consumption Processes in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11678-1.html) [#]: subject: (How to Find High CPU Consumption Processes in Linux) [#]: via: (https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 33d3df87066b767d6c1e61747fb403998ce816d1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 15 Dec 2019 19:40:42 +0800 Subject: [PATCH 110/676] APL --- ...01 Awk one-liners and scripts to help you sort text files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md b/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md index 2ce53e1d7e..aec0e05884 100644 --- a/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md +++ b/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8d860b6664846ede6bcc02fd272585d24157c02a Mon Sep 17 00:00:00 2001 From: algzjh Date: Sun, 15 Dec 2019 20:02:37 +0800 Subject: [PATCH 111/676] translated the article and modified the path --- ...e developers, and other industry trends.md | 63 ------------------- ...e developers, and other industry trends.md | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 63 deletions(-) delete mode 100644 sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md create mode 100644 translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md diff --git a/sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md b/sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md deleted file mode 100644 index fb77d65e1a..0000000000 --- a/sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md +++ /dev/null @@ -1,63 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (algzjh) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An idiot's guide to Kubernetes, low-code developers, and other industry trends) -[#]: via: (https://opensource.com/article/19/12/technology-advice-and-other-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -An idiot's guide to Kubernetes, low-code developers, and other industry trends -====== -A weekly look at open source community, market, and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [An idiot's guide to Kubernetes][2] - -> Kubernetes has already grown to encompass new features which have made it a better container platform for enterprise software. Elements like security and advanced networking have been pulled into the main body of the upstream Kubernetes code, and are now available for everyone to use. -> -> It is, however, true that there will always be supplementary needs to cover other aspects of an enterprise solution; things like logging and performance monitoring. This is where secondary packages like Istio come into play, bringing extra functionality, but keeping the Kubernetes core to a reasonable size and set of features. - -**The impact**: I've always found that it is easy to take awareness of technology developments for granted. When everyone you interact with is also on the "cutting edge" your perspective gets skewed to the point where you might even think that someone who doesn't know about the latest in (INSERT PREFERRED TECHNOLOGY HERE) just isn't keeping up, when really it just hasn't started to impact their ability to do what they need to. Those people aren't idiots; they're our friends, customers, partners, collaborators, and communities. - -## [Gartner: What to consider before adopting low-code development][3] - -> Despite the focus on business IT teams, Gartner finds an increasingly important developer community is the central IT professional developers needing rapid development of simple applications, or to build minimum viable products or multi-experience capabilities. And when application leaders use low-code within conventional application projects, they might want to use a standard IT DevOps automation approach alongside low-code tooling.  - -**The impact**: A growing range of use cases and user experiences can be addressed and delivered through applications that require less time and skill to create. And low-code developers will also probably coalesce into a distinct group with their own norms and subculture. - -## [Nokia argues cloud-native is essential to 5G core][4] - -> Nokia outlined five key business objectives for 5G that can only be delivered by a cloud-native environment. Those include: better bandwidth, latency, and density; the extension of services via network slicing to new enterprises, industries, and [IoT][5] markets; rapid service deployments defined by agility and efficiency; new services that go beyond traditional broadband, voice, and messaging; and the advent of digital services that harness end-to-end networking to capture more revenue. - -**The impact**: This is most meaningful in the context of the increasing number of things that will be hooked up to the network. 4G was primarily about more and more mobile phones; 5G is only really necessary when you start connecting everything else. Whereas 4G meant richer apps on our phones, 5G has very little to do with phones at all. - -## [APIs: The hidden business accelerator][6] - -> For organisations to have a successful digital transformation, an API strategy is critical. From unlocking valuable data to speeding up development time, APIs are the humble heroes of the digital era. Those already experimenting with APIs are already feeling the benefits. For example, research has shown that 53 percent of businesses that have used APIs cite them as increasing productivity, and 29 percent claim they experienced revenue growth as a direct result of API use. When treated as discoverable and reusable products that live beyond one project, APIs help lay a flexible foundation for continuous change. - -**The impact**: The hidden business accelerator is actually the idea that capability should be packaged in a way that allows it to be repurposed and combined in contexts that its original provider didn't anticipate. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/technology-advice-and-other-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.cbronline.com/feature/an-idiots-guide-to-kubernetes -[3]: https://www.computerweekly.com/feature/Gartner-What-to-consider-before-adopting-low-code-development -[4]: https://www.sdxcentral.com/articles/news/nokia-argues-cloud-native-is-essential-to-5g-core/2019/11/ -[5]: https://www.sdxcentral.com/5g/iot/ (IoT) -[6]: https://www.cbronline.com/opinion/digital-transformation-3 diff --git a/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md b/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md new file mode 100644 index 0000000000..277378d8f4 --- /dev/null +++ b/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (algzjh) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An idiot's guide to Kubernetes, low-code developers, and other industry trends) +[#]: via: (https://opensource.com/article/19/12/technology-advice-and-other-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +面向 Kubernetes,低代码开发人员和其他行业趋势的傻瓜指南 +====== +每周查看开源社区,市场和行业趋势。 +![Person standing in front of a giant computer screen with numbers, data][1] + +我在一家采用开源开发模型的企业软件公司担任高级产品营销经理,作为该职位的一部分,我定期为产品营销人员,经理和其他有影响力的人发布有关开源社区,市场和行业趋势的最新信息。这里有该更新中我和他们最喜欢的四篇文章。 + +## [Kubernetes 的傻瓜指南][2] + +> Kubernetes 已经发展出了新的特性,这使其成为企业软件的更好的容器平台。安全性和高级网络等元素已被纳入 Kubernetes 上游代码的主体,并且现在可供所有人使用。 +> +> 然而,企业解决方案的其他方面总会有补充需求;比如日志记录和性能监控。这就是像 Istio 等辅助包发挥作用的地方,它带来了额外的功能,但是仍使 Kubernetes 的核心保持了合理的大小和特性集。 + +**影响**: 我总是发现,人们很容易把对技术发展的认识视为理所当然。当与你打交道的每个人都处于“最前沿”时,你的观点就会歪曲到这样的程度:你甚至可能会认为对最新的(此处插入首选技术)一无所知的人跟不上潮流,而实际上这并没有开始影响他们做自己需要做的事情的能力。那些人不是白痴;他们是我们的朋友、客户、合作伙伴、合作者和社区。 + +## [Gartner: 采用低代码开发之前应该考虑什么][3] + +> 尽管专注于业务 IT 团队,但 Gartner(高德纳咨询公司) 发现,一个日益重要的开发人员社区是需要快速开发简单应用程序或构建最低可行产品或多体验功能的核心 IT 专业开发人员。当应用程序领导者在传统的应用程序项目中使用低代码时,他们可能希望使用标准的 IT DevOps 自动化方法和低代码工具。 + +**影响**: 越来越多的用例和用户体验可以通过需要更少时间和技能来创建的应用程序来处理和交互。而低代码开发人员也可能会结合成一个具有他们自己的规范和亚文化的独特群体。 + +## [诺基亚认为云原生对 5G 核心至关重要][4] + +> 诺基亚概述了 5G 的五个关键业务目标,这些目标只能通过云原生环境来实现。其中包括:更好的带宽、延迟和密度;通过网络切片将服务扩展到新的企业、行业和[物联网][5]市场;根据敏捷性和效率定义的快速服务部署;超越传统带宽、语音和信息传递的新服务;以及利用端到端网络获取更多收入的数字服务的出现。 + +**影响**: 在越来越多的事物连接到网络的情况下,这是最有意义的。4G 主要与越来越多的手机有关;只有当你开始连接其他所有东西时,5G 才是真正必要的。4G 意味着我们的手机上有更丰富的应用程序,而 5G 几乎与手机无关。 + +## [APIs: 隐藏的业务加速器][6] + +> 要想让组织成功地进行数字化转型,API 策略至关重要。从解锁有价值的数据到加快开发时间,API 都是数字时代谦逊的英雄。那些已经尝试过 API 的人已经感受到了好处。例如,研究表明,使用 API 的企业中,有 53% 认为它们提高了生产力,而 29% 声称它们的收入增长是使用 API 的直接结果。当 API 被视为存在于一个项目之外的可发现和可重用的产品时,它有助于为持续的变更奠定灵活的基础。 + +**影响**: 隐藏的业务加速器实际上是这样一种思想,即功能应该以一种方式进行打包,使其能够在原始提供者没有预料到的环境中进行重新利用和组合。 + +_我希望你喜欢这份上周给我留下深刻印象的列表,并于下周一回来了解更多开源社区、市场和行业的趋势。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/technology-advice-and-other-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[algzjh](https://github.com/algzjh) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr "Person standing in front of a giant computer screen with numbers, data" +[2]: https://www.cbronline.com/feature/an-idiots-guide-to-kubernetes +[3]: https://www.computerweekly.com/feature/Gartner-What-to-consider-before-adopting-low-code-development +[4]: https://www.sdxcentral.com/articles/news/nokia-argues-cloud-native-is-essential-to-5g-core/2019/11/ +[5]: https://www.sdxcentral.com/5g/iot/ "IoT" +[6]: https://www.cbronline.com/opinion/digital-transformation-3 From 95181f92e9689904190a528105906a279a5482a7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 15 Dec 2019 22:58:23 +0800 Subject: [PATCH 112/676] TSL --- ...and scripts to help you sort text files.md | 254 ------------------ ...and scripts to help you sort text files.md | 246 +++++++++++++++++ 2 files changed, 246 insertions(+), 254 deletions(-) delete mode 100644 sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md create mode 100644 translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md diff --git a/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md b/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md deleted file mode 100644 index aec0e05884..0000000000 --- a/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md +++ /dev/null @@ -1,254 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Awk one-liners and scripts to help you sort text files) -[#]: via: (https://opensource.com/article/19/11/how-sort-awk) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Awk one-liners and scripts to help you sort text files -====== -Awk is a powerful tool for doing tasks that might otherwise be left to -other common utilities, including sort. -![Green graph of measurements][1] - -Awk is the ubiquitous Unix command for scanning and processing text containing predictable patterns. However, because it features functions, it's also justifiably called a programming language. - -Confusingly, there is more than one awk. (Or, if you believe there can be only one, then there are several clones.) There's **awk**, the original program written by Aho, Weinberger, and Kernighan, and then there's **nawk**, **mawk**, and the GNU version, **gawk**. The GNU version of awk is a highly portable, free software version of the utility with several unique features, so this article is about GNU awk. - -While its official name is gawk, on GNU+Linux systems it's aliased to awk and serves as the default version of that command. On other systems that don't ship with GNU awk, you must install it and refer to it as gawk, rather than awk. This article uses the terms awk and gawk interchangeably. - -Being both a command and a programming language makes awk a powerful tool for tasks that might otherwise be left to **sort**, **cut**, **uniq**, and other common utilities. Luckily, there's lots of room in open source for redundancy, so if you're faced with the question of whether or not to use awk, the answer is probably a solid "maybe." - -The beauty of awk's flexibility is that if you've already committed to using awk for a task, then you can probably stay in awk no matter what comes up along the way. This includes the eternal need to sort data in a way other than the order it was delivered to you. - -### Sample set - -Before exploring awk's sorting methods, generate a sample dataset to use. Keep it simple so that you don't get distracted by edge cases and unintended complexity. This is the sample set this article uses: - - -``` -Aptenodytes;forsteri;Miller,JF;1778;Emperor -Pygoscelis;papua;Wagler;1832;Gentoo -Eudyptula;minor;Bonaparte;1867;Little Blue -Spheniscus;demersus;Brisson;1760;African -Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed -Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper -Torvaldis;linux;Ewing,L;1996;Tux -``` - -It's a small dataset, but it offers a good variety of data types: - - * A genus and species name, which are associated with one another but considered separate - * A surname, sometimes with first initials after a comma - * An integer representing a date - * An arbitrary term - * All fields separated by semi-colons - - - -Depending on your educational background, you may consider this a 2D array or a table or just a line-delimited collection of data. How you think of it is up to you, because awk doesn't expect anything more than text. It's up to you to tell awk how you want to parse it. - -### The sort cheat - -If you just want to sort a text dataset by a specific, definable field (think of a "cell" in a spreadsheet), then you can use the [sort command][2]. - -### Fields and records - -Regardless of the format of your input, you must find patterns in it so that you can focus on the parts of the data that are important to you. In this example, the data is delimited by two factors: lines and fields. Each new line represents a new _record_, as you would likely see in a spreadsheet or database dump. Within each line, there are distinct _fields_ (think of them as cells in a spreadsheet) that are separated by semicolons (;). - -Awk processes one record at a time, so while you're structuring the instructions you will give to awk, you can focus on just one line. Establish what you want to do with one line, then test it (either mentally or with awk) on the next line and a few more. You'll end up with a good hypothesis on what your awk script must do in order to provide you with the data structure you want. - -In this case, it's easy to see that each field is separated by a semicolon. For simplicity's sake, assume you want to sort the list by the very first field of each line. - -Before you can sort, you must be able to focus awk on just the first field of each line, so that's the first step. The syntax of an awk command in a terminal is **awk**, followed by relevant options, followed by your awk command, and ending with the file of data you want to process. - - -``` -$ awk --field-separator=";" '{print $1;}' penguins.list -Aptenodytes -Pygoscelis -Eudyptula -Spheniscus -Megadyptes -Eudyptes -Torvaldis -``` - -Because the field separator is a character that has special meaning to the Bash shell, you must enclose the semicolon in quotes or precede it with a backslash. This command is useful only to prove that you can focus on a specific field. You can try the same command using the number of another field to view the contents of another "column" of your data: - - -``` -$ awk --field-separator=";" '{print $3;}' penguins.list -Miller,JF -Wagler -Bonaparte -Brisson -Milne-Edwards -Viellot -Ewing,L -``` - -Nothing has been sorted yet, but this is good groundwork. - -### Scripting - -Awk is more than just a command; it's a programming language with indices and arrays and functions. That's significant because it means you can grab a list of fields you want to sort by, store the list in memory, process it, and then print the resulting data. For a complex series of actions such as this, it's easier to work in a text file, so create a new file called **sort.awk** and enter this text: - - -``` -#!/bin/gawk -f - -BEGIN { -        FS=";"; -} -``` - -This establishes the file as an awk script that executes the lines contained in the file. - -The **BEGIN** statement is a special setup function provided by awk for tasks that need to occur only once. Defining the built-in variable **FS**, which stands for _field separator_ and is the same value you set in your awk command with **\--field-separator**, only needs to happen once, so it's included in the **BEGIN** statement. - -#### Arrays in awk - -You already know how to gather the values of a specific field by using the **$** notation along with the field number, but in this case, you need to store it in an array rather than print it to the terminal. This is done with an awk array. The important thing about an awk array is that it contains keys and values. Imagine an array about this article; it would look something like this: **author:"seth",title:"How to sort with awk",length:1200**. Elements like **author** and **title** and **length** are keys, with the following contents being values. - -The advantage to this in the context of sorting is that you can assign any field as the key and any record as the value, and then use the built-in awk function **asorti()** (sort by index) to sort by the key. For now, assume arbitrarily that you _only_ want to sort by the second field. - -Awk statements _not_ preceded by the special keywords **BEGIN** or **END** are loops that happen at each record. This is the part of the script that scans the data for patterns and processes it accordingly. Each time awk turns its attention to a record, statements in **{}** (unless preceded by **BEGIN** or **END**) are executed. - -To add a key and value to an array, create a variable (in this example script, I call it **ARRAY**, which isn't terribly original, but very clear) containing an array, and then assign it a key in brackets and a value with an equals sign (**=**). - - -``` -{   # dump each field into an array -    ARRAY[$2] = $R; -} -``` - -In this statement, the contents of the second field (**$2**) are used as the key term, and the current record (**$R**) is used as the value. - -### The asorti() function - -In addition to arrays, awk has several basic functions that you can use as quick and easy solutions for common tasks. One of the functions introduced in GNU awk, **asorti()**, provides the ability to sort an array by key (or _index_) or value. - -You can only sort the array once it has been populated, meaning that this action must not occur with every new record but only the final stage of your script. For this purpose, awk provides the special **END** keyword. The inverse of **BEGIN**, an **END** statement happens only once and only after all records have been scanned. - -Add this to your script: - - -``` -END { -    asorti(ARRAY,SARRAY); -    # get length -    j = length(SARRAY); -    -    for (i = 1; i <= j; i++) { -        printf("%s %s\n", SARRAY[i],ARRAY[SARRAY[i]]) -    } -} -``` - -The **asorti()** function takes the contents of **ARRAY**, sorts it by index, and places the results in a new array called **SARRAY** (an arbitrary name I invented for this article, meaning _Sorted ARRAY_). - -Next, the variable **j** (another arbitrary name) is assigned the results of the **length()** function, which counts the number of items in **SARRAY**. - -Finally, use a **for** loop to iterate through each item in **SARRAY** using the **printf()** function to print each key, followed by the corresponding value of that key in **ARRAY**. - -### Running the script - -To run your awk script, make it executable: - - -``` -`$ chmod +x sorter.awk` -``` - -And then run it against the **penguin.list** sample data: - - -``` -$ ./sorter.awk penguins.list -antipodes Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed -chrysocome Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper -demersus Spheniscus;demersus;Brisson;1760;African -forsteri Aptenodytes;forsteri;Miller,JF;1778;Emperor -linux Torvaldis;linux;Ewing,L;1996;Tux -minor Eudyptula;minor;Bonaparte;1867;Little Blue -papua Pygoscelis;papua;Wagler;1832;Gentoo -``` - -As you can see, the data is sorted by the second field. - -This is a little restrictive. It would be better to have the flexibility to choose at runtime which field you want to use as your sorting key so you could use this script on any dataset and get meaningful results. - -### Adding command options - -You can add a command variable to an awk script by using the literal value **var** in your script. Change your script so that your iterative clause uses **var** when creating your array: - - -``` -{ # dump each field into an array -    ARRAY[$var] = $R; -} -``` - -Try running the script so that it sorts by the third field by using the **-v var** option when you execute it: - - -``` -$ ./sorter.awk -v var=3 penguins.list -Bonaparte Eudyptula;minor;Bonaparte;1867;Little Blue -Brisson Spheniscus;demersus;Brisson;1760;African -Ewing,L Torvaldis;linux;Ewing,L;1996;Tux -Miller,JF Aptenodytes;forsteri;Miller,JF;1778;Emperor -Milne-Edwards Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed -Viellot Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper -Wagler Pygoscelis;papua;Wagler;1832;Gentoo -``` - -### Fixes - -This article has demonstrated how to sort data in pure GNU awk. The script can be improved so, if it's useful to you, spend some time researching [awk functions][3] on gawk's man page and customizing the script for better output. - -Here is the complete script so far: - - -``` -#!/usr/bin/awk -f -# GPLv3 appears here -# usage: ./sorter.awk -v var=NUM FILE - -BEGIN { FS=";"; } - -{ # dump each field into an array -    ARRAY[$var] = $R; -} - -END { -    asorti(ARRAY,SARRAY); -    # get length -    j = length(SARRAY); -    -    for (i = 1; i <= j; i++) { -        printf("%s %s\n", SARRAY[i],ARRAY[SARRAY[i]]) -    } -} -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/how-sort-awk - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements) -[2]: https://opensource.com/article/19/10/get-sorted-sort -[3]: https://www.gnu.org/software/gawk/manual/html_node/Built_002din.html#Built_002din diff --git a/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md b/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md new file mode 100644 index 0000000000..57a307032d --- /dev/null +++ b/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md @@ -0,0 +1,246 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Awk one-liners and scripts to help you sort text files) +[#]: via: (https://opensource.com/article/19/11/how-sort-awk) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +单行 Awk 或脚本帮助你排序文本文件 +====== + +> Awk 是一个强大的工具,可以执行某些可能由其它常见实用程序(包括 `sort`)来完成的任务。 + +![Green graph of measurements][1] + +Awk 是个普遍存在的 Unix 命令,用于扫描和处理包含可预测模式的文本。但是,由于它具有函数功能,因此也可以合理地称为编程语言。 + +令人困惑的是,有不止一个 awk。(或者,如果你认为只有一个,那么其它几个就是克隆。)有 `awk`(由Aho、Weinberger 和 Kernighan 编写的原始程序),然后有 `nawk` 、`mawk` 和 GNU 版本 `gawk`。GNU 版本的 awk 是该实用程序的一个高度可移植的自由软件版本,具有几个独特的功能,因此本文是关于 GNU awk 的。 + +虽然它的正式名称是 `gawk`,但在 GNU+Linux 系统上,它的别名是 `awk`,并用作该命令的默认版本。 在其他没有带有 GNU awk 的系统上,你必须安装它并将其称为 `gawk`,而不是 `awk`。本文互换使用术语 `awk` 和 `gawk`。 + +`awk` 既是命令语言又是编程语言,它使其成为一个强大的工具,可以处理原本留给 `sort`、`cut`、`uniq` 和其他常见实用程序的任务。幸运的是,开放源代码中有很多冗余空间,因此,如果你面临是否使用`awk` 的问题,答案可能是肯定的“也许”。 + +`awk` 的灵活之美在于,如果你已经承诺使用 `awk` 来完成一项任务,那么无论接下来发生什么,你都可以继续使用 `awk`。这包括对数据排序而不是按交付给你的顺序的永恒需求。 + +### 样本数据集 + +在探索 `awk` 的排序方法之前,请生成要使用的样本数据集。保持简单,这样你就不会为极端情况和意想不到的复杂性所困扰。这是本文使用的样本集: + +``` +Aptenodytes;forsteri;Miller,JF;1778;Emperor +Pygoscelis;papua;Wagler;1832;Gentoo +Eudyptula;minor;Bonaparte;1867;Little Blue +Spheniscus;demersus;Brisson;1760;African +Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +Torvaldis;linux;Ewing,L;1996;Tux +``` + +这是一个很小的数据集,但它提供了多种数据类型: + +* 属名和种名,彼此相关但又是分开的 +* 姓,有时以逗号开头的首字母缩写 +* 代表日期的整数 +* 任意术语 +* 所有字段均以分号分隔 + +根据你的教育背景,你可能会认为这是二维数组或表格,或者只是行分隔的数据集合。你如何看待它取决于你,因为 `awk` 只认识文本。由你决定告诉 `awk` 你想如何解析它。 + +### 只想排序 + +如果你只想按特定的可定义字段(例如电子表格中的“单元格”)对文本数据集进行排序,则可以使用 [sort 命令][2]。 + +### 字段和记录 + +字段和记录 + +无论输入的格式如何,都必须在其中找到模式才可以专注于对你重要的数据部分。在此示例中,数据由两个因素定界:行和字段。每行都代表一个新的*记录*,就如你在电子表格或数据库转储中看到的一样。在每一行中,都有用分号(`;`)分隔的不同的*字段*(将其视为电子表格中的单元格)。 + +`awk` 一次只处理一条记录,因此,当你在组织发给 `awk` 的这指令时,你可以只关注一行记录。写下你想对一行数据执行的操作,然后在下一行进行测试(无论是心理上还是用 `awk` 进行测试),然后再进行其他一些测试。最后,你要对你的 `awk` 脚本要处理的数据做好假设,以便可以按你要的数据结构提供给你数据。 + +在这个例子中,很容易看到每个字段都用分号隔开。为简单起见,假设你要按每行的第一字段对列表进行排序。 + +在进行排序之前,你必须能够让 `awk` 只关注在每行的第一个字段上,因此这是第一步。终端中 awk 命令的语法为 `awk',后跟相关选项,后跟你的 `awk` 命令,最后是要处理的数据文件。 + +``` +$ awk --field-separator=";" '{print $1;}' penguins.list +Aptenodytes +Pygoscelis +Eudyptula +Spheniscus +Megadyptes +Eudyptes +Torvaldis +``` + +因为字段分隔符是对 Bash shell 具有特殊含义的字符,所以必须将分号括在引号中或在其前面加上反斜杠。此命令仅用于证明你可以专注于特定字段。你可以使用另一个字段的编号尝试相同的命令,以查看数据的另一个“列”的内容: + +``` +$ awk --field-separator=";" '{print $3;}' penguins.list +Miller,JF +Wagler +Bonaparte +Brisson +Milne-Edwards +Viellot +Ewing,L +``` + +我们尚未进行任何排序,但这是良好的基础。 + +### 脚本编程 + +`awk` 不仅仅是命令,它是一种具有索引、数组和函数的编程语言。这很重要,因为这意味着你可以获取要排序的字段列表,将列表存储在内存中,进行处理,然后打印结果数据。对于诸如此类的一系列复杂操作,在文本文件中进行操作会更容易,因此请创建一个名为 `sort.awk` 的新文件并输入以下文本: + + +``` +#!/bin/gawk -f + +BEGIN { +        FS=";"; +} +``` + +这会将文件建立为 `awk` 脚本,该脚本中包含执行的行。 + +`BEGIN` 语句是 `awk` 提供的特殊设置功能,用于只需要执行一次的任务。定义内置变量 `FS`,它代表字段分隔符field separator,并且与你在 `awk` 命令中使用 `--field-separator` 设置的值相同,它只需执行一次,因此它包含在 `BEGIN` 语句中。 + +#### awk 中的数组 + +你已经知道如何通过使用 `$` 符号和字段编号来收集特定字段的值,但是在这种情况下,你需要将其存储在数组中而不是将其打印到终端。这是通过 `awk` 数组完成的。`awk` 数组的重要之处在于它包含键和值。 想象一下有关本文的内容;它看起来像这样:`author:"seth",title:"How to sort with awk",length:1200`。诸如作者、标题和长度之类的元素是键,跟着的内容为值。 + +在排序的上下文中这样做的好处是,你可以将任何字段分配为键,将任何记录分配为值,然后使用内置的 `awk` 函数 `asorti()`(按索引排序)按键进行排序。现在,随便假设你*只*想按第二个字段排序。 + +*没有*被特殊关键字 `BEGIN` 或 `END` 引起来的 `awk` 语句是在每个记录都有执行的循环。这是脚本的一部分,该脚本扫描数据中的模式并进行相应的处理。每次 `awk` 将注意力转移到一条记录上时,都会执行 `{}` 中的语句(除非以 `BEGIN` 或 `END` 开头)。 + +要将键和值添加到数组,请创建一个包含数组的变量(在本示例脚本中,我将其称为 `ARRAY `,虽然不是很原汁原味,但很清楚),然后在方括号中分配给它键和用等号(`=`)连接的值。 + +``` +{   # dump each field into an array +    ARRAY[$2] = $R; +} +``` + +在此语句中,第二个字段的内容(`$2`)用作关键字,而当前记录(`$R`)用作值。 + + +### asorti() 函数 + +除了数组之外,`awk` 还具有一些基本函数,你可以将它们用作常见任务的快速简便的解决方案。GNU awk中引入的函数之一 `asorti()` 提供了按键(*索引*)或值对数组进行排序的功能。 + +你只能在对数组进行填充后对其进行排序,这意味着此操作不能对每个新记录都触发,而只能在脚本的最后阶段进行。为此,`awk` 提供了特殊的 `END` 关键字。与 `BEGIN` 相反,`END` 语句仅在扫描了所有记录之后才触发一次。 + +将这些添加到你的脚本: + +``` +END { +    asorti(ARRAY,SARRAY); +    # get length +    j = length(SARRAY); +    +    for (i = 1; i <= j; i++) { +        printf("%s %s\n", SARRAY[i],ARRAY[SARRAY[i]]) +    } +} +``` + +`asorti()` 函数获取 `ARRAY` 的内容,按索引对其进行排序,然后将结果放入名为 `SARRAY` 的新数组(我在本文中发明的任意名称,表示“排序的 ARRAY”)。 + +接下来,将变量 `j`(另一个任意名称)分配给 `length()` 函数的结果,该函数计算 `SARRAY` 中的项数。 + +最后,使用 `for` 循环使用 `printf()` 函数遍历 `SARRAY` 中的每一项,以打印每个键,然后在 `ARRAY` 中打印该键的相应值。 + +### 运行该脚本 + +要运行你的 `awk` 脚本,先使其可执行: + +``` +$ chmod +x sorter.awk +``` + +然后针对 `penguin.list` 示例数据运行它: + +``` +$ ./sorter.awk penguins.list +antipodes Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +chrysocome Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +demersus Spheniscus;demersus;Brisson;1760;African +forsteri Aptenodytes;forsteri;Miller,JF;1778;Emperor +linux Torvaldis;linux;Ewing,L;1996;Tux +minor Eudyptula;minor;Bonaparte;1867;Little Blue +papua Pygoscelis;papua;Wagler;1832;Gentoo +``` + +如你所见,数据按第二个字段排序。 + +这有点限制性。最好可以在运行时灵活选择要用作排序键的字段,以便可以在任何数据集上使用此脚本并获得有意义的结果。 + +### 添加命令选项 + +你可以通过在脚本中使用文字值 `var` 将命令变量添加到 `awk` 脚本中。更改脚本,以使迭代子句在创建数组时使用 `var`: + +``` +{ # dump each field into an array +    ARRAY[$var] = $R; +} +``` + +尝试运行脚本,以便在执行脚本时使用 `-v var` 选项将其按第三字段排序: + +``` +$ ./sorter.awk -v var=3 penguins.list +Bonaparte Eudyptula;minor;Bonaparte;1867;Little Blue +Brisson Spheniscus;demersus;Brisson;1760;African +Ewing,L Torvaldis;linux;Ewing,L;1996;Tux +Miller,JF Aptenodytes;forsteri;Miller,JF;1778;Emperor +Milne-Edwards Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Viellot Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +Wagler Pygoscelis;papua;Wagler;1832;Gentoo +``` + +### 修正 + +本文演示了如何在纯 GNU awk 中对数据进行排序。你可以对脚本进行改进,以便对你有用,花一些时间在`gawk` 的手册页上研究 [awk 函数][3]并自定义脚本以获得更好的输出。 + +这是到目前为止的完整脚本: + +``` +#!/usr/bin/awk -f +# GPLv3 appears here +# usage: ./sorter.awk -v var=NUM FILE + +BEGIN { FS=";"; } + +{ # dump each field into an array +    ARRAY[$var] = $R; +} + +END { +    asorti(ARRAY,SARRAY); +    # get length +    j = length(SARRAY); +    +    for (i = 1; i <= j; i++) { +        printf("%s %s\n", SARRAY[i],ARRAY[SARRAY[i]]) +    } +} +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/how-sort-awk + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements) +[2]: https://opensource.com/article/19/10/get-sorted-sort +[3]: https://www.gnu.org/software/gawk/manual/html_node/Built_002din.html#Built_002din From 666a14f21e5dd7d4e4a0254e43f4bb8bd90fd82d Mon Sep 17 00:00:00 2001 From: hj24 Date: Sun, 15 Dec 2019 23:09:11 +0800 Subject: [PATCH 113/676] translated --- ...ow to write a Python web API with Flask.md | 55 +++++++++---------- 1 file changed, 26 insertions(+), 29 deletions(-) rename {sources => translated}/tech/20191127 How to write a Python web API with Flask.md (56%) diff --git a/sources/tech/20191127 How to write a Python web API with Flask.md b/translated/tech/20191127 How to write a Python web API with Flask.md similarity index 56% rename from sources/tech/20191127 How to write a Python web API with Flask.md rename to translated/tech/20191127 How to write a Python web API with Flask.md index e20b2b4f4e..763b7200dd 100644 --- a/sources/tech/20191127 How to write a Python web API with Flask.md +++ b/translated/tech/20191127 How to write a Python web API with Flask.md @@ -9,23 +9,19 @@ 如何使用Flask编写Python Web API ====== -Use Flask, one of the fastest-growing Python frameworks, to fetch data -from a server, in this quick tutorial. 这是一个快速教程,用来展示如何通过Flask(目前发展最迅速的Python框架之一)来从服务器获取数据。 ![spiderweb diagram][1] -[Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs. - [Python][2]是一个以语法简洁著称的高级的,面向对象的程序语言。它一直都是一个用来构建RESTful API的顶级编程语言。 -[Flask][3] is a customizable Python framework that gives developers complete control over how users access data. Flask is a "micro-framework" based on Werkzeug's [WSGI][4] toolkit and Jinja 2's templating engine. It is designed as a web framework for RESTful API development. +[Flask][3]是一个高度可定制化的Python框架,可以为开发人员提供用户访问数据方式的完全控制。Flask是一个基于Werkzeug的[WSGI][4]工具包和Jinja 2模板引擎的”微框架“。它是一个被设计来开发RESTful API的web框架。 -Flask is one of the fastest-growing Python frameworks, and popular websites, including Netflix, Pinterest, and LinkedIn, have incorporated Flask into their development stacks. Here's an example of how Flask can permit users to fetch data from a server using the HTTP GET method. +Flask是Python发展最迅速的框架之一,很多知名网站如:Netflix, Pinterest, 和LinkedIn都将Flask纳入了它们的开发技术栈。下面是一个简单的示例,展示了Flask是如何允许用户通过HTTP GET请求来从服务器获取数据的。 -### Set up a Flask application +### 初始化一个Flask应用 -First, create a structure for your Flask application. You can do this at any location on your system. +首先,创建一个你的Flask项目的目录结构。你可以在你系统的任何地方来做这件事。 ``` @@ -41,10 +37,12 @@ Collecting Flask>=0.8 (from flask-restful) [...] ``` -### Import the Flask modules +### 导入Flask模块 Next, import the **flask** module and its **flask_restful** library into your **main.py** code: +然后,在你的**main.py**代码中导入**flask**模块和它的**flask_restful**库: + ``` from flask import Flask @@ -71,10 +69,12 @@ if __name__ == '__main__':     app.run(debug=True) ``` -### Run the app +### 运行app Flask includes a built-in HTTP server for testing. Test the simple API you built: +Flask包含一个内建的用于测试的HTTP服务器。来测试一下这个你创建的简单的API: + ``` (env) $ python main.py @@ -86,7 +86,7 @@ Flask includes a built-in HTTP server for testing. Test the simple API you bui  * Running on (Press CTRL+C to quit) ``` -Starting the development server starts your Flask application, which contains a method named **get** to respond to a simple HTTP GET request. You can test it using **wget** or **curl** or any web browser. The URL to use is provided in Flask's output after you start the server. +启动开发服务器时将启动Flask应用程序,该应用程序包含一个名为 **get** 的方法来响应简单的HTTP GET请求。你可以通过 **wget**、**curl** 命令或者任意的web浏览器来测试它。 ``` @@ -106,29 +106,26 @@ $ curl } ``` -To see a more complex version of a similar web API using Python and Flask, navigate to the Library of Congress' [Chronicling America][5] website, which provides access to information about historic newspapers and digitized newspaper pages. +要查看使用Python和Flask的类似Web API的更复杂版本,请导航至美国国会图书馆的[Chronicling America] [5]网站,该网站可提供有关这些信息的历史报纸和数字化报纸。 -### Why use Flask? +### 为什么使用 Flask? -Flask has several major benefits: +Flask有以下几个主要的优点: - 1. Python is popular and widely used, so anyone who knows Python can develop for Flask. - 2. It's lightweight and minimalistic. - 3. Built with security in mind. - 4. Great documentation with plenty of clear, working example code. + 1. Python很流行并且广泛被应用,所以任何熟悉Python的人都可以使用Flask来开发。 + 2. 它轻巧而简约。 + 3. 考虑安全性而构建。 + 4. 出色的文档,其中包含大量清晰,有效的示例代码。 + +还有一些潜在的缺点: + + 1. 它轻巧而简约。但如果您正在寻找具有大量捆绑库和预制组件的框架,那么这可能不是最佳选择。 + 2. 如果必须围绕Flask构建自己的框架,则你可能会发现维护自定义项的成本可能会抵消使用Flask的好处。 +如果您要构建Web程序或API,可以考虑选择Flask。它功能强大且健壮,并且其优秀的项目文档使入门变得容易。试用一下,评估一下,看看它是否适合您的项目。 -There are also some potential drawbacks: - - 1. It's lightweight and minimalistic. If you're looking for a framework with lots of bundled libraries and prefabricated components, this may not be your best option. - 2. If you have to build your own framework around Flask, you might find that the cost of maintaining your customization negates the benefit of using Flask. - - - -If you're looking to build a web app or API, Flask is a good option to consider. It's powerful and robust, and the project documentation makes it easy to get started. Try it out, evaluate it, and see if it's right for your project. - -Learn more in this lesson in Python exception handling and how to do it in a secure manner. +在本课中了解更多信息关于Python异常处理以及如何以安全的方式进行操作。 -------------------------------------------------------------------------------- @@ -136,7 +133,7 @@ via: https://opensource.com/article/19/11/python-web-api-flask 作者:[Rachel Waston][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[hj24](https://github.com/hj24) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6a50ceda23f85bde9a65a39390bd33611fa0f77b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 16 Dec 2019 00:52:29 +0800 Subject: [PATCH 114/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191215=20Custom?= =?UTF-8?q?ize=20your=20Linux=20desktop=20with=20the=20Trinity=20Desktop?= =?UTF-8?q?=20Environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191215 Customize your Linux desktop with the Trinity Desktop Environment.md --- ...op with the Trinity Desktop Environment.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20191215 Customize your Linux desktop with the Trinity Desktop Environment.md diff --git a/sources/tech/20191215 Customize your Linux desktop with the Trinity Desktop Environment.md b/sources/tech/20191215 Customize your Linux desktop with the Trinity Desktop Environment.md new file mode 100644 index 0000000000..561e90d771 --- /dev/null +++ b/sources/tech/20191215 Customize your Linux desktop with the Trinity Desktop Environment.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Customize your Linux desktop with the Trinity Desktop Environment) +[#]: via: (https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Customize your Linux desktop with the Trinity Desktop Environment +====== +This article is part of a special series of 24 days of Linux desktops. +TDE is a fully customizable Linux desktop that will be instantly +recognizable to anyone who knew and loved KDE 3. +![Person standing in front of a giant computer screen with numbers, data][1] + +When KDE 4 was released in 2008, KDE 3 went into support mode until support was dropped entirely. That's the usual lifecycle of software, desktops included, but the KDE 3 fanbase wasn't universally pleased with KDE 4, and some of them decided a fork was in order. + +Some of them formed a new project with the mission of preserving the look and feel of KDE 3, starting from KDE 3.5.10 (the last official release in the 3.x series), and then forking Qt 3 into TQt to keep the underlying technology updated. Today, the [Trinity Desktop Environment][2] (TDE) delivers a traditional desktop environment that looks and feels essentially the same as KDE 3 did 10-plus years ago. + +You may find the Trinity desktop included in the software repository of your distribution. Before you install it, be aware that it is meant to provide a full desktop experience, so many TDE apps are installed along with the desktop. If you're already running another desktop, you may find yourself with redundant applications (two PDF readers, two media players, two file managers, and so on). + +If your software repo doesn't offer Trinity, or you just don't want to install it and all of its applications, you can install a TDE distribution in a virtual machine, such as [GNOME Boxes][3]. I used the [exeGNU][4] distribution for the screenshots below, and there are other distros listed on [TDE's LiveCDs][5] page. + +### TDE desktop tour + +The Trinity Desktop Environment is a very traditional desktop. It's one that's likely to be familiar to you—whether or not you've used KDE at all, in fact. It has one panel at the bottom of the screen that contains an application menu in the left corner, a taskbar in the middle, and a system tray in the right, and there are icons for common locations on the desktop. It behaves exactly as you'd expect a desktop to behave, and you can probably change whatever you want to change because TDE is completely customizable. + +If you were a KDE 3 user in the past, revisiting the Trinity Desktop Environment is a little like stepping back in time. While a side-by-side comparison of the two desktops might reveal significant differences, it would be a real challenge to find a deviation in TDE from the desktop you remember. All the key components are there: the sidebar tabs, the Konqueror file manager, the traditional application menu, the retractable panel, and the classic layout. + +![TDE on exeGNU][6] + +How different this is from KDE 4 or KDE 5 is a matter of perspective. To many users, the TDE default is pretty much the same as the default layout of late KDE 4 or current KDE 5 desktops. As is often the case, however, the biggest differences are in the smallest of details. The absence of Dolphin in favor of [Konqueror][7] is one of the biggest non-changes. Konqueror has quite literally set the standard for both file management and web browsing (KHTML is the code that Apple and Google forked to create the Safari and Chrome browsers), so preserving it as the central desktop application is particularly noteworthy. + +All the "old" applications are still there, and seemingly not a button or widget has moved from the old default 3.5 location. The defaults are always set to what they were in KDE 3.5, but nearly everything can be rearranged, changed, hidden, or disassembled. User experience is supreme, and TDE never assumes that any two users want the same experience. + +![Trinity Control Center][8] + +To a tried and true KDE 3.5.x user, using TDE is just a matter of surrendering to muscle memory. + +### Trinity and open source + +Trinity, along with the Mate fork of GNOME 2, is one of the most direct examples of how open source empowers developers to sustain a beloved software project that's otherwise reached its end. Not all software is kept alive by a fork and a dedicated team of true believers, but sometimes it does happen, and when it does, it results in greater variety and more choice. Whether you choose KDE 5 or TDE, or GNOME 3 or Mate, you get to make those choices because open source empowers developers and users to make technology work better for everyone. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.trinitydesktop.org/ +[3]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[4]: http://exegnulinux.net +[5]: https://wiki.trinitydesktop.org/LiveCDs +[6]: https://opensource.com/sites/default/files/uploads/advent-trinity.jpg (TDE on exeGNU) +[7]: https://kde.org/applications/internet/org.kde.konqueror +[8]: https://opensource.com/sites/default/files/uploads/advent-trinity-control.jpg (Trinity Control Center) From e16ed074420dd39bf419bead038af31ae412586a Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 16 Dec 2019 08:58:12 +0800 Subject: [PATCH 115/676] translated --- ...iles into pieces with the split command.md | 120 ------------------ ...iles into pieces with the split command.md | 109 ++++++++++++++++ 2 files changed, 109 insertions(+), 120 deletions(-) delete mode 100644 sources/tech/20191210 Breaking Linux files into pieces with the split command.md create mode 100644 translated/tech/20191210 Breaking Linux files into pieces with the split command.md diff --git a/sources/tech/20191210 Breaking Linux files into pieces with the split command.md b/sources/tech/20191210 Breaking Linux files into pieces with the split command.md deleted file mode 100644 index acbcea7f2b..0000000000 --- a/sources/tech/20191210 Breaking Linux files into pieces with the split command.md +++ /dev/null @@ -1,120 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Breaking Linux files into pieces with the split command) -[#]: via: (https://www.networkworld.com/article/3489256/breaking-linux-files-into-pieces-with-the-split-command.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Breaking Linux files into pieces with the split command -====== -Some simple Linux commands allow you to break up files and reassemble them as needed in order to accommodate size restrictions on file size for storage or email attachments -[Marco Verch][1] [(CC BY 2.0)][2] - -Linux systems provide a very easy-to-use command for breaking files into pieces. This is something that you might need to do prior to uploading your files to some storage site that limits file sizes or emailing them as attachments. To split a file into pieces, you simply use the split command. - -``` -$ split bigfile -``` - -By default, the split command uses a very simple naming scheme. The file chunks will be named xaa, xab, xac, etc., and, presumably, if you break up a file that is sufficiently large, you might even get chunks named xza and xzz. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] - -Unless you ask, the command runs without giving you any feedback. You can, however, use the --verbose option if you would like to see the file chunks as they are being created. - -[][4] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][4] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -``` -$ split –-verbose bigfile -creating file 'xaa' -creating file 'xab' -creating file 'xac' -``` - -You can also contribute to the file naming by providing a prefix. For example, to name all the pieces of your original file bigfile.xaa, bigfile.xab and so on, you would add your prefix to the end of your split command like so: - -``` -$ split –-verbose bigfile bigfile. -creating file 'bigfile.aa' -creating file 'bigfile.ab' -creating file 'bigfile.ac' -``` - -Note that a dot is added to the end of the prefix shown in the above command. Otherwise, the files would have names like bigfilexaa rather than bigfile.xaa. - -Note that the split command does _not_ remove your original file, just creates the chunks. If you want to specify the size of the file chunks, you can add that to your command using the -b option. For example: - -``` -$ split -b100M bigfile -``` - -File sizes can be specified in kilobytes, megabytes, gigabytes … up to yottabytes! Just use the appropriate letter from K, M, G, T, P, E, Z and Y. - -If you want your file to be split based on the number of lines in each chunk rather than the number of bytes, you can use the -l (lines) option. In this example, each file will have 1,000 lines except, of course, for the last one which may have fewer lines. - -``` -$ split --verbose -l1000 logfile log. -creating file 'log.aa' -creating file 'log.ab' -creating file 'log.ac' -creating file 'log.ad' -creating file 'log.ae' -creating file 'log.af' -creating file 'log.ag' -creating file 'log.ah' -creating file 'log.ai' -creating file 'log.aj' -``` - -If you need to reassemble your file from pieces on a remote site, you can do that fairly easily using a cat command like one of these: - -``` -$ cat x?? > original.file -$ cat log.?? > original.file -``` - -Splitting and reassembling with the commands shown above should work for binary files as well as text files. In this example, we’ve split the zip binary into 50 kilobyte chunks, used cat to reassemble them and then compared the assembled and original files. The diff command verifies that the files are the same. - -``` -$ split --verbose -b50K zip zip. -creating file 'zip.aa' -creating file 'zip.ab' -creating file 'zip.ac' -creating file 'zip.ad' -creating file 'zip.ae' -$ cat zip.a? > zip.new -$ diff zip zip.new -$ <== no output = no difference -``` - -The only caution I have to give at this point is that, if you use split often and use the default naming, you will likely end up overwriting some chunks with others and maybe sometimes having more chunks than you were expecting because some were left over from some earlier split. - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3489256/breaking-linux-files-into-pieces-with-the-split-command.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.flickr.com/photos/30478819@N08/34879296673/in/photolist-V9avJ2-LysA9-qVeu6t-dV4dkC-RWNeA5-LFKPG-aLpKTg-aLpJoK-4rN35a-97zDK4-7fevx8-mBSVT-64r2D4-8TbXFw-4g2Wgv-4pAdnq-4g6Ycf-9pt9t9-ceyN2u-LYckrJ-23sDdLH-dAQgiK-25eyt6N-UuAEk9-koNDTn-dAVK2j-ea8feG-bWpNKQ-bzJNPM-dAQ22K-dnkd1e-8qkaFp-dnCtBr-dnknKi-TKXaei-dnkjzV-RxvhHd-pQXTfa-c3crQf-dnkwXG-dnfW2K-2SKdMh-efHTUr-5mMzpp-XdMr5c-88H1s3-d67Gth-aMuG6v-Uio4v1-KZt3M -[2]: https://creativecommons.org/licenses/by/2.0/legalcode -[3]: https://www.networkworld.com/newsletters/signup.html -[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20191210 Breaking Linux files into pieces with the split command.md b/translated/tech/20191210 Breaking Linux files into pieces with the split command.md new file mode 100644 index 0000000000..c67de96b05 --- /dev/null +++ b/translated/tech/20191210 Breaking Linux files into pieces with the split command.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Breaking Linux files into pieces with the split command) +[#]: via: (https://www.networkworld.com/article/3489256/breaking-linux-files-into-pieces-with-the-split-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 split 命令分割 Linux 文件 +====== +一些简单的 Linux 命令能让你根据需要分割以及重新组合文件,来适应存储或电子邮件附件大小的限制 +[Marco Verch][1] [(CC BY 2.0)][2] + +Linux 系统提供了一个非常易于使用的命令来分割文件。在将文件上传到限制大小的存储网站或者作为邮件附件之前,你可能需要执行此操作。要将文件分割为多个文件块,只需使用 split 命令。 + +``` +$ split bigfile +``` + +默认情况下,split 命令使用非常简单的命名方案。文件块将被命名为 xaa、xab、xac等,并且,大概地,如果你将足够大的文件分割,你甚至可能会得到名为 xza 和 xzz 的块。 + + +除非你要求,否则该命令将无任何反馈地运行。但是,如果你想在创建文件块时看到它们,可以使用 --verbose 选项。 + +``` +$ split –-verbose bigfile +creating file 'xaa' +creating file 'xab' +creating file 'xac' +``` + +你还可以给文件命名前缀。例如,要将原始文件命名为 bigfile.xaa、bigfile.xab等,你可以将前缀添加到 split 命令的末尾,如下所示: + +``` +$ split –-verbose bigfile bigfile. +creating file 'bigfile.aa' +creating file 'bigfile.ab' +creating file 'bigfile.ac' +``` + +请注意,上述命令中显示的前缀的末尾会添加一个点。否则,文件将是 bigfilexaa 之类的名称,而不是 bigfile.xaa。 + +请注意,split 命令_不会_删除你的原始文件,只是创建了文件块。如果要指定文件块的大小,可以使用 -b 选项将其添加到命令中。例如: + +``` +$ split -b100M bigfile +``` + +文件大小可以是 KB、MB,GB,最大可以是 YB!只需使 K、M、G、T、P、E、Z 和 Y 这些合适的字母。 + +如果要基于每个块中的行数而不是字节数来拆分文件,那么可以使用 -l(行)选项。在此示例中,每个文件将有 1000 行,当然,最后一个文件可能有较少的行。 + +``` +$ split --verbose -l1000 logfile log. +creating file 'log.aa' +creating file 'log.ab' +creating file 'log.ac' +creating file 'log.ad' +creating file 'log.ae' +creating file 'log.af' +creating file 'log.ag' +creating file 'log.ah' +creating file 'log.ai' +creating file 'log.aj' +``` + +如果你需要在远程站点上重新组合文件,那么可以使用如下所示的 cat 命令轻松地完成此操作: + +``` +$ cat x?? > original.file +$ cat log.?? > original.file +``` + +上面所示的分割和组合命令适合于二进制和文本文件。在此示例中,我们将 zip 二进制文件分割为 50KB 的块,之后使用 cat 重新组合了它们,然后比较了组合后的文件和原始文件。diff 命令验证文件是否相同。 + +``` +$ split --verbose -b50K zip zip. +creating file 'zip.aa' +creating file 'zip.ab' +creating file 'zip.ac' +creating file 'zip.ad' +creating file 'zip.ae' +$ cat zip.a? > zip.new +$ diff zip zip.new +$ <== 无输出 = 无差别 +``` + +我唯一要提醒的一点的是,如果你经常使用 split 并使用默认命名,那么某些文件块可能会覆盖其他的文件块,甚至会比你预期的更多,因为有些是更早之前分割的。 + +加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489256/breaking-linux-files-into-pieces-with-the-split-command.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.flickr.com/photos/30478819@N08/34879296673/in/photolist-V9avJ2-LysA9-qVeu6t-dV4dkC-RWNeA5-LFKPG-aLpKTg-aLpJoK-4rN35a-97zDK4-7fevx8-mBSVT-64r2D4-8TbXFw-4g2Wgv-4pAdnq-4g6Ycf-9pt9t9-ceyN2u-LYckrJ-23sDdLH-dAQgiK-25eyt6N-UuAEk9-koNDTn-dAVK2j-ea8feG-bWpNKQ-bzJNPM-dAQ22K-dnkd1e-8qkaFp-dnCtBr-dnknKi-TKXaei-dnkjzV-RxvhHd-pQXTfa-c3crQf-dnkwXG-dnfW2K-2SKdMh-efHTUr-5mMzpp-XdMr5c-88H1s3-d67Gth-aMuG6v-Uio4v1-KZt3M +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From d2951a94fdbfc75a7d7486658a5672e30900e0b3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 16 Dec 2019 09:10:19 +0800 Subject: [PATCH 116/676] translating --- .../20191212 How to configure Openbox for your Linux desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191212 How to configure Openbox for your Linux desktop.md b/sources/tech/20191212 How to configure Openbox for your Linux desktop.md index c017714234..32ff35bfb8 100644 --- a/sources/tech/20191212 How to configure Openbox for your Linux desktop.md +++ b/sources/tech/20191212 How to configure Openbox for your Linux desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5e72e93428b7d40a94f95eb4edbd66ddf0865e2c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 09:50:20 +0800 Subject: [PATCH 117/676] PRF @geekpi --- ...ava vs. Python- Which should you choose.md | 110 +++++++----------- 1 file changed, 42 insertions(+), 68 deletions(-) diff --git a/translated/talk/20191204 Java vs. Python- Which should you choose.md b/translated/talk/20191204 Java vs. Python- Which should you choose.md index 3dbe4bb50e..d0b775e89e 100644 --- a/translated/talk/20191204 Java vs. Python- Which should you choose.md +++ b/translated/talk/20191204 Java vs. Python- Which should you choose.md @@ -1,119 +1,94 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Java vs. Python: Which should you choose?) [#]: via: (https://opensource.com/article/19/12/java-vs-python) [#]: author: (Archit Modi https://opensource.com/users/architmodi) -Java vs. Python:你应该选择哪个? +Java 与 Python:你应该选择哪个? ====== -比较世界上最流行的两种编程语言,并在投票中让我们知道你喜欢哪一个。 -![Developing code.][1] -让我们比较一下世界上两种最受欢迎、最强大的编程语言:Java 和 Python!这两种语言有巨大的社区支持和库来执行几乎任何编程任务,尽管选择编程语言通常取决于开发人员的场景。在比较和对比之后,请投票[分享你的观点][2]。 +> 比较世界上最流行的两种编程语言,并在投票中让我们知道你喜欢哪一个。 + +![](https://img.linux.net.cn/data/attachment/album/201912/16/095025dppnl2lgtykgggkt.jpg) + +让我们比较一下世界上两种最受欢迎、最强大的编程语言:Java 和 Python!这两种语言有巨大的社区支持和库来执行几乎任何编程任务,尽管选择编程语言通常取决于开发人员的场景。在比较和对比之后,请投票分享你的观点。 ### 是什么? - * **Java** 是一门通用面向对象的编程语言,主要用于开发从移动端到 Web 到企业级应用的各种应用。 - * **Python** 是一门高级面向对象的编程语言,主要用于 Web 开发、人工智能、机器学习、自动化和其他数据科学应用。 - - +* **Java** 是一门通用面向对象的编程语言,主要用于开发从移动端到 Web 到企业级应用的各种应用。 +* **Python** 是一门高级面向对象的编程语言,主要用于 Web 开发、人工智能、机器学习、自动化和其他数据科学应用。 ### 创建者 - * **Java** 是由 James Gosling(Sun Microsystems)创造的。 - * **Python** 是由 Guido van Rossum 创造的。 - - +* **Java** 是由 James Gosling(Sun Microsystems)创造的。 +* **Python** 是由 Guido van Rossum 创造的。 ### 开源状态 - * **Java** 是免费的,(大部分)开源,但商业用途除外。 - * **Python** 所有场景均免费。 - - +* **Java** 是免费的,(大部分)开源,但商业用途除外。 +* **Python** 对于所有场景都是免费、开源的。 ### 平台依赖 - * **Java** 根据它的 WORA (”一次编写,到处运行“)哲学,它是平台无关的。 - * **Python** 依赖于平台。 - - +* **Java** 根据它的 WORA (“一次编写,到处运行write once, run anywhere”)哲学,它是平台无关的。 +* **Python** 依赖于平台。 ### 编译或解释 - * **Java** 是一门编译语言。Java 程序在编译时转换为字节码,而不是运行时。 - * **Python** 是一门解释性语言。Python 程序在运行时进行解释。 - - +* **Java** 是一门编译语言。Java 程序在编译时转换为字节码,而不是运行时。 +* **Python** 是一门解释性语言。Python 程序在运行时进行解释。 ### 文件创建 - * **Java**:编译后生成 **<filename>.class** 文件。 - * **Python**:在运行期,创建 **<filename>.pyc** 文件 - - +* **Java**:编译后生成 `.class` 文件。 +* **Python**:在运行期,创建 `.pyc` 文件。 ### 错误类型 - * **Java** 有 2 种错误类型:编译和运行时错误。 - * **Python** 有 1 种错误类型:回溯(或运行时)错误。 - - +* **Java** 有 2 种错误类型:编译和运行时错误。 +* **Python** 有 1 种错误类型:回溯(或运行时)错误。 ### 静态或动态类型 - * **Java** 是静态类型。当初始化变量时,需要在程序中指定变量的类型,因为类型检查是在编译时完成的。 - * **Python** 是动态类型。变量不需要在初始化时指定类型,因为类型检查是在运行时完成的。 - - +* **Java** 是静态类型。当初始化变量时,需要在程序中指定变量的类型,因为类型检查是在编译时完成的。 +* **Python** 是动态类型。变量不需要在初始化时指定类型,因为类型检查是在运行时完成的。 ### 语法 - * **Java**:每个语句都需要以分号 (\*; ) 结尾,并且代码块由大括号 ( {} ) 分隔。 - * **Python**:代码块通过缩进分隔(用户可以选择要使用的空格数,但在整个块中应保持一致)。 - - +* **Java**:每个语句都需要以分号(`;` )结尾,并且代码块由大括号( `{}` )分隔。 +* **Python**:代码块通过缩进分隔(用户可以选择要使用的空格数,但在整个块中应保持一致)。 ### 类的数量 - * **Java**:在 Java 中的单个文件中只能存在一个公有顶级类。 - * **Python**:Python 中的单个文件中可以存在任意数量的类。 - - - -### 代码更多或更少? - - * **Java** 通常比 Python 要写更多代码行。 - * **Python**通常比 Java 要写更少代码行。 +* **Java**:在 Java 中的单个文件中只能存在一个公有顶级类。 +* **Python**:Python 中的单个文件中可以存在任意数量的类。 +### 代码多少? +* **Java** 通常比 Python 要写更多代码行。 +* **Python**通常比 Java 要写更少代码行。 ### 多重继承 - * **Java** 不支持多重继承(从两个或多个基类继承)。 - * **Python** 支持多重继承,但由于继承复杂性、层次结构、依赖等各种问题,它很少实现。 - - +* **Java** 不支持多重继承(从两个或多个基类继承)。 +* **Python** 支持多重继承,但由于继承复杂性、层次结构、依赖等各种问题,它很少实现。 ### 多线程 - * **Java** 多线程可以支持同时运行的两个或多个并发线程。 - * **Python** 使用全局解释器锁 (GIL),一次只允许运行单个线程 ( CPU 核)。 - - +* **Java** 多线程可以支持同时运行的两个或多个并发线程。 +* **Python** 使用全局解释器锁 (GIL),一次只允许运行单个线程(一个 CPU 核)。 ### 执行速度 - * **Java** 的执行时间通常比 Python 快。 - * **Python** 的执行时间通常比 Java 慢。 +* **Java** 的执行时间通常比 Python 快。 +* **Python** 的执行时间通常比 Java 慢。 +### Hello world - -### Java 的 Hello world - +Java 的: ``` public class Hello { @@ -123,18 +98,17 @@ public class Hello { } ``` -### Python 的 Hello world - +Python 的: ``` -`print("Hello Opensource.com from Java!")` +print("Hello Opensource.com from Java!") ``` ### 运行程序 ![Java vs. Python][5] -要运行 java 程序 ”Hello.java“,你需要先编译它,这将创建一个 ”Hello.class“ 文件。只需运行类名 ”java Hello“。对于 Python,只需运行文件 ”python3 helloworld.py“。 +要运行 java 程序 `Hello.java`,你需要先编译它,这将创建一个 `Hello.class` 文件。只需运行类名 `java Hello`。对于 Python,只需运行文件 `python3 helloworld.py`。 -------------------------------------------------------------------------------- @@ -143,7 +117,7 @@ via: https://opensource.com/article/19/12/java-vs-python 作者:[Archit Modi][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c8ef537d67912ae16111c03b04c668192459ff98 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 09:51:26 +0800 Subject: [PATCH 118/676] PUB @geekpi https://linux.cn/article-11679-1.html --- .../20191204 Java vs. Python- Which should you choose.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20191204 Java vs. Python- Which should you choose.md (98%) diff --git a/translated/talk/20191204 Java vs. Python- Which should you choose.md b/published/20191204 Java vs. Python- Which should you choose.md similarity index 98% rename from translated/talk/20191204 Java vs. Python- Which should you choose.md rename to published/20191204 Java vs. Python- Which should you choose.md index d0b775e89e..82e3d842c2 100644 --- a/translated/talk/20191204 Java vs. Python- Which should you choose.md +++ b/published/20191204 Java vs. Python- Which should you choose.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11679-1.html) [#]: subject: (Java vs. Python: Which should you choose?) [#]: via: (https://opensource.com/article/19/12/java-vs-python) [#]: author: (Archit Modi https://opensource.com/users/architmodi) From 35da6ff65b1879fb743a6ee9567b6acaba5cecc1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 09:59:28 +0800 Subject: [PATCH 119/676] =?UTF-8?q?=E6=B8=85=E9=99=A4=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E5=92=8C=E6=97=A0=E6=95=88=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rin OS Responds to the Privacy Concerns.md | 105 ------------------ ...tations Software MuseScore 3.3 Released.md | 89 --------------- ... How to change colors and themes in Vim.md | 12 -- ...91212 7 ways to remember Linux commands.md | 32 ------ 4 files changed, 238 deletions(-) delete mode 100644 sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md delete mode 100644 sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md delete mode 100644 sources/tech/20191209 How to change colors and themes in Vim.md delete mode 100644 sources/tech/20191212 7 ways to remember Linux commands.md diff --git a/sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md b/sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md deleted file mode 100644 index 51151d2e87..0000000000 --- a/sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md +++ /dev/null @@ -1,105 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Zorin OS Responds to the Privacy Concerns) -[#]: via: (https://itsfoss.com/zorin-os-privacy-concerns/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Zorin OS Responds to the Privacy Concerns -====== - -_**There were some privacy concerns around ‘data collection’ in Zorin OS. It’s FOSS spoke to Zorin OS CEO and here is his response to the controversy.**_ - -After a few days of [Zorin OS 15 Lite][1] release, a Reddit thread surfaced which flagged a privacy concern regarding the Linux distribution. - -The [Reddit thread][2] focuses on the [privacy policy][3] of Zorin OS and warns users that Zorin OS is sending anonymous pings every 60 minutes without users’ consent, which is potentially a privacy issue. - -![][4] - -The policy in question can be quoted here as: - -> _**Anonymous pings**: When using Zorin OS, your computer may occasionally send us a ping which includes an anonymous unique identifier for your computer. We use this information to count the number of active users of Zorin OS. The unique identifier does not identify you unless you (or someone acting on your behalf) discloses it separately. You may choose to disable these pings by uninstalling the “Zorin-os-census” package from your computer_ - -Now, there’s a lot of [discussions][5] surrounding the concern. There’s also a [YouTube video][6] talking about it. - -In a nutshell, it’s a mess. Some insist that they collect our IP addresses and some users complain that they should ask about it while installing Zorin OS. - -While I agree that they could add an opt-out option in the installation process – so I reached out to **Artyom Zorin** (_CEO, Zorin Group_) to clarify the situation. - -### Zorin’s Clarification On What They Collect With Every Anonymous Ping - -When I asked for an elaborate explanation of what the “**anonymous unique identifier**” includes, Artyom mentioned – “_It appears that there are some inaccuracies and misconceptions about the census in the comments sections_“. - -To continue the explanation about the unique identifier, he assured that **their servers do not log IP addresses** when a ping arrives. - -The zorin-os-census script **simply counts the number of unique computers using Zorin OS** and no personal data is being collected along with it. - -Artyom explained in detail: - -> The anonymous identifier is a series of letters and numbers which is randomly generated (not based on any external data) and only used for the Zorin OS Census. Its single purpose is to make sure that the computer isn’t double-counted when a ping is sent from a computer to the server. On a fully-installed Zorin OS system, the anonymous identifier can be found in /var/lib/zorin-os-census/uuid and should look like this:_68f2d95b-f51f-4a5d-9b48-a99c28691b89_ -> * -> *We would like to clarify that no personal or personally-identifiable data is being collected by us and the server does not log IP addresses when pings arrive. The zorin-os-census script is only used to count the number of computers and users running Zorin OS after installation. Even I wouldn’t be able to tell which computer is my own from looking at the server-side database. I have attached a screenshot of a snippet of the database table displaying the information we store. - -He also stressed his ‘commitment on privacy’: - -> Privacy is an essential human right. It’s a core tenet of our mission to give you back control of your technology, and not the other way around. We make privacy a priority with every decision we make, and we’re committed to protecting it in every level of the software we build. - -As you can observe in the response above, he shared a screenshot of how their database of unique identifiers looks like: - -![][7] - -If you’re still curious, you can also check out the [source code][8] for the zorin-os-census script. - -### Can We Opt-Out Of It? - -While the data collected may be ‘harmless’, it is important to give the option to the user whether or not they want Zorin OS to collect the data, right? - -So, when I inquired about the same, he mentioned that i**t was already something planned for Zorin OS 15 Lite release**. - -However, they did not want to rush to add it before properly testing it. Hence, they decided to keep it for the upcoming release (**Zorin OS 15.1**) which is planned to arrive in **early-to-mid December this year.** - -> We have in fact been working on implementing an opt-out option for this into the Zorin OS installer (Ubiquity). To ensure the stability and accessibility of this new functionality we’re adding to Ubiquity, we have scheduled a period of time to translate the text strings and rigorously test the software (in order to avoid regressions), as the installer is a critical component of the operating system. Unfortunately, the testing period for the opt-out option didn’t complete before our planned release of Zorin OS 15 Lite, and we, therefore, decided not to risk adding it before we could guarantee its stability. However, we are on track to include the opt-out option in the upcoming Zorin OS 15.1 release, which we plan to release in early-to-mid December. - -### Will It Be Something Similar To What Ubuntu Does? - -Ubuntu does let you opt-out from collecting information about your computer. - -So, when I asked if Zorin OS will add something similar to that, he responded with some details about how Ubuntu collects data and how Zorin OS is different from that. - -He mentioned the fact that Ubuntu comes pre-installed with a **popularity-contest** package that **occasionally sends data of what packages the user has installed** to the Ubuntu Developers. - -And, further clarified that **Zorin OS does not include that**. - -> While Ubuntu’s telemetry tool gives users the option to not send extensive information about the computers to the Ubuntu developers, selecting the “No” option still sends a ping to Ubuntu’s servers . -> -> From our research, it is not clear whether Ubuntu’s servers store logs of users’ IP addresses when they receive telemetry data. In addition, Zorin OS does not include the “popularity-contest” package that is pre-installed in Ubuntu. This package is designed to occasionally send a list of all packages a user has installed on their computer to the Ubuntu developers. - -**In the end…** - -While the concern regarding the anonymous pings may not seem to a privacy threat, an opt-out option should be presented to the user while installing Zorin OS. Let’s wait and watch if it should arrive in the upcoming Zorin OS 15.1 release. - -What do you think about the privacy concern mentioned above? Let us know your thoughts in the comments down below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/zorin-os-privacy-concerns/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/zorin-os-lite/ -[2]: https://www.reddit.com/r/FreeAsInFreedom/comments/e0yhw4/beware_zorin_os_sends_anonymous_pings_every_60/ -[3]: https://zorinos.com/legal/privacy/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-privacy-reddit.jpg?ssl=1 -[5]: https://www.reddit.com/r/linux/comments/e0zd5n/beware_zorin_os_sends_anonymous_pings_every_60/ -[6]: https://www.youtube.com/watch?v=bcgk9LvC36Y&feature=youtu.be&t=860 -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-census-database.png?ssl=1 -[8]: https://launchpad.net/~zorinos/+archive/ubuntu/stable/+sourcepub/10183568/+listing-archive-extra diff --git a/sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md b/sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md deleted file mode 100644 index 2835a5d06a..0000000000 --- a/sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Open Source Music Notations Software MuseScore 3.3 Released!) -[#]: via: (https://itsfoss.com/musescore/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Open Source Music Notations Software MuseScore 3.3 Released! -====== - -_**Brief: MuseScore is an open-source software to help you create, play, and print sheet music. They released a major update recently. So, we take a look at what MuseScore has to offer**_ _**overall.**_ - -### MuseScore: A Music Composition and Notation Software - -![][1] - -[MuseScore][2] is open-source software that lets you create, play, and print [sheet music][3]. - -You can even use a MIDI keyboard as input and simply play the tune you want to create the notation of. - -In order to make use of it, you need to know how sheet music notations work. In either case, you can just play something using your MIDI keyboard or any other instrument and learn how the music notations work while using it. - -So, it should come in handy for beginners and experts as well. - -You can download and use MuseScore for free. However, if you want to share your music/composition and reach out to a wider community on the MuseScore platform, you can opt to create a free or premium account on [MuseScore.com][4]. - -### Features of MuseScore - -![Musescore 3 Screenshot][5] - -MuseScore includes a lot of things that can be highlighted. If you are someone who is not involved in making music notations for your compositions – you might have to dig deeper just like me. - -Usually, I just head over to any [DAW available on Linux][6] and start playing something to record/loop it without needing to create the music notations. So, for me, MuseScore definitely presents a learning curve with all the features offered. - -I’ll just list out the features with some brief descriptions – so you can explore them if it sounds interesting to you. - - * Supports Input via MIDI keyboard - * You can transfer to/from other programs via [MusicXML][7], MIDI, and other options. - * A Huge collection of palettes (music symbols) to choose from. - * You also get the ability to re-arrange the palettes and create your own list of most-used palettes or edit them. - * Some plugins supported to extend the functionality - * Import PDFs to read and play notations - * Several instruments supported - * Basic or Advanced layout of palettes to get started - - - -Some of the recent key changes include the palettes redesign, accessibility, and the not input workflow. For reference, you can check out how the new palettes work: - -### Installing MuseScore 3.3.3 on Ubuntu/Linux - -The latest version of MuseScore is 3.3.3 with all the bug fixes and improvements to its recent [MuseScore 3.3 release][8]. - -You may find an older release in your Software Center (or your official repo). So, you can either opt for a Flatpak package, Snap, or maybe an AppImage from its [download page][9] with links for different Linux distributions. - -[Download MuseScore][9] - -**Wrapping Up** - -I was quite fascinated to learn about MuseScore being an open-source and free solution to create, play, and print sheet music. - -It may not be the most easy-to-use software there is – but when considering the work with music notations, it will help you learn more about it and help you with your work as well. - -What do you think about MuseScore? Do share your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/musescore/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/musescore-3.jpg?ssl=1 -[2]: https://musescore.org/en -[3]: https://en.wikipedia.org/wiki/Sheet_music -[4]: https://musescore.com/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/musescore-3-screenshot.jpg?ssl=1 -[6]: https://itsfoss.com/best-audio-editors-linux/ -[7]: https://en.wikipedia.org/wiki/MusicXML -[8]: https://musescore.org/en/3.3 -[9]: https://musescore.org/en/download diff --git a/sources/tech/20191209 How to change colors and themes in Vim.md b/sources/tech/20191209 How to change colors and themes in Vim.md deleted file mode 100644 index a5aac50b0b..0000000000 --- a/sources/tech/20191209 How to change colors and themes in Vim.md +++ /dev/null @@ -1,12 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to change colors and themes in Vim) -[#]: via: (https://opensource.com/article/19/12/colors-themes-vim) -[#]: author: (Rashan Smith https://opensource.com/users/rsmith) - -How to change colors and themes in Vim -====== -Style your command line Vim with your favorite color scheme. diff --git a/sources/tech/20191212 7 ways to remember Linux commands.md b/sources/tech/20191212 7 ways to remember Linux commands.md deleted file mode 100644 index 18c06e8dca..0000000000 --- a/sources/tech/20191212 7 ways to remember Linux commands.md +++ /dev/null @@ -1,32 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 ways to remember Linux commands) -[#]: via: (https://www.linux.com/tutorials/7-ways-to-remember-linux-commands/) -[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) - -7 ways to remember Linux commands -====== - -Some Linux commands are very easy to remember. The names may have only a couple letters and they often relate directly to what you want to do – like cd for changing directories or pwd for displaying the present working directory. Others can be very difficult to remember, especially if what you want to do relies on using a series of options. - -So, let’s look at some commands and tricks that can help you remember commands that do just what you need them to do and that make issuing those commands so much easier. - -[Source: [Network World][1]] - --------------------------------------------------------------------------------- - -via: https://www.linux.com/tutorials/7-ways-to-remember-linux-commands/ - -作者:[Swapnil Bhartiya][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/author/swapnil/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/article/3489537/7-ways-to-remember-linux-commands.html From 52063974f3edad3ace7132c2b06de1bf3289856d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 10:55:06 +0800 Subject: [PATCH 120/676] PRF @algzjh --- ...e developers, and other industry trends.md | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md b/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md index 277378d8f4..a2f0c6622b 100644 --- a/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md +++ b/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md @@ -1,46 +1,55 @@ [#]: collector: (lujun9972) [#]: translator: (algzjh) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (An idiot's guide to Kubernetes, low-code developers, and other industry trends) [#]: via: (https://opensource.com/article/19/12/technology-advice-and-other-industry-trends) [#]: author: (Tim Hildred https://opensource.com/users/thildred) -面向 Kubernetes,低代码开发人员和其他行业趋势的傻瓜指南 +每周开源点评:Kubernetes 傻瓜指南、低代码开发人员和其他行业趋势 ====== -每周查看开源社区,市场和行业趋势。 +> 每周开源社区、市场和行业趋势。 + ![Person standing in front of a giant computer screen with numbers, data][1] -我在一家采用开源开发模型的企业软件公司担任高级产品营销经理,作为该职位的一部分,我定期为产品营销人员,经理和其他有影响力的人发布有关开源社区,市场和行业趋势的最新信息。这里有该更新中我和他们最喜欢的四篇文章。 +作为我在具有开源开发模型的企业软件公司担任高级产品营销经理的角色的一部分,我为产品营销人员、经理和其他影响者定期发布有关开源社区,市场和行业趋势的定期更新。这里有该更新中我和他们最喜欢的四篇文章。 -## [Kubernetes 的傻瓜指南][2] +### Kubernetes 傻瓜指南 + +- [文章链接][2] > Kubernetes 已经发展出了新的特性,这使其成为企业软件的更好的容器平台。安全性和高级网络等元素已被纳入 Kubernetes 上游代码的主体,并且现在可供所有人使用。 > > 然而,企业解决方案的其他方面总会有补充需求;比如日志记录和性能监控。这就是像 Istio 等辅助包发挥作用的地方,它带来了额外的功能,但是仍使 Kubernetes 的核心保持了合理的大小和特性集。 -**影响**: 我总是发现,人们很容易把对技术发展的认识视为理所当然。当与你打交道的每个人都处于“最前沿”时,你的观点就会歪曲到这样的程度:你甚至可能会认为对最新的(此处插入首选技术)一无所知的人跟不上潮流,而实际上这并没有开始影响他们做自己需要做的事情的能力。那些人不是白痴;他们是我们的朋友、客户、合作伙伴、合作者和社区。 +**影响**: 我总是发现,人们很容易把对技术发展的认识视为理所当然。当与你打交道的每个人都处于“最前沿”时,你的观点就会歪曲到这样的程度:你甚至可能会认为对最新的(*此处插入首选技术*)一无所知的人跟不上潮流,而实际上这并没有开始影响他们做自己需要做的事情的能力。那些人不是白痴;他们是我们的朋友、客户、合作伙伴、合作者和社区。 -## [Gartner: 采用低代码开发之前应该考虑什么][3] +### Gartner: 采用低代码开发之前应该考虑什么 -> 尽管专注于业务 IT 团队,但 Gartner(高德纳咨询公司) 发现,一个日益重要的开发人员社区是需要快速开发简单应用程序或构建最低可行产品或多体验功能的核心 IT 专业开发人员。当应用程序领导者在传统的应用程序项目中使用低代码时,他们可能希望使用标准的 IT DevOps 自动化方法和低代码工具。 +- [文章链接][3] + +> 尽管专注于商业 IT 团队,但 Gartner 发现,一个日益重要的开发人员社区是需要快速开发简单应用程序或构建最低可行产品或多体验功能的核心 IT 专业开发人员。当应用程序领导者在传统的应用程序项目中使用低代码时,他们可能希望使用标准的 IT DevOps 自动化方法和低代码工具。 **影响**: 越来越多的用例和用户体验可以通过需要更少时间和技能来创建的应用程序来处理和交互。而低代码开发人员也可能会结合成一个具有他们自己的规范和亚文化的独特群体。 -## [诺基亚认为云原生对 5G 核心至关重要][4] +### 诺基亚认为云原生对 5G 核心至关重要 + +- [文章链接][4] > 诺基亚概述了 5G 的五个关键业务目标,这些目标只能通过云原生环境来实现。其中包括:更好的带宽、延迟和密度;通过网络切片将服务扩展到新的企业、行业和[物联网][5]市场;根据敏捷性和效率定义的快速服务部署;超越传统带宽、语音和信息传递的新服务;以及利用端到端网络获取更多收入的数字服务的出现。 **影响**: 在越来越多的事物连接到网络的情况下,这是最有意义的。4G 主要与越来越多的手机有关;只有当你开始连接其他所有东西时,5G 才是真正必要的。4G 意味着我们的手机上有更丰富的应用程序,而 5G 几乎与手机无关。 -## [APIs: 隐藏的业务加速器][6] +### API:隐藏的业务加速器 -> 要想让组织成功地进行数字化转型,API 策略至关重要。从解锁有价值的数据到加快开发时间,API 都是数字时代谦逊的英雄。那些已经尝试过 API 的人已经感受到了好处。例如,研究表明,使用 API 的企业中,有 53% 认为它们提高了生产力,而 29% 声称它们的收入增长是使用 API 的直接结果。当 API 被视为存在于一个项目之外的可发现和可重用的产品时,它有助于为持续的变更奠定灵活的基础。 +- [文章链接][6] + +> 要想让组织成功地进行数字化转型,API 策略至关重要。从解锁有价值的数据到加快开发时间,API 都是数字时代的幕后英雄。那些已经尝试过 API 的人已经感受到了好处。例如,研究表明,使用 API 的企业中,有 53% 认为它们提高了生产力,而 29% 声称它们的收入增长是使用 API 的直接结果。当 API 被视为存在于一个项目之外的可发现和可重用的产品时,它有助于为持续的变更奠定灵活的基础。 **影响**: 隐藏的业务加速器实际上是这样一种思想,即功能应该以一种方式进行打包,使其能够在原始提供者没有预料到的环境中进行重新利用和组合。 -_我希望你喜欢这份上周给我留下深刻印象的列表,并于下周一回来了解更多开源社区、市场和行业的趋势。_ +我希望你喜欢这份上周给我留下深刻印象的列表,并于下周一回来了解更多开源社区、市场和行业的趋势。 -------------------------------------------------------------------------------- @@ -49,7 +58,7 @@ via: https://opensource.com/article/19/12/technology-advice-and-other-industry-t 作者:[Tim Hildred][a] 选题:[lujun9972][b] 译者:[algzjh](https://github.com/algzjh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c33f65e341ac800d3e1a63491c34271fc9a4155d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 10:55:38 +0800 Subject: [PATCH 121/676] PUB @algzjh https://linux.cn/article-11681-1.html --- ...ernetes, low-code developers, and other industry trends.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md (98%) diff --git a/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md b/published/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md similarity index 98% rename from translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md rename to published/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md index a2f0c6622b..6e13e0dbfd 100644 --- a/translated/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md +++ b/published/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (algzjh) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11681-1.html) [#]: subject: (An idiot's guide to Kubernetes, low-code developers, and other industry trends) [#]: via: (https://opensource.com/article/19/12/technology-advice-and-other-industry-trends) [#]: author: (Tim Hildred https://opensource.com/users/thildred) From 53d98163622012b0ab921e9dc4ded9cecd50a3fb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 11:11:34 +0800 Subject: [PATCH 122/676] PRF @geekpi --- ...iles into pieces with the split command.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/tech/20191210 Breaking Linux files into pieces with the split command.md b/translated/tech/20191210 Breaking Linux files into pieces with the split command.md index c67de96b05..71f7a13876 100644 --- a/translated/tech/20191210 Breaking Linux files into pieces with the split command.md +++ b/translated/tech/20191210 Breaking Linux files into pieces with the split command.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Breaking Linux files into pieces with the split command) @@ -9,19 +9,20 @@ 使用 split 命令分割 Linux 文件 ====== -一些简单的 Linux 命令能让你根据需要分割以及重新组合文件,来适应存储或电子邮件附件大小的限制 -[Marco Verch][1] [(CC BY 2.0)][2] -Linux 系统提供了一个非常易于使用的命令来分割文件。在将文件上传到限制大小的存储网站或者作为邮件附件之前,你可能需要执行此操作。要将文件分割为多个文件块,只需使用 split 命令。 +> 一些简单的 Linux 命令能让你根据需要分割以及重新组合文件,来适应存储或电子邮件附件大小的限制。 + +![Marco Verch][1] + +Linux 系统提供了一个非常易于使用的命令来分割文件。在将文件上传到限制大小的存储网站或者作为邮件附件之前,你可能需要执行此操作。要将文件分割为多个文件块,只需使用 `split` 命令。 ``` $ split bigfile ``` -默认情况下,split 命令使用非常简单的命名方案。文件块将被命名为 xaa、xab、xac等,并且,大概地,如果你将足够大的文件分割,你甚至可能会得到名为 xza 和 xzz 的块。 +默认情况下,`split` 命令使用非常简单的命名方案。文件块将被命名为 `xaa`、`xab`、`xac` 等,并且,大概地,如果你将足够大的文件分割,你甚至可能会得到名为 `xza` 和 `xzz` 的块。 - -除非你要求,否则该命令将无任何反馈地运行。但是,如果你想在创建文件块时看到它们,可以使用 --verbose 选项。 +除非你要求,否则该命令将无任何反馈地运行。但是,如果你想在创建文件块时看到反馈,可以使用 `--verbose` 选项。 ``` $ split –-verbose bigfile @@ -30,7 +31,7 @@ creating file 'xab' creating file 'xac' ``` -你还可以给文件命名前缀。例如,要将原始文件命名为 bigfile.xaa、bigfile.xab等,你可以将前缀添加到 split 命令的末尾,如下所示: +你还可以给文件命名前缀。例如,要将你原始文件分割并命名为 `bigfile.aa`、`bigfile.ab` 等,你可以将前缀添加到 `split` 命令的末尾,如下所示: ``` $ split –-verbose bigfile bigfile. @@ -39,9 +40,9 @@ creating file 'bigfile.ab' creating file 'bigfile.ac' ``` -请注意,上述命令中显示的前缀的末尾会添加一个点。否则,文件将是 bigfilexaa 之类的名称,而不是 bigfile.xaa。 +请注意,上述命令中显示的前缀的末尾会添加一个点。否则,文件将是 `bigfileaa` 之类的名称,而不是 `bigfile.aa`。 -请注意,split 命令_不会_删除你的原始文件,只是创建了文件块。如果要指定文件块的大小,可以使用 -b 选项将其添加到命令中。例如: +请注意,`split` 命令*不会*删除你的原始文件,只是创建了文件块。如果要指定文件块的大小,可以使用 `-b` 选项将其添加到命令中。例如: ``` $ split -b100M bigfile @@ -49,7 +50,7 @@ $ split -b100M bigfile 文件大小可以是 KB、MB,GB,最大可以是 YB!只需使 K、M、G、T、P、E、Z 和 Y 这些合适的字母。 -如果要基于每个块中的行数而不是字节数来拆分文件,那么可以使用 -l(行)选项。在此示例中,每个文件将有 1000 行,当然,最后一个文件可能有较少的行。 +如果要基于每个块中的行数而不是字节数来拆分文件,那么可以使用 `-l`(行)选项。在此示例中,每个文件将有 1000 行,当然,最后一个文件可能有较少的行。 ``` $ split --verbose -l1000 logfile log. @@ -65,14 +66,14 @@ creating file 'log.ai' creating file 'log.aj' ``` -如果你需要在远程站点上重新组合文件,那么可以使用如下所示的 cat 命令轻松地完成此操作: +如果你需要在远程站点上重新组合文件,那么可以使用如下所示的 `cat` 命令轻松地完成此操作: ``` $ cat x?? > original.file $ cat log.?? > original.file ``` -上面所示的分割和组合命令适合于二进制和文本文件。在此示例中,我们将 zip 二进制文件分割为 50KB 的块,之后使用 cat 重新组合了它们,然后比较了组合后的文件和原始文件。diff 命令验证文件是否相同。 +上面所示的分割和组合命令适合于二进制和文本文件。在此示例中,我们将 zip 二进制文件分割为 50KB 的块,之后使用 `cat` 重新组合了它们,然后比较了组合后的文件和原始文件。`diff` 命令验证文件是否相同。 ``` $ split --verbose -b50K zip zip. @@ -86,9 +87,7 @@ $ diff zip zip.new $ <== 无输出 = 无差别 ``` -我唯一要提醒的一点的是,如果你经常使用 split 并使用默认命名,那么某些文件块可能会覆盖其他的文件块,甚至会比你预期的更多,因为有些是更早之前分割的。 - -加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。 +我唯一要提醒的一点的是,如果你经常使用 `split` 并使用默认命名,那么某些文件块可能会覆盖其他的文件块,甚至会比你预期的更多,因为有些是更早之前分割的。 -------------------------------------------------------------------------------- @@ -97,13 +96,13 @@ via: https://www.networkworld.com/article/3489256/breaking-linux-files-into-piec 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ [b]: https://github.com/lujun9972 -[1]: https://www.flickr.com/photos/30478819@N08/34879296673/in/photolist-V9avJ2-LysA9-qVeu6t-dV4dkC-RWNeA5-LFKPG-aLpKTg-aLpJoK-4rN35a-97zDK4-7fevx8-mBSVT-64r2D4-8TbXFw-4g2Wgv-4pAdnq-4g6Ycf-9pt9t9-ceyN2u-LYckrJ-23sDdLH-dAQgiK-25eyt6N-UuAEk9-koNDTn-dAVK2j-ea8feG-bWpNKQ-bzJNPM-dAQ22K-dnkd1e-8qkaFp-dnCtBr-dnknKi-TKXaei-dnkjzV-RxvhHd-pQXTfa-c3crQf-dnkwXG-dnfW2K-2SKdMh-efHTUr-5mMzpp-XdMr5c-88H1s3-d67Gth-aMuG6v-Uio4v1-KZt3M +[1]: https://images.idgesg.net/images/article/2018/08/chocolate-chunks-100767935-large.jpg [2]: https://creativecommons.org/licenses/by/2.0/legalcode [5]: https://www.facebook.com/NetworkWorld/ [6]: https://www.linkedin.com/company/network-world From b26bb4d0d7191b60b5fb9d5076cdb99a52b6ef5d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 11:12:08 +0800 Subject: [PATCH 123/676] PUB @geekpi https://linux.cn/article-11682-1.html --- ...Breaking Linux files into pieces with the split command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191210 Breaking Linux files into pieces with the split command.md (98%) diff --git a/translated/tech/20191210 Breaking Linux files into pieces with the split command.md b/published/20191210 Breaking Linux files into pieces with the split command.md similarity index 98% rename from translated/tech/20191210 Breaking Linux files into pieces with the split command.md rename to published/20191210 Breaking Linux files into pieces with the split command.md index 71f7a13876..0151b678df 100644 --- a/translated/tech/20191210 Breaking Linux files into pieces with the split command.md +++ b/published/20191210 Breaking Linux files into pieces with the split command.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11682-1.html) [#]: subject: (Breaking Linux files into pieces with the split command) [#]: via: (https://www.networkworld.com/article/3489256/breaking-linux-files-into-pieces-with-the-split-command.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From ddb43f63bde19e419a4ce12d704e1ec38a750d2b Mon Sep 17 00:00:00 2001 From: mayunmeiyouming <48499337+mayunmeiyouming@users.noreply.github.com> Date: Mon, 16 Dec 2019 11:25:16 +0800 Subject: [PATCH 124/676] Update and rename sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md to translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md --- ... fans love about the Mate Linux desktop.md | 58 ------------------- ... fans love about the Mate Linux desktop.md | 56 ++++++++++++++++++ 2 files changed, 56 insertions(+), 58 deletions(-) delete mode 100644 sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md create mode 100644 translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md diff --git a/sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md b/sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md deleted file mode 100644 index 80ecf157a1..0000000000 --- a/sources/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md +++ /dev/null @@ -1,58 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What GNOME 2 fans love about the Mate Linux desktop) -[#]: via: (https://opensource.com/article/19/12/mate-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -What GNOME 2 fans love about the Mate Linux desktop -====== -This article is part of a special series of 24 days of Linux desktops. -If you remember GNOME 2 fondly, the Mate Linux desktop will fulfill your -need for nostalgia. -![Linux keys on the keyboard for a desktop computer][1] - -Stop me if you've heard this one before: When GNOME 3 was first released, many GNOME users were not ready to give up GNOME 2. The [Mate][2] (named after the _yerba mate_ plant) project began as an effort to continue the GNOME 2 desktop, at first using GTK 2 (the toolkit GNOME 2 was based upon) and later incorporating GTK 3. The desktop became wildly popular, due in no small part to Linux Mint's prompt adoption of it, and since then, it has become commonly available on Fedora, Ubuntu, Slackware, Arch, and many other Linux distributions. Today, Mate continues to deliver a traditional desktop environment that looks and feels exactly like GNOME 2 did, using the GTK 3 toolkit. - -You may find Mate included in the software repository of your Linux distribution, or you can download and [install][3] a distribution that ships Mate as its default desktop. Before you do, though, be aware that it is meant to provide a full desktop experience, so many Mate apps are installed along with the desktop. If you're running a different desktop, you may find yourself with redundant applications (two PDF readers, two media players, two file managers, and so on). If you just want to try the Mate desktop, you can install a Mate-based distribution in a virtual machine, such as [GNOME Boxes][4]. - -### Mate desktop tour - -The Mate project doesn't just evoke GNOME 2; it _is_ GNOME 2. If you were a fan of the Linux desktop back in the mid-'00s, at the very least, you'll find Mate nostalgic. I was not a fan of GNOME 2 and tended to use KDE instead, but there's one place I can't imagine without GNOME 2: [OpenSolaris][5]. The OpenSolaris project didn't last long, coming to prominence when Ian Murdock joined Sun Microsystems just before it was subsumed by Oracle, but I was a low-level Solaris admin at the time and used OpenSolaris to teach myself more about that flavor of Unix. It was the only platform where I used GNOME 2 (because I didn't know how to change the desktop at first and then just got used to it), and today the [OpenIndiana project][6], a community continuation of OpenSolaris, uses GNOME 2 by way of the Mate desktop. - -![Mate on OpenIndiana][7] - -Mate's layout consists of three menus in the top-left corner: Applications, Places, and System. The Applications menu provides quick access to all application launchers installed on the system. The Places menu provides quick access to common locations, such as your home directory, a network folder, and so on. The System menu contains global options, such as shutdown and suspend. In the upper-right corner is a system tray, and there's a taskbar and a virtual desktop pager at the bottom of the screen. - -It's a slightly peculiar configuration, as far as desktop design goes. It borrows equal parts from earlier Linux desktops, the Mac Finder, and Windows, but creates a unique configuration that's intuitive and somehow familiar. Mate intentionally resists deviation from this model, and that's exactly the way its users prefer it. - -### Mate and open source - -Mate is one of the most direct examples of how open source empowers developers to fight against a project's end of life. On paper, GNOME 2 was superseded by GNOME 3, yet it lives on because one developer forked the code and carried on. Momentum grew, more developers joined, and the desktop that users love is healthier than ever. Not all software gets a second chance at life, but the option is always there with open source, and it's always absent otherwise. - -Using and supporting open source means supporting user and developer freedom. And the Mate desktop is a powerful example of what happens when it works. - -Exploring different desktops is a good thing. I’ve recently converted to GNOME 3 ("hallowed be its... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/mate-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer) -[2]: https://mate-desktop.org/ -[3]: https://mate-desktop.org/install/ -[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization -[5]: https://en.wikipedia.org/wiki/OpenSolaris -[6]: https://www.openindiana.org/documentation/faq/#what-is-openindiana -[7]: https://opensource.com/sites/default/files/uploads/advent-mate-openindiana_675px.jpg (Mate on OpenIndiana) diff --git a/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md b/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md new file mode 100644 index 0000000000..505c16110e --- /dev/null +++ b/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (mayunmeiyouming) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What GNOME 2 fans love about the Mate Linux desktop) +[#]: via: (https://opensource.com/article/19/12/mate-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +GNOME 2粉丝喜欢Mate Linux桌面的什么 +====== +本文是24天Linux桌面特别系列的一部分。如果您还记得GNOME 2,那么Mate Linux桌面将满足您的怀旧的情怀。 +![Linux keys on the keyboard for a desktop computer][1] + +如果你以前听过这个:当GNOME3第一次发布时,很多GNOME用户还没有准备好放弃GNOME2。[Mate] [2](以yerba mate_ plant命名)项目的开始是为了延续GNOME 2桌面,刚开始时使用GTK 2(GNOME 2所基于的工具包),然后又合并了GTK 3。由于Linux Mint的简单易用,使得桌面变得非常流行,并且从那时起,它已经普遍用于Fedora、Ubuntu、Slackware、Arch和许多其他Linux发行版上。今天,Mate继续提供一个传统的桌面环境,它的外观和感觉与GNOME 2完全一样,使用GTK 3工具包。 + +您可以在Linux发行版的软件仓库中找到Mate,也可以下载并[安装][3]把Mate作为默认桌面的发行版。不过,在你这样做之前,请注意它是为了提供完整的桌面体验,所以许多Mate应用程序都是随桌面一起安装的。如果您运行的是不同的桌面,您可能会发现自己有多余的应用程序(两个PDF阅读器、两个媒体播放器、两个文件管理器,等等)。如果您只想尝试Mate桌面,可以在虚拟机中安装基于Mate的发行版,例如[GNOME box][4]。 + +### Mate桌面之旅 + +Mate项目不仅仅唤起了GNOME 2;它是gnome2。如果你是00年代中期Linux桌面的粉丝,至少,你会发现Mate的怀旧情怀。我不是GNOME2的粉丝,我倾向于使用KDE,但是有一个地方我无法想象没有GNOME2:[OpenSolaris][5]。OpenSolaris项目并没有持续太久,当Ian Murdock在被Oracle并入Sun Microsystems之前加入Sun Microsystems时,它变得非常突出,但我当时是一个低级的Solaris管理员,并使用OpenSolaris来教自己更多关于Unix的那种风格。这是我使用GNOME2的唯一平台(因为我一开始不知道如何更改桌面,后来才习惯),而今天的[OpenIndiana project][6]是OpenSolaris的社区延续,它通过Mate桌面使用GNOME2。 + +![Mate on OpenIndiana][7] + +Mate的布局由左上角的三个菜单组成:应用程序、位置和系统。应用程序菜单提供对系统上安装的所有的应用程序的启动程序的快速访问。Places菜单提供对常用位置(如主目录、网络文件夹等)的快速访问。系统菜单包含全局选项,如关级和睡眠。右上角是一个系统托盘,屏幕底部有一个任务栏和一个虚拟桌面切换栏。 + +就桌面设计而言,它是一种稍微有点奇怪的配置。它从早期的Linux桌面、MacFinder和Windows中借用了相同的部分,但是又创建了一个独特的配置,这种配置很直观,而且很熟悉。Mate故意抵制与这个模型的偏差,这正是它的用户喜欢的地方。 + +### Mate和开源 + +Mate是一个最直接的例子,展示了开源如何使开发人员能够对抗项目生命的终结。从理论上讲,GNOME2会被GNOME3所取代,但它依然存在,因为一个开发人员建立代码的一个分支并继续进行下去。势头越来越大,更多的开发人员加入进来,并且用户喜爱的桌面比以往任何时候都更好。并不是所有的软件都有第二次机会,但是开源永远是一个机会,否则就永远没有机会。 + +使用和支持开源意味着支持用户和开发人员的自由。而且Mate桌面是它们的努力的有力证明。 + +探索不同的桌面是一件好事。我最近将开始使用为GNOME 3 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/mate-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[mayunmeiyouming](https://github.com/mayunmeiyouming) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer) +[2]: https://mate-desktop.org/ +[3]: https://mate-desktop.org/install/ +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://en.wikipedia.org/wiki/OpenSolaris +[6]: https://www.openindiana.org/documentation/faq/#what-is-openindiana +[7]: https://opensource.com/sites/default/files/uploads/advent-mate-openindiana_675px.jpg (Mate on OpenIndiana) From 8e830bb47c599f5fd3133afb6280b0f8c3583452 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 15:17:15 +0800 Subject: [PATCH 125/676] APL --- ... Text Snippets To Pastebin-like Services From Commandline.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md index 58b072f2fc..7644c67892 100644 --- a/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md +++ b/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ebb92bd4ea6f9aff5b55a37f5fd49eb977e439b8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 15:58:42 +0800 Subject: [PATCH 126/676] TSL --- ...Pastebin-like Services From Commandline.md | 259 ------------------ ...Pastebin-like Services From Commandline.md | 247 +++++++++++++++++ 2 files changed, 247 insertions(+), 259 deletions(-) delete mode 100644 sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md create mode 100644 translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md diff --git a/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md deleted file mode 100644 index 7644c67892..0000000000 --- a/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md +++ /dev/null @@ -1,259 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Easily Upload Text Snippets To Pastebin-like Services From Commandline) -[#]: via: (https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -Easily Upload Text Snippets To Pastebin-like Services From Commandline -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-720x340.png) - -Whenever there is need to share the code snippets online, the first one probably comes to our mind is Pastebin.com, the online text sharing site launched by **Paul Dixon** in 2002. Now, there are several alternative text sharing services available to upload and share text snippets, error logs, config files, a command’s output or any sort of text files. If you happen to share your code often using various Pastebin-like services, I do have a good news for you. Say hello to **Wgetpaste** , a command line BASH utility to easily upload text snippets to pastebin-like services. Using Wgetpaste script, anyone can quickly share text snippets to their friends, colleagues, or whoever wants to see/use/review the code from command line in Unix-like systems. - -### Installing Wgetpaste - -Wgetpaste is available in Arch Linux [Community] repository. To install it on Arch Linux and its variants like Antergos and Manjaro Linux, just run the following command: - -``` -$ sudo pacman -S wgetpaste -``` - -For other distributions, grab the source code from [**Wgetpaste website**][1] and install it manually as described below. - -First download the latest Wgetpaste tar file: - -``` -$ wget http://wgetpaste.zlin.dk/wgetpaste-2.28.tar.bz2 -``` - -Extract it: - -``` -$ tar -xvjf wgetpaste-2.28.tar.bz2 -``` - -It will extract the contents of the tar file in a folder named “wgetpaste-2.28”. - -Go to that directory: - -``` -$ cd wgetpaste-2.28/ -``` - -Copy the wgetpaste binary to your $PATH, for example **/usr/local/bin/**. - -``` -$ sudo cp wgetpaste /usr/local/bin/ -``` - -Finally, make it executable using command: - -``` -$ sudo chmod +x /usr/local/bin/wgetpaste -``` - -### Upload Text Snippets To Pastebin-like Services - -Uploading text snippets using Wgetpaste is trivial. Let me show you a few examples. - -**1\. Upload text files** - -To upload any text file using Wgetpaste, just run: - -``` -$ wgetpaste mytext.txt -``` - -This command will upload the contents of mytext.txt file. - -Sample output: - -``` -Your paste can be seen here: https://paste.pound-python.org/show/eO0aQjTgExP0wT5uWyX7/ -``` - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-1.png) - -You can share the pastebin URL via any medium like mail, message, whatsapp or IRC etc. Whoever has this URL can visit it and view the contents of the text file in a web browser of their choice. - -Here is the contents of mytext.txt file in web browser: - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-2.png) - -You can also use **‘tee’** command to display what is being pasted, instead of uploading them blindly. - -To do so, use **-t** option like below. - -``` -$ wgetpaste -t mytext.txt -``` - -![][3] - -**2. Upload text snippets to different services -** - -By default, Wgetpaste will upload the text snippets to **poundpython** () service. - -To view the list of supported services, run: - -``` -$ wgetpaste -S -``` - -Sample output: - -``` -Services supported: (case sensitive): -Name: | Url: -=============|================= -bpaste | https://bpaste.net/ -codepad | http://codepad.org/ -dpaste | http://dpaste.com/ -gists | https://api.github.com/gists -*poundpython | https://paste.pound-python.org/ -``` - -Here, ***** indicates the default service. - -As you can see, Wgetpaste currently supports five text sharing services. I didn’t try all of them, but I believe all services will work. - -To upload the contents to other services, for example **bpaste.net** , use **-s** option like below. - -``` -$ wgetpaste -s bpaste mytext.txt -Your paste can be seen here: https://bpaste.net/show/5199e127e733 -``` - -**3\. Read input from stdin** - -Wgetpaste can also read the input from stdin. - -``` -$ uname -a | wgetpaste -``` - -This command will upload the output of ‘uname -a’ command. - -**4. Upload the COMMAND and the output of COMMAND together -** - -Sometimes, you may need to paste a COMMAND and its output. To do so, specify the contents of the command within quotes like below. - -``` -$ wgetpaste -c 'ls -l' -``` - -This will upload the command ‘ls -l’ along with its output to the pastebin service. - -This can be useful when you wanted to let others to clearly know what was the exact command you just ran and its output. - -![][4] - -As you can see in the output, I ran ‘ls -l’ command. - -**5. Upload system log files, config files -** - -Like I already said, we can upload any sort of text files, not just an ordinary text file, in your system such as log files, a specific command’s output etc. Say for example, you just updated your Arch Linux box and ended up with a broken system. You ask your colleague how to fix it and s/he wants to read the pacman.log file. Here is the command to upload the contents of the pacman.log file: - -``` -$ wgetpaste /var/log/pacman.log -``` - -Share the pastebin URL with your Colleague, so s/he will review the pacman.log and may help you to fix the problem by reviewing the log file. - -Usually, the contents of log files might be too long and you don’t want to share them all. In such cases, just use **cat** command to read the output and use **tail** command with the **-n** switch to define the number of lines to share and finally pipe the output to Wgetpaste as shown below. - -``` -$ cat /var/log/pacman.log | tail -n 50 | wgetpaste -``` - -The above command will upload only the **last 50 lines** of pacman.log file. - -**6\. Convert input url to tinyurl** - -By default, Wgetpaste will display the full pastebin URL in the output. If you want to convert the input URL to a tinyurl, just use **-u** option. - -``` -$ wgetpaste -u mytext.txt -Your paste can be seen here: http://tinyurl.com/y85d8gtz -``` - -**7. Set language -** - -By default, Wgetpaste will upload text snippets in **plain text**. - -To list languages supported by the specified service, use **-L** option. - -``` -$ wgetpaste -L -``` - -This command will list all languages supported by default service i.e **poundpython** (). - -We can change this using **-l** option. - -``` -$ wgetpaste -l Bash mytext.txt -``` - -**8\. Disable syntax highlighting or html in the output** - -As I mentioned above, the text snippets will be displayed in a specific language format (plaintext, Bash etc.). - -You can, however, change this behaviour to display the raw text snippets using **-r** option. - -``` -$ wgetpaste -r mytext.txt -Your raw paste can be seen here: https://paste.pound-python.org/raw/CUJhQ3jEmr2UvfmD2xCL/ -``` - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-5.png) - -As you can see in the above output, there is no syntax highlighting, no html formatting. Just a raw output. - -**9\. Change Wgetpaste defaults** - -All Defaults values (DEFAULT_{NICK,LANGUAGE,EXPIRATION}[_${SERVICE}] and DEFAULT_SERVICE) can be changed globally in **/etc/wgetpaste.conf** or per user in **~/.wgetpaste.conf** files. These files, however, are not available by default in my system. I guess we need to manually create them. The developer has given the sample contents for both files [**here**][5] and [**here**][6]. Just create these files manually with given sample contents and modify the parameters accordingly to change Wgetpaste defaults. - -**10\. Getting help** - -To display the help section, run: - -``` -$ wgetpaste -h -``` - -And, that’s all for now. Hope this was useful. We will publish more useful content in the days to come. Stay tuned! - -On behalf of **OSTechNix** , I wish you all a very **Happy New Year 2019**. I am grateful to all our readers, contributors, and mentors for supporting us from the beginning of our journey. We couldn’t come this far without your support and guidance. Thank you everyone! Have a great year ahead!! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: http://wgetpaste.zlin.dk/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-3.png -[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-4.png -[5]: http://wgetpaste.zlin.dk/zlin.conf -[6]: http://wgetpaste.zlin.dk/wgetpaste.example diff --git a/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md new file mode 100644 index 0000000000..1c60f5abfb --- /dev/null +++ b/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md @@ -0,0 +1,247 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Easily Upload Text Snippets To Pastebin-like Services From Commandline) +[#]: via: (https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +从命令行轻松将文本片段上传到类似 Pastebin 的服务中 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-720x340.png) + +每当需要在线共享代码片段时,我们想到的第一个便是 Pastebin.com,这是 Paul Dixon 于 2002 年推出的在线文本共享网站。现在,有几种可供选择的文本共享服务可以上传和共享文本片段、错误日志、配置文件、命令输出或任何类型的文本文件。如果你碰巧经常使用各种类似于 Pastebin 的服务来共享代码,那么这对你来说确实是个好消息。向 Wgetpaste 打个招呼吧,它是一个命令行 BASH 实用程序,可轻松地将文本摘要上传到类似 pastebin 的服务中。使用 Wgetpaste 脚本,任何人都可以与自己的朋友、同事或想在类似 Unix 的系统中的命令行中查看/使用/查看代码的人快速共享文本片段。 + +### 安装 Wgetpaste + +Wgetpaste 在 Arch Linux [Community] 存储库中可用。要将其安装在 Arch Linux 及其变体(如 Antergos 和 Manjaro Linux)上,只需运行以下命令: + +``` +$ sudo pacman -S wgetpaste +``` + +对于其他发行版,请从 [Wgetpaste 网站][1] 获取源代码,并按如下所述手动安装。 + +首先下载最新的 Wgetpaste tar 文件: + +``` +$ wget http://wgetpaste.zlin.dk/wgetpaste-2.28.tar.bz2 +``` + +提取它: + +``` +$ tar -xvjf wgetpaste-2.28.tar.bz2 +``` + +它将 tar 文件的内容提取到名为 `wgetpaste-2.28` 的文件夹中。 + +转到该目录: + +``` +$ cd wgetpaste-2.28/ +``` + +将 `wgetpaste` 二进制文件复制到 `$PATH` 中,例如 `/usr/local/bin/`。 + +``` +$ sudo cp wgetpaste /usr/local/bin/ +``` + +最后,使用命令使其可执行: + +``` +$ sudo chmod +x /usr/local/bin/wgetpaste +``` + +### 将文本片段上传到类似 Pastebin 的服务中 + +使用 Wgetpaste 上传文本片段很简单。让我向你展示一些示例。 + +#### 1、上传文本文件 + +要使用 Wgetpaste 上传任何文本文件,只需运行: + +``` +$ wgetpaste mytext.txt +``` + +此命令将上传 `mytext.txt` 文件的内容。 + +示例输出: + +``` +Your paste can be seen here: https://paste.pound-python.org/show/eO0aQjTgExP0wT5uWyX7/ +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-1.png) + +你可以通过邮件、短信、whatsapp 或 IRC 等任何媒体共享 pastebin 的 URL。拥有此 URL 的人都可以访问它,并在他们选择的 Web 浏览器中查看文本文件的内容。 + +这是 Web 浏览器中 `mytext.txt` 文件的内容: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-2.png) + +你也可以使用 `tee` 命令显示粘贴的内容,而不是盲目地上传它们。 + +为此,请使用如下的 `-t` 选项。 + +``` +$ wgetpaste -t mytext.txt +``` + +![][3] + +#### 2、将文字片段上传到其他服务 + +默认情况下,Wgetpaste 会将文本片段上传到 poundpython()服务。 + +要查看支持的服务列表,请运行: + +``` +$ wgetpaste -S +``` + +示例输出: + +``` +Services supported: (case sensitive): +Name: | Url: +=============|================= +bpaste | https://bpaste.net/ +codepad | http://codepad.org/ +dpaste | http://dpaste.com/ +gists | https://api.github.com/gists +*poundpython | https://paste.pound-python.org/ +``` + +在这里,`*` 表示默认服务。 + +如你所见,Wgetpaste 当前支持五种文本共享服务。我并没有全部尝试,但是我相信所有服务都可以使用。 + +要将内容上传到其他服务,例如 bpaste.net,请使用如下所示的 `-s` 选项。 + +``` +$ wgetpaste -s bpaste mytext.txt +Your paste can be seen here: https://bpaste.net/show/5199e127e733 +``` + +#### 3、从标准输入读取输入 + +Wgetpaste 也可以从标准输入读取。 + +``` +$ uname -a | wgetpaste +``` + +此命令将上传 `uname -a` 命令的输出。 + +#### 4、上传命令及命令的输出 + +有时,你可能需要粘贴命令及其输出。为此,请在如下所示的引号内指定命令的内容。 + +``` +$ wgetpaste -c 'ls -l' +``` + +这会将命令 `ls -l` 及其输出上传到 pastebin 服务。 + +当你想让其他人清楚地知道你刚运行的确切命令及其输出时,此功能很有用。 + +![][4] + +如你在输出中看到的,我运行了 `ls -l` 命令。 + +#### 5、上载系统日志文件、配置文件 + +就像我已经说过的,我们可以上载你的系统中任何类型的文本文件,而不仅仅是普通的文本文件,例如日志文件、特定命令的输出等。例如,你刚刚更新了 Arch Linux 机器,最后系统损坏了。你问你的同事该如何解决此问题,他(她)想阅读 `pacman.log` 文件。 这是上传 `pacman.log` 文件内容的命令: + +``` +$ wgetpaste /var/log/pacman.log +``` + +与你的同事共享 pastebin URL,以便他/她可以查看 `pacman.log`,并通过查看日志文件来帮助你解决问题。 + +通常,日志文件的内容可能太长,你不希望全部共享它们。在这种情况下,只需使用 `cat` 命令读取输出,然后使用 `tail -n` 命令定义要共享的行数,最后将输出通过管道传递到 Wgetpaste,如下所示。 + +``` +$ cat /var/log/pacman.log | tail -n 50 | wgetpaste +``` + +上面的命令将仅上传 `pacman.log` 文件的“最后 50 行”。 + +#### 6、将输入网址转换为短链接 + +默认情况下,Wgetpaste 将在输出中显示完整的 pastebin URL。如果要将输入 URL 转换为短链接,只需使用 `-u` 选项。 + +``` +$ wgetpaste -u mytext.txt +Your paste can be seen here: http://tinyurl.com/y85d8gtz +``` + +#### 7、设定语言 + +默认情况下,Wgetpaste 将上传“纯文本”中的文本片段。 + +要列出指定服务支持的语言,请使用 `-L` 选项。 + +``` +$ wgetpaste -L +``` + +该命令将列出默认服务(poundpython )支持的所有语言。 + +我们可以使用 `-l` 选项来改变它。 + +``` +$ wgetpaste -l Bash mytext.txt +``` + +#### 8、在输出中禁用语法突出显示或 html + +如上所述,文本片段将以特定的语言格式(纯文本、Bash 等)显示。 + +但是,你可以更改此行为,以使用 `-r` 选项显示原始文本摘要。 + +``` +$ wgetpaste -r mytext.txt +Your raw paste can be seen here: https://paste.pound-python.org/raw/CUJhQ3jEmr2UvfmD2xCL/ +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-5.png) + +如你在上面的输出中看到的,没有语法突出显示,没有 html 格式。只是原始输出。 + +#### 9、更改 Wgetpaste 默认值 + +所有默认值(`DEFAULT_{NICK,LANGUAGE,EXPIRATION}[_${SERVICE}]` 和 `DEFAULT_SERVICE`)都可以在 `/etc/wgetpaste.conf` 中全局更改,也可以在 `~/.wgetpaste.conf` 文件中针对每个用户更改。但是,这些文件在我的系统中默认情况下并不存在。我想我们需要手动创建它们。开发人员已经在[这里][5]和[这里][6]为这两个文件提供了示例内容。只需使用给定的样本内容手动创建这些文件,并相应地修改参数即可更改 Wgetpaste 的默认设置。 + +#### 10、获得帮助 + +要显示帮助部分,请运行: + +``` +$ wgetpaste -h +``` + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: http://wgetpaste.zlin.dk/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-3.png +[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-4.png +[5]: http://wgetpaste.zlin.dk/zlin.conf +[6]: http://wgetpaste.zlin.dk/wgetpaste.example From d869fb309d4946bf3ea74a9b1f88db4dc8e5b6d0 Mon Sep 17 00:00:00 2001 From: Hank Chow <280630620@qq.com> Date: Mon, 16 Dec 2019 19:32:37 +0800 Subject: [PATCH 127/676] hankchow translating --- .../20191210 3 easy steps to update your apps to Python 3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191210 3 easy steps to update your apps to Python 3.md b/sources/tech/20191210 3 easy steps to update your apps to Python 3.md index 5b3f7adcb8..d304f95ec0 100644 --- a/sources/tech/20191210 3 easy steps to update your apps to Python 3.md +++ b/sources/tech/20191210 3 easy steps to update your apps to Python 3.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4951623d68dce82b7ce9f7532e856236a9af07b9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 16 Dec 2019 22:45:44 +0800 Subject: [PATCH 128/676] PRF @laingke --- .../20191004 What-s in an open source name.md | 68 ++++++++++--------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/translated/talk/20191004 What-s in an open source name.md b/translated/talk/20191004 What-s in an open source name.md index 50e24c9ae8..166f341119 100644 --- a/translated/talk/20191004 What-s in an open source name.md +++ b/translated/talk/20191004 What-s in an open source name.md @@ -1,78 +1,80 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What's in an open source name?) [#]: via: (https://opensource.com/article/19/10/open-source-name-origins) [#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) -开源名称中有什么? +开源软件名称中的故事 ====== -有没有想过您喜欢的开源项目或编程语言的名称来自何处?了解从 A 到 Z 的流行技术术语背后的起源故事。 + +> 有没有想过你喜欢的开源项目或编程语言的名称来自何处?按字母顺序了解流行技术术语背后的起源故事。 + ![A person writing.][1] -GNOME、Java、Jupyter、Python。如果你的朋友或家人曾留意过你的工作对话,他们可能会认为您从事文艺复兴时期的民间文学艺术、咖啡烘焙、天文学或动物学工作。这些开源技术的名称从何而来?我们要求作者社区提供意见,并汇总了一些我们最喜欢的技术名称起源故事。 +GNOME、Java、Jupyter、Python。如果你的朋友或家人曾留意过你的工作对话,他们可能会认为你从事文艺复兴时期的民间文学艺术、咖啡烘焙、天文学或动物学工作。这些开源技术的名称从何而来?我们请我们的作者社区提供意见,并汇总了一些我们最喜欢的技术名称的起源故事。 ### Ansible -“Ansible”这个名称直接来自科幻小说。厄休拉·勒古恩(Ursula Le Guin)的《鲁康农的世界》(_Rocannon's World_)一书中能进行即时(比光速更快)通信的设备允许被称为 ansibles(显然来自“ answerable”一词)。Ansibles 成为科幻小说的主要内容,包括在奥森·斯科特·卡德(Orson Scott Card)的《安德的游戏》(_Ender's Game_)(后来成为受欢迎的电影)中,该设备控制了许多远程太空飞船。对于控制分布式机器的软件来说,这似乎是一个很好的模型,因此 Michael DeHaan(Ansible 的创建者和创始人)借用了这个名称。 +“Ansible”这个名称直接来自科幻小说。Ursula Le Guin 的《鲁康农的世界Rocannon's World一书中能进行即时(比光速更快)通信的设备被称为 ansibles(显然来自 “ answerable” 一词)。Ansibles 开始流行于科幻小说,Orson Scott Card 的《安德的游戏Ender's Game(后来成为受欢迎的电影)中,该设备控制了许多远程太空飞船。对于控制分布式机器的软件来说,这似乎是一个很好的模型,因此 Michael DeHaan(Ansible 的创建者和创始人)借用了这个名称。 ### Apache -[Apache][2] 是最初于 1995 年发布的开源 Web 服务器。它的名称与著名的美国原住民部落无关;相反,它是指对原始软件代码重复的补丁。因此称之为,“一个修补A-patchy服务器”。 +[Apache][2] 是最初于 1995 年发布的开源 Web 服务器。它的名称与著名的美国原住民部落无关;相反,它是指对原始软件代码的重复补丁。因此称之为,“一个修补的A-patchy服务器”。 ### awk -“awk(1) 代表着 Aho, Weinberger, Kernighan(作者)”—— Michael Greenberg +“awk(1) 代表着 Aho、Weinberger、Kernighan(作者)”—— Michael Greenberg ### Bash -“最初的 Unix shell,即 Bourne shell,是以其创建者的名字命名的。在开发 Bash 时,csh(发音为‘seashell’)实际上更受交互登录用户的欢迎。Bash 项目旨在赋予 Bourne shell 新的生命,使其更适合于交互式使用,因此它被命名为‘Bourne again shell’,是‘重生’的双关语。’”——Ken Gaillot +“最初的 Unix shell,即 Bourne shell,是以其创建者的名字命名的。在开发 Bash 时,csh(发音为 ‘seashell’)实际上更受交互登录用户的欢迎。Bash 项目旨在赋予 Bourne shell 新的生命,使其更适合于交互式使用,因此它被命名为 ‘Bourne again shell’,是‘重生born again’的双关语。”——Ken Gaillot ### C -在早期,AT&T 的 Ken Thompson 和 Dennis Ritchie 发现可以使用更高级的编程语言(而不是低级的、可移植性更低的汇编编程)来编写操作系统和工具是很有趣的。早期有一个叫做 BCPL(Basic Combined programming Language,基本组合编程语言)的编程系统,汤普森创建了一个名为 B 的简化版 BCPL,但 B 的灵活性和速度都不高。然后,里奇把 B 的思想扩展成一种叫做 C 的编译语言。”——Jim Hall +在早期,AT&T 的 Ken Thompson 和 Dennis Ritchie 发现可以使用更高级的编程语言(而不是低级的、可移植性更低的汇编编程)来编写操作系统和工具是很有趣的。早期有一个叫做 BCPL(基本组合编程语言Basic Combined programming Language)的编程系统,Thompson 创建了一个名为 B 的简化版 BCPL,但 B 的灵活性和速度都不高。然后,Ritchie 把 B 的思想扩展成一种叫做 C 的编译语言。”——Jim Hall ### dd -“我想你发表这样一篇文章不能不提到 dd。我的外号叫 Didi。正确发音,它听起来像‘dd’。我第一次学的是 Unix,然后是 Linux,那是在 1993 年,当时我还是个学生。然后我去了军队,来到了我的部队中少数几个使用 Unix(Ultrix)的部门之一(其它部门主要是 VMS),那里的一个人说:‘这么说,你是一个黑客,对吗?你以为你了解 Unix 吗?好的,那么 dd 这个名字的原因是什么呢?’我不知道,试着猜:‘数据复印机?’所以他说,‘我要告诉你 dd 的故事。dd 是 _convert 和 copy_ 的缩写(任何人仍然可以在今天从参考页中看到),但由于 cc 这个缩写已经被 C 的编译器占用,它被命名为 dd。’只有几年后,我听闻了关于 JCL 的数据定义和非统一、半开玩笑的 Unix dd 命令语法的纪实中的一部分都是基于这个说法的。”——Yedidyah Bar David +“我想你发表这样一篇文章不能不提到 dd。我的外号叫 Didi。正确的发音它听起来像‘dd’。我开始学的是 Unix,然后是 Linux,那是在 1993 年,当时我还是个学生。然后我去了军队,来到了我的部队中少数几个使用 Unix(Ultrix)的部门之一(其它部门主要是 VMS),那里的一个人说:‘这么说,你是一个黑客,对吗?你以为你了解 Unix 吗?好的,那么 dd 这个名字的是怎么来的呢?’我不知道,试着猜道:‘数据复印机Data duplicator?’所以他说,‘我要告诉你 dd 的故事。dd 是转换convert复制copy的缩写(如今任何人仍然可以在参考页中看到),但由于 cc 这个缩写已经被 C 的编译器占用,所以它被命名为 dd。’就在几年后,我听闻了关于 JCL 的数据定义和非统一、半开玩笑的 Unix dd 命令语法的纪实故事中某种程度都是基于这个说法的。”——Yedidyah Bar David ### Emacs -经典的反 vianti-vi 编辑器,其名称的真正词源并不明显,因为它源自“Editing MACroS”。但是,它作为一个伟大的宗教亵渎和崇拜的对象,吸引了许多恶作剧般的缩写,例如“避开 Meta Alt Control Shift 键Escape Meta Alt Control Shift”(以调侃其对键盘的大量依赖),“8MB 并经常交换Eight Megabytes And Constantly Swapping”(从那时起就有很多内存了),“最终分配了所有的计算机存储Eventually malloc()s All Computer Storage”和 “EMACS 使一台计算机慢EMACS Makes A Computer Slow”——改编术语文件/黑客的字典 +经典的反 vianti-vi编辑器,其名称的真正词源并不明显,因为它源自“编辑宏Editing MACroS”。但是,它作为一个伟大的宗教亵渎和崇拜的对象,吸引了许多恶作剧般的缩写,例如“避开 Meta Alt Control Shift 键Escape Meta Alt Control Shift”(以调侃其对键盘的大量依赖),“8MB 并经常发生内存交换Eight Megabytes And Constantly Swapping”(从那时起就有很多内存了),“最终分配了所有的计算机存储Eventually malloc()s All Computer Storage”和 “EMACS 使一台计算机慢EMACS Makes A Computer Slow”——改编自 Jargon File/Hacker's Dictionary ### Enarx -[Enarx][3] 是机密计算领域的一个新项目。该项目的设计原则之一是它应该是“可替代的”。因此最初的名字是“psilocybin”(著名的魔术蘑菇)。一般情况下,经理级别的人可能会对这个名称有所抵触,因此考虑使用新名称。该项目的两位创始人 Mike Bursell 和 Nathaniel McCallum 都是老一辈的极客,因此他们考虑了许多不同的想法,包括 тайна(Tayna——俄语中代表秘密或神秘——虽然公认的俄语并不是一门古老的语言,但你就不要在乎这些细节了),crypticon(希腊语的意思是完全庶生的),cryptidion(希腊中表示小密室),arconus(拉丁语中表示秘密的褒义形容词),arcanum(拉丁语中表示秘密的中性形容词)和 ærn(盎格鲁撒克逊人表示地方,秘密的地方,壁橱,住所,房子,或小屋的词汇)。最后,由于各种原因,包括域名和 GitHub 项目名称的可用性,他们选择了 enarx,这是两个拉丁词根的组合:en-(表示内部)和 -arx(表示城堡,要塞或堡垒)。 +[Enarx][3] 是机密计算领域的一个新项目。该项目的设计原则之一是它应该是“可替代的”。因此最初的名字是“psilocybin”(著名的魔术蘑菇)。一般情况下,经理级别的人可能会对这个名称有所抵触,因此考虑使用新名称。该项目的两位创始人 Mike Bursell 和 Nathaniel McCallum 都是古老语言极客,因此他们考虑了许多不同的想法,包括 тайна(Tayna——俄语中代表秘密或神秘——虽然公认的俄语并不是一门古老的语言,但你就不要在乎这些细节了),crypticon(希腊语的意思是完全庶生的),cryptidion(希腊中表示小密室),arconus(拉丁语中表示秘密的褒义形容词),arcanum(拉丁语中表示秘密的中性形容词)和 ærn(盎格鲁撒克逊人表示地方、秘密的地方、壁橱、住所、房子,或小屋的词汇)。最后,由于各种原因,包括域名和 GitHub 项目名称的可用性,他们选择了 enarx,这是两个拉丁词根的组合:en-(表示内部)和 -arx(表示城堡、要塞或堡垒)。 ### GIMP -没有 [GIMP][4] 我们会怎么样?GNU 图像处理项目多年来一直是开源的主要内容。[维基百科][5]指出,“1995 年,[Spencer Kimball][6] 和 [Peter Mattis][7] 开始开发 GIMP,作为加州大学伯克利分校的一个为期一个学期的实验计算设施项目。” +没有 [GIMP][4] 我们会怎么样?GNU 图像处理项目GNU Image Manipulation Project多年来一直是开源的主要内容。[维基百科][5]指出,“1995 年,[Spencer Kimball][6] 和 [Peter Mattis][7] 开始开发 GIMP,作为加州大学伯克利分校的一个为期一个学期的实验计算设施项目。” ### GNOME -你有没有想过为什么 GNOME 被称为 GNOME?根据[维基百科][8],GNOME 最初是一个表示“GNU 网络对象模型环境”的缩写词。现在,该名称不再表示项目,并已被删除,但该名称仍然保留。[GNOME 3][9] 是 Fedora、红帽企业版、Ubuntu、Debian、SUSE Linux 企业版等发行版的默认桌面环境。 +你有没有想过为什么 GNOME 被称为 GNOME?根据[维基百科][8],GNOME 最初是一个表示“GNU 网络对象模型环境GNU Network Object Model Environment”的缩写词。现在,该名称不再表示该项目,并且该项目已被删除,但这个名称仍然保留。[GNOME 3][9] 是 Fedora、红帽企业版、Ubuntu、Debian、SUSE Linux 企业版等发行版的默认桌面环境。 ### Java -您能想象这种编程语言还有其它名称吗?Java 最初被称为 Oak,但是遗憾的是,Sun Microsystems 的法律团队因其现有商标而否决了该名称。所以开发团队又重新给它命名。[据说][10]该语言的工作组在 1995 年 1 月举行了一次大规模的头脑风暴。许多其它名称也被扔掉了,包括 Silk、DNA、WebDancer 等。该团队不希望新名称与过度使用的术语“web”或“net.”有任何关系。取而代之的是,他们在寻找更有活力、更有趣、更容易记住的东西。Java 满足了这些要求,并且奇迹般地,团队同意通过了! +你能想象这种编程语言还有其它名称吗?Java 最初被称为 Oak,但是遗憾的是,Sun Microsystems 的法律团队因现有商标而否决了该名称。所以开发团队又重新给它命名。[据说][10]该语言的工作组在 1995 年 1 月举行了一次大规模的头脑风暴。许多其它名称也被扔掉了,包括 Silk、DNA、WebDancer 等。该团队不希望新名称与过度使用的术语“web”或“net”有任何关系。取而代之的是,他们在寻找更有活力、更有趣、更容易记住的东西。Java 满足了这些要求,并且奇迹般地,团队同意通过了! ### Jupyter -现在许多数据科学家和学生在工作中使用 [Jupyter][11] 笔记本。“Jupyter”这个名字是三种开源计算机语言的融合,这三种语言在笔记本中都有使用,在数据科学中也很突出:[Julia][12]、[Python][13] 和 [R][14]。 +现在许多数据科学家和学生在工作中使用 [Jupyter][11] 笔记本。“Jupyter”这个名字是三种开源计算机语言的融合,这三种语言在这个笔记本中都有使用,在数据科学中也很突出:[Julia][12]、[Python][13] 和 [R][14]。 ### Kubernetes -Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuckie 在 [2015 Hacker News][15] 回应中证实了这种词源。为了坚持航海主题,他解释说,这项技术驱动集装箱,就像舵手或飞行员驱动集装箱船一样。因此,选择了 Kubernetes 这个名字。我们中的许多人仍然在尝试正确的发音(koo-bur-NET-eez),因此 K8s 是可以接受的替代发音。有趣的是,它与英语单词“ governor”具有相同的词源,也与蒸汽机上的机械负反馈装置相同。 +Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuckie 在 [2015 Hacker News][15] 回应中证实了这种词源。为了坚持航海主题,他解释说,这项技术驱动集装箱,就像舵手或驾驶员驾驶集装箱船一样。因此,选择了 Kubernetes 这个名字。我们中的许多人仍然在尝试正确的发音(koo-bur-NET-eez),因此 K8s 是可以接受的替代发音。有趣的是,它与英语单词“governorgovernor”具有相同的词源,也与蒸汽机上的机械负反馈装置相同。 ### KDE -那 K desktop 呢? KDE 最初代表“ Kool 桌面环境”。 它由 [Matthias Ettrich][16] 于 1996 年创立。根据[维基百科][17]上的说法,该名称是 Unix 上 [Common Desktop Environment][18](CDE)一词的调侃。 +那 K 桌面呢?KDE 最初代表“酷桌面环境Kool Desktop Environment”。 它由 [Matthias Ettrich][16] 于 1996 年创立。根据[维基百科][17]上的说法,该名称是 Unix 上 [通用桌面环境][18]Common Desktop Environment(CDE)一词的调侃。 ### Linux -[Linux][19] 因其发明者 Linus Torvalds 的名字命名的。Linus 最初想将他的作品命名为“Freax”,因为他认为以他自己的名字命名太自负了。根据[维基百科][19]的说法,“赫尔辛基科技大学 Torvalds 的同事 Ari Lemmke 当时是 FTP 服务器的志愿管理员之一,他并不认为‘Freax’是个好名字。 因此,他在没有咨询 Torvalds 的情况下,将服务器上的这个项目命名为‘Linux’。” +[Linux][19] 因其发明者 Linus Torvalds 的名字命名的。Linus 最初想将他的作品命名为“Freax”,因为他认为以他自己的名字命名太自负了。根据[维基百科][19]的说法,“赫尔辛基科技大学 Torvalds 的同事 Ari Lemmke 当时是 FTP 服务器的志愿管理员之一,他并不认为‘Freax’是个好名字。因此,他在没有咨询 Torvalds 的情况下,将服务器上的这个项目命名为‘Linux’。” 以下是一些最受欢迎的Linux发行版。 @@ -82,21 +84,21 @@ Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuck #### Debian -[Debian][21] Linux 创建于 1993 年 9 月,是其创始人 Ian Murdock 和他当时的女友 Debra Lynn 的混成词。 +[Debian][21] Linux 创建于 1993 年 9 月,是其创始人 Ian Murdock 和他当时的女友 Debra Lynn 的名字的混成词。 #### RHEL -[Red Hat Linux][22] 的名字来自它的创始人马克·尤因(Marc Ewing),他戴着一顶祖父送给他的康奈尔大学红色软呢帽。红帽公司成立于 1993 年 3 月 26 日。[Fedora Linux][23] 作为一个志愿者项目而启动,旨在为红帽发行版提供额外的软件,它的名字来自红帽的“Shadowman”标识。 +[Red Hat Linux][22] 的名字来自它的创始人 Marc Ewing,他戴着一顶祖父送给他的康奈尔大学红色软呢帽。红帽公司成立于 1993 年 3 月 26 日。[Fedora Linux][23] 作为一个志愿者项目而启动,旨在为红帽发行版提供额外的软件,它的名字来自红帽的“Shadowman”徽标。 #### Ubuntu -[Ubuntu][24] 旨在广泛分享开源软件,它以非洲哲学“人的本质”命名,可以翻译为“对他人的人道主义”或“我之所以是我,是因为我们都是这样的人”。 +[Ubuntu][24] 旨在广泛分享开源软件,它以非洲哲学“人的本质ubuntu”命名,可以翻译为“对他人的人道主义”或“我之所以是我,是因为我们都是这样的人”。 ### Moodle -开源学习平台 [Moodle][25] 是“模块化面向对象动态学习环境modular object-oriented dynamic learning environment”的首字母缩写。Moodle 仍然是电子学习的领先平台。全球有近 10.4 万个注册的 Moodle 网站。 +开源学习平台 [Moodle][25] 是“模块化面向对象动态学习环境modular object-oriented dynamic learning environment”的首字母缩写。Moodle 仍然是领先的线上学习平台。全球有近 10.4 万个注册的 Moodle 网站。 -另外两个流行的开源内容管理系统是 Drupal 和 Joomla。Drupal 的名字来自荷兰语,意思是“放弃”。根据维基百科,Joomla 是斯瓦希里语单词“jumla”的[英式拼写][26],在阿拉伯语、乌尔都语和其他语言中是“一起”的意思。 +另外两个流行的开源内容管理系统是 Drupal 和 Joomla。Drupal 的名字来自荷兰语 “druppel”,意思是“放弃”。根据维基百科,Joomla 是斯瓦希里语单词“jumla”的[英式拼写][26],在阿拉伯语、乌尔都语和其他语言中是“一起”的意思。 ### Mozilla @@ -104,23 +106,23 @@ Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuck ### Nginx -“许多技术人员都试图装酷,并将它念成‘n’‘g’‘n’‘x’。实际上,很少的一部分人只做了一些基本的研究工作,就可以很快发现名称实际上应该被说成是“ EngineX”,指的是功能强大的 web 服务器,例如引擎。”——Jean Sebastien Tougne +“许多技术人员都试图装酷,并将它念成‘n’‘g’‘n’‘x’。实际上,很少的一些人做点基本的调查工作,就可以很快发现该名称实际上应该被念成是“EngineX”,指的是功能强大的 web 服务器,像个引擎。”——Jean Sebastien Tougne ### Perl -Perl 的创始人 Larry Wall 最初将他的项目命名为“Pearl”。根据维基百科,Wall 想给这种语言起一个有积极含义的简短名字。在 Perl 正式发布之前,Wall 发现了现有的 [PEARL][29] 编程语言,并更改了名称的拼写。 +Perl 的创始人 Larry Wall 最初将他的项目命名为“Pearl”。根据维基百科,Wall 想给这种语言起一个有积极含义的简短名字。在 Perl 正式发布之前,Wall 发现了已有 [PEARL][29] 编程语言,于是更改了名称的拼写。 -### Piet and Mondrian +### Piet 和 Mondrian -“有两种编程语言以艺术家 Piet Mondrian 命名。一种叫做‘Piet’,另一种叫做‘Mondrian’。[David Morgan-Mar [写道][30]]:“Piet 是一种编程语言,其中的程序看起来像抽象绘画。该语言以几何抽象艺术的开创者 Piet Mondrian 的名字命名。我曾想将这种语言命名为 Mondrian,但是有人告诉我这会让它看起来像一种很普通的脚本语言。哦,好吧,我想我们不能都是深奥的语言作家。”——Yuval Lifshitz +“有两种编程语言以艺术家 Piet Mondrian 命名。一种叫做‘Piet’,另一种叫做‘Mondrian’。(David Morgan-Mar [写道][30]):‘Piet 是一种编程语言,其中的程序看起来像抽象绘画。该语言以几何抽象艺术的开创者 Piet Mondrian 的名字命名。我曾想将这种语言命名为 Mondrian,但是有人告诉我这会让它看起来像一种很普通的脚本语言。哦,好吧,我想我们不能都是深奥的语言作家。’”——Yuval Lifshitz ### Python -Python编程语言的独特名称来自其创建者 Guido Van Rossum,他是喜剧团体 Monty Python 的粉丝。 +Python 编程语言的独特名称来自其创建者 Guido Van Rossum,他是喜剧团体 Monty Python 的粉丝。 ### Raspberry Pi -Raspberry Pi 以其微小但强大的功能和对钱包友好的价格标签而闻名,在开源社区中是最受欢迎的。但是它可爱(和好吃)的名字是从哪里来的呢?在 70 年代和 80 年代,以水果命名的计算机是一种流行的趋势。苹果,橘子,杏……有人饿了吗?根据创始人 Eben Upton 的 [2012 采访] [31],“Raspberry Pi”这个名称是对这种趋势的致敬。树莓也很小,但味道却很浓。名称中的“Pi”暗示着这样的事实:最初,计算机只能运行 Python。 +Raspberry Pi 以其微小但强大的功能和对钱包友好的价格标签而闻名,在开源社区中是最受欢迎的。但是它可爱(和好吃)的名字是从哪里来的呢?在 70 年代和 80 年代,以水果命名的计算机是一种流行的趋势。苹果、橘子、杏……有人饿了吗?根据创始人 Eben Upton 的 [2012 采访] [31],“Raspberry Pi”这个名称是对这种趋势的致敬。树莓也很小,但味道却很浓。名称中的“Pi”暗示着这样的事实:最初,计算机只能运行 Python。 ### Samba @@ -132,7 +134,7 @@ Raspberry Pi 以其微小但强大的功能和对钱包友好的价格标签而 ### SQL -“你可能知道 [SQL] 代表结构化查询语言,但你知道为什么它经常被读作‘sequel’吗?”它是作为‘QUEL’(查询语言)的后续(即续集)而创建的。”——Ken Gaillot +“你可能知道 [SQL] 代表结构化查询语言Structured Query Language,但你知道为什么它经常被读作‘sequel’吗?”它是作为原本的‘QUEL’(查询语言QUEry Language)的后续(即续集)而创建的。”——Ken Gaillot ### XFCE @@ -140,7 +142,7 @@ Raspberry Pi 以其微小但强大的功能和对钱包友好的价格标签而 ### Zsh -Zsh 是一个交互式登录 shell。1990 年,普林斯顿大学的学生 Paul Falstad 写了 shell 的第一个版本。他在看到当时在普林斯顿大学担任助教的 Zhong Sha(zsh)的登录 ID 后,给它起了个名字,他觉得这个名字听起来像 [shell 的好名字][37]。 +Zsh 是一个交互式登录 shell。1990 年,普林斯顿大学的学生 Paul Falstad 写了该 shell 的第一个版本。他在看到当时在普林斯顿大学担任助教的 Zhong Sha(缩写为 zsh)的登录 ID 后,他觉得这个名字听起来像 [shell 的好名字][37],给它起了这个名字。 还有更多的项目和名称还没有包括在这个列表中。请一定要在评论中分享你的收藏。 @@ -151,7 +153,7 @@ via: https://opensource.com/article/19/10/open-source-name-origins 作者:[Joshua Allen Holm][a] 选题:[lujun9972][b] 译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2b66438daa01b446e67caec24d754e13a740c8b7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Dec 2019 01:00:48 +0800 Subject: [PATCH 129/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191216=20Settin?= =?UTF-8?q?g=20up=20the=20sway=20window=20manager=20on=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191216 Setting up the sway window manager on Fedora.md --- ...ng up the sway window manager on Fedora.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20191216 Setting up the sway window manager on Fedora.md diff --git a/sources/tech/20191216 Setting up the sway window manager on Fedora.md b/sources/tech/20191216 Setting up the sway window manager on Fedora.md new file mode 100644 index 0000000000..67c1e34f4c --- /dev/null +++ b/sources/tech/20191216 Setting up the sway window manager on Fedora.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Setting up the sway window manager on Fedora) +[#]: via: (https://fedoramagazine.org/setting-up-the-sway-window-manager-on-fedora/) +[#]: author: (George Luiz Maluf https://fedoramagazine.org/author/georgelmaluf/) + +Setting up the sway window manager on Fedora +====== + +![][1] + +Sometimes during a critical activity, working with overlapping windows becomes counterproductive. You might find a tiled window manager like sway to be a good alternative. + +Sway is a tiling Wayland compositor. It has the advantage of compatibility with an existing [i3 configuration][2], so you can use it to replace i3 and use Wayland as the display protocol. + +### Installing sway + +To setup sway, open a new terminal and type the following command + +``` +sudo dnf install sway +``` + +Once the installation is completed, log out of your user session. At the login screen, select your user account. Before you enter your password, choose _Sway_ from the menu, as shown in the following image. + +![][3] + +After login, your desktop looks like this: + +![][4] + +### Configuration + +To begin configuration, copy the default config into your user directory. Do that using the following commands. + +``` +mkdir -p .config/sway +cp /etc/sway/config ~/.config/sway/ +``` + +Sway is highly configurable. It’s suggested you read the project’s [wiki page][5] to fine tune your settings. For example, to change the keyboard layout, open a new terminal and run this command: + +``` +$ swaymsg -t get_inputs +[george@mrwhite ~]$ swaymsg -t get_inputs + Input device: VirtualPS/2 VMware VMMouse + Type: Mouse + Identifier: 2:19:VirtualPS/2_VMware_VMMouse + Product ID: 19 + Vendor ID: 2 + Libinput Send Events: enabled + Input device: VirtualPS/2 VMware VMMouse + Type: Mouse + Identifier: 2:19:VirtualPS/2_VMware_VMMouse + Product ID: 19 + Vendor ID: 2 + Libinput Send Events: enabled + Input device: AT Translated Set 2 keyboard + Type: Keyboard + Identifier: 1:1:AT_Translated_Set_2_keyboard + Product ID: 1 + Vendor ID: 1 + Active Keyboard Layout: Portuguese (Brazil) + Libinput Send Events: enabled +``` + +Copy the identifier keyboard code. Open your _~/.config/sway/config file_ with your text editor and edit the configuration accordingly: + +``` +## Input configuration +input "1:1:AT_Translated_Set_2_keyboard" { + xkb_layout br +} +``` + +Save the settings. To reload the configurations, press **Super+Shift+c**. (Typically the **Super** key is mapped to the logo key on a PC.) + +### Waybar + +Sway’s default status bar may not have all the functions you want. Fortunately Waybar is a good replacement. To install, run the follow commands. _(Note, however, that COPR is not an official Fedora repository and not supported by the Fedora Project.)_ + +``` +sudo dnf copr enable alebastr/waybar +sudo dnf install waybar +``` + +Open your _~/.config/sway/config_ file. Edit the bar configuration like this: + +``` +bar { + swaybar_command waybar +} +``` + +Reload the configuration and you’ll now see the waybar in action, as shown below. + +![][6] + +To customize the waybar, you can visit this [wiki page][7] for more details and ideas. + +### Alacritty + +Alacritty is a terminal emulator that uses the GPU for rendering, and a good replacement for _urxvt_. To install run the following lines + +``` +sudo dnf copr enable pschyska/alacritty +sudo dnf install alacritty +``` + +To enable it as default terminal emulator edit your _~/.config/sway/config_. Change this line: + +``` +set $term urxvt256c-ml +``` + +To: + +``` +set $term alacritty +``` + +Reload your configuration. + +When you open a new terminal with **Super+C**, alacritty will be open as seen in the following image: + +![][8] + +* * * + +_Photo by [Ivan Vranić][9] on [Unsplash][10]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/setting-up-the-sway-window-manager-on-fedora/ + +作者:[George Luiz Maluf][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/georgelmaluf/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/12/sway-816x345.jpg +[2]: https://fedoramagazine.org/getting-started-i3-window-manager/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/11/sway_login_menu-1024x522.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/11/sway_desktop_default-1024x522.png +[5]: https://github.com/swaywm/sway/wiki +[6]: https://fedoramagazine.org/wp-content/uploads/2019/11/sway_waybar_default-1024x522.png +[7]: https://github.com/Alexays/Waybar/wiki/Configuration +[8]: https://fedoramagazine.org/wp-content/uploads/2019/11/sway_alacritty-1024x522.png +[9]: https://unsplash.com/@hvranic?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[10]: https://unsplash.com/s/photos/sway?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From a641ed53f93a2a36363282ac2c0d466765643ae0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Dec 2019 01:01:40 +0800 Subject: [PATCH 130/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191217=20App=20?= =?UTF-8?q?Highlight:=20Open=20Source=20Disk=20Partitioning=20Tool=20GPart?= =?UTF-8?q?ed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md --- ...n Source Disk Partitioning Tool GParted.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md diff --git a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md new file mode 100644 index 0000000000..6c78a12ecb --- /dev/null +++ b/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) +[#]: via: (https://itsfoss.com/gparted/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +App Highlight: Open Source Disk Partitioning Tool GParted +====== + +_**Brief: GParted is an incredibly popular and free partition editor available for Linux distros. Here, we take a look at what it offers in brief.**_ + +### GParted: A Free & Open-Source GUI-based Partition Manager + +![][1] + +GParted is undoubtedly one of the [best partition managers for Linux][2] out there. The user interface is very simple and gets the job done. + +In some cases, you end up using [GParted][3] to fix or format your USB drive as well. I had a [USB disk which I couldn’t format in Ubuntu][4] using the “Disks” app – this is where GParted came to the rescue. + +So, it is a quite useful tool with a lot of good features. Let me highlight them for you. + +Warning! + +Playing with disk partitioning is a risky task. Don’t do it unless it’s absolutely necessary. Or else, you might just end up wiping the entire disk. + +### Features of GParted + +You can do a lot of things with GParted, ranging from a simple format task to important partitioning tasks. I’ll highlight the key features with some screenshots to help you know more about it before installing it. + +#### Create partition tables + +You can create a new partition table for your new disks or erase the content of your existing disk to modify the partition table. + +![][5] + +You will be able to select msdos, gpt, atari, and a lot more types of partition tables. + +#### Create, move, label, delete & modify partitions + +You can easily create, label, delete or modify the partitions with a bunch of options available within GParted. + +![][6] + +Of course, you will have to be careful about what you want to do. + +The good thing is that GParted makes sure that you do not directly apply any changes – it queues up your selected operations/tasks and asks for another final confirmation before you hit it. + +The tick mark symbol ✓on the top allows you to confirm the changes and then only your changes take into effect. + +Here’s another screenshot for the options you have available for the partitions: + +![][7] + +#### Attempt data rescue + +Apart from editing partitions, you can also try to [recover your lost data in Linux][8] using the “**Attempt Data Rescue**” feature as shown in the screenshot below. + +![][9] + +It is worth noting that you do not have this feature installed by default – you only see the option visible. So, for the data recovery feature to work, you have to install gpart separately using the following command (on Ubuntu/Debian-based distributions): + +``` +sudo apt install gpart +``` + +In addition to all the key features, it supports a wide range of storage devices and filesystems. You can learn more about it from the [list of features][10] on their official website. + +### Installing GParted on Ubuntu and other Linux distributions + +You might have GParted pre-installed. So, make sure to verify that. If you do not have it installed, you can head into the software center to get it installed. + +In case you want to use the terminal, simply type in the following command: + +``` +sudo apt install gparted +``` + +As I mentioned above, if you want the data recovery option, you should install gpart package in addition to gparted package. + +If you’re using any other Linux distribution, you can either find it in the respective software manager or simply check out the [official download instructions][11]. + +[Download GParted][11] + +**Wrapping Up** + +GParted is a very useful and important tool when it comes to dealing with disk management and partitions. However, you will have to be careful while using it for the obvious reasons. + +Have you tried GParted? Which other partitioning tool you use on Linux? Feel free to share your experiences in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gparted/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-screenshot.png?ssl=1 +[2]: https://itsfoss.com/partition-managers-linux/ +[3]: https://gparted.org/ +[4]: https://itsfoss.com/format-usb-drive-sd-card-ubuntu/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-create-partition-table.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-modify-partitions.png?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-partition-options.png?ssl=1 +[8]: https://itsfoss.com/recover-deleted-files-linux/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-attempt-data-rescue-feature.png?ssl=1 +[10]: https://gparted.org/features.php +[11]: https://gparted.org/download.php From d4dd858f83e1791c9cdff0a2eb7b163a8607de47 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Dec 2019 01:03:14 +0800 Subject: [PATCH 131/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191216=20Relive?= =?UTF-8?q?=20Linux=20history=20with=20the=20ROX=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191216 Relive Linux history with the ROX desktop.md --- ...live Linux history with the ROX desktop.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20191216 Relive Linux history with the ROX desktop.md diff --git a/sources/tech/20191216 Relive Linux history with the ROX desktop.md b/sources/tech/20191216 Relive Linux history with the ROX desktop.md new file mode 100644 index 0000000000..215006514f --- /dev/null +++ b/sources/tech/20191216 Relive Linux history with the ROX desktop.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Relive Linux history with the ROX desktop) +[#]: via: (https://opensource.com/article/19/12/linux-rox-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Relive Linux history with the ROX desktop +====== +This article is part of a special series of 24 days of Linux desktops. +If you're looking for a fun trip back in time, the ROX desktop is well +worth a go. +![Person typing on a 1980's computer][1] + +The [ROX][2] desktop is no longer being actively developed, but its legacy resounds today, and even when it was active, it was a unique take on what a Linux desktop could be. While other desktops felt roughly similar to old Unix or Windows interfaces, ROX belongs solidly in the BeOS, AmigaOS, and [RISC OS][3] desktop camps. + +It focuses on drag-and-drop actions (which makes its accessibility non-optimal for some users), point-and-click actions, pop-up contextual menus, and a unique system of app directories for running local applications with no installation required. + +### Installing ROX + +Today, ROX is mostly abandoned and left in fragments that the user is left to sort out. Luckily, the puzzle is relatively easy to solve, but don't get confused when you find bits and pieces of the ROX desktop in your distribution's repository—but not _every_ bit of the ROX desktop. The popular parts of ROX—the file manager ([ROX-Filer][4]) and the terminal ([ROXTerm][5])—seem to have endured in most of the popular distribution repositories, and you can install (and use) them as standalone applications. However, to run the ROX desktop, you must also install ROX-Session and the libraries it depends on. + +I installed ROX on Slackware 14.2, but it should work on any Linux or BSD system. + +First, you must install [ROX-lib2][6] from its repository. True to its philosophy of minimal installs, all you have to do to install ROX-lib2 is download the tarball, [unarchive it][7], and move the **ROX-Lib** directory to **/usr/local/lib**. + +Next, you have to install [ROX-Session][8]. This probably needs to be compiled from source code, as it's not likely to be in your software repository. The compile process requires build tools, which ship by default on Slackware but are often omitted in other distributions to save space on the initial download. The names of the packages you must install to build from source code vary depending on your distro, so refer to the documentation for specifics. For example, on Debian-based distributions, you can learn about build requirements in [Debian's wiki][9], and on Fedora-based distributions, refer to [Fedora's docs][10]. Once you have the build tools installed, execute the custom ROX-Session build script: + + +``` +`$ ./AppRun` +``` + +This manages its own build and installation and prompts you for root permissions to add itself as an option on your login screen. + +If you have not installed ROX-Filer from your software repository, do that before continuing. + +Together, these components create a complete ROX desktop. To log into your new desktop, log out of your current desktop session. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +With SDDM: + +![][11] + +With GDM: + +![][12] + +### ROX desktop features + +The ROX desktop is simple by default, with a single panel at the bottom of the screen and a shortcut icon to your home directory on the desktop. The panel contains shortcuts to common locations. That's all there is to the ROX desktop, at least as it's configured out of the box. If you want a clock or a calendar or a system tray, you need to find applications that provide them. + +![Default ROX desktop][13] + +There is no taskbar, as such, but when you minimize a window, it becomes a temporary icon on your desktop. You can click the icon to bring its window back to its former size and placement. + +The panel can be modified some, as well. You can place different shortcuts into it and even create your own applets. + +There's no application menu, either, nor are there shortcuts to applications in a contextual menu. Instead, you can navigate manually to **/usr/share/applications**, or you can add your application directory or directories to the ROX panel. + +![ROX desktop][14] + +The ROX desktop's workflow concentrates on being mouse-driven, reminiscent of Mac OS 7.5 and 8. With ROX-filer, you can manage permissions, file management, introspection, script launching, background setting, and nearly anything else you can think of, provided that you're patient enough for the point-and-click style of interaction. For power users, this seems slow, but ROX manages to make it relatively painless and very intuitive. + +### App directories, AppRun, and AppImage + +The ROX desktop has an elegant convention by which a directory containing a script named **AppRun** is executed as if it were an application. This means that in order to make a ROX app, all you have to do is compile code into a directory, place a script called **AppRun** at the root of that directory to execute the binary you've compiled, and then mark the directory executable. ROX-Filer displays a directory configured in the manner you set with a special icon and color. When you click on an app directory, ROX-Filer automatically runs the **AppRun** script inside. It looks and behaves exactly like an application that has been installed, but it's local to the user's home directory and requires no special permissions. + +This is a convenience feature, but it's one of those small features that feels great when you use it because it's so easy to implement. It's by no means essential, and it's only a few steps ahead of building an application locally, hiding the directory somewhere out of the way, and drumming up a quick **.desktop** file to act as your launcher. However, the concept of an application directory has been [cited][15] as an inspiration for the [AppImage][16] packaging system. + +### Why you should try ROX desktop + +Getting ROX set up and usable is somewhat difficult, and it appears to truly be abandoned. However, its legacy lives on in many ways today, and it's a fascinating and fun bit of Linux history. It may not become your primary desktop, but if you're looking for a fun trip back in time, then ROX is well worth a go. Explore it, customize it, and see what clever ideas it contains. There may yet be hidden gems that the open source community can benefit from. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-rox-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: http://rox.sourceforge.net/desktop/ +[3]: https://www.riscosopen.org/content/ +[4]: http://rox.sourceforge.net/desktop/ROX-Filer +[5]: http://roxterm.sourceforge.net/ +[6]: http://rox.sourceforge.net/desktop/ROX-Lib +[7]: https://opensource.com/article/17/7/how-unzip-targz-file +[8]: http://rox.sourceforge.net/desktop/ROX-Session.html +[9]: https://wiki.debian.org/BuildingTutorial +[10]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html +[11]: https://opensource.com/sites/default/files/advent-kdm_0.jpg +[12]: https://opensource.com/sites/default/files/advent-gdm_1.jpg +[13]: https://opensource.com/sites/default/files/uploads/advent-rox.jpg (Default ROX desktop) +[14]: https://opensource.com/sites/default/files/uploads/advent-rox-custom.jpg (ROX desktop) +[15]: https://github.com/AppImage/AppImageKit/wiki/AppDir +[16]: https://appimage.org/ From e3734887e6cbc215dd6f2eb48e47a8f35bb171aa Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Dec 2019 01:03:45 +0800 Subject: [PATCH 132/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191216=2010=20t?= =?UTF-8?q?ips=20for=20onboarding=20open=20source=20contributors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191216 10 tips for onboarding open source contributors.md --- ...for onboarding open source contributors.md | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 sources/tech/20191216 10 tips for onboarding open source contributors.md diff --git a/sources/tech/20191216 10 tips for onboarding open source contributors.md b/sources/tech/20191216 10 tips for onboarding open source contributors.md new file mode 100644 index 0000000000..cd080e085d --- /dev/null +++ b/sources/tech/20191216 10 tips for onboarding open source contributors.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 tips for onboarding open source contributors) +[#]: via: (https://opensource.com/article/19/12/open-source-contributors) +[#]: author: (rowasc https://opensource.com/users/rowasc) + +10 tips for onboarding open source contributors +====== +Making new contributors feel welcome in your community is essential to +your project's future, so it's important to put time and attention into +onboarding them. +![Women programming][1] + +Contributors are the lifeblood of many open source projects because they enable smaller projects to grow and improve without a lot of financial support and they bring fresh perspectives to the project. That is the case at [Ushahidi][2], a non-profit organization that is building and using software to help raise the voices of underserved, marginalized communities. Our products enable local observers to submit reports about local humanitarian crises (such as political unrest and natural disasters) using their mobile phones or the internet, while simultaneously creating a temporal and geospatial archive of events. + +Ushahidi always strives for openness, but **it's very hard to evaluate how open your organization works from the inside**. Staff and longtime contributors know too much: they are cursed by knowledge and access to the people who know how things work. While a crisis brings out the good in people who want to help, getting involved with an open source project during a crisis is complex. The maintainers are usually going through a stressful time. New requests for features are coming every day. New bugs are being reported all the time. + +There are never enough people to fix everything, which is why it's so important for projects to have a good process for onboarding new contributors. + +### Why Ushahidi needed to re-engage with its community + +In the beginning, Ushahidi had a really big community and did a lot of community engagement. We had community dev calls, where core developers and community developers talked about what they were working on. We had t-shirts and swag; we had community badges and blog posts celebrating the top contributor of the month. We sponsored tech events and made sure to have a booth or a presentation showcasing the platform. + +Our documentation was good and extensive with toolkits and examples for different use cases, our forum was active, we were active! + +But then a few things happened. The software got outdated, and the core team started working on a new version. At the same time, we adopted a new strategy around sustainability and started a Software-as-a-Service model, spanning from free grassroots deployments to more complex enterprise plans, to try to bring much-needed financial stability and sustainability and serve new use cases and needs. + +All of this took longer than expected, and we did not want to bring in new contributors "just yet." Not getting our contributors engaged from the beginning resulted in our docs being unclear, unfinished, and unstructured. We did not adjust the software to be easy for our open source users to install or use. **Nothing was intentional, but we were not serving our open source community as well as we would like.** Now, our main focus is to re-engage with our community. + +The following are 10 things we've learned and done that may help you improve your contributor onboarding processes if you're in a similar situation. + +### 1\. Evaluate your processes + +To evaluate how open your organization's processes are and how they are working for new contributors, source new folks who can try to answer questions like: "How do you get new code into production?" and "Who can trigger a production release?" or "How does testing happen?" + +Some things to look for: + + * Is it clear to new contributors about how to get started? Are getting-started guides hard to find, too complex, or disorganized? + * Are communication and coordination happening in the open? Or are they hidden in Slack rooms, making it hard to know what is going on? + * Is the process for code reviews and merges clear? What about the safety nets for code contributions and the QA process? + + + +When you're deep into a project with your community, it's difficult to know how it looks to new contributors. We learned that **what feels like an open process from the inside can feel very closed from the perspective of a new contributor**. + +### 2\. Set the foundation + +Diversity and inclusion are core to Ushahidi; about 80% of people working on the project are women and non-binary genders, a majority of our team are people of color, and we live on four continents. This reflects the reality that many of our users live in. They are not all in the United States, they are from diverse backgrounds, and they have different goals. What unites them is that they are all working to improve their communities in their own way. + +For us, **having a good foundation starts with having a diverse team that represents our users and stakeholders**. But that's not all; we have also improved our contributor resources with: + + * A new developers hub + * New and updated documentation + * New pathways to contributing + * Videos + * FAQs + + + +We're also restarting our community engagement by: + + * Doing webinars + * Hosting hackathons + * Proactively organizing and triaging issues + * Announcing releases and contributors to each release + + + +### 3\. Make "getting started" clear + +When someone wants to start contributing, there needs to be clarity on how to start. We label good starter contributions as first-timer issues; these describe in detail what needs to be done, how to find the code, and what you need to do. It takes us longer to write these issues than it would to fix the actual thing ourselves, but that is not the goal. The goal is to **give people who may be new to open source a chance to contribute and learn about the work we do**. + +#### Find the blockers + +It is also important to understand where the blockers for getting started are. One of Ushahidi's biggest blockers was installing the software in development environments. We assumed that because our engineers could get things set up, others would be able to do so. But other people may not have the same environment, and they absolutely did not have the amount of support that our core engineering team gets. + +To resolve this, we created videos on installation procedures, and we also created an **installation-helper** feature that checks common things that people forget during configuration and installation and also gives hints on how to solve problems. + +![Ushahidi's installation-helper][3] + +### 4\. Learn from diverse perspectives + +It's important to ask others to evaluate and double-check the documentation we provide to our contributors. We are really lucky that our team has people in programs, community, and design roles that really care about open source, and their input often helps us figure out how to **reach people who are less experienced with coding or who may want to contribute in different ways than writing code or doing QA**. + +When we were creating videos for our new developers hub, our community engagement officer was a big help. She is not a developer, and she is an excellent writer, so she helped by watching us go through the documentation, taking notes, then writing the initial scripts for our videos. She ensured that the things that we encounter daily—and know how to deal with by heart—are addressed in the documentation. + +Input like this is very valuable, since it reminds us what we know and take for granted that could confuse and turn away new contributors. + +### 5\. When possible, make short calls + +Try to invest in calls when needed and when your schedule allows. **Sometimes a five-minute call with a new contributor will give a better return than a 30-minute text chat.** If you reach a point in a chat that it's clear your instructions aren't working for the person, ask them to jump on a call to show you what they are doing. It's important to set a time limit (e.g., "I have 10 minutes now, so let's see if we can solve it right away"); otherwise, you may end up spending the whole day fixing unrelated things, which is not a great way to scale yourself. + +Make sure to use what you learn from these interactions to improve your documentation. Otherwise, you will find yourself doing so many 10-minute calls that you will never get anything done. + +### 6\. Always say thank you + +**Thank people even when it feels all you are getting are requests to do more work.** We say thank you for everything. We say thank you for bug reports, feature requests, for code contributions. We say thank you for reaching out and asking for help. + +It is hard for some people to reach out, and thanking them validates that it was OK to do so. This validation may also help people not only for the current situation but also for other projects and situations in the future. + +### 7\. Be kind in code reviews + +Someone has found you, gotten set up, fixed a bug, and finally sent a pull request. It's time to review the code. Step away from your personal opinions on how things should be. It's not time to be nit-picky and rude. + +When performing code reviews, **ensure you are helping the person make the code better** and not just following your personal preferences. Find at least one good thing to say about the pull request, and _always thank the contributor_. + +If you get a pull request that you don't plan to merge, maybe because it's the wrong scope or direction or simply something you don't want to add, it is important to deal with it straightaway instead of ignoring it. It does not help anyone to ignore pull requests, and it only serves to clutter your repository. Thank the contributor, explain why you don't plan to merge the changes, and close the pull request. + +If you merge the changes, make sure to tag the contributor when it goes out so that they know it had an impact. + +### 8\. Be responsive + +Throughout this process, **it is important to be responsive and not let people wait**. Giving someone some kind of response—even if you can't help them right now—and setting the expectation for when you'll be able to follow up is super-important. + +Sometimes a comment goes undiscovered—you miss a notification and find it three months later. It's tricky to respond in those situations, but it's still better to acknowledge the message, apologize for the delay, and ask if they still want help (with this or something else) rather than just ignoring them forever. It sets the tone that you care about your work and community, even when you make mistakes. + +### 9\. Help contributors thrive + +Sometimes a contributor comes in, sends their contributions, and leaves without much interaction. But, on some occasions, you get the opportunity to work with people over a longer time. Working with new contributors over a period of weeks or months is extremely valuable because you will gain insights into how people—especially those new to your project or tech—see your work and what challenges they face. It's also a chance to help people grow and learn. It's a win-win for everyone. + +In 2019, we participated in the [Google Summer of Code][4] and [Outreachy][5], and these experiences helped both the interns and our team learn new things. By working with interns, we get to understand what it's like to join our project, what onboarding looks like for a very junior engineer, and what blockers there might be to them contributing to our project. + +#### Prevent imposter syndrome + +On a related note, it's important to help prevent [impostor syndrome][6]. The feeling of not belonging or of "how did I even get here" is so common, especially among underrepresented groups in tech. It is written and talked about a lot, especially in the past tense, but rarely by people who are actively going through it. + +How do you spot it? How do you know someone is feeling like they aren't accomplishing enough or are feeling like a fraud? + +**Showing senior folks failing and learning from their mistakes helps to create an inclusive environment.** Things like pair programming, sharing your past experiences, discussing your career path, and telling people about when you made mistakes are ways to help to bridge gaps between senior engineers and new people. It helps new folks feel like they belong in tech because the smart, senior people in front of them also had concerns and made mistakes, but they picked themselves up and kept going. + +### 10\. Avoid communication barriers + +This may be obvious, but not all your contributors speak English as their first language. For many, it'll be their second, or maybe even third or fourth, language. A lot of your contributors may not speak English at a level that allows them to collaborate seamlessly, and it's important to remember that broken English is fine, even expected, in a global project. Be empathetic, be nice, and support these folks. Don't assume that someone is "dumb" just because they have bad grammar in English. Just because someone does not speak perfect English, it does not mean they aren't talented. It literally only means they don't speak perfect English. + +Another potential communication barrier is using mannerisms that others may perceive in different ways than we intended. For example, signing an email "Thanks, Romina" or saying "OK, bye!" sound perfectly appropriate to me, but they could signal to someone else that you don't respect them. To assign the label "rude" to someone because of this would be… quite rude? + +**When you are dealing with a multicultural, global network of contributors, try not to worry about language barriers or mannerisms that aren't meant to be offensive.** + +This doesn't mean that you should excuse bad behavior. There are no excuses for calling another person names, putting someone down, or misgendering someone on purpose, and maintainers are obligated to act on the code of conduct and resolve the situation. + +### In summary + +Making new contributors feel welcome in your community is essential to your project's future, so it's important to put time and attention into onboarding them. + + * Make sure to see your community from the contributors' side. + * Enabling underrepresented minorities to thrive creates a more welcoming community for everyone. + * Be aware of the community you are serving and ask yourself what their specific needs are. + * Allow questions both in private and public. + * Be nice, set the tone. + * Say thank you. + * Be responsive. + * Be consistent. + + + +### Other resources + + * [Ushahidi's documentation][7] + * [First Timers Only][8] offers good tips for first-time contributors + * [GitHub's all-contributors repository][9] provides specs for recognizing all types of open source contributors + * [Up For Grabs][10] to find open issues for OSS and how to label issues + + + +The four-day-long siege of a Nairobi mall ended Tuesday with a death toll of more than 60 people –... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/open-source-contributors + +作者:[rowasc][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rowasc +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard2.png?itok=WnKfsl-G (Women programming) +[2]: https://www.ushahidi.com/ +[3]: https://opensource.com/sites/default/files/uploads/ushahidi_installation-helper.png (Ushahidi's installation-helper) +[4]: https://summerofcode.withgoogle.com/archive/ +[5]: https://www.outreachy.org/ +[6]: https://opensource.com/open-organization/17/5/team-impostor-syndrome +[7]: https://docs.ushahidi.com/index/ +[8]: https://www.firsttimersonly.com/ +[9]: https://github.com/all-contributors/all-contributors +[10]: https://up-for-grabs.net/ From 64bcb11cb1c14f0b248d852a58287aff257a0016 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 17 Dec 2019 01:06:14 +0800 Subject: [PATCH 133/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191216=207=20co?= =?UTF-8?q?nsiderations=20when=20buying=20network-automation=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191216 7 considerations when buying network-automation tools.md --- ...ns when buying network-automation tools.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/talk/20191216 7 considerations when buying network-automation tools.md diff --git a/sources/talk/20191216 7 considerations when buying network-automation tools.md b/sources/talk/20191216 7 considerations when buying network-automation tools.md new file mode 100644 index 0000000000..cec4eed0a8 --- /dev/null +++ b/sources/talk/20191216 7 considerations when buying network-automation tools.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 considerations when buying network-automation tools) +[#]: via: (https://www.networkworld.com/article/3490459/7-considerations-when-buying-network-automation-tools.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +7 considerations when buying network-automation tools +====== +Here’s the factors you need to weigh so you can make a smart decision about the network automation tool that’s best for your organization. +bananajazz / Getty Images + +The concept of network automation has been around for as long as there have been networks, and until now the uptake has been slow for a number of reasons including resistance from network engineers.  But now forces are coming together to create a perfect storm of sorts, driving a need for network automation tools. + +One factor is that more and more network teams are starting to feel the pain of working in the fast-paced digital world where doing things the old way simply does not work.  The manual, box-by-box, method of configuring and updating routers and switches through a command-line interface (CLI) is too slow and error prone.  + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +Also, the rise of software-defined networks ([SDN][2]), including software-defined WANs ([SD-WAN][3]), has enabled network-automation tools to evolve from operationally focused point products that address things like change management and configuration into policy and orchestration tools. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Today, network-automation tools are strategic, enable business alignment, and provide a roadmap to the utopian state of a fully intent-based system where the network runs and secures itself. Their time is now, but there is a wide range of them. Below are seven key criteria that enterprises should consider when deciding which is best for them. + +### Single vendor or multi-vendor? + +There are several third-party and vendor-specific network automation tools.  Red Hat, NetBrain and Forward Networks are three of the leading multi-vendor tools.  All of the major network vendors including Cisco, Juniper, Arista and Extreme have their own automation platforms. + +Customers need to determine if they want to go all in with a single vendor or strive for multiple vendors. Neither is better per se; it’s a choice the enterprise needs to make. If a single vendor platform is chosen, ensure it works with the vendor's entire product line and not just a subset. If a third-party tool is chosen, seek out one that that supports the current and likely future vendors whose gear will be in the organization’s network. + +### Breadth of APIs + +It’s important that network-automation tools interface with other tools such as ServiceNow and Splunk. This means every feature should be available as an API, which isn’t always the case. Even if a tool is being used standalone today, it will likely need to interface with another application in the near future for broader automation capabilities, so this should not be overlooked. + +### Orchestration + +When network devices change, it’s often the case that another element of the infrastructure must also change. For example, when a network device is added, it may require changing a [firewall][5] setting or connecting to a load balancer. This drives up the need for orchestration capabilities so the network-automation tool can trigger other automation frameworks to change devices that are upstream or downstream from it. + +### AI/intent-based networking capabilities + +The concept of an [intent-based network][6] is that it runs, heals and secures itself. This can’t be done with a bevy of rules because the environment changes too fast. Instead, AI capabilities should be included in the system to fully automate all operations so the network itself can adapt to changes. + +ZK Research recommends that the system have two modes of operation – one that recommends changes for the engineer to execute on and then one that fully executes changes without requiring human intervention.  This will let the customer get comfortable with AI first. (One question ZK Research gets a lot is how one knows it’s really AI based. The answer is that the tool gets smarter over time.  All changes should feed back into the system as part of the learning data set and make the system smarter.  Rules-based systems will not.) + +### SaaS or on-prem? + +Traditional network-automation tools have been offered only as on-premises software or appliances. There is a growing number of companies that prefer to buy the tools in a software as a service (SaaS) model to ensure rapid deployment and continuous updates. + +Again, there’s no wrong choice.  The company needs to determine which option best fits its operating model and compliance requirements. + +One important note: It’s the belief of ZK Research that all solutions will eventually be hybrid where customers may keep the data on the local premises, but advanced, artificial intelligence capabilities and cross-company comparisons will be done in the cloud.  On-prem solutions do not have the necessary horsepower to deliver real-time AI capabilities + +### Compliance and security reporting + +There’s a growing push from leading organizations to bring IT and security operations together.  This means network-automation tools need to provide information that shows security policies are continually being adhered to and compliance mandates are being met. The reporting capabilities need to provide visibility into every phase of the network lifecycle including planning, deploying and optimization. + +### Ease of use + +This is an often-overlooked component of management platforms. Feature-rich tools with long learning curves can require years before IT teams realize their full value.  Also, when a product is too technical, the company is put at risk if people with the best knowledge of it exit the organization. + +Network automation tools should be fully GUI based, which means every feature available via the CLI should also be accessible through the graphical interface.  The tools should be easy to use as well so lower level engineers can work with it. This will obviate the need to always include a senior, more expensive engineer. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3490459/7-considerations-when-buying-network-automation-tools.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html +[3]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html +[6]: https://www.networkworld.com/article/3202699/what-is-intent-based-networking.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 9a39b2a421c7fda468d4bd7f76d4258b54e47e8a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 17 Dec 2019 08:29:10 +0800 Subject: [PATCH 134/676] Rename sources/tech/20191216 10 tips for onboarding open source contributors.md to sources/talk/20191216 10 tips for onboarding open source contributors.md --- .../20191216 10 tips for onboarding open source contributors.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191216 10 tips for onboarding open source contributors.md (100%) diff --git a/sources/tech/20191216 10 tips for onboarding open source contributors.md b/sources/talk/20191216 10 tips for onboarding open source contributors.md similarity index 100% rename from sources/tech/20191216 10 tips for onboarding open source contributors.md rename to sources/talk/20191216 10 tips for onboarding open source contributors.md From 4f14db533119d3931964f91286a6b711df7dc69a Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 17 Dec 2019 08:49:03 +0800 Subject: [PATCH 135/676] translating --- ...nnotate screenshots on Linux with Ksnip.md | 105 ------------------ ...nnotate screenshots on Linux with Ksnip.md | 103 +++++++++++++++++ 2 files changed, 103 insertions(+), 105 deletions(-) delete mode 100644 sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md create mode 100644 translated/tech/20191211 Annotate screenshots on Linux with Ksnip.md diff --git a/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md b/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md deleted file mode 100644 index 1393e7ebcb..0000000000 --- a/sources/tech/20191211 Annotate screenshots on Linux with Ksnip.md +++ /dev/null @@ -1,105 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Annotate screenshots on Linux with Ksnip) -[#]: via: (https://opensource.com/article/19/12/annotate-screenshots-linux-ksnip) -[#]: author: (Clayton Dewey https://opensource.com/users/cedewey) - -Annotate screenshots on Linux with Ksnip -====== -Ksnip allows you to create and mark up screenshots in Linux with ease. -![a checklist for a team][1] - -I recently switched from MacOS to [Elementary OS][2], a Linux distribution focused on ease of use and privacy. As a user-experience designer and a free software supporter, I take screenshots and annotate them all the time. After trying out several different tools, the one I enjoy the most by far is [Ksnip][3], an open source tool licensed under GPLv2. - -![Ksnip screenshot][4] - -### Installation - -Install Ksnip with your preferred package manager. I installed it via Apt: - - -``` -`sudo apt-get install ksnip` -``` - -### Configuration - -Ksnip comes with quite a few configuration options, including: - - * Location to save screenshots - * Default screenshot filename - * Image grabber behavior - * Cursor color and thickness - * Text font - - - -You can also integrate it with your Imgur account. - -![Ksnip configuration options][5] - -### Usage - -Ksnip offers a wide range of [features][6]. My favorite part of Ksnip is that it has all the annotation tools I need (plus one I hadn't thought of!). - -You can annotate with: - - * Pen - * Marker - * Rectangles - * Ellipses - * Text - - - -You can also blur areas to remove sensitive information. And use my new favorite tool: numbered dots for steps on an interface. - -### About the creator - -I'm enjoying Ksnip so much that I reached out to the creator, [Damir Porobic][7], to learn more about the project. - -When I asked what inspired him to create Ksnip, he said: - -> "I switched from Windows to Linux a few years ago and missed the Windows Snipping Tool that I was used to on Windows. All other screenshot tools at that time were either huge (a lot of buttons and complex features) or lacked key features like annotations, so I decided to build a simple Snipping Tool clone, but with time it got more and more features. So here we are." - -This is exactly what I found as I was evaluating screenshot tools. It's great that he took the time to build a solution and freely share it for others to benefit. - -As for the future of Ksnip, Damir would like to add global shortcuts (at least for Windows) and tabs for new screenshots and allow the application to run in the background. There is also a growing list of feature requests on GitHub. - -### Ways to help - -Damir's biggest need for Ksnip help is with development. He and his wife are expecting a baby soon, so he won't have as much time to devote to the project. He is available to review and accept pull requests, though. - -Also, the project could benefit from additional installation options via Snap and Flatpak and installers for MacOS and a setup for Windows. If you would like to help, check out the [Contribution][8] section of Ksnip's README. - -* * * - -_This article originally appeared on [Agaric Tech Cooperative's blog][9] and is republished with permission._ - -How do you know when your documentation needs screenshots? Ben Cotton shares some helpful tips. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/annotate-screenshots-linux-ksnip - -作者:[Clayton Dewey][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/cedewey -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) -[2]: https://elementary.io/ -[3]: https://github.com/damirporobic/ksnip -[4]: https://opensource.com/sites/default/files/uploads/ksnip.png (Ksnip screenshot) -[5]: https://opensource.com/sites/default/files/uploads/ksnip-configuration.png (Ksnip configuration options) -[6]: https://github.com/DamirPorobic/ksnip#features -[7]: https://github.com/damirporobic/ -[8]: https://github.com/DamirPorobic/ksnip/blob/master/README.md#contribution -[9]: https://agaric.coop/blog/annotate-screenshots-linux-ksnip diff --git a/translated/tech/20191211 Annotate screenshots on Linux with Ksnip.md b/translated/tech/20191211 Annotate screenshots on Linux with Ksnip.md new file mode 100644 index 0000000000..be9e674b41 --- /dev/null +++ b/translated/tech/20191211 Annotate screenshots on Linux with Ksnip.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Annotate screenshots on Linux with Ksnip) +[#]: via: (https://opensource.com/article/19/12/annotate-screenshots-linux-ksnip) +[#]: author: (Clayton Dewey https://opensource.com/users/cedewey) + +在 Linux 上使用 Ksnip 注释截图 +====== +Ksnip 让你能轻松地在 Linux 中创建和标记截图。 +![a checklist for a team][1] + +我最近从 MacOS 切换到了 [Elementary OS][2],这是一个专注于易用性和隐私性的 Linux 发行版。作为用户体验设计师和免费软件支持者,我会经常截图并进行注释。在尝试了几种不同的工具之后,到目前为止,我最喜欢的工具是 [Ksnip][3],它是 GPLv2 许可下的一种开源工具。 + +![Ksnip screenshot][4] + +### 安装 + +使用你首选的包管理器安装 Ksnip。我通过 Apt 安装了它: + + +``` +`sudo apt-get install ksnip` +``` + +### 配置 + +Ksnip 有许多配置选项,包括: + + * 保存截图的地方 +  * 默认截图的文件名 +  * 图像采集器行为 +  * 光标颜色和宽度 +  * 文字字体 + + + +你也可以将其与你的 Imgur 帐户集成。 + +![Ksnip configuration options][5] + +### 用法 + +Ksnip 提供了大量的[功能][6]。我最喜欢的 Ksnip 部分是它拥有我需要的所有注释工具(还有一个我没想到的工具!)。 + +您可以使用以下注释: + + * 钢笔 + * 记号笔 + * 矩形 + * 椭圆 + * 文字 + + + +你还可以模糊区域来移除敏感信息。还有使用我最喜欢的新工具:用于在界面上表示步骤的带数字的点。 + +### 关于作者 + +我非常喜欢 Ksnip,因此我联系了作者 [Damir Porobic][7] 来了解有关该项目的更多信息。 + +当我问到是什么启发了他编写 Ksnip 时,他说: + +>“几年前我从 Windows 切换到 Linux,却没有了在 Windows 中常用的 Windows Snipping Tool。当时的所有其他截图工具要么很大(很多按钮和复杂功能),要么缺少诸如注释等关键功能,所以我决定编写一个简单的 Windows Snipping Tool 克隆版,但是随着时间的流逝,它开始有越来越多的功能。“ + +这正是我在评估截图工具时发现的。他花时间构建解决方案并免费共享给他人使用,这真是太好了。 + +至于 Ksnip 的未来,Damir 希望添加全局快捷方式(至少对于 Windows 是这样)和用于新截图的选项卡,并允许该应用在后台运行。GitHub 上的功能请求列表也越来越多。 + +### 帮助的方式 + +Damir 最需要的是帮助开发 Ksnip。他和他的妻子很快就会有孩子了,所以他将没有太多的时间放在这个项目上。不过,他可以检查和接受拉取请求。 + +此外,此项目还可以通过 Snap 、Flatpak 以及 MacOS 安装包、Windows 安装包等其他安装方式安装。如果你想提供帮助,请查看 Ksnip 的 README 的 [Contribution][8] 部分。 + +* * * + +_此文章最初发表在 [Agaric Tech Cooperative 的博客][9]上,并经允许重新发布。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/annotate-screenshots-linux-ksnip + +作者:[Clayton Dewey][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cedewey +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://elementary.io/ +[3]: https://github.com/damirporobic/ksnip +[4]: https://opensource.com/sites/default/files/uploads/ksnip.png (Ksnip screenshot) +[5]: https://opensource.com/sites/default/files/uploads/ksnip-configuration.png (Ksnip configuration options) +[6]: https://github.com/DamirPorobic/ksnip#features +[7]: https://github.com/damirporobic/ +[8]: https://github.com/DamirPorobic/ksnip/blob/master/README.md#contribution +[9]: https://agaric.coop/blog/annotate-screenshots-linux-ksnip From 11830ecadb93dbbb94017d5a3bc41feccc3e9a78 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 17 Dec 2019 08:53:18 +0800 Subject: [PATCH 136/676] translting --- .../20191214 Get started with Lumina for your Linux desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191214 Get started with Lumina for your Linux desktop.md b/sources/tech/20191214 Get started with Lumina for your Linux desktop.md index f3bf864b3a..c624b43d71 100644 --- a/sources/tech/20191214 Get started with Lumina for your Linux desktop.md +++ b/sources/tech/20191214 Get started with Lumina for your Linux desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 59f0a9c4f8353c4bf4f425c6e3fec9fb07d6dd6e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Dec 2019 09:52:12 +0800 Subject: [PATCH 137/676] PRF @wxy --- ...and scripts to help you sort text files.md | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md b/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md index 57a307032d..53bd6c549b 100644 --- a/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md +++ b/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Awk one-liners and scripts to help you sort text files) [#]: via: (https://opensource.com/article/19/11/how-sort-awk) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -单行 Awk 或脚本帮助你排序文本文件 +帮助你排序文本文件的 Awk 命令行或脚本 ====== > Awk 是一个强大的工具,可以执行某些可能由其它常见实用程序(包括 `sort`)来完成的任务。 -![Green graph of measurements][1] +![](https://img.linux.net.cn/data/attachment/album/201912/17/095222q7m5da4h8facvmtv.jpg) -Awk 是个普遍存在的 Unix 命令,用于扫描和处理包含可预测模式的文本。但是,由于它具有函数功能,因此也可以合理地称为编程语言。 +Awk 是个普遍存在的 Unix 命令,用于扫描和处理包含可预测模式的文本。但是,由于它具有函数功能,因此也可以合理地称之为编程语言。 -令人困惑的是,有不止一个 awk。(或者,如果你认为只有一个,那么其它几个就是克隆。)有 `awk`(由Aho、Weinberger 和 Kernighan 编写的原始程序),然后有 `nawk` 、`mawk` 和 GNU 版本 `gawk`。GNU 版本的 awk 是该实用程序的一个高度可移植的自由软件版本,具有几个独特的功能,因此本文是关于 GNU awk 的。 +令人困惑的是,有不止一个 awk。(或者,如果你认为只有一个,那么其它几个就是克隆。)有 `awk`(由Aho、Weinberger 和 Kernighan 编写的原始程序),然后有 `nawk` 、`mawk` 和 GNU 版本的 `gawk`。GNU 版本的 awk 是该实用程序的一个高度可移植的自由软件版本,具有几个独特的功能,因此本文是关于 GNU awk 的。 -虽然它的正式名称是 `gawk`,但在 GNU+Linux 系统上,它的别名是 `awk`,并用作该命令的默认版本。 在其他没有带有 GNU awk 的系统上,你必须安装它并将其称为 `gawk`,而不是 `awk`。本文互换使用术语 `awk` 和 `gawk`。 +虽然它的正式名称是 `gawk`,但在 GNU+Linux 系统上,它的别名是 `awk`,并用作该命令的默认版本。 在其他没有带有 GNU awk 的系统上,你必须先安装它并将其称为 `gawk`,而不是 `awk`。本文互换使用术语 `awk` 和 `gawk`。 -`awk` 既是命令语言又是编程语言,它使其成为一个强大的工具,可以处理原本留给 `sort`、`cut`、`uniq` 和其他常见实用程序的任务。幸运的是,开放源代码中有很多冗余空间,因此,如果你面临是否使用`awk` 的问题,答案可能是肯定的“也许”。 +`awk` 既是命令语言又是编程语言,这使其成为一个强大的工具,可以处理原本留给 `sort`、`cut`、`uniq` 和其他常见实用程序的任务。幸运的是,开源中有很多冗余空间,因此,如果你面临是否使用 `awk` 的问题,答案可能是肯定的“随便”。 -`awk` 的灵活之美在于,如果你已经承诺使用 `awk` 来完成一项任务,那么无论接下来发生什么,你都可以继续使用 `awk`。这包括对数据排序而不是按交付给你的顺序的永恒需求。 +`awk` 的灵活之美在于,如果你已经确定使用 `awk` 来完成一项任务,那么无论接下来发生什么,你都可以继续使用 `awk`。这包括对数据排序而不是按交付给你的顺序的永恒需求。 ### 样本数据集 @@ -41,12 +41,12 @@ Torvaldis;linux;Ewing,L;1996;Tux 这是一个很小的数据集,但它提供了多种数据类型: * 属名和种名,彼此相关但又是分开的 -* 姓,有时以逗号开头的首字母缩写 +* 姓,有时是以逗号开头的首字母缩写 * 代表日期的整数 * 任意术语 * 所有字段均以分号分隔 -根据你的教育背景,你可能会认为这是二维数组或表格,或者只是行分隔的数据集合。你如何看待它取决于你,因为 `awk` 只认识文本。由你决定告诉 `awk` 你想如何解析它。 +根据你的教育背景,你可能会认为这是二维数组或表格,或者只是行分隔的数据集合。你如何看待它只是你的问题,而 `awk` 只认识文本。由你决定告诉 `awk` 你想如何解析它。 ### 只想排序 @@ -54,15 +54,13 @@ Torvaldis;linux;Ewing,L;1996;Tux ### 字段和记录 -字段和记录 - 无论输入的格式如何,都必须在其中找到模式才可以专注于对你重要的数据部分。在此示例中,数据由两个因素定界:行和字段。每行都代表一个新的*记录*,就如你在电子表格或数据库转储中看到的一样。在每一行中,都有用分号(`;`)分隔的不同的*字段*(将其视为电子表格中的单元格)。 -`awk` 一次只处理一条记录,因此,当你在组织发给 `awk` 的这指令时,你可以只关注一行记录。写下你想对一行数据执行的操作,然后在下一行进行测试(无论是心理上还是用 `awk` 进行测试),然后再进行其他一些测试。最后,你要对你的 `awk` 脚本要处理的数据做好假设,以便可以按你要的数据结构提供给你数据。 +`awk` 一次只处理一条记录,因此,当你在构造发给 `awk` 的这指令时,你可以只关注一行记录。写下你想对一行数据执行的操作,然后在下一行进行测试(无论是心理上还是用 `awk` 进行测试),然后再进行其它的一些测试。最后,你要对你的 `awk` 脚本要处理的数据做好假设,以便可以按你要的数据结构提供给你数据。 在这个例子中,很容易看到每个字段都用分号隔开。为简单起见,假设你要按每行的第一字段对列表进行排序。 -在进行排序之前,你必须能够让 `awk` 只关注在每行的第一个字段上,因此这是第一步。终端中 awk 命令的语法为 `awk',后跟相关选项,后跟你的 `awk` 命令,最后是要处理的数据文件。 +在进行排序之前,你必须能够让 `awk` 只关注在每行的第一个字段上,因此这是第一步。终端中 awk 命令的语法为 `awk`,后跟相关选项,最后是要处理的数据文件。 ``` $ awk --field-separator=";" '{print $1;}' penguins.list @@ -94,7 +92,6 @@ Ewing,L `awk` 不仅仅是命令,它是一种具有索引、数组和函数的编程语言。这很重要,因为这意味着你可以获取要排序的字段列表,将列表存储在内存中,进行处理,然后打印结果数据。对于诸如此类的一系列复杂操作,在文本文件中进行操作会更容易,因此请创建一个名为 `sort.awk` 的新文件并输入以下文本: - ``` #!/bin/gawk -f @@ -103,7 +100,7 @@ BEGIN { } ``` -这会将文件建立为 `awk` 脚本,该脚本中包含执行的行。 +这会将该文件建立为 `awk` 脚本,该脚本中包含执行的行。 `BEGIN` 语句是 `awk` 提供的特殊设置功能,用于只需要执行一次的任务。定义内置变量 `FS`,它代表字段分隔符field separator,并且与你在 `awk` 命令中使用 `--field-separator` 设置的值相同,它只需执行一次,因此它包含在 `BEGIN` 语句中。 @@ -113,9 +110,9 @@ BEGIN { 在排序的上下文中这样做的好处是,你可以将任何字段分配为键,将任何记录分配为值,然后使用内置的 `awk` 函数 `asorti()`(按索引排序)按键进行排序。现在,随便假设你*只*想按第二个字段排序。 -*没有*被特殊关键字 `BEGIN` 或 `END` 引起来的 `awk` 语句是在每个记录都有执行的循环。这是脚本的一部分,该脚本扫描数据中的模式并进行相应的处理。每次 `awk` 将注意力转移到一条记录上时,都会执行 `{}` 中的语句(除非以 `BEGIN` 或 `END` 开头)。 +*没有*被特殊关键字 `BEGIN` 或 `END` 引起来的 `awk` 语句是在每个记录都要执行的循环。这是脚本的一部分,该脚本扫描数据中的模式并进行相应的处理。每次 `awk` 将注意力转移到一条记录上时,都会执行 `{}` 中的语句(除非以 `BEGIN` 或 `END` 开头)。 -要将键和值添加到数组,请创建一个包含数组的变量(在本示例脚本中,我将其称为 `ARRAY `,虽然不是很原汁原味,但很清楚),然后在方括号中分配给它键和用等号(`=`)连接的值。 +要将键和值添加到数组,请创建一个包含数组的变量(在本示例脚本中,我将其称为 `ARRAY`,虽然不是很原汁原味,但很清楚),然后在方括号中分配给它键,用等号(`=`)连接值。 ``` {   # dump each field into an array @@ -125,7 +122,6 @@ BEGIN { 在此语句中,第二个字段的内容(`$2`)用作关键字,而当前记录(`$R`)用作值。 - ### asorti() 函数 除了数组之外,`awk` 还具有一些基本函数,你可以将它们用作常见任务的快速简便的解决方案。GNU awk中引入的函数之一 `asorti()` 提供了按键(*索引*)或值对数组进行排序的功能。 @@ -175,11 +171,11 @@ papua Pygoscelis;papua;Wagler;1832;Gentoo 如你所见,数据按第二个字段排序。 -这有点限制性。最好可以在运行时灵活选择要用作排序键的字段,以便可以在任何数据集上使用此脚本并获得有意义的结果。 +这有点限制。最好可以在运行时灵活选择要用作排序键的字段,以便可以在任何数据集上使用此脚本并获得有意义的结果。 ### 添加命令选项 -你可以通过在脚本中使用文字值 `var` 将命令变量添加到 `awk` 脚本中。更改脚本,以使迭代子句在创建数组时使用 `var`: +你可以通过在脚本中使用字面值 `var` 将命令变量添加到 `awk` 脚本中。更改脚本,以使迭代子句在创建数组时使用 `var`: ``` { # dump each field into an array @@ -187,7 +183,7 @@ papua Pygoscelis;papua;Wagler;1832;Gentoo } ``` -尝试运行脚本,以便在执行脚本时使用 `-v var` 选项将其按第三字段排序: +尝试运行该脚本,以便在执行脚本时使用 `-v var` 选项将其按第三字段排序: ``` $ ./sorter.awk -v var=3 penguins.list @@ -235,7 +231,7 @@ via: https://opensource.com/article/19/11/how-sort-awk 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 199c592edc0a8ad98eb889d3046b879fc0b0932c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Dec 2019 09:54:00 +0800 Subject: [PATCH 138/676] PUB @wxy https://linux.cn/article-11684-1.html --- ... Awk one-liners and scripts to help you sort text files.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191101 Awk one-liners and scripts to help you sort text files.md (99%) diff --git a/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md b/published/20191101 Awk one-liners and scripts to help you sort text files.md similarity index 99% rename from translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md rename to published/20191101 Awk one-liners and scripts to help you sort text files.md index 53bd6c549b..a22edd71eb 100644 --- a/translated/tech/20191101 Awk one-liners and scripts to help you sort text files.md +++ b/published/20191101 Awk one-liners and scripts to help you sort text files.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11684-1.html) [#]: subject: (Awk one-liners and scripts to help you sort text files) [#]: via: (https://opensource.com/article/19/11/how-sort-awk) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From cf7be43191296459ab166698f88aefeb31e117b6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 17 Dec 2019 16:30:33 +0800 Subject: [PATCH 139/676] translating --- .../20191127 Create virtual machines with Cockpit in Fedora.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md b/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md index 853ad5c501..7fd09b985d 100644 --- a/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md +++ b/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 75bd5bac401ba1999484f4a4f03195b1bbb90e30 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Dec 2019 17:37:09 +0800 Subject: [PATCH 140/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lxbwolf 这篇很长,不过要是更仔细一些就更好了。 --- ... Logical operators and shell expansions.md | 264 ++++++++---------- 1 file changed, 118 insertions(+), 146 deletions(-) diff --git a/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md index a3adfeb6cf..e1dbced9ab 100644 --- a/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md +++ b/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -1,102 +1,98 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to program with Bash: Logical operators and shell expansions) [#]: via: (https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions) [#]: author: (David Both https://opensource.com/users/dboth) -Bash 编程教程:逻辑操作符和 shell 扩展 +怎样用 Bash 编程:逻辑操作符和 shell 扩展 ====== -学习逻辑操作符和 shell 扩展,本文是Bash 编程系列(三篇文章)的第二篇。 -![Women in computing and open source v5][1] +> 学习逻辑操作符和 shell 扩展,本文是三篇 Bash 编程系列的第二篇。 -Bash 是一种强大的编程语言,完美契合命令行和 shell 脚本。本系列(三篇文章,基于我的 [Linux 自学课程三卷][2])讲解如何在 CLI 使用 Bash 编程。 +![](https://img.linux.net.cn/data/attachment/album/201912/17/173459pxhz0aiicimzd1m2.jpg) -[第一篇文章][3] 讲解了 Bash 的一些简单命令行操作,包括如何使用变量和控制操作符。第二篇文章探讨文件、字符串、数字等类型和各种各样在执行流中提供控制逻辑的的逻辑运算符,还有 Bash 中的各类 shell 扩展。本系列第三篇也是最后一篇文章,将会探索能重复执行操作的 **for** 、**while** 和 **until** 循环。 +Bash 是一种强大的编程语言,完美契合命令行和 shell 脚本。本系列(三篇文章,基于我的 [三集 Linux 自学课程][2])讲解如何在 CLI 使用 Bash 编程。 -逻辑操作符是程序中判断的根本要素,也是执行不同的语句组合的依据。有时这也被称为流控制。 +[第一篇文章][3] 讲解了 Bash 的一些简单命令行操作,包括如何使用变量和控制操作符。第二篇文章探讨文件、字符串、数字等类型和各种各样在执行流中提供控制逻辑的的逻辑运算符,还有 Bash 中的各类 shell 扩展。本系列第三篇也是最后一篇文章,将会探索能重复执行操作的 `for` 、`while` 和 `until` 循环。 + +逻辑操作符是程序中进行判断的根本要素,也是执行不同的语句组合的依据。有时这也被称为流控制。 ### 逻辑操作符 -Bash 中有大量的用于不同条件表达式的逻辑操作符。最基本的是 **if** 控制结构,它判断一个条件,如果条件为真,就执行一些程序语句。操作符共有三类:文件,数字和非数字操作符。如果条件为真,所有的操作符返回 true(0),如果条件为假,返回 false(1)。 +Bash 中有大量的用于不同条件表达式的逻辑操作符。最基本的是 `if` 控制结构,它判断一个条件,如果条件为真,就执行一些程序语句。操作符共有三类:文件、数字和非数字操作符。如果条件为真,所有的操作符返回真值(`0`),如果条件为假,返回假值(`1`)。 -这些比较操作符的函数语法是,一个操作符加一个或两个参数放在中括号内,后面跟一系列程序语句,如果条件为真,程序语句执行,可能会有另一个程序语句 list,该 list 在条件为假时执行: +这些比较操作符的函数语法是,一个操作符加一个或两个参数放在中括号内,后面跟一系列程序语句,如果条件为真,程序语句执行,可能会有另一个程序语句列表,该列表在条件为假时执行: ``` if [ arg1 operator arg2 ] ; then list -or +或 if [ arg1 operator arg2 ] ; then list ; else list ; fi ``` -像例子中那样,在比较表达式中,空格不能省略。中括号的每部分,**[** 和 **]**,是跟 **test** 命令一样的传统的 Bash 符号: - +像例子中那样,在比较表达式中,空格不能省略。中括号的每部分,`[` 和 `]`,是跟 `test` 命令一样的传统的 Bash 符号: ``` -`if test arg1 operator arg2 ; then list` +if test arg1 operator arg2 ; then list ``` -还有一个更新的语法能提供一点点便利,一些系统管理员比较喜欢用。这种格式对于不同版本的 Bash 和一些 shell 如 ksh(the Korn shell)兼容性稍差。格式如下: - +还有一个更新的语法能提供一点点便利,一些系统管理员比较喜欢用。这种格式对于不同版本的 Bash 和一些 shell 如 ksh(Korn shell)兼容性稍差。格式如下: ``` -`if [[ arg1 operator arg2 ]] ; then list` +if [[ arg1 operator arg2 ]] ; then list ``` #### 文件操作符 文件操作符是 Bash 中一系列强大的逻辑操作符。图表 1 列出了 20 多种不同的 Bash 处理文件的操作符。在我的脚本中使用频率很高。 -Operator | Description +操作符 | 描述 ---|--- --a filename | 如果文件存在,返回 true;文件可以为空也可以有内容,但是只要它存在,就返回 true --b filename | 如果文件存在且是一个块设备如**/dev/sda** or **/dev/sda1**,则返回 true --c filename | 如果文件存在且是一个字符设备如**/dev/TTY1**,则返回 true --d filename | 如果文件存在且是一个目录,返回 true --e filename | 如果文件存在,返回 true;与上面的 **-a** 相同 --f filename | 如果文件存在且是一个一般文件,不是目录、设备文件或链接等的其他的文件,则返回 true --g filename | 如果文件存在且 **SETGID** 标记被设置在其上,返回 true --h filename | 如果文件存在且是一个符号链接,则返回 true --k filename | 如果文件存在且粘贴位已设置,则返回 true --p filename | 如果文件存在且是一个命名的管道(FIFO),返回 true --r filename | 如果文件存在且有可读权限,如它的可读位被设置,返回 true --s filename | 如果文件存在且大小大于 0,返回 true;如果一个文件存在但大小为 0,则返回 false --t fd | 如果文件描述符 **fd** 被打开且被关联到一个终端设备上,返回 true --u filename | 如果文件存在且它的 **set-user-id** 位被设置,返回 true --w filename | 如果文件存在且有可写权限,返回 true --x filename | 如果文件存在且有可执行权限,返回 true --G filename | 如果文件存在且文件的 group ID 与当前用户相同,返回 true --L filename | 如果文件存在且是一个符号链接,返回 true --N filename | 如果文件存在且从文件上一次被读取到现在为止, 文件被修改过,返回 true --O filename | 如果文件存在且你是文件的拥有者,返回 true --S filename | True if the file exists and is a socket -file1 -ef file2 | 如果文件`file1`和 文件`file2`是相同文件的硬链接,返回 true -file1 -nt file2 | 如果文件 file1 比 file2 新(根据修改日期),或 file1 存在而 file2 不存在 -file1 -ot file2 | 如果文件 file1 比 file2 旧(根据修改日期),或 file1 不存在而 file2 存在 +`-a filename` | 如果文件存在,返回真值;文件可以为空也可以有内容,但是只要它存在,就返回真值 +`-b filename` | 如果文件存在且是一个块设备,如 `/dev/sda` 或 `/dev/sda1`,则返回真值 +`-c filename` | 如果文件存在且是一个字符设备,如 `/dev/TTY1`,则返回真值 +`-d filename` | 如果文件存在且是一个目录,返回真值 +`-e filename` | 如果文件存在,返回真值;与上面的 `-a` 相同 +`-f filename` | 如果文件存在且是一个一般文件,不是目录、设备文件或链接等的其他的文件,则返回 真值 +`-g filename` | 如果文件存在且 `SETGID` 标记被设置在其上,返回真值 +`-h filename` | 如果文件存在且是一个符号链接,则返回真值 +`-k filename` | 如果文件存在且粘滞位已设置,则返回真值 +`-p filename` | 如果文件存在且是一个命名的管道(FIFO),返回真值 +`-r filename` | 如果文件存在且有可读权限(它的可读位被设置),返回真值 +`-s filename` | 如果文件存在且大小大于 0,返回真值;如果一个文件存在但大小为 0,则返回假值 +`-t fd` | 如果文件描述符 `fd` 被打开且被关联到一个终端设备上,返回真值 +`-u filename` | 如果文件存在且它的 `SETUID` 位被设置,返回真值 +`-w filename` | 如果文件存在且有可写权限,返回真值 +`-x filename` | 如果文件存在且有可执行权限,返回真值 +`-G filename` | 如果文件存在且文件的组 ID 与当前用户相同,返回真值 +`-L filename` | 如果文件存在且是一个符号链接,返回真值(同 `-h`) +`-N filename` | 如果文件存在且从文件上一次被读取后文件被修改过,返回真值 +`-O filename` | 如果文件存在且你是文件的拥有者,返回真值 +`-S filename` | 如果文件存在且文件是套接字,返回真值 +`file1 -ef file2` | 如果文件 `file1` 和文件 `file2` 指向同一设备的同一 INODE 号,返回真值(即硬链接) +`file1 -nt file2` | 如果文件 `file1` 比 `file2` 新(根据修改日期),或 `file1` 存在而 `file2` 不存在,返回真值 +`file1 -ot file2` | 如果文件 `file1` 比 `file2` 旧(根据修改日期),或 `file1` 不存在而 `file2` 存在 -_**Fig.1:Bash 文件操作符**_ +*图表 1:Bash 文件操作符* 以测试一个文件存在与否来举例: - ``` [student@studentvm1 testdir]$ File="TestFile1" ; if [ -e $File ] ; then echo "The file $File exists." ; else echo "The file $File does not exist." ; fi The file TestFile1 does not exist. [student@studentvm1 testdir]$ ``` -创建一个用来测试的文件,命名为 **TestFile1**。目前它不需要包含任何数据: - +创建一个用来测试的文件,命名为 `TestFile1`。目前它不需要包含任何数据: ``` -`[student@studentvm1 testdir]$ touch TestFile1` +[student@studentvm1 testdir]$ touch TestFile1 ``` -在这个简短的 CLI 程序中,修改 **$File** 变量的值相比于在多个地方修改表示文件名的字符串的值要容易: - +在这个简短的 CLI 程序中,修改 `$File` 变量的值相比于在多个地方修改表示文件名的字符串的值要容易: ``` [student@studentvm1 testdir]$ File="TestFile1" ; if [ -e $File ] ; then echo "The file $File exists." ; else echo "The file $File does not exist." ; fi @@ -107,21 +103,17 @@ The file TestFile1 exists. 现在,运行一个测试来判断一个文件是否存在且长度不为 0(表示它包含数据)。假设你想判断三种情况: 1. 文件不存在; - 2. 文件存在且为空; - 3. 文件存在且包含数据。 - 因此,你需要一组更负责的测试代码 — 为了测试所有的情况在 **if-elif-else** 结构中使用 **elif** 语句: - +因此,你需要一组更复杂的测试代码 — 为了测试所有的情况,使用 `if-elif-else` 结构中的 `elif` 语句: ``` [student@studentvm1 testdir]$ File="TestFile1" ; if [ -s $File ] ; then echo "$File exists and contains data." ; fi [student@studentvm1 testdir]$ ``` -在本案例中,文件存在但不包含任何数据。向文件添加一些数据再运行一次: - +在这个情况中,文件存在但不包含任何数据。向文件添加一些数据再运行一次: ``` [student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; fi @@ -129,8 +121,7 @@ TestFile1 exists and contains data. [student@studentvm1 testdir]$ ``` -这组语句能返回正常的结果,但是仅仅是在我们已知三种可能的情况下测试某种确切的条件。添加一段 **else** 语句,这样你就可以更精确地测试。把文件删掉,你就可以完整地测试这段新代码: - +这组语句能返回正常的结果,但是仅仅是在我们已知三种可能的情况下测试某种确切的条件。添加一段 `else` 语句,这样你就可以更精确地测试。把文件删掉,你就可以完整地测试这段新代码: ``` [student@studentvm1 testdir]$ File="TestFile1" ; rm $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi @@ -139,7 +130,6 @@ TestFile1 does not exist or is empty. 现在创建一个空文件用来测试: - ``` [student@studentvm1 testdir]$ File="TestFile1" ; touch $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi TestFile1 does not exist or is empty. @@ -147,73 +137,70 @@ TestFile1 does not exist or is empty. 向文件添加一些内容,然后再测试一次: - ``` -[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi TestFile1 exists and contains data. ``` -现在加入 **elif** 语句来辨别是文件不存在还是文件为空: - +现在加入 `elif` 语句来辨别是文件不存在还是文件为空: ``` [student@studentvm1 testdir]$ File="TestFile1" ; touch $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; elif [ -e $File ] ; then echo "$File exists and is empty." ; else echo "$File does not exist." ; fi TestFile1 exists and is empty. -[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; elif [ -e $File ] ; then echo "$File exists and is empty." ; else echo "$File does not exist." ; fi +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; elif [ -e $File ] ; then echo "$File exists and is empty." ; else echo "$File does not exist." ; fi TestFile1 exists and contains data. [student@studentvm1 testdir]$ ``` 现在你有一个可以测试这三种情况的 Bash CLI 程序,但是可能的情况是无限的。 -如果你能像保存在文件中的脚本那样书写程序语句,那么对于即使更复杂的命令组合也会很容易看出它们的逻辑结构。图表 2 就是一个示例。 **if-elif-else** 结构中每一部分的程序语句的缩进让逻辑更变得清晰。 +如果你能像保存在文件中的脚本那样组织程序语句,那么即使对于更复杂的命令组合也会很容易看出它们的逻辑结构。图表 2 就是一个示例。 `if-elif-else` 结构中每一部分的程序语句的缩进让逻辑更变得清晰。 ``` File="TestFile1" -echo "This is $File" > $File +echo "This is $File" > $File if [ -s $File ] -   then -   echo "$File exists and contains data." + then + echo "$File exists and contains data." elif [ -e $File ] -   then -   echo "$File exists and is empty." + then + echo "$File exists and is empty." else -   echo "$File does not exist." + echo "$File does not exist." fi ``` -_**Fig. 2: 像在脚本里一样重写书写命令行程序**_ +*图表 2: 像在脚本里一样重写书写命令行程序* -对于大多数 CLI 程序来说,让这些复杂的命令变得有逻辑需要写很长的代码。虽然 CLI 可能是用 Linux 或 Bash 内置的命令,但是当 CLI 程序很长或很复杂时,创建一个脚本保存在一个文件中将更有效,保存到文件中后,可以随时运行。 +对于大多数 CLI 程序来说,让这些复杂的命令变得有逻辑需要写很长的代码。虽然 CLI 可能是用 Linux 或 Bash 内置的命令,但是当 CLI 程序很长或很复杂时,创建一个保存在文件中的脚本将更有效,保存到文件中后,可以随时运行。 #### 字符串比较操作符 字符串比较操作符使我们可以对字符串中的字符按字母顺序进行比较。图表 3 列出了仅有的几个字符串比较操作符。 -Operator | Description +操作符 | 描述 ---|--- --z string | True if the length of string is zero --n string | True if the length of string is non-zero -string1 == string2
or
string1 = string2 | 如果两个字符串相等,返回 true。为了保持 POSIX 一致性,一个等号 **=** 应与 test 命令一起用。命令 **[[** 支持模式匹配,跟前面描述的一样(复杂命令)。 -string1 != string2 | 两个字符串不相等,返回 true -string1 < string2 | 如果对 string1 和 string2 按字母顺序进行排序,string1 排在 string2 前面(即基于地区设定的对所有字母和特殊字符的排列顺序) -string1 > string2 | 如果对 string1 和 string2 按字母顺序进行排序,string1 排在 string2 后面 -_**Fig. 3: Bash 字符串逻辑操作符**_ +`-z string` | 如果字符串的长度为 0 ,返回真值 +`-n string` |如果字符串的长度不为 0 ,返回真值 +`string1 == string2` 或 `string1 = string2` | 如果两个字符串相等,返回真值。处于遵从 POSIX 一致性,在测试命令中应使用一个等号 `=`。与命令 `[[` 一起使用时,会进行如上描述的模式匹配(混合命令)。 +`string1 != string2` | 两个字符串不相等,返回真值 +`string1 < string2` | 如果对 `string1` 和 `string2` 按字母顺序进行排序,`string1` 排在 `string2` 前面(即基于地区设定的对所有字母和特殊字符的排列顺序) +`string1 > string2` | 如果对 `string1` 和 `string2` 按字母顺序进行排序,`string1` 排在 `string2` 后面 -首先,检查字符串长度。比较表达式中 **$MyVar** 两边的双引号不能省略(你仍应该在目录 **~/testdir** 下 )。 +*图表 3: Bash 字符串逻辑操作符* +首先,检查字符串长度。比较表达式中 `$MyVar` 两边的双引号不能省略(你仍应该在目录 `~/testdir` 下 )。 ``` -[student@studentvm1 testdir]$ MyVar="" ; if [ -z "$MyVar" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi +[student@studentvm1 testdir]$ MyVar="" ; if [ -z "" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi MyVar is zero length. -[student@studentvm1 testdir]$ MyVar="Random text" ; if [ -z "$MyVar" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi +[student@studentvm1 testdir]$ MyVar="Random text" ; if [ -z "" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi MyVar is zero length. ``` 你也可以这样做: - ``` [student@studentvm1 testdir]$ MyVar="Random text" ; if [ -n "$MyVar" ] ; then echo "MyVar contains data." ; else echo "MyVar is zero length" ; fi MyVar contains data. @@ -221,8 +208,7 @@ MyVar contains data. MyVar is zero length ``` -有时候你需要知道一个字符串确切的长度。这虽然不是比较,但是也与比较相关。不幸的是,计算字符串的长度没有简单的方法。有很多种方法可以计算,但是我认为使用 **expr**(evaluate expression,求值表达式)是相对最简单的一种。阅读 **expr** 的 man 主页可以了解更多相关知识。注意表达式中你检测的字符串或变量两边的引号不要省略。 - +有时候你需要知道一个字符串确切的长度。这虽然不是比较,但是也与比较相关。不幸的是,计算字符串的长度没有简单的方法。有很多种方法可以计算,但是我认为使用 `expr`(求值表达式)命令是相对最简单的一种。阅读 `expr` 的手册页可以了解更多相关知识。注意表达式中你检测的字符串或变量两边的引号不要省略。 ``` [student@studentvm1 testdir]$ MyVar="" ; expr length "$MyVar" @@ -235,7 +221,6 @@ MyVar is zero length 关于比较操作符,在我们的脚本中使用了大量的检测两个字符串是否相等(例如,两个字符串是否实际上是同一个字符串)的操作。我使用的是非 POSIX 版本的比较表达式: - ``` [student@studentvm1 testdir]$ Var1="Hello World" ; Var2="Hello World" ; if [ "$Var1" == "$Var2" ] ; then echo "Var1 matches Var2" ; else echo "Var1 and Var2 do not match." ; fi Var1 matches Var2 @@ -249,19 +234,18 @@ Var1 and Var2 do not match. 数字操作符用于两个数字参数之间的比较。像其他类操作符一样,大部分都很容易理解。 -Operator | Description +操作符 | 描述 ---|--- -arg1 -eq arg2 | True if arg1 equals arg2 -arg1 -ne arg2 | 如果 arg1 不等于 arg2,返回 true -arg1 -lt arg2 | 如果 arg1 小于 arg2,返回 true -arg1 -le arg2 | 如果 arg1 小于或等于 arg2,返回 true -arg1 -gt arg2 | 如果 arg1 大于 arg2,返回 true -arg1 -ge arg2 | 如果 arg1 大于或等于 arg2,返回 true +`arg1 -eq arg2` | 如果 `arg1` 等于 `arg2`,返回真值 +`arg1 -ne arg2` | 如果 `arg1` 不等于 `arg2`,返回真值 +`arg1 -lt arg2` | 如果 `arg1` 小于 `arg2`,返回真值 +`arg1 -le arg2` | 如果 `arg1` 小于或等于 `arg2`,返回真值 +`arg1 -gt arg2` | 如果 `arg1` 大于 `arg2`,返回真值 +`arg1 -ge arg2` | 如果 `arg1` 大于或等于 `arg2`,返回真值 -_**Fig. 4: Bash 数字比较逻辑操作符**_ - -来看几个简单的例子。第一个示例设置变量 **$X** 的值为 1,然后检测 **$X** 是否等于 1.第二个示例中, **$X** 被设置为 0,所以比较表达式返回结果不为 true。 +*图表 4: Bash 数字比较逻辑操作符* +来看几个简单的例子。第一个示例设置变量 `$X` 的值为 1,然后检测 `$X` 是否等于 1。第二个示例中,`$X` 被设置为 0,所以比较表达式返回结果不为真值。 ``` [student@studentvm1 testdir]$ X=1 ; if [ $X -eq 1 ] ; then echo "X equals 1" ; else echo "X does not equal 1" ; fi @@ -273,31 +257,30 @@ X does not equal 1 自己来多尝试一下其他的。 -#### 混杂操作符 +#### 杂项操作符 -这些混杂操作符展示一个 shell 选项是否被设置或一个 shell 变量是否有值,但是它不显示变量的值,只显示它是否有值。 +这些杂项操作符展示一个 shell 选项是否被设置,或一个 shell 变量是否有值,但是它不显示变量的值,只显示它是否有值。 -Operator | Description +操作符 | 描述 ---|--- --o optname | 如果一个选项 `optname` 开启了(查看 Bash 内建的 Bash man 页面中 **-o** 选项描述下面的选项列表),则返回 true --v varname | 如果 shell 变量 varname 被设置了值(被赋予了值),则返回 true --R varname | 如果一个 shell 变量 varname 被设置了值且是一个名字引用,则返回 true +`-o optname` | 如果一个 shell 选项 `optname` 是启用的(查看内建在 Bash 手册页中的 set `-o` 选项描述下面的选项列表),则返回真值 +`-v varname` | 如果 shell 变量 `varname` 被设置了值(被赋予了值),则返回真值 +`-R varname` | 如果一个 shell 变量 `varname` 被设置了值且是一个名字引用,则返回真值 -_**Fig. 5: 混杂 Bash 逻辑操作符**_ +*图表 5: 杂项 Bash 逻辑操作符* 自己来使用这些操作符实践下。 ### 扩展 -Bash 支持一些类型扩展和一些非常有用的命令替换。根据 Bash man 页面,Bash 有多种扩展格式。本文只介绍其中 5 种:`~` 扩展,算术扩展,路径名称扩展,大括号扩展和命令替换。 +Bash 支持非常有用的几种类型的扩展和命令替换。根据 Bash 手册页,Bash 有七种扩展格式。本文只介绍其中五种:`~` 扩展、算术扩展、路径名称扩展、大括号扩展和命令替换。 #### 大括号扩展 -大括号扩展是生成任意字符串的一种方法。(下面的例子是用特定模式的字符创建大量的文件。)大括号扩展可以用于生产任意字符串的列表,并把它们插入一个静态字符串的中间特定位置或静态字符串的两端。这可能很难想象,所以还是来实践一下。 +大括号扩展是生成任意字符串的一种方法。(下面的例子是用特定模式的字符创建大量的文件。)大括号扩展可以用于产生任意字符串的列表,并把它们插入一个用静态字符串包围的特定位置或静态字符串的两端。这可能不太好想象,所以还是来实践一下。 首先,看一下大括号扩展的作用: - ``` [student@studentvm1 testdir]$ echo {string1,string2,string3} string1 string2 string3 @@ -305,7 +288,6 @@ string1 string2 string3 看起来不是很有用,对吧?但是用其他方式使用它,再来看看: - ``` [student@studentvm1 testdir]$ echo "Hello "{David,Jen,Rikki,Jason}. Hello David. Hello Jen. Hello Rikki. Hello Jason. @@ -313,7 +295,6 @@ Hello David. Hello Jen. Hello Rikki. Hello Jason. 这看起来貌似有点用了 — 我们可以少打很多字。现在试一下这个: - ``` [student@studentvm1 testdir]$ echo b{ed,olt,ar}s beds bolts bars @@ -323,10 +304,9 @@ beds bolts bars #### ~ 扩展 -资料显示,使用最多的扩展是波浪字符(~)扩展。当你在命令中使用它(如 **cd ~/Documents**)时,Bash shell 把这个快捷方式展开式完整的 home 目录。 - -使用 Bash 程序观察 ~ 扩展的作用: +资料显示,使用最多的扩展是波浪字符(`~`)扩展。当你在命令中使用它(如 `cd ~/Documents`)时,Bash shell 把这个快捷方式展开成用户的完整的家目录。 +使用这个 Bash 程序观察 `~` 扩展的作用: ``` [student@studentvm1 testdir]$ echo ~ @@ -340,13 +320,12 @@ beds bolts bars #### 路径名称扩展 -路径名称扩展是展开文件代换模式到匹配到的完成路径名称的另一种说法,匹配字符使用 **?** 和 **\*** 。文件代换指的是在大量操作中匹配文件名、路径和其他字符串时用特定的模式字符产生极大的灵活性。这些特定的模式字符允许匹配字符串中的一个、多个或特定字符。 +路径名称扩展是展开文件通配模式为匹配该模式的完整路径名称的另一种说法,匹配字符使用 `?` 和 `*`。文件通配指的是在大量操作中匹配文件名、路径和其他字符串时用特定的模式字符产生极大的灵活性。这些特定的模式字符允许匹配字符串中的一个、多个或特定字符。 - * **?** — 匹配字符串中特定位置的一个任意字符 - * ***** — 匹配字符串中特定位置的 0 个或多个任意字符 - -这个扩展用于匹配路径名称。为了弄清它的用法,请确保 **testdir** 是当前工作目录(PWD),先执行基本的列出清单命令 `ls`(我 home 目录下的内容跟你的不一样)。 +* `?` — 匹配字符串中特定位置的一个任意字符 +* `*` — 匹配字符串中特定位置的 0 个或多个任意字符 +这个扩展用于匹配路径名称。为了弄清它的用法,请确保 `testdir` 是当前工作目录(`PWD`),先执行基本的列出清单命令 `ls`(我家目录下的内容跟你的不一样)。 ``` [student@studentvm1 testdir]$ ls @@ -357,8 +336,7 @@ cpuHog     Desktop       dmesg.txt   link3      random.txt  testdir1 [student@studentvm1 testdir]$ ``` -现在列出以 **Do**, **testdir/Documents**, 和 **testdir/Downloads** 开头的目录: - +现在列出以 `Do`、`testdir/Documents` 和 `testdir/Downloads` 开头的目录: ``` Documents: @@ -375,8 +353,7 @@ Downloads: [student@studentvm1 testdir]$ ``` -然而,并没有得到你期望的结果。它列出了以 **Do** 开头的目录下的内容。使用 **-d** 选项,仅列出目录而不列出它们的内容。 - +然而,并没有得到你期望的结果。它列出了以 `Do` 开头的目录下的内容。使用 `-d` 选项,仅列出目录而不列出它们的内容。 ``` [student@studentvm1 testdir]$ ls -d Do* @@ -384,8 +361,7 @@ Documents  Downloads [student@studentvm1 testdir]$ ``` -在两个例子中,Bash shell 都把 **Do*** 模式展开成了匹配该模式的目录名称。但是如果有文件也匹配这个模式,会发生什么? - +在两个例子中,Bash shell 都把 `Do*` 模式展开成了匹配该模式的目录名称。但是如果有文件也匹配这个模式,会发生什么? ``` [student@studentvm1 testdir]$ touch Downtown ; ls -d Do* @@ -393,31 +369,27 @@ Documents  Downloads  Downtown [student@studentvm1 testdir]$ ``` -因此所有匹配这个模式的文件也被展开成了完成名字。 +因此所有匹配这个模式的文件也被展开成了完整名字。 #### 命令替换 -命令替换让一个命令的 STDOUT 数据流被当做参数传给另一个命令,例如,在一个循环中作为一系列被处理的项目。Bash man 页面显示:”命令替换用命令的输出替换了命令的名字。“ 可能不太好理解。 +命令替换是让一个命令的标准输出数据流被当做参数传给另一个命令的扩展形式,例如,在一个循环中作为一系列被处理的项目。Bash 手册页显示:“命令替换可以让你用一个命令的输出替换为命令的名字。”这可能不太好理解。 -命令替换有两种格式:**`command`** 和 **$(command)**。在更早的格式中使用反引号(**\`**),在命令中使用反斜杠(`\`)来保持它转义之前的文本含义。然而,当用在新版本的括号格式中时,反斜杠被当做一个特殊字符处理。也请注意带括号的格式打开个关闭命令语句都是用一个括号。 +命令替换有两种格式:\`command\` 和 `$(command)`。在更早的格式中使用反引号(\`),在命令中使用反斜杠(`\`)来保持它转义之前的文本含义。然而,当用在新版本的括号格式中时,反斜杠被当做一个特殊字符处理。也请注意带括号的格式打开个关闭命令语句都是用一个括号。 -我经常在命令行程序和脚本中出现一个命令的结果可以被作为参数传给另一个命令时使用命令替换。 - -来看一个非常简单的示例,这个示例使用了这个扩展的两种格式(再一次提醒,确保 **testdir** 是当前工作目录): +我经常在命令行程序和脚本中使用这种能力,一个命令的结果能被用作另一个命令的参数。 +来看一个非常简单的示例,这个示例使用了这个扩展的两种格式(再一次提醒,确保 `testdir` 是当前工作目录): ``` [student@studentvm1 testdir]$ echo "Todays date is `date`" -Todays date is Sun Apr  7 14:42:46 EDT 2019 +Todays date is Sun Apr 7 14:42:46 EDT 2019 [student@studentvm1 testdir]$ echo "Todays date is $(date)" -Todays date is Sun Apr  7 14:42:59 EDT 2019 +Todays date is Sun Apr 7 14:42:59 EDT 2019 [student@studentvm1 testdir]$ ``` -**-seq** 工具加上 **-w** 选项后,在生成的数字前面会用 0 补全,这样所有的结果都等宽,例如,忽略数字的值,它们的位数一样。这样在对它们按数字顺序进行排列时很容易。 - -**-seq** 工具用于一个数字序列: - +`-seq` 工具用于一个数字序列: ``` [student@studentvm1 testdir]$ seq 5 @@ -433,20 +405,20 @@ Todays date is Sun Apr  7 14:42:59 EDT 2019 现在你可以做一些更有用处的操作,比如创建大量用于测试的空文件。 - ``` -`[student@studentvm1 testdir]$ for I in $(seq -w 5000) ; do touch file-$I ; done` +[student@studentvm1 testdir]$ for I in $(seq -w 5000) ; do touch file-$I ; done ``` - **seq -w 5000** 语句生成了1 到 5000 的数字序列。通过把命令替换用于 **for** 语句,**for** 语句就可以使用数字序列来生成文件名的数字部分。 +`-seq` 工具加上 `-w` 选项后,在生成的数字前面会用 0 补全,这样所有的结果都等宽,例如,忽略数字的值,它们的位数一样。这样在对它们按数字顺序进行排列时很容易。 + +`seq -w 5000` 语句生成了 1 到 5000 的数字序列。通过把命令替换用于 `for` 语句,`for` 语句就可以使用该数字序列来生成文件名的数字部分。 #### 算术扩展 -Bash 可以进行整型的数学计算,但是比较繁琐(你一会儿将看到)。数字扩展的语法是 **$((算术表达式))** ,分别用两个括号来打开和关闭表达式。算术扩展在 shell 程序或脚本中类似命令替换;表达式结算后的结果替换了表达式,用于 shell 后续的计算。 +Bash 可以进行整型的数学计算,但是比较繁琐(你一会儿将看到)。数字扩展的语法是 `$((arithmetic-expression))` ,分别用两个括号来打开和关闭表达式。算术扩展在 shell 程序或脚本中类似命令替换;表达式结算后的结果替换了表达式,用于 shell 后续的计算。 我们再用一个简单的用法来开始: - ``` [student@studentvm1 testdir]$ echo $((1+1)) 2 @@ -456,14 +428,12 @@ Var 3 = 35 下面的除法结果是 0,因为表达式的结果是一个小于 1 的整型数字: - ``` [student@studentvm1 testdir]$ Var1=5 ; Var2=7 ; Var3=$((Var1/Var2)) ; echo "Var 3 = $Var3" Var 3 = 0 ``` -这是一个我经常在脚本或 CLI 程序中使用的一个简单的计算,用来查看在 Linux 主机中使用了多少虚拟内存。 **free** 不提供我需要的数据: - +这是一个我经常在脚本或 CLI 程序中使用的一个简单的计算,用来查看在 Linux 主机中使用了多少虚拟内存。 `free` 不提供我需要的数据: ``` [student@studentvm1 testdir]$ RAM=`free | grep ^Mem | awk '{print $2}'` ; Swap=`free | grep ^Swap | awk '{print $2}'` ; echo "RAM = $RAM and Swap = $Swap" ; echo "Total Virtual memory is $((RAM+Swap))" ; @@ -471,11 +441,13 @@ RAM = 4037080 and Swap = 6291452 Total Virtual memory is 10328532 ``` -我使用 **\`** 字符来划定用作命令替换的界限。我用 Bash 算术扩展的场景主要是用脚本检查系统资源用量后基于返回的结果选择一个程序运行的路径。 +我使用 \` 字符来划定用作命令替换的界限。 + +我用 Bash 算术扩展的场景主要是用脚本检查系统资源用量后基于返回的结果选择一个程序运行的路径。 ### 总结 -本文是 Bash 编程语言系列的第二篇,探讨了 Bash 文件,字符串,数字和各种提供流程控制逻辑的逻辑操作符还有不同种类的 shell 扩展。 +本文是 Bash 编程语言系列的第二篇,探讨了 Bash 中文件、字符串、数字和各种提供流程控制逻辑的逻辑操作符还有不同种类的 shell 扩展。 -------------------------------------------------------------------------------- @@ -484,7 +456,7 @@ via: https://opensource.com/article/19/10/programming-bash-logical-operators-she 作者:[David Both][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -492,4 +464,4 @@ via: https://opensource.com/article/19/10/programming-bash-logical-operators-she [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_5.png?itok=YHpNs_ss (Women in computing and open source v5) [2]: http://www.both.org/?page_id=1183 -[3]: https://opensource.com/article/19/10/programming-bash-part-1 +[3]: https://linux.cn/article-11552-1.html From cdc444d6f005000c001f423311e620256268fe52 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Dec 2019 17:37:54 +0800 Subject: [PATCH 141/676] PUB @lxbwolf https://linux.cn/article-11687-1.html --- ...ogram with Bash- Logical operators and shell expansions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191022 How to program with Bash- Logical operators and shell expansions.md (99%) diff --git a/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/published/20191022 How to program with Bash- Logical operators and shell expansions.md similarity index 99% rename from translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md rename to published/20191022 How to program with Bash- Logical operators and shell expansions.md index e1dbced9ab..736e49f580 100644 --- a/translated/tech/20191022 How to program with Bash- Logical operators and shell expansions.md +++ b/published/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11687-1.html) [#]: subject: (How to program with Bash: Logical operators and shell expansions) [#]: via: (https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions) [#]: author: (David Both https://opensource.com/users/dboth) From e508fe338aa1a22480201a2b2277d27854b4722d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Dec 2019 17:59:59 +0800 Subject: [PATCH 142/676] PRF --- ...program with Bash- Logical operators and shell expansions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20191022 How to program with Bash- Logical operators and shell expansions.md b/published/20191022 How to program with Bash- Logical operators and shell expansions.md index 736e49f580..31f0e3ef32 100644 --- a/published/20191022 How to program with Bash- Logical operators and shell expansions.md +++ b/published/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -409,7 +409,7 @@ Todays date is Sun Apr 7 14:42:59 EDT 2019 [student@studentvm1 testdir]$ for I in $(seq -w 5000) ; do touch file-$I ; done ``` -`-seq` 工具加上 `-w` 选项后,在生成的数字前面会用 0 补全,这样所有的结果都等宽,例如,忽略数字的值,它们的位数一样。这样在对它们按数字顺序进行排列时很容易。 +`seq` 工具加上 `-w` 选项后,在生成的数字前面会用 0 补全,这样所有的结果都等宽,例如,忽略数字的值,它们的位数一样。这样在对它们按数字顺序进行排列时很容易。 `seq -w 5000` 语句生成了 1 到 5000 的数字序列。通过把命令替换用于 `for` 语句,`for` 语句就可以使用该数字序列来生成文件名的数字部分。 From 2871b30977052841c1e2ff6a763d88699d994165 Mon Sep 17 00:00:00 2001 From: Hank Chow <280630620@qq.com> Date: Tue, 17 Dec 2019 19:32:28 +0800 Subject: [PATCH 143/676] hankchow translated --- ...y steps to update your apps to Python 3.md | 164 ------------------ ...y steps to update your apps to Python 3.md | 163 +++++++++++++++++ 2 files changed, 163 insertions(+), 164 deletions(-) delete mode 100644 sources/tech/20191210 3 easy steps to update your apps to Python 3.md create mode 100644 translated/tech/20191210 3 easy steps to update your apps to Python 3.md diff --git a/sources/tech/20191210 3 easy steps to update your apps to Python 3.md b/sources/tech/20191210 3 easy steps to update your apps to Python 3.md deleted file mode 100644 index d304f95ec0..0000000000 --- a/sources/tech/20191210 3 easy steps to update your apps to Python 3.md +++ /dev/null @@ -1,164 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (3 easy steps to update your apps to Python 3) -[#]: via: (https://opensource.com/article/19/12/update-apps-python-3) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -3 easy steps to update your apps to Python 3 -====== -Python 2 has reached its end of life, so it's past time to convert your -Python 2 project to Python 3. -![Hands on a keyboard with a Python book ][1] - -The 2.x series of Python is [officially over][2], but converting code to Python 3 is easier than you think. Over the weekend, I spent an evening converting the frontend code of a 3D renderer (and its corresponding [PySide][3] version) to Python 3, and it was surprisingly simple in retrospect, although it seemed relatively hopeless during the refactoring process. The conversion process can seem a little like a labyrinth, with every change you make revealing a dozen more changes you need to make. - -You may or may not _want_ to do the conversion, but—whether it's because you procrastinated too long or you rely on a module that won't be maintained unless you convert—sometimes you just don't have a choice. And if you're looking for an easy task to start your contribution to open source, converting a Python 2 app to Python 3 is a great way to make an easy but meaningful impression. - -Whatever your reason for refactoring Python 2 code into Python 3, it's an important job. Here are three steps to approach the task with clarity. - -### 1\. Run 2to3 - -For the past several years, Python has shipped with a script called [**2to3**][4], which does the bulk of the conversion from Python 2 to Python 3 for you. Automatically. And you already have it installed (whether you realize it or not). - -Here's a short snippet of code written in Python 2.6: - - -``` -#!/usr/bin/env python -# -*- coding: utf-8 -*- -mystring = u'abcdé' -print ord(mystring[-1]) -``` - -Run the **2to3** script: - - -``` -$ 2to3 example.py -RefactoringTool: Refactored example.py -\--- example.py     (original) -+++ example.py     (refactored) -@@ -1,5 +1,5 @@ - #!/usr/bin/env python - # -*- coding: utf-8 -*- -  --mystring = u'abcdé' --print ord(mystring[-1]) -+mystring = 'abcdé' -+print(ord(mystring[-1])) -RefactoringTool: Files that need to be modified: -RefactoringTool: example.py -``` - -By default, **2to3** prints only the changes required to bring old Python code up to Python 3 standards. The output is a usable patch you can use to change your file, but it's easier to just let Python do that for you, using the **\--write** (or **-w**) option: - - -``` -$ 2to3 -w example.py -[...] -RefactoringTool: Files that were modified: -RefactoringTool: example.py -``` - -The **2to3** script doesn't work on just a single file. You can run it on an entire directory of Python files, with or without the **\--write** option, to process all ***.py** files in the directory and its subdirectories. - -### 2\. Use Pylint or Pyflakes - -It's not uncommon to discover code quirks that ran without issue in Python 2 but don't work so well in Python 3. Because these quirks can't be fixed by converting syntax, they get past **2to3** unchanged, but they fail once you try to run the code. - -To detect such issues, you can use an application like [Pylint][5] or a tool like [Pyflakes][6] (or the [flake8][7] wrapper). I prefer Pyflakes because, unlike Pylint, it ignores deviations in the _style_ of your code. While the "prettiness" of Python is often praised as one of its strong points, when porting someone else's code from 2 to 3, treating style and function as two separate bugs is a matter of prioritization. - -Here's example output from Pyflakes: - - -``` -$ pyflakes example/maths -example/maths/enum.py:19: undefined name 'cmp' -example/maths/enum.py:105: local variable 'e' is assigned to but never used -example/maths/enum.py:109: undefined name 'basestring' -example/maths/enum.py:208: undefined name 'EnumValueCompareError' -example/maths/enum.py:208: local variable 'e' is assigned to but never used -``` - -This output (compared to 143 lines from Pylint, most of which were complaints about indentation) clearly displays the problems in the code that you should repair. - -The most interesting error here is the first one, on line 19. It's a little misleading because you might think that **cmp** is a variable that was never defined, but **cmp** is really a function from Python 2 that doesn't exist in Python 3. It's wrapped in a **try** statement, so the issue could easily go unnoticed until it becomes obvious that the **try** result is not getting produced. - - -``` -    try: -        result = cmp(self.index, other.index) -        except: -                result = 42 -        -        return result -``` - -There are countless examples of functions that no longer exist or that have changed between when an application was maintained as a Python 2 codebase and when you decide to port it. PySide(2) bindings have changed, Python functions have disappeared or been transformed (**imp** to **importlib**, for example), and so on. Fix them one by one as you encounter them. Even though it's up to you to reimplement or replace those missing functions, by now, most of these issues are known and [well-documented][8]. The real challenge is more about catching the errors than fixing them, so use Pyflakes or a similar tool. - -### 3\. Repair broken Python 2 code - -The **2to3** script gets your code Python 3 compliant, but it only knows about differences between Python 2 and 3. It generally can't make adjustments to account for changes in libraries that worked one way back in 2010 but have had major revisions since then. You must update that code manually. - -For instance, this code apparently worked back in the days of Python 2.6: - - -``` -class CLOCK_SPEED: -        TICKS_PER_SECOND = 16 -        TICK_RATES = [int(i * TICKS_PER_SECOND) -                      for i in (0.5, 1, 2, 3, 4, 6, 8, 11, 20)] - -class FPS: -        STATS_UPDATE_FREQUENCY = CLOCK_SPEED.TICKS_PER_SECOND -``` - -Automated tools like **2to3** and **Pyflakes** don't detect the problem, but Python 3 doesn't see **GAME_SPEED.TICKS_PER_SECOND** as a valid statement because the function being called was never explicitly declared. Adjusting the code is a simple exercise in object-oriented programming: - - -``` -class CLOCK_SPEED: -        def TICKS_PER_SECOND(): -                TICKS_PER_SECOND = 16 -                TICK_RATES = [int(i * TICKS_PER_SECOND) -                        for i in (0.5, 1, 2, 3, 4, 6, 8, 11, 20)] -                return TICKS_PER_SECOND - -class FPS: -        STATS_UPDATE_FREQUENCY = CLOCK_SPEED.TICKS_PER_SECOND() -``` - -You may be inclined to make it cleaner still by replacing the **TICKS_PER_SECOND** function with a constructor (an **__init__** function to set default values), but that would change the required call from **CLOCK_SPEED.TICKS_PER_SECOND()** to just **CLOCK_SPEED()**, which may or may not have ramifications elsewhere in the codebase. If you know the code well, then you can use your better judgment about how - -much alteration is _required_ and how much would just be pleasant, but generally, I prefer to assume every change I make inevitably demands at least three changes to every other file in the project, so I try to work within its existing structure. - -### Don't stop believing - -If you're porting a very large project, it sometimes starts to feel like there's no end in sight. It can seem like forever before you see a useful error message that's _not_ about a Python 2 quirk that slipped past the scripts and linters, and once you get to that point, you'll start to suspect it would be easier to just start from scratch. The bright side is that you (presumably) know that the codebase you're porting works (or worked) in Python 2, and once you make your adjustments, it will work again in Python 3; it's just a matter of conversion. - -Once you've done the legwork, you'll have a Python 3 module or application, and regular maintenance (and those style changes to make Pylint happy) can begin anew! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/update-apps-python-3 - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) -[2]: https://opensource.com/article/19/11/end-of-life-python-2 -[3]: https://pypi.org/project/PySide/ -[4]: https://docs.python.org/3.1/library/2to3.html -[5]: https://opensource.com/article/19/10/python-pylint-introduction -[6]: https://pypi.org/project/pyflakes/ -[7]: https://opensource.com/article/19/5/python-flake8 -[8]: https://docs.python.org/3.0/whatsnew/3.0.html diff --git a/translated/tech/20191210 3 easy steps to update your apps to Python 3.md b/translated/tech/20191210 3 easy steps to update your apps to Python 3.md new file mode 100644 index 0000000000..566eb735c8 --- /dev/null +++ b/translated/tech/20191210 3 easy steps to update your apps to Python 3.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 easy steps to update your apps to Python 3) +[#]: via: (https://opensource.com/article/19/12/update-apps-python-3) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +将你的应用迁移到 Python 3 的三个步骤 +====== +Python 2 气数将尽,是时候将你的项目从 Python 2 迁移到 Python 3 了。 + +![Hands on a keyboard with a Python book ][1] + +Python 2.x 很快就要[失去官方支持][2]了,尽管如此,从 Python 2 迁移到 Python 3 却并没有想象中那么难。我在上周用了一个晚上的时间将一个 3D 渲染器及其对应的 [PySide][3] 迁移到 Python 3,回想起来,尽管在迁移过程中无可避免地会遇到一些牵一发而动全身的修改,但整个过程相比起痛苦的重构来说简直是出奇地简单。 + +每个人都别无选择地有各种必须迁移的原因:或许是觉得已经拖延太久了,或许是依赖了某个在 Python 2 下不再维护的模块。但如果你仅仅是想通过做一些事情来对开源做贡献,那么把一个 Python 2 应用迁移到 Python 3 就是一个简单而又有意义的做法。 + +无论你从 Python 2 迁移到 Python 3 的原因是什么,这都是一项重要的任务。按照以下三个步骤,可以让你把任务完成得更加清晰。 + +### 1\. 使用 2to3 + +从几年前开始,Python 在你或许还不知道的情况下就已经自带了一个名叫 [2to3][4] 的脚本,它可以帮助你实现大部分代码从 Python 2 到 Python 3 的自动转换。 + +下面是一段使用 Python 2.6 编写的代码: + + +``` +#!/usr/bin/env python +# -*- coding: utf-8 -*- +mystring = u'abcdé' +print ord(mystring[-1]) +``` + +对其执行 2to3 脚本: + + +``` +$ 2to3 example.py +RefactoringTool: Refactored example.py +\--- example.py     (original) ++++ example.py     (refactored) +@@ -1,5 +1,5 @@ + #!/usr/bin/env python + # -*- coding: utf-8 -*- +  +-mystring = u'abcdé' +-print ord(mystring[-1]) ++mystring = 'abcdé' ++print(ord(mystring[-1])) +RefactoringTool: Files that need to be modified: +RefactoringTool: example.py +``` + +在默认情况下,2to3 只会对迁移到 Python 3 时必须作出修改的代码进行标示,在输出结果中显示的 Python 3 代码是直接可用的,但你可以在 2to3 加上 `-w` 或者 `--write` 参数,这样它就可以直接按照给出的方案修改你的 Python 2 代码文件了。 + + +``` +$ 2to3 -w example.py +[...] +RefactoringTool: Files that were modified: +RefactoringTool: example.py +``` + +2to3 脚本不仅仅对单个文件有效,你还可以把它用于一个目录下的所有 Python 文件,同时它也会递归地对所有子目录下的 Python 文件都生效。 + +### 2\. 使用 Pylint 或 Pyflakes + +有一些不良的代码习惯在 Python 2 下运行是没有异常的,在 Python 3 下运行则会或多或少报出错误,并且这些代码无法通过语法转换来修复,所以 2to3 对它们没有效果,但一旦使用 Python 3 来运行就会产生报错。 + +对于这种情况,你需要使用 [Pylint][5]、[Pyflakes][6](或封装好的 [flake8][7])这类工具。其中我更喜欢 Pyflakes,它会忽略代码风格上的差异,在这一点上它和 Pylint 不同。尽管代码优美是 Python 的一大特点,但在代码迁移的层面上,“让代码功能保持一致”无疑比“让代码风格保持一致”重要得多/ + +以下是 Pyflakes 的输出样例: + + +``` +$ pyflakes example/maths +example/maths/enum.py:19: undefined name 'cmp' +example/maths/enum.py:105: local variable 'e' is assigned to but never used +example/maths/enum.py:109: undefined name 'basestring' +example/maths/enum.py:208: undefined name 'EnumValueCompareError' +example/maths/enum.py:208: local variable 'e' is assigned to but never used +``` + +上面这些由 Pyflakes 输出的内容清晰地给出了代码中需要修改的问题。相比之下,Pylint 会输出多达 143 行的内容,而且多数是诸如代码缩进这样无关紧要的问题。 + +值得注意的是第 19 行这个容易产生误导的错误。从输出来看你可能会以为 `cmp` 是一个在使用前未定义的变量,实际上 `cmp` 是 Python 2 的一个内置函数,而它在 Python 3 中被移除了。而且这段代码被放在了 `try` 语句块中,除非认真检查这段代码的输出值,否则这个问题很容易被忽略掉。 + + +``` +    try: +        result = cmp(self.index, other.index) +    except: +        result = 42 +        +    return result +``` + +在代码迁移过程中,你会发现很多原本在 Python 2 中能正常运行的函数都发生了变化,甚至直接在 Python 3 中被移除了。例如 PySide 的绑定方式发生了变化、`importlib` 取代了 `imp` 等等。这样的问题只能见到一个解决一个,而涉及到的功能需要重构还是直接放弃,则需要你自己权衡。但目前来说,大多数问题都是已知的,并且有[完善的文档记录][8]。所以难的不是修复问题,而是找到问题,从这个角度来说,使用 Pyflake 是很有必要的。 + +### 3\. 修复被破坏的 Python 2 代码 + +尽管 2to3 脚本能够帮助你把代码修改成兼容 Python 3 的形式,但对于一个完整的代码库,它就显得有点无能为力了,因为一些老旧的代码在 Python 3 中可能需要不同的结构来表示。在这样的情况下,只能人工进行修改。 + +例如以下代码在 Python 2.6 中可以正常运行: + + +``` +class CLOCK_SPEED: +        TICKS_PER_SECOND = 16 +        TICK_RATES = [int(i * TICKS_PER_SECOND) +                      for i in (0.5, 1, 2, 3, 4, 6, 8, 11, 20)] + +class FPS: +        STATS_UPDATE_FREQUENCY = CLOCK_SPEED.TICKS_PER_SECOND +``` + +类似 2to3 和 Pyflakes 这些自动化工具并不能发现其中的问题,但如果上述代码使用 Python 3 来运行,解释器会认为 `CLOCK_SPEED.TICKS_PER_SECOND` 是未被明确定义的。因此就需要把代码改成面向对象的结构: + + +``` +class CLOCK_SPEED: +        def TICKS_PER_SECOND(): +                TICKS_PER_SECOND = 16 +                TICK_RATES = [int(i * TICKS_PER_SECOND) +                        for i in (0.5, 1, 2, 3, 4, 6, 8, 11, 20)] +                return TICKS_PER_SECOND + +class FPS: +        STATS_UPDATE_FREQUENCY = CLOCK_SPEED.TICKS_PER_SECOND() +``` + +你也许会认为如果把 `TICKS_PER_SECOND()` 改写为一个构造函数能让代码看起来更加简洁,但这样就需要把这个方法的调用形式从 `CLOCK_SPEED.TICKS_PER_SECOND()` 改为 `CLOCK_SPEED()` 了,这样的改动或多或少会对整个库造成一些未知的影响。如果你对整个代码库的结构烂熟于心,那么你确实可以随心所欲地作出这样的修改。但我通常认为,只要我做出了修改,都可能会影响到其它代码中的至少三处地方,因此我更倾向于不使代码的结构发生改变。 + +### 坚持信念 + +如果你正在尝试将一个大项目从 Python 2 迁移到 Python 3,也许你会觉得这是一个漫长的过程。你可能会费尽心思也找不到一条有用的报错信息,这种情况下甚至会有将代码推倒重建的冲动。但从另一个角度想,代码原本在 Python 2 中就可以运行,要让它能在 Python 3 中继续运行,你需要做的只是对它稍加转换而已。 + +但只要你完成了迁移,你就得到了这个模块或者整个应用程序的 Python 3 版本,外加 Python 官方的长期支持。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/update-apps-python-3 + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd "Hands on a keyboard with a Python book " +[2]: https://opensource.com/article/19/11/end-of-life-python-2 +[3]: https://pypi.org/project/PySide/ +[4]: https://docs.python.org/3.1/library/2to3.html +[5]: https://opensource.com/article/19/10/python-pylint-introduction +[6]: https://pypi.org/project/pyflakes/ +[7]: https://opensource.com/article/19/5/python-flake8 +[8]: https://docs.python.org/3.0/whatsnew/3.0.html + From 51e7de642145b38504641ab41c9d5d9096b10295 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Dec 2019 22:58:56 +0800 Subject: [PATCH 144/676] PRF @laingke --- .../20191004 What-s in an open source name.md | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/translated/talk/20191004 What-s in an open source name.md b/translated/talk/20191004 What-s in an open source name.md index 166f341119..520f298387 100644 --- a/translated/talk/20191004 What-s in an open source name.md +++ b/translated/talk/20191004 What-s in an open source name.md @@ -10,15 +10,15 @@ 开源软件名称中的故事 ====== -> 有没有想过你喜欢的开源项目或编程语言的名称来自何处?按字母顺序了解流行技术术语背后的起源故事。 +> 有没有想过你喜欢的开源项目或编程语言的名称来自何处?让我们按字母顺序了解一下流行的技术术语背后的起源故事。 -![A person writing.][1] +![](https://img.linux.net.cn/data/attachment/album/201912/17/225902ogkk85zm4gqlim9h.jpg) -GNOME、Java、Jupyter、Python。如果你的朋友或家人曾留意过你的工作对话,他们可能会认为你从事文艺复兴时期的民间文学艺术、咖啡烘焙、天文学或动物学工作。这些开源技术的名称从何而来?我们请我们的作者社区提供意见,并汇总了一些我们最喜欢的技术名称的起源故事。 +GNOME、Java、Jupyter、Python……如果你的朋友或家人曾留意过你的工作对话,他们可能会认为你从事文艺复兴时期的民间文学艺术、咖啡烘焙、天文学或动物学工作。这些开源技术的名称从何而来?我们请我们的作者社区提供意见,并汇总了一些我们最喜欢的技术名称的起源故事。 ### Ansible -“Ansible”这个名称直接来自科幻小说。Ursula Le Guin 的《鲁康农的世界Rocannon's World一书中能进行即时(比光速更快)通信的设备被称为 ansibles(显然来自 “ answerable” 一词)。Ansibles 开始流行于科幻小说,Orson Scott Card 的《安德的游戏Ender's Game(后来成为受欢迎的电影)中,该设备控制了许多远程太空飞船。对于控制分布式机器的软件来说,这似乎是一个很好的模型,因此 Michael DeHaan(Ansible 的创建者和创始人)借用了这个名称。 +“Ansible”这个名称直接来自科幻小说。Ursula Le Guin 的《Rocannon's World》一书中能进行即时(比光速更快)通信的设备被称为 ansibles(显然来自 “answerable” 一词)。Ansibles 开始流行于科幻小说之中,Orson Scott Card 的《Ender's Game》(后来成为受欢迎的电影)中,该设备控制了许多远程太空飞船。对于控制分布式机器的软件来说,这似乎是一个很好的模型,因此 Michael DeHaan(Ansible 的创建者和创始人)借用了这个名称。 ### Apache @@ -30,35 +30,35 @@ GNOME、Java、Jupyter、Python。如果你的朋友或家人曾留意过你的 ### Bash -“最初的 Unix shell,即 Bourne shell,是以其创建者的名字命名的。在开发 Bash 时,csh(发音为 ‘seashell’)实际上更受交互登录用户的欢迎。Bash 项目旨在赋予 Bourne shell 新的生命,使其更适合于交互式使用,因此它被命名为 ‘Bourne again shell’,是‘重生born again’的双关语。”——Ken Gaillot +“最初的 Unix shell,即 Bourne shell,是以其创造者的名字命名的。在开发出来 Bash 时,csh(发音为 ‘seashell’)实际上更受交互登录用户的欢迎。Bash 项目旨在赋予 Bourne shell 新的生命,使其更适合于交互式使用,因此它被命名为 ‘Bourne again shell’,是‘重生born again’的双关语。”——Ken Gaillot ### C -在早期,AT&T 的 Ken Thompson 和 Dennis Ritchie 发现可以使用更高级的编程语言(而不是低级的、可移植性更低的汇编编程)来编写操作系统和工具是很有趣的。早期有一个叫做 BCPL(基本组合编程语言Basic Combined programming Language)的编程系统,Thompson 创建了一个名为 B 的简化版 BCPL,但 B 的灵活性和速度都不高。然后,Ritchie 把 B 的思想扩展成一种叫做 C 的编译语言。”——Jim Hall +在早期,AT&T 的 Ken Thompson 和 Dennis Ritchie 发现可以使用更高级的编程语言(而不是低级的、可移植性更低的汇编编程)来编写操作系统和工具。早期有一个叫做 BCPL(基本组合编程语言Basic Combined programming Language)的编程系统,Thompson 创建了一个名为 B 的简化版 BCPL,但 B 的灵活性和速度都不高。然后,Ritchie 把 B 的思想扩展成一种叫做 C 的编译语言。”——Jim Hall ### dd -“我想你发表这样一篇文章不能不提到 dd。我的外号叫 Didi。正确的发音它听起来像‘dd’。我开始学的是 Unix,然后是 Linux,那是在 1993 年,当时我还是个学生。然后我去了军队,来到了我的部队中少数几个使用 Unix(Ultrix)的部门之一(其它部门主要是 VMS),那里的一个人说:‘这么说,你是一个黑客,对吗?你以为你了解 Unix 吗?好的,那么 dd 这个名字的是怎么来的呢?’我不知道,试着猜道:‘数据复印机Data duplicator?’所以他说,‘我要告诉你 dd 的故事。dd 是转换convert复制copy的缩写(如今任何人仍然可以在参考页中看到),但由于 cc 这个缩写已经被 C 的编译器占用,所以它被命名为 dd。’就在几年后,我听闻了关于 JCL 的数据定义和非统一、半开玩笑的 Unix dd 命令语法的纪实故事中某种程度都是基于这个说法的。”——Yedidyah Bar David +“我想你发表这样一篇文章不能不提到 dd。我的外号叫 Didi。发音正确的话听起来像 ‘dd’。我开始学的是 Unix,然后是 Linux,那是在 1993 年,当时我还是个学生。然后我去了军队,来到了我的部队中少数几个使用 Unix(Ultrix)的部门之一(其它部门主要是 VMS),那里的一个人说:‘这么说,你是一个黑客,对吗?你以为你了解 Unix 吗?好的,那么 dd 这个名字的是怎么来的呢?’我不知道,试着猜道:‘数据复印机Data duplicator?’所以他说,‘我要告诉你 dd 的故事。dd 是转换convert复制copy的缩写(如今人们仍然可以在手册页中看到),但由于 cc 这个缩写已经被 C 编译器占用,所以它被命名为 dd。’就在几年后,我听闻了关于 JCL 的数据定义和 Unix dd 命令不统一的、半开玩笑的语法的真实故事,某种程度是基于此的。”——Yedidyah Bar David ### Emacs -经典的反 vianti-vi编辑器,其名称的真正词源并不明显,因为它源自“编辑宏Editing MACroS”。但是,它作为一个伟大的宗教亵渎和崇拜的对象,吸引了许多恶作剧般的缩写,例如“避开 Meta Alt Control Shift 键Escape Meta Alt Control Shift”(以调侃其对键盘的大量依赖),“8MB 并经常发生内存交换Eight Megabytes And Constantly Swapping”(从那时起就有很多内存了),“最终分配了所有的计算机存储Eventually malloc()s All Computer Storage”和 “EMACS 使一台计算机慢EMACS Makes A Computer Slow”——改编自 Jargon File/Hacker's Dictionary +经典的反 vianti-vi编辑器,其名称的真正词源并不明显,因为它源自“编辑宏Editing MACroS”。但是,它作为一个伟大的宗教亵渎和崇拜的对象,吸引了许多恶作剧般的缩写,例如“Escape Meta Alt Control Shift”(以调侃其对键盘的大量依赖),“8MB 并经常发生内存交换Eight Megabytes And Constantly Swapping”(从那时起就很吃内存了),“最终分配了所有的计算机存储空间Eventually malloc()s All Computer Storage”和 “EMACS 使一台计算机慢EMACS Makes A Computer Slow”——改编自 Jargon File/Hacker's Dictionary ### Enarx -[Enarx][3] 是机密计算领域的一个新项目。该项目的设计原则之一是它应该是“可替代的”。因此最初的名字是“psilocybin”(著名的魔术蘑菇)。一般情况下,经理级别的人可能会对这个名称有所抵触,因此考虑使用新名称。该项目的两位创始人 Mike Bursell 和 Nathaniel McCallum 都是古老语言极客,因此他们考虑了许多不同的想法,包括 тайна(Tayna——俄语中代表秘密或神秘——虽然公认的俄语并不是一门古老的语言,但你就不要在乎这些细节了),crypticon(希腊语的意思是完全庶生的),cryptidion(希腊中表示小密室),arconus(拉丁语中表示秘密的褒义形容词),arcanum(拉丁语中表示秘密的中性形容词)和 ærn(盎格鲁撒克逊人表示地方、秘密的地方、壁橱、住所、房子,或小屋的词汇)。最后,由于各种原因,包括域名和 GitHub 项目名称的可用性,他们选择了 enarx,这是两个拉丁词根的组合:en-(表示内部)和 -arx(表示城堡、要塞或堡垒)。 +[Enarx][3] 是机密计算领域的一个新项目。该项目的设计原则之一是它应该是“可替代的”。因此最初的名字是“psilocybin”(著名的魔术蘑菇)。一般情况下,经理级别的人可能会对这个名称有所抵触,因此考虑使用新名称。该项目的两位创始人 Mike Bursell 和 Nathaniel McCallum 都是古老语言极客,因此他们考虑了许多不同的想法,包括 тайна(Tayna——俄语中代表秘密或神秘——虽然俄语并不是一门古老的语言,但你就不要在乎这些细节了),crypticon(希腊语的意思是完全私生的),cryptidion(希腊中表示小密室),arconus(拉丁语中表示秘密的褒义形容词),arcanum(拉丁语中表示秘密的中性形容词)和 ærn(盎格鲁撒克逊人表示地方、秘密的地方、壁橱、住所、房子,或小屋的词汇)。最后,由于各种原因,包括域名和 GitHub 项目名称的可用性,他们选择了 enarx,这是两个拉丁词根的组合:en-(表示内部)和 -arx(表示城堡、要塞或堡垒)。 ### GIMP -没有 [GIMP][4] 我们会怎么样?GNU 图像处理项目GNU Image Manipulation Project多年来一直是开源的主要内容。[维基百科][5]指出,“1995 年,[Spencer Kimball][6] 和 [Peter Mattis][7] 开始开发 GIMP,作为加州大学伯克利分校的一个为期一个学期的实验计算设施项目。” +没有 [GIMP][4] 我们会怎么样?GNU 图像处理项目GNU Image Manipulation Project多年来一直是开源的重要基础。[维基百科][5]指出,“1995 年,[Spencer Kimball][6] 和 [Peter Mattis][7] 在加州大学伯克利分校开始为实验计算设施eXperimental Computing Facility开发 GIMP,这是一个为期一个学期的项目。” ### GNOME -你有没有想过为什么 GNOME 被称为 GNOME?根据[维基百科][8],GNOME 最初是一个表示“GNU 网络对象模型环境GNU Network Object Model Environment”的缩写词。现在,该名称不再表示该项目,并且该项目已被删除,但这个名称仍然保留。[GNOME 3][9] 是 Fedora、红帽企业版、Ubuntu、Debian、SUSE Linux 企业版等发行版的默认桌面环境。 +你有没有想过为什么 GNOME 被称为 GNOME?根据[维基百科][8],GNOME 最初是一个表示“GNU 网络对象模型环境GNU Network Object Model Environment”的缩写词。现在,该名称不再表示该项目,并且该项目已被放弃,但这个名称仍然保留了下来。[GNOME 3][9] 是 Fedora、红帽企业版、Ubuntu、Debian、SUSE Linux 企业版等发行版的默认桌面环境。 ### Java -你能想象这种编程语言还有其它名称吗?Java 最初被称为 Oak,但是遗憾的是,Sun Microsystems 的法律团队因现有商标而否决了该名称。所以开发团队又重新给它命名。[据说][10]该语言的工作组在 1995 年 1 月举行了一次大规模的头脑风暴。许多其它名称也被扔掉了,包括 Silk、DNA、WebDancer 等。该团队不希望新名称与过度使用的术语“web”或“net”有任何关系。取而代之的是,他们在寻找更有活力、更有趣、更容易记住的东西。Java 满足了这些要求,并且奇迹般地,团队同意通过了! +你能想象这种编程语言还有其它名称吗?Java 最初被称为 Oak,但是遗憾的是,Sun Microsystems 的法律团队由于已有该商标而否决了它。所以开发团队又重新给它命名。[据说][10]该语言的工作组在 1995 年 1 月举行了一次大规模的头脑风暴。许多其它名称也被扔掉了,包括 Silk、DNA、WebDancer 等。该团队不希望新名称与过度使用的术语“web”或“net”有任何关系。取而代之的是,他们在寻找更有活力、更有趣、更容易记住的东西。Java 满足了这些要求,并且奇迹般地,团队同意通过了! ### Jupyter @@ -66,21 +66,21 @@ GNOME、Java、Jupyter、Python。如果你的朋友或家人曾留意过你的 ### Kubernetes -Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuckie 在 [2015 Hacker News][15] 回应中证实了这种词源。为了坚持航海主题,他解释说,这项技术驱动集装箱,就像舵手或驾驶员驾驶集装箱船一样。因此,选择了 Kubernetes 这个名字。我们中的许多人仍然在尝试正确的发音(koo-bur-NET-eez),因此 K8s 是可以接受的替代发音。有趣的是,它与英语单词“governorgovernor”具有相同的词源,也与蒸汽机上的机械负反馈装置相同。 +Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuckie 在 [2015 Hacker News][15] 回应中证实了这种词源。他坚持航海主题,解释说,这项技术可以驱动集装箱,就像舵手或驾驶员驾驶集装箱船一样,因此,他选择了 Kubernetes 这个名字。我们中的许多人仍然在尝试正确的发音(koo-bur-NET-eez),因此 替代使用 K8s 也是可以接受的。有趣的是,它与英语单词“governorgovernor”具有相同的词源,也与蒸汽机上的机械负反馈装置相同。 ### KDE -那 K 桌面呢?KDE 最初代表“酷桌面环境Kool Desktop Environment”。 它由 [Matthias Ettrich][16] 于 1996 年创立。根据[维基百科][17]上的说法,该名称是 Unix 上 [通用桌面环境][18]Common Desktop Environment(CDE)一词的调侃。 +那 K 桌面呢?KDE 最初代表“酷桌面环境Kool Desktop Environment”。 它由 [Matthias Ettrich][16] 于 1996 年创立。根据[维基百科][17]上的说法,该名称是对 Unix 上 [通用桌面环境][18]Common Desktop Environment(CDE)一词的调侃。 ### Linux -[Linux][19] 因其发明者 Linus Torvalds 的名字命名的。Linus 最初想将他的作品命名为“Freax”,因为他认为以他自己的名字命名太自负了。根据[维基百科][19]的说法,“赫尔辛基科技大学 Torvalds 的同事 Ari Lemmke 当时是 FTP 服务器的志愿管理员之一,他并不认为‘Freax’是个好名字。因此,他在没有咨询 Torvalds 的情况下,将服务器上的这个项目命名为‘Linux’。” +[Linux][19] 因其发明者 Linus Torvalds 的名字命名的。Linus 最初想将他的作品命名为“Freax”,因为他认为以他自己的名字命名太自负了。根据[维基百科][19]的说法,“赫尔辛基科技大学 Torvalds 的同事 Ari Lemmke 当时是 FTP 服务器的志愿管理员之一,他并不认为‘Freax’是个好名字。因此,他没有征询 Torvalds 就将服务器上的这个项目命名为‘Linux’。” -以下是一些最受欢迎的Linux发行版。 +以下是一些最受欢迎的 Linux 发行版。 #### CentOS -[CentOS][20] 是社区企业操作系统Community Enterprise Operating System的缩写。它包含 Red Hat Enterprise Linux 的上游软件包。 +[CentOS][20] 是社区企业操作系统Community Enterprise Operating System的缩写。它包含来自 Red Hat Enterprise Linux 的上游软件包。 #### Debian @@ -88,7 +88,7 @@ Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuck #### RHEL -[Red Hat Linux][22] 的名字来自它的创始人 Marc Ewing,他戴着一顶祖父送给他的康奈尔大学红色软呢帽。红帽公司成立于 1993 年 3 月 26 日。[Fedora Linux][23] 作为一个志愿者项目而启动,旨在为红帽发行版提供额外的软件,它的名字来自红帽的“Shadowman”徽标。 +[Red Hat Linux][22] 得名于它的创始人 Marc Ewing,他戴着一顶祖父送给他的康奈尔大学红色软呢帽fedora。红帽公司成立于 1993 年 3 月 26 日。[Fedora Linux][23] 最初是一个志愿者项目,旨在为红帽发行版提供额外的软件,它的名字来自红帽的“Shadowman”徽标。 #### Ubuntu @@ -98,11 +98,11 @@ Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuck 开源学习平台 [Moodle][25] 是“模块化面向对象动态学习环境modular object-oriented dynamic learning environment”的首字母缩写。Moodle 仍然是领先的线上学习平台。全球有近 10.4 万个注册的 Moodle 网站。 -另外两个流行的开源内容管理系统是 Drupal 和 Joomla。Drupal 的名字来自荷兰语 “druppel”,意思是“放弃”。根据维基百科,Joomla 是斯瓦希里语单词“jumla”的[英式拼写][26],在阿拉伯语、乌尔都语和其他语言中是“一起”的意思。 +另外两个流行的开源内容管理系统是 Drupal 和 Joomla。Drupal 的名字来自荷兰语 “druppel”,意思是“掉落”。根据维基百科,Joomla 是斯瓦希里语单词“jumla”的[英式拼写][26],在阿拉伯语、乌尔都语和其他语言中是“在一起”的意思。 ### Mozilla -[Mozilla][27] 是一个成立于 1998 年的开源软件社区。根据其网站,“Mozilla 项目创建于 1998 年,发布了 Netscape 浏览器套件源代码。它旨在利用互联网上成千上万的程序员的创造力,并推动浏览器市场上前所未有的创新水平。” 这个名字是 [Mosaic] [28] 和 Godzilla 的混成词。 +[Mozilla][27] 是一个成立于 1998 年的开源软件社区。根据其网站,“Mozilla 项目创建于 1998 年,发布了 Netscape 浏览器套件源代码。其旨在利用互联网上成千上万的程序员的创造力,并推动浏览器市场上前所未有的创新水平。” 这个名字是 [Mosaic] [28] 和 Godzilla 的混成词。 ### Nginx @@ -118,11 +118,11 @@ Perl 的创始人 Larry Wall 最初将他的项目命名为“Pearl”。根据 ### Python -Python 编程语言的独特名称来自其创建者 Guido Van Rossum,他是喜剧团体 Monty Python 的粉丝。 +Python 编程语言的独特名称来自其创建者 Guido Van Rossum,他是英国六人喜剧团体 Monty Python 的粉丝。 ### Raspberry Pi -Raspberry Pi 以其微小但强大的功能和对钱包友好的价格标签而闻名,在开源社区中是最受欢迎的。但是它可爱(和好吃)的名字是从哪里来的呢?在 70 年代和 80 年代,以水果命名的计算机是一种流行的趋势。苹果、橘子、杏……有人饿了吗?根据创始人 Eben Upton 的 [2012 采访] [31],“Raspberry Pi”这个名称是对这种趋势的致敬。树莓也很小,但味道却很浓。名称中的“Pi”暗示着这样的事实:最初,计算机只能运行 Python。 +Raspberry Pi 以其微小但强大的功能和对低廉的价格而闻名,在开源社区中是最受欢迎的。但是它可爱(和好吃)的名字是从哪里来的呢?在 70 年代和 80 年代,以水果命名的计算机是一种流行的趋势。苹果、橘子、杏……有人饿了吗?根据创始人 Eben Upton 的 [2012 采访] [31],“树莓派Raspberry Pi”这个名称是对这种趋势的致敬。树莓也很小,但却很有味道。名称中的“Pi”暗示着这样的事实:最初,该计算机只能运行 Python。 ### Samba @@ -130,11 +130,13 @@ Raspberry Pi 以其微小但强大的功能和对钱包友好的价格标签而 ### ScummVM -[ScummVM][33](《疯狂大楼》虚拟机的脚本创建实用程序)是一个程序,可以在现代计算机上运行一些经典的计算机冒险游戏。最初,它旨在玩用 SCUMM 构建的 LucasArts 冒险游戏,该游戏最初用于开发《疯狂大楼》,后来又被用来开发 LucasArts 的其它大多数冒险游戏。目前,ScummVM 支持大量游戏引擎,包括 Sierra Online 的 AGI 和 SCI,但仍保留名称 ScummVM。一个相关的项目 [ResidualVM][34] 之所以得名,是因为它涵盖了 ScummVM 未涵盖的“剩余” LucasArts 冒险游戏。 ResidualVM 涵盖的 LucasArts 游戏是使用 GrimE(Grim Engine)开发的,该引擎最初用于开发 Grim Fandango,因此 ResidualVM 的名称是双关语。 +[ScummVM][33](《疯狂大楼》虚拟机的脚本创建实用程序)是一个程序,可以在现代计算机上运行一些经典的计算机冒险游戏。最初,它旨在玩用 SCUMM 构建的 LucasArts 的冒险游戏,该游戏最初用于开发《疯狂大楼》,后来又被用来开发 LucasArts 的其它大多数冒险游戏。目前,ScummVM 支持大量游戏引擎,包括 Sierra Online 的 AGI 和 SCI,但仍保留着名称 ScummVM。 + +有一个相关的项目 [ResidualVM][34] 之所以得名,是因为它涵盖了 ScummVM 未涵盖的“剩余的residual” LucasArts 冒险游戏。 ResidualVM 涵盖的 LucasArts 游戏是使用 GrimE(Grim Engine)开发的,该引擎最初用于开发 Grim Fandango,因此 ResidualVM 的名称是双关语。 ### SQL -“你可能知道 [SQL] 代表结构化查询语言Structured Query Language,但你知道为什么它经常被读作‘sequel’吗?”它是作为原本的‘QUEL’(查询语言QUEry Language)的后续(即续集)而创建的。”——Ken Gaillot +“你可能知道 SQL 代表结构化查询语言Structured Query Language,但你知道为什么它经常被读作‘sequel’吗?它是作为原本的‘QUEL’(查询语言QUEry Language)的后续(如结局sequel)而创建的。”——Ken Gaillot ### XFCE @@ -142,7 +144,7 @@ Raspberry Pi 以其微小但强大的功能和对钱包友好的价格标签而 ### Zsh -Zsh 是一个交互式登录 shell。1990 年,普林斯顿大学的学生 Paul Falstad 写了该 shell 的第一个版本。他在看到当时在普林斯顿大学担任助教的 Zhong Sha(缩写为 zsh)的登录 ID 后,他觉得这个名字听起来像 [shell 的好名字][37],给它起了这个名字。 +Zsh 是一个交互式登录 shell。1990 年,普林斯顿大学的学生 Paul Falstad 写了该 shell 的第一个版本。他在看到当时在普林斯顿大学担任助教的 Zhong Sha 的登录 ID(zsh)后,觉得这个名字听起来像 [shell 的好名字][37],给它起了这个名字。 还有更多的项目和名称还没有包括在这个列表中。请一定要在评论中分享你的收藏。 From a3268a9501dfb1084dff471df484fd67b92bdd6e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 17 Dec 2019 23:04:30 +0800 Subject: [PATCH 145/676] PUB @laingke https://linux.cn/article-11688-1.html --- .../20191004 What-s in an open source name.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/talk => published}/20191004 What-s in an open source name.md (98%) diff --git a/translated/talk/20191004 What-s in an open source name.md b/published/20191004 What-s in an open source name.md similarity index 98% rename from translated/talk/20191004 What-s in an open source name.md rename to published/20191004 What-s in an open source name.md index 520f298387..2b6d45c599 100644 --- a/translated/talk/20191004 What-s in an open source name.md +++ b/published/20191004 What-s in an open source name.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11688-1.html) [#]: subject: (What's in an open source name?) [#]: via: (https://opensource.com/article/19/10/open-source-name-origins) [#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) @@ -66,7 +66,7 @@ GNOME、Java、Jupyter、Python……如果你的朋友或家人曾留意过你 ### Kubernetes -Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuckie 在 [2015 Hacker News][15] 回应中证实了这种词源。他坚持航海主题,解释说,这项技术可以驱动集装箱,就像舵手或驾驶员驾驶集装箱船一样,因此,他选择了 Kubernetes 这个名字。我们中的许多人仍然在尝试正确的发音(koo-bur-NET-eez),因此 替代使用 K8s 也是可以接受的。有趣的是,它与英语单词“governorgovernor”具有相同的词源,也与蒸汽机上的机械负反馈装置相同。 +Kubernetes 源自希腊语中的舵手。Kubernetes 项目创始人 Craig McLuckie 在 [2015 Hacker News][15] 回应中证实了这种词源。他坚持航海主题,解释说,这项技术可以驱动集装箱,就像舵手或驾驶员驾驶集装箱船一样,因此,他选择了 Kubernetes 这个名字。我们中的许多人仍然在尝试正确的发音(koo-bur-NET-eez),因此 替代使用 K8s 也是可以接受的。有趣的是,它与英语单词“行政长官governor”具有相同的词源,也与蒸汽机上的机械负反馈装置相同。 ### KDE From 8d9c2918ae5d9e87d0f9e4ef81b56b20b621db2c Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 17 Dec 2019 23:47:09 +0800 Subject: [PATCH 146/676] Move translated article to translated/tech/ --- .../tech/20191023 How to program with Bash- Loops.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {sources => translated}/tech/20191023 How to program with Bash- Loops.md (99%) diff --git a/sources/tech/20191023 How to program with Bash- Loops.md b/translated/tech/20191023 How to program with Bash- Loops.md similarity index 99% rename from sources/tech/20191023 How to program with Bash- Loops.md rename to translated/tech/20191023 How to program with Bash- Loops.md index aa318334b1..5d051aafcd 100644 --- a/sources/tech/20191023 How to program with Bash- Loops.md +++ b/translated/tech/20191023 How to program with Bash- Loops.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to program with Bash: Loops) @@ -324,7 +324,7 @@ via: https://opensource.com/article/19/10/programming-bash-loops 作者:[David Both][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 28436f98a06195e2596d2a7697138e528feb9dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 18 Dec 2019 10:02:23 +0800 Subject: [PATCH 147/676] Translated --- .../tech/20190225 Netboot a Fedora Live CD.md | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) rename {sources => translated}/tech/20190225 Netboot a Fedora Live CD.md (53%) diff --git a/sources/tech/20190225 Netboot a Fedora Live CD.md b/translated/tech/20190225 Netboot a Fedora Live CD.md similarity index 53% rename from sources/tech/20190225 Netboot a Fedora Live CD.md rename to translated/tech/20190225 Netboot a Fedora Live CD.md index f2ca6bb346..6cae3ce9d4 100644 --- a/sources/tech/20190225 Netboot a Fedora Live CD.md +++ b/translated/tech/20190225 Netboot a Fedora Live CD.md @@ -7,23 +7,23 @@ [#]: via: (https://fedoramagazine.org/netboot-a-fedora-live-cd/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -Netboot a Fedora Live CD +网络启动一个 Fedora Live CD ====== ![](https://fedoramagazine.org/wp-content/uploads/2019/02/netboot-livecd-816x345.jpg) -[Live CDs][1] are useful for many tasks such as: +[Live CD][1] 对于很多任务是很有用的,例如: - * installing the operating system to a hard drive - * repairing a boot loader or performing other rescue-mode operations - * providing a consistent and minimal environment for web browsing - * …and [much more][2]. + * 将操作系统安装到一个硬盘驱动器 + * 修复一个启动加载程序或执行其它救援模式操作 + * 为网络浏览提供一个相适应的最小环境 + * …以及[更多的东西][2]。 -As an alternative to using DVDs and USB drives to store your Live CD images, you can upload them to an [iSCSI][3] server where they will be less likely to get lost or damaged. This guide shows you how to load your Live CD images onto an iSCSI server and access them with the [iPXE][4] boot loader. +因为使用 DVD 和 USB 驱动器来存储你的 Live CD 镜像是一个替代方案,你可以上传它们到一个不太可能丢失或损坏的 [iSCSI][3] 服务器中。这个指南向你展示如何加载你的 Live CD 镜像到一个 ISCSI 服务器上,并使用 [iPXE][4] 启动加载程序来访问它们。 -### Download a Live CD Image +### 下载一个 Live CD 镜像 ``` $ MY_RLSE=27 @@ -32,11 +32,11 @@ $ MY_NAME=fc$MY_RLSE $ wget -O $MY_NAME.iso https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/$MY_RLSE/Workstation/x86_64/iso/$MY_LIVE ``` -The above commands download the Fedora-Workstation-Live-x86_64-27-1.6.iso Fedora Live image and save it as fc27.iso. Change the value of MY_RLSE to download other archived versions. Or you can browse to to download the latest Fedora live image. Versions prior to 21 used different naming conventions, and must be [downloaded manually here][5]. If you download a Live CD image manually, set the MY_NAME variable to the basename of the file without the extension. That way the commands in the following sections will reference the correct file. +上面的命令下载 Fedora-Workstation-Live-x86_64-27-1.6.iso Fedora Live 镜像,并保存为 fc27.iso 。更改 MY_RLSE 的值来下载其它档案版本。或者,你可以浏览 来下载最新的 Fedora live 镜像。在21之前的版本使用不同的命名约定,必需[在这里手动下载][5]。如果你手动下载一个 Live CD 镜像,设置 MY_NAME 变量为不带有扩展名的文件的基本名称。用此方法,下面部分中命令将引用正确的文件。 -### Convert the Live CD Image +### 转换 Live CD 镜像 -Use the livecd-iso-to-disk tool to convert the ISO file to a disk image and add the netroot parameter to the embedded kernel command line: +使用 livecd-iso-to-disk 工具来转换 ISO 文件为一个磁盘镜像,并添加 netroot 参数到嵌入的内核命令行: ``` $ sudo dnf install -y livecd-tools @@ -49,18 +49,18 @@ $ sudo livecd-iso-to-disk --format --extra-kernel-args netroot=iscsi:$MY_SRVR::: $ sudo losetup -d $MY_LOOP ``` -### Upload the Live Image to your Server +### 上传 Live 镜像到你的服务器 -Create a directory on your iSCSI server to store your live images and then upload your modified image to it. +在你的 ISCSI 服务器上创建一个目录来存储你的 live 镜像,随后上传你修改的镜像到其中。 -**For releases 21 and greater:** +**对于 21 及更高发布版本:** ``` $ MY_FLDR=/images $ scp $MY_NAME.img $MY_SRVR:$MY_FLDR/ ``` -**For releases prior to 21:** +**对于 21 以前发布版本:** ``` $ MY_FLDR=/images @@ -71,9 +71,9 @@ $ sudo dd status=none if=${MY_LOOP}p1 | ssh $MY_SRVR "dd of=$MY_FLDR/$MY_NAME.im $ sudo losetup -d $MY_LOOP ``` -### Define the iSCSI Target +### 定义 iSCSI 目标 -Run the following commands on your iSCSI server: +在你的 iSCSI 服务器上运行下面的命令: ``` $ sudo -i @@ -91,11 +91,11 @@ END # tgt-admin --update ALL ``` -### Create a Bootable USB Drive +### 创建一个可启动 USB 驱动器 -The [iPXE][4] boot loader has a [sanboot][6] command you can use to connect to and start the live images hosted on your iSCSI server. It can be compiled in many different [formats][7]. The format that works best depends on the type of hardware you’re running. As an example, the following instructions show how to [chain load][8] iPXE from [syslinux][9] on a USB drive. +[iPXE][4] 启动加载程序有一个 [sanboot][6] 命令,你可以使用它来连接,并启动你 ISCSI 服务器上运行的live 镜像。它可以用很多不同的[格式][7]编译。最好的工作格式依赖于你正在运行的硬件。例如,下面的说明向你展示如何在一个 USB 驱动器上从 [syslinux][9] 中 [链式加载][8] iPXE。 -First, download iPXE and build it in its lkrn format. This should be done as a normal user on a workstation: +首先,下载 iPXE ,并以它的 lkrn 格式构建。这应该作为一个工作站上的普通用户完成: ``` $ sudo dnf install -y git @@ -107,7 +107,7 @@ $ make bin/ipxe.lkrn $ cp bin/ipxe.lkrn /tmp ``` -Next, prepare a USB drive with a MSDOS partition table and a FAT32 file system. The below commands assume that you have already connected the USB drive to be formatted. **Be careful that you do not format the wrong drive!** +接下来,准备一个带有一个 MSDOS 分区表和一个 FAT32 文件系统的 USB 驱动器。下面的命令假设你已经连接将要格式化的 USB 驱动器。**注意:你要格式正确的驱动器!** ``` $ sudo -i @@ -119,7 +119,7 @@ $ sudo -i # mkfs -t vfat -F 32 ${MY_USB}1 ``` -Finally, install syslinux on the USB drive and configure it to chain load iPXE: +最后,在 USB 驱动器上安装并配置 syslinux ,来链式加载 iPXE : ``` # dnf install -y syslinux-nonlinux @@ -146,16 +146,16 @@ END # umount ${MY_USB}1 ``` -You should be able to use this same USB drive to netboot additional iSCSI targets simply by editing the syslinux.cfg file and adding additional menu entries. +通过简单地编辑 syslinux.cfg 文件,并添加附加的菜单入口,你应该能够使用这同一个 USB 驱动器来网络启动附加的 ISCSI 目标。 -This is just one method of loading iPXE. You could install syslinux directly on your workstation. Another option is to compile iPXE as an EFI executable and place it directly in your [ESP][10]. Yet another is to compile iPXE as a PXE loader and place it on your TFTP server to be referenced by DHCP. The best option depends on your environment. +这仅是加载 IPXE 的一种方法。你可以直接在你的工作站上安装 syslinux 。再一种选项是编译 iPXE 为一个 EFI 可执行文件,并直接放置它到你的 [ESP][10]中。又一种选项是编译 iPXE 为一个 PXE 加载器,并放置它到你的能够被 DHCP 引用的 TFTP 服务器。最佳的选项依赖于的环境 -### Final Notes +### 最后说明 - * You may want to add the –filename \EFI\BOOT\grubx64.efi parameter to the sanboot command if you compile iPXE in its EFI format. - * It is possible to create custom live images. Refer to [Creating and using live CD][11] for more information. - * It is possible to add the –overlay-size-mb and –home-size-mb parameters to the livecd-iso-to-disk command to create live images with persistent storage. However, if you have multiple concurrent users, you’ll need to set up your iSCSI server to manage separate per-user writeable overlays. This is similar to what was shown in the “[How to Build a Netboot Server, Part 4][12]” article. - * The live images support a persistenthome option on their kernel command line (e.g. persistenthome=LABEL=HOME). Used together with CHAP-authenticated iSCSI targets, the persistenthome option provides an interesting alternative to NFS for centralized home directories. + * 如果你以 IPXE 的 EFI 格式编译 IPXE ,你可能想添加 –filename \EFI\BOOT\grubx64.efi 参数到 sanboot 命令。 + * 能够创建自定义 live 镜像。更多信息参考[创建和使用 live CD][11] 。 + * 有可能添加 –overlay-size-mb 和 –home-size-mb 参数到 livecd-iso-to-disk 命令来创建永久存储的 live 镜像。然而,如果你有多个并发用户,你将需要设置你的 ISCSI 服务器来管理独立的每个用户可写覆盖。这与 “[如何构建一个网络启动服务器,部分 4][12]” 一文所示类似。 + * Live 镜像在它们的内核命令行中支持一个 persistenthome 选项(例如, persistenthome=LABEL=HOME)。与经过 CHAP 身份验证的 iSCSI 目标一起使用,对于集权控制主目录,persistenthome 选项为 NFS 提供一个有趣的替代方案。 @@ -166,7 +166,7 @@ via: https://fedoramagazine.org/netboot-a-fedora-live-cd/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[robsean](https://github.com/robsean) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -185,3 +185,4 @@ via: https://fedoramagazine.org/netboot-a-fedora-live-cd/ [10]: https://en.wikipedia.org/wiki/EFI_system_partition [11]: https://docs.fedoraproject.org/en-US/quick-docs/creating-and-using-a-live-installation-image/#proc_creating-and-using-live-cd [12]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/ + From 1b30d628387108c466caabd997b60bab08d25c75 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 18 Dec 2019 12:58:46 +0800 Subject: [PATCH 148/676] translated --- ...onfigure Openbox for your Linux desktop.md | 69 ------------------- ...onfigure Openbox for your Linux desktop.md | 67 ++++++++++++++++++ 2 files changed, 67 insertions(+), 69 deletions(-) delete mode 100644 sources/tech/20191212 How to configure Openbox for your Linux desktop.md create mode 100644 translated/tech/20191212 How to configure Openbox for your Linux desktop.md diff --git a/sources/tech/20191212 How to configure Openbox for your Linux desktop.md b/sources/tech/20191212 How to configure Openbox for your Linux desktop.md deleted file mode 100644 index 32ff35bfb8..0000000000 --- a/sources/tech/20191212 How to configure Openbox for your Linux desktop.md +++ /dev/null @@ -1,69 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to configure Openbox for your Linux desktop) -[#]: via: (https://opensource.com/article/19/12/openbox-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to configure Openbox for your Linux desktop -====== -This article is part of a special series of 24 days of Linux desktops. -The Openbox Linux window manager is light on system resources, easy to -configure, and a pleasure to use. -![open with sky and grass][1] - -You may have used the [Openbox][2] desktop without knowing it: While Openbox is a great window manager on its own, it also serves as the window manager "engine" for desktop environments like LXDE and LXQT, and it can even manage KDE and GNOME. Aside from being the foundation for several desktops, Openbox is arguably one of the easiest window managers to configure for anyone who doesn't want to learn all the options to put into a config file. By using the **obconf** menu-based configuration application, all the common preferences can be set just as easily as in a full desktop, like GNOME or KDE. - -### Installing Openbox - -You are likely to find Openbox in the software repository of your Linux distribution, but you can also find it on [Openbox.org][3]. If you're already running a different desktop, it's safe to install Openbox on the same system, because Openbox doesn't include any bundled applications aside from a few configuration panels. - -After installing it, log out of your current desktop session so you can log into your Openbox desktop. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -To override it with GDM: - -![Select your desktop session in GDM][4] - -With SDDM: - -![Select your desktop session with KDM][5] - -### Configure the Openbox desktop - -By default, Openbox includes the **obconf** application, which you can use to choose and install themes, modify mouse behavior, set desktop preferences, and do much more. You can probably find other configuration applications, like **obmenu**, in your repository to configure other parts of your window manager. - -![Openbox Obconf configuration application][6] - -Building your own desktop experience is relatively easy. There are little components for all the usual desktop tropes, like [stalonetray][7] for a system tray, [Tint2][8] for a taskbar, or [Xfce4-panel][9] for nearly anything you can think of. String any set of applications together until you have the open source desktop of your dreams. - -![Openbox][10] - -### Why you should use Openbox - -Openbox is light on system resources, easy to configure, and a pleasure to use. It pops up in the unlikeliest of places, so it can be a good system to get familiar with. You never know when you'll be in front of a desktop that secretly uses Openbox as its window manager (and won't it be nice that you know how to customize it?). If critical mass and open source appeal to you, open up the Openbox box and get started. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/openbox-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_general_openfield.png?itok=MeVN97oy (open with sky and grass) -[2]: http://openbox.org -[3]: http://openbox.org/wiki/Openbox:Download -[4]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) -[5]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) -[6]: https://opensource.com/sites/default/files/uploads/advent-openbox-obconf_675px.jpg (Openbox Obconf configuration application) -[7]: https://sourceforge.net/projects/stalonetray/ -[8]: https://opensource.com/article/19/1/productivity-tool-tint2 -[9]: http://xfce.org -[10]: https://opensource.com/sites/default/files/uploads/advent-openbox_675px.jpg (Openbox) diff --git a/translated/tech/20191212 How to configure Openbox for your Linux desktop.md b/translated/tech/20191212 How to configure Openbox for your Linux desktop.md new file mode 100644 index 0000000000..5c6879119f --- /dev/null +++ b/translated/tech/20191212 How to configure Openbox for your Linux desktop.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to configure Openbox for your Linux desktop) +[#]: via: (https://opensource.com/article/19/12/openbox-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何为 Linux 桌面配置 Openbox +====== +本文是 24 天 Linux 桌面特别系列的一部分。Openbox 窗口管理器占用很小的系统资源、易于配置、使用愉快。 +![open with sky and grass][1] + +你可能不知道使用过 [Openbox][2] 桌面:尽管 Openbox 本身是一个出色的窗口管理器,但它还是 LXDE 和 LXQT 等桌面环境的窗口管理器“引擎”,它甚至可以管理 KDE 和 GNOME。除了作为多个桌面的基础之外,Openbox 可以说是最简单的窗口管理器之一,可以为那些不想学习所有配置选项的人配置。通过使用基于菜单的 **obconf** 的配置应用,可以像在 GNOME 或 KDE 这样的完整桌面中一样轻松地设置所有常用首选项。 + +### 安装 Openbox + +你可能会在 Linux 发行版的软件仓库中找到 Openbox,但也可以在 [Openbox.org][3] 中找到它。如果你已经在运行其他桌面,那么可以安全地在同一系统上安装 Openbox,因为 Openbox 除了几个配置面板之外,不包括任何捆绑的应用。 + +安装后,退出当前桌面会话,以便你可以登录 Openbox 桌面。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,这取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 + +要使用 GDM 覆盖它: + +![Select your desktop session in GDM][4] + +要使用 SDDM 覆盖它: + +![Select your desktop session with KDM][5] + +### 配置 Openbox 桌面 + +默认情况下,Openbox 包含 **obconf** 应用,你可以使用它来选择和安装主题,修改鼠标行为,设置桌面首选项等。你可能会在仓库中发现其他配置应用,如 **obmenu** ,用于配置窗口管理器的其他部分。 + +![Openbox Obconf configuration application][6] + +建立你自己的桌面体验相对容易。它有一些所有常见的桌面组件,例如系统托盘 [stalonetray][7]、任务栏 [Tint2][8] 或 [Xfce4-panel][9] 等几乎你能想到的。任意组合应用,直到拥有梦想的开源桌面为止。 + +![Openbox][10] + +### 为何使用 Openbox + +Openbox 占用很小的系统资源、易于配置、使用愉快。它基本不会弹出,因此会是一个容易熟悉的系统。你永远不会知道你面前的桌面秘密使用了 Openbox 作为窗口管理器(知道如何自定义它会不会很高兴?)。如果开源吸引你,那么试试看 Openbox。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/openbox-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_general_openfield.png?itok=MeVN97oy (open with sky and grass) +[2]: http://openbox.org +[3]: http://openbox.org/wiki/Openbox:Download +[4]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) +[5]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) +[6]: https://opensource.com/sites/default/files/uploads/advent-openbox-obconf_675px.jpg (Openbox Obconf configuration application) +[7]: https://sourceforge.net/projects/stalonetray/ +[8]: https://opensource.com/article/19/1/productivity-tool-tint2 +[9]: http://xfce.org +[10]: https://opensource.com/sites/default/files/uploads/advent-openbox_675px.jpg (Openbox) From 5abd3a235def4417b144e5b7f34688b9b5dd741d Mon Sep 17 00:00:00 2001 From: Hank Chow <280630620@qq.com> Date: Wed, 18 Dec 2019 19:29:21 +0800 Subject: [PATCH 149/676] hankchow translating --- sources/tech/20191017 How to type emoji on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191017 How to type emoji on Linux.md b/sources/tech/20191017 How to type emoji on Linux.md index ff85c55938..f4396b8240 100644 --- a/sources/tech/20191017 How to type emoji on Linux.md +++ b/sources/tech/20191017 How to type emoji on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 27ca6702e46b126ba85ce2dd4f3daf846e504932 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 18 Dec 2019 23:13:31 +0800 Subject: [PATCH 150/676] translating by lxbwolf --- .../tech/20190513 How To Set Password Complexity On Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190513 How To Set Password Complexity On Linux.md b/sources/tech/20190513 How To Set Password Complexity On Linux.md index e9a3171c6b..879cb2bef8 100644 --- a/sources/tech/20190513 How To Set Password Complexity On Linux.md +++ b/sources/tech/20190513 How To Set Password Complexity On Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cd5f2377f106c75bba22eeddac6afb4cf40a63e4 Mon Sep 17 00:00:00 2001 From: XLCYun Date: Thu, 19 Dec 2019 00:34:46 +0800 Subject: [PATCH 151/676] =?UTF-8?q?=E7=94=B3=E9=A2=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 20190711 DevOps for introverted people.md --- sources/tech/20190711 DevOps for introverted people.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190711 DevOps for introverted people.md b/sources/tech/20190711 DevOps for introverted people.md index b356d5de7d..da1778573c 100644 --- a/sources/tech/20190711 DevOps for introverted people.md +++ b/sources/tech/20190711 DevOps for introverted people.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( XLCYun ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5791f7710f5b63af46944b879baafc7a6cf9ea19 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 00:53:03 +0800 Subject: [PATCH 152/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191218=20Make?= =?UTF-8?q?=20sysadmin=20work=20on=20Fedora=20easier=20with=20screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191218 Make sysadmin work on Fedora easier with screen.md --- ...admin work on Fedora easier with screen.md | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 sources/tech/20191218 Make sysadmin work on Fedora easier with screen.md diff --git a/sources/tech/20191218 Make sysadmin work on Fedora easier with screen.md b/sources/tech/20191218 Make sysadmin work on Fedora easier with screen.md new file mode 100644 index 0000000000..1523293a7d --- /dev/null +++ b/sources/tech/20191218 Make sysadmin work on Fedora easier with screen.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make sysadmin work on Fedora easier with screen) +[#]: via: (https://fedoramagazine.org/make-sysadmin-work-on-fedora-easier-with-screen/) +[#]: author: (Carmine Zaccagnino https://fedoramagazine.org/author/carzacc/) + +Make sysadmin work on Fedora easier with screen +====== + +![][1] + +When you manage a Linux instance, you’ll find that your job is made much easier by the many tools designed specifically to deal with something specific within the system. For example, if you need to install packages, you have easy-to-use package managers that make that a breeze. If you need to create, resize or delete filesystems, you can do so using tools that are built to be used by humans. The same goes for managing services and browsing logs with [systemd][2] using the _systemctl_ and _journalctl_ commands respectively. The _screen_ tool is another such example. + +You can run all of those tools directly at the command line interface. But if you’re connecting to a server remotely using SSH, sometimes you need another layer between you and the operating system so the command you’re running doesn’t stop if your remote connection terminates. Sysadmins do this to prevent sudden termination in case of a connection issue, but also on purpose to run a command that needs to keep running indefinitely in the background. Enter the _screen_ utility. + +### Introducing screen + +The _screen_ tool allows you to have multiple sessions (called _screens_) that are independent from each other and that you can name, leave and join as you desire. It’s multi-tasking for the remote CLI. You can get started with it simply by running this command: + +``` +$ screen +``` + +The command creates a screen and connect you to it: your current session is now a screen. You can run any command that does something and doesn’t automatically terminate after a few seconds. For example, you might call a web app executable or a game server. Then press **Ctrl+A** and, right after that, the **D** key and you will _detach_ from the screen, leaving it running in the background. + +The **Ctrl+A** combination, given that it is part of every _screen_ command, is often shortened in documentation to **C-a**. Then the _detach_ command used earlier can be described simply as **C-a d**. + +#### Getting in and out of sessions + +If you want to connect to that screen again, run _screen -r_ and you will _attach_ to that screen. Just running **screen** will create a new screen, and subsequent _screen -r_ commands will print out something like this: + +``` +There are several suitable screens on: + 5589.pts-0.hostname (Detached) + 5536.pts-0.hostname (Detached) + Type "screen [-d] -r [pid.]tty.host" to resume one of them. +``` + +You can then choose whether to resume the first or the second screen you created by running either one of these commands: + +``` +$ screen -r 5536 +$ screen -r 5589 +``` + +Adding the rest of the name of the string is optional in this case. + +#### Named screens + +If you know you’ll have multiple screens, you might want to be able to connect to a screen using a name you choose. This is easier than choosing from a list of numbers that only reflect the process IDs of the screen sessions. To do that, use the _-S_ option as in the following example: + +``` +$ screen -S mywebapp +``` + +Then you can resume that screen in the future using this command: + +``` +$ screen -r mywebapp +``` + +#### Starting a process in the background using screen + +An optional argument is the command to be executed inside the created session. For example: + +``` +$ screen -S session_name command args +``` + +This would be the same as running: + +``` +$ screen -S session_name +``` + +…And then running this command inside the _screen_ session: + +``` +$ command args +``` + +The screen session will terminate when the command finishes its execution. + +This is made particularly useful by passing the **-dm** option, which starts the screen in the background without attaching to it. For example, you can copy a very large file in the background by running this command: + +``` +$ screen -S copy -d -m cp /path/to/file /path/to/output +``` + +### Other screen features + +Now that you’ve seen the basics, let’s see some of the other most commonly used screen features. + +#### Easily switching between windows in a screen + +When inside a screen, you can create a new window using **C-a c**. After you do that, you can switch between the windows using **C-a n** to go to the next one and **C-a p** to go to the previous window. You can destroy (kill) the current window with **C-a k**. + +#### Copying and pasting text + +The screen tool also enables you to copy any text on the screen and paste it later wherever you can type some text. + +The **C-a [** keybinding frees your cursor of any constraints and lets it go anywhere your will takes it using the arrow keys on your keyboard. To select and copy text, move to the start of the string you want to copy, and press **Enter** on the keyboard. Then move the cursor to the end of the text you want to copy and press **Enter** again. + +After you’ve done that, use **C-a ]** to paste that text in your shell. Or you can open a text editor like _vim_ or _nano_ and paste the text you copied there. + +### Important notes about screen + +Here are some other tips to keep in mind when using this utility. + +#### Privileged sessions vs. sudo inside a screen + +What if you need to run a command with root privileges inside screen? You can run either of these commands: + +``` +$ screen -S sessionname sudo command +$ sudo screen -S sessionname command +``` + +Notice that the second command is like running this command: + +``` +# screen -S sessionname command +``` + +Seeing things this way makes it a lot more obvious coupled with the fact that each screen is associated to a user: + + * The first one creates a screen with root privileges that can be accessed by the current user even if, within that screen, they switch to another user or _root_ using the _sudo -i_ command. + * The second one creates a screen that can only be accessed by the _root_ user, or by running _sudo screen -r_ as a user with the [appropriate _sudo_ access][3]. + + + +#### Notes about screen in systemd units + +You might be tempted to run a screen session in the background as part of a systemd unit executed at startup, just like any Unix daemon. That way you can resume the screen session and interact with whatever you ran that way. That can work, but you need to consider that it requires the right setup. + +By default, [systemd assumes][4] services are either _oneshot,_ meaning they set up something and then shut down, or _simple_. A service is simple by default when you create a unit file with no _Type_. What you actually need to do is to set the _Type_ to _forking_, which describes _screen_‘s actual behavior when the **-dm** option is passed. It starts the process and then forks itself, leaving the process running in the background while the foreground process closes. + +If you don’t set that, that _screen_ behavior is interpreted by systemd as the service exiting or failing. This causes systemd to kill the background process when the foreground process exits, which is not what you want. + +* * * + +_Photo by [Vlad Tchompalov][5] on [Unsplash][6]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/make-sysadmin-work-on-fedora-easier-with-screen/ + +作者:[Carmine Zaccagnino][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/carzacc/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/12/screen-816x345.jpg +[2]: https://fedoramagazine.org/what-is-an-init-system/ +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://www.freedesktop.org/software/systemd/man/systemd.service.html +[5]: https://unsplash.com/@tchompalov?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[6]: https://unsplash.com/s/photos/screen?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From 752aa3906249475c373904e6d2a9be0b2bfb4c68 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Thu, 19 Dec 2019 01:05:26 +0800 Subject: [PATCH 153/676] translated 20190513-How-To-Set-Password-Complexity-On-Linux.md --- ...How To Set Password Complexity On Linux.md | 243 ------------------ ...How To Set Password Complexity On Linux.md | 189 ++++++++++++++ 2 files changed, 189 insertions(+), 243 deletions(-) delete mode 100644 sources/tech/20190513 How To Set Password Complexity On Linux.md create mode 100644 translated/tech/20190513 How To Set Password Complexity On Linux.md diff --git a/sources/tech/20190513 How To Set Password Complexity On Linux.md b/sources/tech/20190513 How To Set Password Complexity On Linux.md deleted file mode 100644 index 879cb2bef8..0000000000 --- a/sources/tech/20190513 How To Set Password Complexity On Linux.md +++ /dev/null @@ -1,243 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Set Password Complexity On Linux?) -[#]: via: (https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How To Set Password Complexity On Linux? -====== - -User management is one of the important task of Linux system administration. - -There are many aspect is involved in this and implementing the strong password policy is one of them. - -Navigate to the following URL, if you would like to **[generate a strong password on Linux][1]**. - -It will Restrict unauthorized access to systems. - -By default Linux is secure that everybody know. however, we need to make necessary tweak on this to make it more secure. - -Insecure password will leads to breach security. So, take additional care on this. - -Navigate to the following URL, if you would like to see the **[password strength and score][2]** of the generated strong password. - -In this article, we will teach you, how to implement the best security policy on Linux. - -We can use PAM (the “pluggable authentication module”) to enforce password policy On most Linux systems. - -The file can be found in the following location. - -For Redhat based systems @ `/etc/pam.d/system-auth` and Debian based systems @ `/etc/pam.d/common-password`. - -The default password aging details can be found in the `/etc/login.defs` file. - -I have trimmed this file for better understanding. - -``` -# vi /etc/login.defs - -PASS_MAX_DAYS 99999 -PASS_MIN_DAYS 0 -PASS_MIN_LEN 5 -PASS_WARN_AGE 7 -``` - -**Details:** - - * **`PASS_MAX_DAYS:`**` ` Maximum number of days a password may be used. - * **`PASS_MIN_DAYS:`**` ` Minimum number of days allowed between password changes. - * **`PASS_MIN_LEN:`**` ` Minimum acceptable password length. - * **`PASS_WARN_AGE:`**` ` Number of days warning given before a password expires. - - - -We will show you, how to implement the below eleven password policies in Linux. - - * Password Max days - * Password Min days - * Password warning days - * Password history or Deny Re-Used Passwords - * Password minimum length - * Minimum upper case characters - * Minimum lower case characters - * Minimum digits in password - * Minimum other characters (Symbols) - * Account lock – retries - * Account unlock time - - - -### What Is Password Max days? - -This parameter limits the maximum number of days a password can be used. It’s mandatory for user to change his/her account password before expiry. - -If they forget to change, they are not allowed to login into the system. They need to work with admin team to get rid of it. - -It can be set in `/etc/login.defs` file. I’m going to set `90 days`. - -``` -# vi /etc/login.defs - -PASS_MAX_DAYS 90 -``` - -### What Is Password Min days? - -This parameter limits the minimum number of days after password can be changed. - -Say for example, if this parameter is set to 15 and user changed password today. Then he won’t be able to change the password again before 15 days from now. - -It can be set in `/etc/login.defs` file. I’m going to set `15 days`. - -``` -# vi /etc/login.defs - -PASS_MIN_DAYS 15 -``` - -### What Is Password Warning Days? - -This parameter controls the password warning days and it will warn the user when the password is going to expires. - -A warning will be given to the user regularly until the warning days ends. This can helps user to change their password before expiry. Otherwise we need to work with admin team for unlock the password. - -It can be set in `/etc/login.defs` file. I’m going to set `10 days`. - -``` -# vi /etc/login.defs - -PASS_WARN_AGE 10 -``` - -**Note:** All the above parameters only applicable for new accounts and not for existing accounts. - -### What Is Password History Or Deny Re-Used Passwords? - -This parameter keep controls of the password history. Keep history of passwords used (the number of previous passwords which cannot be reused). - -When the users try to set a new password, it will check the password history and warn the user when they set the same old password. - -It can be set in `/etc/pam.d/system-auth` file. I’m going to set `5` for history of password. - -``` -# vi /etc/pam.d/system-auth - -password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok remember=5 -``` - -### What Is Password Minimum Length? - -This parameter keeps the minimum password length. When the users set a new password, it will check against this parameter and warn the user if they try to set the password length less than that. - -It can be set in `/etc/pam.d/system-auth` file. I’m going to set `12` character for minimum password length. - -``` -# vi /etc/pam.d/system-auth - -password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 -``` - -**try_first_pass retry=3** : Allow users to set a good password before the passwd command aborts. - -### Set Minimum Upper Case Characters? - -This parameter keeps, how many upper case characters should be added in the password. These are password strengthening parameters ,which increase the password strength. - -When the users set a new password, it will check against this parameter and warn the user if they are not including any upper case characters in the password. - -It can be set in `/etc/pam.d/system-auth` file. I’m going to set `1` character for minimum password length. - -``` -# vi /etc/pam.d/system-auth - -password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 ucredit=-1 -``` - -### Set Minimum Lower Case Characters? - -This parameter keeps, how many lower case characters should be added in the password. These are password strengthening parameters ,which increase the password strength. - -When the users set a new password, it will check against this parameter and warn the user if they are not including any lower case characters in the password. - -It can be set in `/etc/pam.d/system-auth` file. I’m going to set `1` character. - -``` -# vi /etc/pam.d/system-auth - -password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 lcredit=-1 -``` - -### Set Minimum Digits In Password? - -This parameter keeps, how many digits should be added in the password. These are password strengthening parameters ,which increase the password strength. - -When the users set a new password, it will check against this parameter and warn the user if they are not including any digits in the password. - -It can be set in `/etc/pam.d/system-auth` file. I’m going to set `1` character. - -``` -# vi /etc/pam.d/system-auth - -password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 dcredit=-1 -``` - -### Set Minimum Other Characters (Symbols) In Password? - -This parameter keeps, how many Symbols should be added in the password. These are password strengthening parameters ,which increase the password strength. - -When the users set a new password, it will check against this parameter and warn the user if they are not including any Symbol in the password. - -It can be set in `/etc/pam.d/system-auth` file. I’m going to set `1` character. - -``` -# vi /etc/pam.d/system-auth - -password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 ocredit=-1 -``` - -### Set Account Lock? - -This parameter controls users failed attempts. It locks user account after reaches the given number of failed login attempts. - -It can be set in `/etc/pam.d/system-auth` file. - -``` -# vi /etc/pam.d/system-auth - -auth required pam_tally2.so onerr=fail audit silent deny=5 -account required pam_tally2.so -``` - -### Set Account Unlock Time? - -This parameter keeps users unlock time. If the user account is locked after consecutive failed authentications. - -It’s unlock the locked user account after reaches the given time. Sets the time (900 seconds = 15 minutes) for which the account should remain locked. - -It can be set in `/etc/pam.d/system-auth` file. - -``` -# vi /etc/pam.d/system-auth - -auth required pam_tally2.so onerr=fail audit silent deny=5 unlock_time=900 -account required pam_tally2.so -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/5-ways-to-generate-a-random-strong-password-in-linux-terminal/ -[2]: https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/ diff --git a/translated/tech/20190513 How To Set Password Complexity On Linux.md b/translated/tech/20190513 How To Set Password Complexity On Linux.md new file mode 100644 index 0000000000..9e70171824 --- /dev/null +++ b/translated/tech/20190513 How To Set Password Complexity On Linux.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Set Password Complexity On Linux?) +[#]: via: (https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Linux 如何设置密码复杂度? +====== + +对于 Linux 系统管理员来说,用户管理是最重要的事之一。这涉及到很多因素,实现强密码策略是用户管理的其中一个方面。移步后面的 URL 查看如何 [在 Linux 上生成一个强密码][1]。它会限制系统未授权的用户的访问。 + +所有人都知道 Linux 的默认策略很安全,然而我们还是要做一些微调,这样才更安全。弱密码有安全隐患,因此,请特别注意。移步后面的 URL 查看生成的强密码的 [密码长度和分值][2]。本文将教你在 Linux 中如何实现最安全的策略。 + +在大多数 Linux 系统中,我们可以用 PAM(pluggable authentication module,译注:可插拔认证模块)来加强密码策略。在下面的路径可以找到这个文件。 + +在红帽系列的系统中,路径:`/etc/pam.d/system-auth`。 + +Debian 系列的系统中,路径:`/etc/pam.d/common-password`。 + +关于默认的密码过期时间,可以在 `/etc/login.defs` 文件中查看详细信息。 + +为了更好理解,我摘取了文件的部分内容: + +``` +# vi /etc/login.defs + +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_MIN_LEN 5 +PASS_WARN_AGE 7 +``` + +**详细解释:** + + * **`PASS_MAX_DAYS:`**` ` 一个密码可使用的最大天数。 + * **`PASS_MIN_DAYS:`**` ` 两次密码修改之间最小的间隔天数。 + * **`PASS_MIN_LEN:`**` ` 密码最小长度。 + * **`PASS_WARN_AGE:`**` ` 密码过期前给出警告的天数。 + + + +我们将会展示在 Linux 中如何实现下面的 11 个密码策略。 + + * 一个密码可使用的最大天数 + * 两次密码修改之间最小的间隔天数 + * 密码过期前给出警告的天数 + * 密码历史记录/拒绝重复使用密码 + * 密码最小长度 + * 最少的大写字母个数 + * 最少的小写字母个数 + * 最少的数字个数 + * 最少的其他字符(符号)个数 + * 账号锁定 — 重试 + * 账号解锁时间 + +### 密码可使用的最大天数是什么? + +这一参数限制一个密码可使用的最大天数。它强制用户在过期前修改他/她的密码。如果他们忘记修改,那么他们会登录不了系统。他们需要联系管理员才能正常登录。这个参数可以在 `/etc/login.defs` 文件中设置。我把这个参数设置为 `90 天`。 + +``` +# vi /etc/login.defs + +PASS_MAX_DAYS 90 +``` + +### 密码最小天数是什么? + +这个参数限制两次修改之间的最少天数。举例来说,如果这个参数被设置为 15 天,用户今天修改了密码,那么在 15 天之内他都不能修改密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 `15 天`。 + +``` +# vi /etc/login.defs + +PASS_MIN_DAYS 15 +``` + +### 密码警告天数是什么? + +这个参数控制密码警告的前置天数,在密码即将过期时会给用户警告提示。在警告天数结束前,用户会收到日常警告提示。这可以提醒用户在密码过期前修改他们的密码,否则我们就需要联系管理员来解锁密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 `10 天`。 + +``` +# vi /etc/login.defs + +PASS_WARN_AGE 10 +``` + +**注意:** 上面的所有参数仅对新账号有效,对已存在的账号无效。 + +### 密码历史或拒绝重复使用密码是什么? + +这个参数控制密码历史。它记录曾经使用过的密码(禁止使用的曾用密码的个数)。当用户设置新的密码时,它会检查密码历史,如果他们要设置的密码是一个曾经使用过的旧密码,将会发出警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码历史为 `5`。 + +``` +# vi /etc/pam.d/system-auth + +password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok remember=5 +``` + +### 密码最小长度是什么? + +这个参数表示密码的最小长度。当用户设置新密码时,系统会检查这个参数,如果新设的密码长度小于这个参数设置的值,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置最小密码长度为 `12`。 + +``` +# vi /etc/pam.d/system-auth + +password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 +``` + +**try_first_pass retry=3** : 在密码设置交互界面,用户有 3 次机会重设密码。 + +### 设置最少的大写字母个数? + +这个参数表示密码中至少需要的大写字母的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有大写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码(中大写字母)的最小长度为 `1` 个字母。 + +``` +# vi /etc/pam.d/system-auth + +password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 ucredit=-1 +``` + +### 设置最少的小写字母个数? + +这个参数表示密码中至少需要的小写字母的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有小写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1` 个字母。 + +``` +# vi /etc/pam.d/system-auth + +password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 lcredit=-1 +``` + +### 设置密码中最少的数字个数? + +这个参数表示密码中至少需要的数字的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有数字,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1`。 + +``` +# vi /etc/pam.d/system-auth + +password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 dcredit=-1 +``` + +### 设置密码中最少的其他字符(符号)个数? + +这个参数表示密码中至少需要的特殊符号的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有特殊符号,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1` 个字符。 + +``` +# vi /etc/pam.d/system-auth + +password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 ocredit=-1 +``` + +### 设置账号锁定? + +这个参数控制用户连续登录失败的最大次数。当达到设定的连续失败登录次数阈值时,锁定账号。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。 + +``` +# vi /etc/pam.d/system-auth + +auth required pam_tally2.so onerr=fail audit silent deny=5 +account required pam_tally2.so +``` + +### 设定账号解锁时间? + +这个参数表示用户解锁时间。如果一个用户账号在连续认证失败后被锁定了,当过了设定的解锁时间后,就会解锁。设置被锁定中的账号的解锁时间(900 秒 = 15分钟)。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。 + +``` +# vi /etc/pam.d/system-auth + +auth required pam_tally2.so onerr=fail audit silent deny=5 unlock_time=900 +account required pam_tally2.so +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/5-ways-to-generate-a-random-strong-password-in-linux-terminal/ +[2]: https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/ From c5db224ea01d5049a5ee09d642d13a3ac165b82c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:12:18 +0800 Subject: [PATCH 154/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191219=20Linux?= =?UTF-8?q?=20Mint=2019.3=20=E2=80=9CTricia=E2=80=9D=20Released:=20Here?= =?UTF-8?q?=E2=80=99s=20What=E2=80=99s=20New=20and=20How=20to=20Get=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md --- ...ed- Here-s What-s New and How to Get it.md | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 sources/tech/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md diff --git a/sources/tech/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md b/sources/tech/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md new file mode 100644 index 0000000000..507915626b --- /dev/null +++ b/sources/tech/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Mint 19.3 “Tricia” Released: Here’s What’s New and How to Get it) +[#]: via: (https://itsfoss.com/linux-mint-19-3/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Mint 19.3 “Tricia” Released: Here’s What’s New and How to Get it +====== + +_**Linux Mint 19.3 “Tricia” has been released. See what’s new in it and learn how to upgrade to Linux Mint 19.3.**_ + +The Linux Mint team finally announced the release of Linux Mint 19.3 codenamed ‘Tricia’ with useful feature additions along with a ton of improvements under-the-hood. + +This is a point release based on the latest **Ubuntu 18.04.3** and it comes packed with the **Linux kernel 5.0**. + +I downloaded and quickly tested the edition featuring the [Cinnamon 4.4][1] desktop environment. You may also try the Xfce or MATE edition of Linux Mint 19.3. + +### Linux Mint 19.3: What’s New? + +![Linux Mint 19 3 Desktop][2] + +While being an LTS release that will be supported until 2023 – it brings in a couple of useful features and improvements. Let me highlight some of them for you. + +#### System Reports + +![][3] + +Right after installing Linux Mint 19.3 (or upgrading it), you will notice a warning icon on the right side of the panel (taskbar). + +When you click on it, you should be displayed a list of potential issues that you can take care of to ensure the best out of Linux Mint experience. + +For starters, it will suggest that you should create a root password, install a language pack, or update software packages – in the form of a warning. This is particularly useful to make sure that you perform important actions even after following the first set of steps on the welcome screen. + +#### Improved Language Settings + +Along with the ability to install/set a language, you will also get the ability to change the time format. + +So, the language settings are now more useful than ever before. + +#### HiDPI Support + +As a result of [HiDPI][4] support, the system tray icons will look crisp and overall, you should get a pleasant user experience on a high-res display. + +#### New Applications + +![Linux Mint Drawing App][5] + +With the new release, you will n longer find “**GIMP**” pre-installed. + +Even though GIMP is a powerful utility, they decided to add a simpler “**Drawing**” app to let users to easily crop/resize images while being able to tweak it a little. + +Also, **Gnote** replaces **Tomboy** as the default note-taking application on Linux Mint 19.3 + +In addition to both these replacements, Celluloid video player has also been added instead of Xplayer. In case you did not know, Celluloid happens to be one of the [best open source video players][6] for Linux. + +#### Cinnamon 4.4 Desktop + +![Cinnamon 4 4 Desktop][7] + +In my case, the new Cinnamon 4.4 desktop experience introduces a couple of new abilities like adjusting/tweaking the panel zones individually as you can see in the screenshot above. + +#### Other Improvements + +There are several other improvements including more customizability options in the file manager and so on. + +You can read more about the detailed changes in the [official release notes][8]. + +[Subscribe to our YouTube channel for more Linux videos][9] + +### Linux Mint 19 vs 19.1 vs 19.2 vs 19.3: What’s the difference? + +You probably already know that Linux Mint releases are based on Ubuntu long term support releases. Linux Mint 19 series is based on Ubuntu 18.04 LTS. + +Ubuntu LTS releases get ‘point releases’ on the interval of a few months. Point release basically consists of bug fixes and security updates that have been pushed since the last release of the LTS version. This is similar to the Service Pack concept in Windows XP if you remember it. + +If you are going to download Ubuntu 18.04 which was released in April 2018 in 2019, you’ll get Ubuntu 18.04.2. The ISO image of 18.04.2 will consist of 18.04 and the bug fixes and security updates applied till 18.04.2. Imagine if there were no point releases, then right after [installing Ubuntu 18.04][10], you’ll have to install a few gigabytes of system updates. Not very convenient, right? + +But Linux Mint has it slightly different. Linux Mint has a major release based on Ubuntu LTS release and then it has three minor releases based on Ubuntu LTS point releases. + +Mint 19 was based on Ubuntu 18.04, 19.1 was based on 18.04.1 and Mint 19.2 is based on Ubuntu 18.04.2. Similarly, Mint 19.3 is based on Ubuntu 18.04.3. It is worth noting that all Mint 19.x releases are long term support releases and will get security updates till 2023. + +Now, if you are using Ubuntu 18.04 and keep your system updated, you’ll automatically get updated to 18.04.1, 18.04.2 etc. That’s not the case in Linux Mint. + +Linux Mint minor releases also consist of _feature changes_ along with bug fixes and security updates and this is the reason why updating Linux Mint 19 won’t automatically put you on 19.1. + +Linux Mint gives you the option if you want the new features or not. For example, Mint 19.3 has Cinnamon 4.4 and several other visual changes. If you are happy with the existing features, you can stay on Mint 19.2. You’ll still get the necessary security and maintenance updates on Mint 19.2 till 2023. + +Now that you understand the concept of minor releases and want the latest minor release, let’s see how to upgrade to Mint 19.3. + +### Linux Mint 19.3: How to Upgrade? + +No matter whether you have Linux Mint 19.1 or 19, you can follow these steps to [upgrade Linux Mint version][11]. + +**Note**: _You should consider making a system snapshot (just in case) for backup. In addition, the Linux Mint team advises you to disable the screensaver and upgrade Cinnamon spices (if installed) from the System settings._ + +![][12] + + 1. Launch the Update Manager. + 2. Now, refresh it to load up the latest available updates (or you can change the mirror if you want). + 3. Once done, simply click on the Edit button to find “**Upgrade to Linux Mint 19.3 Tricia**” button similar to the image above. + 4. Finally, just follow the on-screen instructions to easily update it. + + + +Based on your internet connection, it should take anything between a couple of minutes to 30 minutes. + +### Don’t see Mint 19.3 update yet? Here’s what you can do + +If you don’t see the option to upgrade to Linux Mint 19.3 Tricia, don’t lose hope. Here are a couple of things you can do. + +#### **Step 1: Make sure to use mint-upgrade-info version 1.1.3** + +Make sure that mint-upgrade-info is updated to version 1.1.3. You can try the install command that will update it to a newer version (if there is any). + +``` +sudo apt install mint-upgrade-info +``` + +#### **Step 2: Switch to default software sources** + +Chances are that you are using a mirror closer to you to get faster software downloads. But this could cause a problem as the mirrors might not have the new upgrade info yet. + +Go to Software Source and change the sources to default. Now run the update manager again and see if Mint 19.3 upgrade is available. + +### Download Linux Mint 19.3 ‘Tricia’ + +If you want to perform a fresh install, you can easily download the latest available version from the official download page (depending on what edition you want). + +You will also find multiple mirrors available to download the ISOs – feel free to try the nearest mirror for potentially faster download. + +[Linux Mint 19.3][13] + +**Wrapping Up** + +Have you tried Linux Mint 19.3 yet? Let me know your thoughts in the comments down below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-mint-19-3/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/linuxmint/cinnamon/releases/tag/4.4.0 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-19-3-desktop.jpg?ssl=1 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-system-report.jpg?ssl=1 +[4]: https://wiki.archlinux.org/index.php/HiDPI +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-drawing-app.jpg?ssl=1 +[6]: https://itsfoss.com/video-players-linux/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/cinnamon-4-4-desktop.jpg?ssl=1 +[8]: https://linuxmint.com/rel_tricia_cinnamon.php +[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[10]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ +[11]: https://itsfoss.com/upgrade-linux-mint-version/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/mintupgrade.png?ssl=1 +[13]: https://linuxmint.com/download.php From 52067f389886493932a6a9e5e2c88402921dff4a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:12:37 +0800 Subject: [PATCH 155/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191219=20An=20A?= =?UTF-8?q?ctionable=20Guide=20to=20Enhance=20Your=20Online=20Privacy=20Wi?= =?UTF-8?q?th=20Tor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191219 An Actionable Guide to Enhance Your Online Privacy With Tor.md --- ...to Enhance Your Online Privacy With Tor.md | 260 ++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 sources/tech/20191219 An Actionable Guide to Enhance Your Online Privacy With Tor.md diff --git a/sources/tech/20191219 An Actionable Guide to Enhance Your Online Privacy With Tor.md b/sources/tech/20191219 An Actionable Guide to Enhance Your Online Privacy With Tor.md new file mode 100644 index 0000000000..36fb202b9e --- /dev/null +++ b/sources/tech/20191219 An Actionable Guide to Enhance Your Online Privacy With Tor.md @@ -0,0 +1,260 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Actionable Guide to Enhance Your Online Privacy With Tor) +[#]: via: (https://itsfoss.com/tor-guide/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +An Actionable Guide to Enhance Your Online Privacy With Tor +====== + +In a world where technology is rapidly evolving, companies are gathering data and information from users in order to optimize the functionality of their applications as much as possible, privacy has slowly begun to fade and look like a myth. + +Many people believe that completely concealing their identity online is a difficult process that cannot be achieved. But of course, for security experts and for those who are optimistic that anonymity will not be lost, the answer is that we can enhance anonymity on the Internet. + +This can clearly be achieved with the help of _Tor_. Tor stands for The Onion Routing. + +Tor is a free and open source software developed by the [Tor project][1], a non-profit organization focusing on the freedom and privacy of users on the Internet. + +![Tor Onion][2] + +Let’s see below how you can enhance our online privacy with Tor. + +### What is Tor? + +As I mentioned before, Tor is a free open source software which defends users’ privacy. Specifically, The Onion Router software is being used by students, companies, universities, reporters who maybe want to share an idea anonymously for many years. In order to conceal users’ identities, Tor routes traffic through a worldwide overlay network which consisting of thousand of relays. + +![Tor Network][3] + +In addition, it has a very handy functionality as it encrypts the data multiple times, including the next IP address for the node it is intended for, and sends it through a virtual circuit that includes a random node. Each node decrypts a layer of encrypted information in order to reveal the next node. The result is that the remaining encrypted information will be decrypted at the last node without revealing the source IP address. This process builds the Tor circuit. + +### How to install Tor on Linux + +Since Tor is one of the most popular software in the open source community, it can be found in almost every Linux distribution’s repository. + +For Ubuntu-based distributions, it is available in the universe repository. We have a separate article on [installing Tor browser on Ubuntu][4] which you may refer. It also has a few tips on using the browser that you may find useful. + +I am using Debian 10 so I’ll mention the steps for installing Tor on Debian: + +All you have to do is to add the backport repository to our sources.list and then we can easily install Tor and its components. Use the following commands: + +``` +echo "deb http://deb.debian.org/debian buster-backports main contrib" > /etc/apt/sources.list.d/buster-backports.list + +sudo apt update +sudo apt install tor torbrowser-launcher +``` + +Remember! + +Do not run Tor as root, as it is not secure for your operating system. It is recommended to run it as a normal user. + +### What can you achieve with Tor? + +As we move on, you will see numerous privacy enhancements that can be impressively accomplished with Tor. + +Particularly, below we will see the topics that will be covered: + + * Explore the Tor Network with Tor Browser + * Use Tor through Firefox + + + +Note: It would be helpful to take into consideration that Tor can be used alongside with many applications, so anyone can privately use the application she/he desires. + + * Create a hidden Tor service + * Create a middle Tor relay + + + +#### Explore the Tor network with Tor browser + +To connect to the Tor network through the Tor browser, open the application that will be with the rest of your internet applications or type in the terminal: + +``` +torbrowser-launcher +``` + +Initially, a window will appear, which allows some settings to be modified in the connection. For example, for users who wish to access the Tor network, and their country does not allow them, they must have the necessary settings for a successful connection. + +![Tor Network Settings][5] + +You can always request a bridge from the Tor Database, [BridgeDB][6]. + +If everything is under control, all that’s left is to connect. + +![Tor Browser][7] + +_**Welcome to Tor..**_ + +It is worth mentioning that it would be helpful and safe to avoid adding extensions to Tor Browser as it can reveal user’s real location and IP address to the website operators. + +It is also recommended to avoid downloading torrents, to avoid IP revealing. + +_**Let the exploration begin ..**_ + +#### How to use Tor through Firefox + +You don’t always need to use the Tor browser. The [awesome Firefox][8] allows you to use Tor network. + +In order to connect to tor network via Firefox, you must first open the tor service. To do this, execute the following command: + +``` +sudo service tor start +``` + +To ensure that the tor is active, you can observe the open links. Below you can see the running port, which is the 9050. + +``` +netstat -nvlp +``` + +Here’s the output: + +``` +.. .. .. .. .. + +tcp 0 0 127.0.0.1:9050 0.0.0.0:* LISTEN +``` + +The only thing left to do is to set Firefox to be connected through Tor proxy. + +Go to Preferences → General → Network Proxy and set the localhost IP and Tor listening port to SOCKS v5 as shows below: + +![Setting Tor in Firefox][9] + +#### How to create a Tor Hidden Service + +Ttry to search for the term “Hidden Wiki”, you will notice that you will not find any hidden content. This is because the content discussed above does not represent the standard domain, but a top-level domain that can be found through Tor. This domain is .onion. + +So let’s see how you can create your own _**secret onion service**_. + +With the installation of Tor, torrc was created. The torrc is the tor configuration file, and its path is /etc/tor/torrc. + +Note: In order for modification to be applied, the ‘#’ symbol must be removed from the start of the line. + +To create the onion service you need to modify the configuration file so that after its modification it contains our service. + +You can open the file with a [command line text editor][10] of your choice. Personally, my favourite text editor is Vim. If Vim is used and you have any difficulty, you can take a look at the following article to make the situation clearer. + +In torrc you will find a lot of content, which can, in any case, be analyzed in a related article. For the time being, we are interested in the line mentioned by “Hidden Service”. + +![][11] + +At first glance, it can be understood that a path, a network address and finally two doors should be set. + +``` +HiddenServiceDir /var/lib/tor/hidden_service/ +``` + +‘HiddenServiceDir’ denotes the path the hostname will generate, which will then be the user visit point to the secret service created. + +HiddenServicePort 80 127.0.0.1:80 + +‘HiddenServicePort’ indicates which address and port the .onion service will be connected to. + +For example, below is the creation of a hidden service named linuxhandbook, which as a port destination will have port 80, as the address will have localhost’s IP and port 80 respectively. + +![][12] + +Finally, the only thing left to complete the creation is to restart the tor service. Once the tor is restarted, the /var/lib/tor// path will have both the public and private secret service key, as well as the hostname file. The ‘Hostname’ file contains the .onion link provided for our onion site. + +Here is the output of my ‘hostname’ file. + +``` +ogl3kz3nfckz22xp4migfed76fgbofwueytf7z6d2tnlh7vuto3zjjad.onion +``` + +Just visit this link through your Tor Browser and you will see your up and running server based on a .onion domain. + +![Sample Onion Web Page][13] + +#### How to Create a Middle Tor Relay + +The Tor network, as mentioned before, is an open network, which consists of many nodes. Tor nodes are a creation of volunteers, that is, contributors to enhancing privacy. It is worth noting that the nodes are over 7000 and they are getting bigger day by day. Everyone’s contribution is always acceptable as we expand one of the predominantly largest networks worldwide. + +Tor contains Guard, Middle and Exit Relays. A Guard Relay is the the first relay of a Tor circuit. The Middle Relay is the second hop of the circuit. Guard and Middle Relays are listed in the public list of Tor relays. Exit Relay is the final relay of a tor circuit. It is a crucial relay, as it sends traffic out its destination. + +All relays are meaningful but in this article, we will cover about Middle relays. + +Here’s and image showing middle-relay traffic the last two months. + +![][14] + +Lets see how we can create a middle relay. + +Once again, in order to create your own middle relay, you have to modify the torrc file. + +In any case, as I mentioned above, you can uncomment the lines when you need your configuration to be enabled. + +However, it is feasible to copy the following lines and then modify them. + +``` +#change the nickname “Linuxhandbook” to a name that you like +Nickname Linuxhandbook +ORPort 443 +ExitRelay 0 +SocksPort 0 +ControlSocket 0 +#change the email address below and be aware that it will be published +ContactInfo [email protected] +``` + +An explanation should make the situation clearer. + + * Nickname: Set your own relay name. + * ORPort: Set a port which will be the relay’s listening port. + * ExitRelay: By default, is set to 0, we want to create a middle relay. + + + +Note: tor service needs to be open. + +You should see your middle-relay up and running in Tor Metrics after a few couple of hours. Therefore, it usually takes 3 hours to be published, according to [Tormetrics][15]. + +Warning! + +For sure, some of you may have heard of the term “Deep Web”, “Hidden Wiki” and many other services that you haven’t been able to visit yet. Besides, you may have heard that there is content posted on the Tor network which may be illegal. + +In the Tor network, one can find almost anything, such as forums with any kind of discussion. Quite right, since there is no censorship in a network whose entities are anonymous. This is both good and bad at the same time. + +I am not going to give sermons here about what you should use and what you should not use. I believe that you are sensible enough to make that decision. + +In conclusion, you can thoroughly see, that one can, in any case, enhance their privacy as well as defend themselves from Internet censorship. I would love to hear your opinion about Tor. + +##### Panos + +Penetration Tester and Operating System developer + +Panos’ love for Free Open Source Software is invaluable. In his spare time, he observes the night sky with his telescope. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/tor-guide/ + +作者:[Community][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://www.torproject.org/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/tor_onion.jpg?ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/tor-network-diagram.png?ssl=1 +[4]: https://itsfoss.com/install-tar-browser-linux/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/tor_browser.png?ssl=1 +[6]: https://www.bridgedb.org/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/tor_firefox.jpg?ssl=1 +[8]: https://itsfoss.com/why-firefox/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/tor_settings.png?ssl=1 +[10]: https://itsfoss.com/command-line-text-editors-linux/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/create_tor_relay.jpg?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/create_tor_relay_2.jpg?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/onion_web_page.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/tor_relay.jpg?ssl=1 +[15]: https://metrics.torproject.org/ From 420c47dbb959d2933db6e8dbf3519ee18ac105f6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:14:44 +0800 Subject: [PATCH 156/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191218=20Introd?= =?UTF-8?q?uction=20to=20automation=20with=20Bash=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191218 Introduction to automation with Bash scripts.md --- ...duction to automation with Bash scripts.md | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 sources/tech/20191218 Introduction to automation with Bash scripts.md diff --git a/sources/tech/20191218 Introduction to automation with Bash scripts.md b/sources/tech/20191218 Introduction to automation with Bash scripts.md new file mode 100644 index 0000000000..f73c6e36c4 --- /dev/null +++ b/sources/tech/20191218 Introduction to automation with Bash scripts.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to automation with Bash scripts) +[#]: via: (https://opensource.com/article/19/12/automation-bash-scripts) +[#]: author: (David Both https://opensource.com/users/dboth) + +Introduction to automation with Bash scripts +====== +In the first article in this four-part series, learn how to create a +simple shell script and why they are the best way to automate tasks. +![Person using a laptop][1] + +Sysadmins, those of us who run and manage Linux computers most closely, have direct access to tools that help us work more efficiently. To help you use these tools to their maximum benefit to make your life easier, this series of articles explores using automation in the form of Bash shell scripts. It covers: + + * The advantages of automation with Bash shell scripts + * Why using shell scripts is a better choice for sysadmins than compiled languages like C or C++ + * Creating a set of requirements for new scripts + * Creating simple Bash shell scripts from command-line interface (CLI) programs + * Enhancing security through using the user ID (UID) running the script + * Using logical comparison tools to provide execution flow control for command-line programs and scripts + * Using command-line options to control script functionality + * Creating Bash functions that can be called from one or more locations within a script + * Why and how to license your code as open source + * Creating and implementing a simple test plan + + + +I previously wrote a series of articles about Bash commands and syntax and creating Bash programs at the command line, which you can find in the references section at the end of this article. But this series of four articles is as much about creating scripts (and some techniques that I find useful) as it is about Bash commands and syntax. + +### Why I use shell scripts + +In Chapter 9 of [_The Linux Philosophy for Sysadmins_][2], I write: + +> "A sysadmin is most productive when thinking—thinking about how to solve existing problems and about how to avoid future problems; thinking about how to monitor Linux computers in order to find clues that anticipate and foreshadow those future problems; thinking about how to make [their] job more efficient; thinking about how to automate all of those tasks that need to be performed whether every day or once a year. +> +> "Sysadmins are next most productive when creating the shell programs that automate the solutions that they have conceived while appearing to be unproductive. The more automation we have in place, the more time we have available to fix real problems when they occur and to contemplate how to automate even more than we already have." + +This first article explores why shell scripts are an important tool for the sysadmin and the basics of creating a very simple Bash script. + +### Why automate? + +Have you ever performed a long and complex task at the command line and thought, "Glad that's done. Now I never have to worry about it again!"? I have—frequently. I ultimately figured out that almost everything that I ever need to do on a computer (whether mine or one that belongs to an employer or a consulting customer) will need to be done again sometime in the future. + +Of course, I always think that I will remember how I did the task. But, often, the next time is far enough into the future that I forget that I have _ever_ done it, let alone _how_ to do it. I started writing down the steps required for some tasks on bits of paper, then thought, "How stupid of me!" So I transferred those scribbles to a simple notepad application on my computer, until one day, I thought again, "How stupid of me!" If I am going to store this data on my computer, I might as well create a shell script and store it in a standard location, like **/usr/local/bin** or **~/bin**, so I can just type the name of the shell program and let it do all the tasks I used to do manually. + +For me, automation also means that I don't have to remember or recreate the details of how I performed the task in order to do it again. It takes time to remember how to do things and time to type in all the commands. This can become a significant time sink for tasks that require typing large numbers of long commands. Automating tasks by creating shell scripts reduces the typing necessary to perform routine tasks. + +### Shell scripts + +Writing shell programs—also known as scripts—is the best strategy for leveraging my time. Once I write a shell program, I can rerun it as many times as I need to. I can also update my shell scripts to compensate for changes from one release of Linux to the next, installing new hardware and software, changing what I want or need to accomplish with the script, adding new functions, removing functions that are no longer needed, and fixing the not-so-rare bugs in my scripts. These kinds of changes are just part of the maintenance cycle for any type of code. + +Every task performed via the keyboard in a terminal session by entering and executing shell commands can and should be automated. Sysadmins should automate everything we are asked to do or decide needs to be done. Many times, doing the automation upfront saves me time the first time. + +One Bash script can contain anywhere from a few commands to many thousands. I have written Bash scripts with only one or two commands, and I have written a script with over 2,700 lines, more than half of which are comments. + +### Getting started + +Here's a trivial example of a shell script and how to create it. In my earlier series on Bash command-line programming, I used the example from every book on programming I have ever read: "Hello world." From the command line, it looks like this: + + +``` +[student@testvm1 ~]$ echo "Hello world" +Hello world +``` + +By definition, a program or shell script is a sequence of instructions for the computer to execute. But typing them into the command line every time is quite tedious, especially when the programs are long and complex. Storing them in a file that can be executed with a single command saves time and reduces the possibility for errors to creep in. + +I recommend trying the following examples as a non-root user on a test system or virtual machine (VM). Although the examples are harmless, mistakes do happen, and being safe is always wise. + +The first task is to create a file to contain your program. Use the **touch** command to create the empty file, **hello**, then make it executable: + + +``` +[student@testvm1 ~]$ touch hello +[student@testvm1 ~]$ chmod 774 hello +``` + +Now, use your favorite editor to add the following line to the file: + + +``` +`echo "Hello world"` +``` + +Save the file and run it from the command line. You can use a separate shell session to execute the scripts in this series: + + +``` +[student@testvm1 ~]$ ./hello +Hello world! +``` + +This is the simplest Bash program you may ever create—a single statement in a file. For this exercise, your complete shell script will be built around this simple Bash statement. The function of the program is irrelevant for this purpose, and this simple statement allows you to build a program structure—a template for other programs—without being concerned about the logic of a functional purpose. You can concentrate on the basic program structure and creating your template in a very simple way, and you can create and test the template itself rather than a complex functional program. + +### Shebang + +The single statement works fine as long as you use Bash or a shell compatible with the commands used in the script. If no shell is specified in the script, the default shell will be used to execute the script commands. + +The next task is to ensure that the script will run using the Bash shell, even if another shell is the default. This is accomplished with the shebang line. Shebang is the geeky way to describe the **#!** characters that explicitly specify which shell to use when running the script. In this case, that is Bash, but it could be any other shell. If the specified shell is not installed, the script will not run. + +Add the shebang line as the first line of the script, so now it looks like this: + + +``` +#!/usr/bin/bash +echo "Hello world!" +``` + +Run the script again—you should see no difference in the result. If you have other shells installed (such as ksh, csh, tcsh, zsh, etc.), start one and run the script again. + +### Scripts vs. compiled programs + +When writing programs to automate—well, everything—sysadmins should always use shell scripts. Because shell scripts are stored in ASCII text format, they can be viewed and modified by humans just as easily as they can by computers. You can examine a shell program and see exactly what it does and whether there are any obvious errors in the syntax or logic. This is a powerful example of what it means to be _open_. + +I know some developers consider shell scripts something less than "true" programming. This marginalization of shell scripts and those who write them seems to be predicated on the idea that the only "true" programming language is one that must be compiled from source code to produce executable code. I can tell you from experience that this is categorically untrue. + +I have used many languages, including BASIC, C, C++, Pascal, Perl, Tcl/Expect, REXX (and some of its variations, including Object REXX), many shell languages (including Korn, csh and Bash), and even some assembly language. Every computer language ever devised has had one purpose: to allow humans to tell computers what to do. When you write a program, regardless of the language you choose, you are giving the computer instructions to perform specific tasks in a specific sequence. + +Scripts can be written and tested far more quickly than compiled languages. Programs usually must be written quickly to meet time constraints imposed by circumstances or the pointy-haired boss. Most scripts that sysadmins write are to fix a problem, to clean up the aftermath of a problem, or to deliver a program that must be operational long before a compiled program could be written and tested. + +Writing a program quickly requires shell programming because it enables a quick response to the needs of the customer—whether that is you or someone else. If there are problems with the logic or bugs in the code, they can be corrected and retested almost immediately. If the original set of requirements is flawed or incomplete, shell scripts can be altered very quickly to meet the new requirements. In general, the need for speed of development in the sysadmin's job overrides the need to make the program run as fast as possible or to use as little as possible in the way of system resources like RAM. + +Most things sysadmins do take longer to figure out how to do than to execute. Thus, it might seem counterproductive to create shell scripts for everything you do. It takes some time to write the scripts and make them into tools that produce reproducible results and can be used as many times as necessary. The time savings come every time you can run the script without having to figure out (again) how to do the task. + +### Final thoughts + +This article didn't get very far with creating a shell script, but it did create a very small one. It also explored the reasons for creating shell scripts and why they are the most efficient option for the system administrator (rather than compiled programs). + +In the next article, you will begin creating a Bash script template that can be used as a starting point for other Bash scripts. The template will ultimately contain a Help facility, a GNU licensing statement, a number of simple functions, and some logic to deal with those options, as well as others that might be needed for the scripts that will be based on this template. + +### Resources  + + * [How to program with Bash: Syntax and tools][3] + * [How to program with Bash: Logical operators and shell expansions][4] + * [How to program with Bash: Loops][5] + + + +* * * + +_This series of articles is partially based on Volume 2, Chapter 10 of David Both's three-part Linux self-study course, [Using and Administering Linux—Zero to SysAdmin][6]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/automation-bash-scripts + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: http://www.both.org/?page_id=903 +[3]: https://opensource.com/article/19/10/programming-bash-syntax-tools +[4]: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions +[5]: https://opensource.com/article/19/10/programming-bash-loops +[6]: http://www.both.org/?page_id=1183 From 1036858aeb668cc7fc9db05e5a56d4d8d18ac48d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:15:16 +0800 Subject: [PATCH 157/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191218=20Linux?= =?UTF-8?q?=20desktops=20for=20minimalists:=20Getting=20started=20with=20L?= =?UTF-8?q?XQt=20and=20LXDE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191218 Linux desktops for minimalists- Getting started with LXQt and LXDE.md --- ...sts- Getting started with LXQt and LXDE.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20191218 Linux desktops for minimalists- Getting started with LXQt and LXDE.md diff --git a/sources/tech/20191218 Linux desktops for minimalists- Getting started with LXQt and LXDE.md b/sources/tech/20191218 Linux desktops for minimalists- Getting started with LXQt and LXDE.md new file mode 100644 index 0000000000..4d12d6c268 --- /dev/null +++ b/sources/tech/20191218 Linux desktops for minimalists- Getting started with LXQt and LXDE.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux desktops for minimalists: Getting started with LXQt and LXDE) +[#]: via: (https://opensource.com/article/19/12/lxqt-lxde-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux desktops for minimalists: Getting started with LXQt and LXDE +====== +This article is part of a special series of 24 days of Linux desktops. +Both LXDE and LXQt aim to provide a lightweight desktop for users who +either need it or just prefer it, with minimal setup or configuration +required. +![Penguins walking on the beach ][1] + +Preserving and resurrecting old computers is a popular part of the Linux hacker's ethos, and one way to help make that possible is with a desktop environment that doesn't use up scarce system resources. After all, the fact that a current version of Linux can run effectively on a computer over 15 years old is quite a feat, but it doesn't make the CPU and RAM any better than the day they were slotted in. There are extremely light desktops available, but there's usually a catch: the user must assemble the parts. Fortunately, a number of lightweight desktops have appeared over the years in an attempt to provide a fast and light desktop with no setup required. + +Two early implementations of this idea were [LXDE][2] and [Razor-qt][3], the former based on GTK (the libraries used by GNOME) and the latter based on Qt (the libraries used by KDE). Coincidentally, the lead maintainer of LXDE discovered [the bliss that is Qt development][4] and decided to port (just as a side project!) the entire desktop to Qt. LXDE, the Qt port of it, and the Razor-qt project were combined to form [LXQt][5], although today, LXDE and LXQt coexist as separate projects. + +Whether you use LXDE or LXQt, their goals are the same: to provide a lightweight desktop for users who either need it or just prefer it, with minimal setup or configuration required. These are drop-in desktops for any Linux or BSD system, whether it's 15 years old, or a new Raspberry Pi, or a hefty workstation that was just assembled. I used LXQt for this article, but everything apart from the GUI toolkit and some application names applies equally to LXQt and LXDE. + +![LXQt on CentOS][6] + +You may find LXQt or LXDE included your distribution's software repository, or you can download and install a distribution that ships LXQt or LXDE as a default desktop. Before you do, though, be aware that an LX* desktop is meant to provide a full desktop experience, so many applications are installed along with the desktop. If you're already running another desktop, you may find yourself with redundant applications (two PDF readers, two media players, two file managers, and so on). If you just want to try the LXQt or LXDE desktop, consider using a desktop virtualization application, such as [GNOME Boxes][7]. + +After installing, log out of your current desktop session so you can log into your new desktop. By default, your session manager (KDM, GDM, or LightDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +With GDM: + +![][8] + +With SDDM: + +![][9] + +### LXQt and LXDE desktop tour + +The desktop layout has a classic look that's familiar to anyone who's used KDE's Plasma desktop or, realistically, any computer within the past two decades. There's an application menu in the lower-left corner, a taskbar for pinned and active applications, and a system tray in the lower-right corner. Because this is a full desktop environment, a few lightweight but robust applications are included. There's a text editor, an excellent file manager called PCManFM on LXDE and PCManFM-Qt on LXQt, configuration panels, a terminal, theme settings, and so on. + +![LXDE desktop on Fedora][10] + +The goal, aside from being light on resources, is to be intuitive, and these desktops excel at that. This isn't the place to look for an innovative new desktop design. The LXDE and LXQt desktops feel like they've been around forever, gliding through user actions with ease, finding just the right balance between explanatory prompts and minimal design. All the default settings are sensible, and 90% of what most users need to do on a desktop is covered (I'm reserving a conservative 10% for unique personal tastes that nobody expects any desktop to guess). + +### To LXDE or to LXQt + +Linux power users know GTK from Qt and sometimes even _care_ about which one they use, but it seems everyone admits it's down to personal taste and, in the end, doesn't actually matter. If you have no preference between GTK and Qt, then whether you use LXDE or LXQt may as well be a flip of a coin. They each have the same admirable goal: to provide a full desktop experience to any Linux computer that needs one, regardless of processor power or amount of RAM. If you're a fan of simplicity, then both desktops will appeal to you, and you're likely to settle into the defaults without spending hours customizing or rearranging anything at all. Sometimes it's refreshing to not care about the details and get straight to work. LXDE and LXQt are determined to bring that convenience to you, so give one a try. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/lxqt-lxde-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/community-penguins-osdc-lead.png?itok=BmqsAF4A (Penguins walking on the beach ) +[2]: http://lxde.org +[3]: https://web.archive.org/web/20160220061334/http://razor-qt.org/ +[4]: https://opensource.com/article/17/4/pyqt-versus-wxpython +[5]: http://lxqt.org +[6]: https://opensource.com/sites/default/files/uploads/advent-lxqt-file.jpg (LXQt on CentOS) +[7]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[8]: https://opensource.com/sites/default/files/advent-gdm_1.jpg +[9]: https://opensource.com/sites/default/files/advent-kdm_0.jpg +[10]: https://opensource.com/sites/default/files/uploads/advent-lxde.jpg (LXDE desktop on Fedora) From e9cc7149c0041b6f2401af1360e3d1dd9b492f7e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:15:37 +0800 Subject: [PATCH 158/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191218=20Emacs?= =?UTF-8?q?=20for=20Vim=20users:=20Getting=20started=20with=20the=20Spacem?= =?UTF-8?q?acs=20text=20editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191218 Emacs for Vim users- Getting started with the Spacemacs text editor.md --- ... started with the Spacemacs text editor.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20191218 Emacs for Vim users- Getting started with the Spacemacs text editor.md diff --git a/sources/tech/20191218 Emacs for Vim users- Getting started with the Spacemacs text editor.md b/sources/tech/20191218 Emacs for Vim users- Getting started with the Spacemacs text editor.md new file mode 100644 index 0000000000..a5782451e1 --- /dev/null +++ b/sources/tech/20191218 Emacs for Vim users- Getting started with the Spacemacs text editor.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Emacs for Vim users: Getting started with the Spacemacs text editor) +[#]: via: (https://opensource.com/article/19/12/spacemacs) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Emacs for Vim users: Getting started with the Spacemacs text editor +====== +Spacemacs offers all the power of Emacs combined with the keystroke +commands and functionality you are used to in Vim. +![Hands programming][1] + +I use [Vim][2] a lot. I'm a site reliability engineer (SRE), and Vim is the one thing I know I can access on every machine in our fleet. I also like [Emacs][3], with its wide variety of useful packages, ease of extending, and its many built-in tools. Because they each have their own set of commands, I have to actively switch codes in my head (usually after typing **:wq** in Emacs or trying to **C+X** in Vim). The [Evil][4] package for Emacs helps quite a bit by making Emacs behave more like Vim, but there is some effort required to set it up the first time. + +### Enter Spacemacs + +![Spacemacs splash screen][5] + +[Spacemacs][6] is a set of configurations for Emacs that combines an easy setup, Evil, and a system to manage and set up additional Emacs packages with pre-built configurations to make them easier to use out of the box. + +### Installation and setup + +As I mentioned above, Spacemacs is easy to install. No, really: it takes just one command: + + +``` +`git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d` +``` + +Then just start Emacs. It will prompt you through the basic configuration options and generate a **.spacemacs** configuration file. The defaults are as safe as can be: Vim keybindings, Spacemacs' recommended packages, and the Helm search engine. When the configuration completes, you will see a help screen with some basic information and commands. + +![Spacemacs help screen][7] + +Now Spacemacs is set up and ready to go and will behave like Vim. You can start right away by entering **:e </path/to/file>** to open and edit a file and using good old **:wq** to save (among other commands). As a bonus, if you are a seasoned Emacs user, many of the commands you are used to are still there. + +### Using Spacemacs + +On the main splash screen, you'll notice a lot of information. There are buttons to update Spacemacs and the packages, access different forms of documentation, and open recently edited files. + +Whenever you're not in insert mode, you can press the **Space Bar** to bring up a menu of other available options. The default options include access to the Helm search engine and the basic functions for opening and editing files. As you add packages, they will also show up in the menu. In most special screens (i.e., those that are not a document you are editing), the **q** key will exit the screen. + +### Configuring Spacemacs + +Before getting into Spacemacs' configuration, you need to understand **layers**. Layers are self-contained configuration files that load on top of one another. A layer is comprised of the instructions to download and install the package and any dependencies, as well as the basic configuration and key mappings for the package. + +Spacemacs has quite a few [layers available][8], and more are being added all the time. You can find the complete list in the **~/.emacs.d/layers** directory tree. They are organized by type; to use one, just add it in the main **.spacemacs** configuration file to the **dotspacemacs-configuration-layers** list. + +I generally enable the Git, Version-Control, Markdown, and Colors (theme support) layers. If you are familiar with configuring Emacs, you can also add custom configurations in [Lisp][9] to the **dotspacemacs/user-config** section. + +You can also enable a Nyan Cat progress bar by adding the following line in your layers list: + + +``` +`(colors :variables colors-enable-nyan-cat-progress-bar t)` +``` + +  + +![Nyan Cat progress bar in Spacemacs][10] + +### Using Org mode in Spacemacs + +One of my other favorite layers is [Org mode][11], probably one of the most popular notes, to-do, and project management applications in the open source world. + +To install Org, just open up the **.spacemacs** file and uncomment the line for **org** under **dotspacemacs-configuration-layers**. + +![Installing Org mode in Spacemacs][12] + +Exit and restart Emacs, and it will download the Org packages and set them up. Type **Space Bar+a**, and you see a new menu item for Org with the hotkey **o**, and the common Org functions—agenda, to-do list, etc.—are under that menu. They are  blank until you configure the default Org files. The easiest way to do that is with the built-in Emacs configuration tool, which you can access by typing **Space Bar+?** and searching for **Customize**. When the Customize screen opens, search for **org-agenda-files**. Add a file or two to the list (I used **~/todo.org** and **~/notes.org**), click Apply and Save, then exit Customize. + +![Emacs Customize tool in Spacemacs][13] + +Next, create a file so that Org can read them into the agenda and to-do list. Even if the file is blank, that's OK—it just has to exist. Since I added two files—todo.org and notes.org—to my configuration, I can type **:e todo.org** and **:e notes.org** to open both, and then **:w** to save the blank files. + +Next, enter the Org agenda with **Space Bar+a+o+a** or the Org to-do list with **Space Bar+a+o+t**. If you have added actionable items or scheduled events to the notes or to-do files, you will see them now. You can find out more about Org's structure and syntax in _[Get started with Org mode without Emacs][14]_ or on the [Org mode][11] website. + +![Spacemacs todo.org and the Org todo agenda][15] + +Spacemacs offers all the power of Emacs combined with the keystroke commands and functionality you are used to with Vim. Give it a try, and please let me know what you think in the comments. + +This is a short list of my favorite graphical text editors for Linux that can be classified as IDE... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/spacemacs + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/emacs +[4]: https://www.emacswiki.org/emacs/Evil +[5]: https://opensource.com/sites/default/files/uploads/spacemacs_spash.png (Spacemacs splash screen) +[6]: https://www.spacemacs.org/ +[7]: https://opensource.com/sites/default/files/uploads/spacemacs_help.png (Spacemacs help screen) +[8]: https://www.spacemacs.org/layers/LAYERS.html +[9]: https://en.wikipedia.org/wiki/Lisp_(programming_language) +[10]: https://opensource.com/sites/default/files/uploads/nyan-cat-progress.png (Nyan Cat progress bar in Spacemacs) +[11]: https://orgmode.org +[12]: https://opensource.com/sites/default/files/uploads/spacemacs_org_change.png (Installing Org mode in Spacemacs) +[13]: https://opensource.com/sites/default/files/uploads/emacs_customize.png (Emacs Customize tool in Spacemacs) +[14]: https://opensource.com/article/19/1/productivity-tool-org-mode +[15]: https://opensource.com/sites/default/files/uploads/spacemacs_org.png (Spacemacs todo.org and the Org todo agenda) From 46899453501a6ec078e0ccdb4d6a7d7dfbff0bad Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:15:59 +0800 Subject: [PATCH 159/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191217=205=20in?= =?UTF-8?q?terview=20questions=20every=20Kubernetes=20job=20candidate=20sh?= =?UTF-8?q?ould=20know?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md --- ...ry Kubernetes job candidate should know.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md diff --git a/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md b/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md new file mode 100644 index 0000000000..4b08d6f2dd --- /dev/null +++ b/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 interview questions every Kubernetes job candidate should know) +[#]: via: (https://opensource.com/article/19/12/kubernetes-interview-questions) +[#]: author: (Jessica Repka https://opensource.com/users/jrepka) + +5 interview questions every Kubernetes job candidate should know +====== +If you're interviewing people for Kubernetes-related roles, here's what +to ask and why it matters. +![Pair programming][1] + +Job interviews are hard for people on both sides of the table, but I've discovered that interviewing candidates for Kubernetes-related jobs has seemed especially hard lately. Why, you ask? For one thing, it's hard to find someone who can answer some of my questions. Also, it has been hard to confirm whether they have the right experience, regardless of their answers to my questions. + +I'll skip over my musings on that topic and get to some questions that you should ask of any job candidate who would be working with [Kubernetes][2]. + +### What is Kubernetes? + +I've always found this question to be one of the best ones to ask in interviews. I always hear, "I work with Kubernetes," but when I ask, "what is it?" I never get a confident answer. + +My favorite answer is from [Chris Short][3]: "Just an API with some YAML files." + +While he is not wrong, I'll give you a more detailed version. Kubernetes is a portable container orchestration tool that is used to automate the tasks of managing, monitoring, scaling, and deploying containerized applications. + +I've found that "an orchestration tool for deploying containerized applications" is probably as good as you're going to get as an answer, which in my opinion is good enough. While many believe Kubernetes adds a great deal more, overall, it offers many APIs to add to this core feature: container orchestration. + +In my opinion, this is one of the best questions you can ask in an interview, as it at least proves whether the candidate knows what Kubernetes is. + +### What is the difference between a Kubernetes node and a pod? + +This question reveals a great first look at the complexity of Kubernetes. It shifts the conversation to an architectural overview and can lead to many interesting follow-up details. It has also been explained incorrectly to me an innumerable amount of times. + +A [node][4] is the worker machine. This machine can be a virtual machine (VM) or a physical machine, depending on whether you are running on a hypervisor or on bare metal. The node contains services to run containers, including the kubelet, kube-proxy, and container runtime. + +A [pod][5] includes (1) one or more containers (2) with shared network (3) and storage (4) and the specification on how to run the containers deployed together. All four of these details are important. For bonus points, an applicant could mention that, technically, a pod is the smallest deployable unit Kubernetes can create and manage—not a container. + +The best short answer I've received for this question is: "The node is the worker, and the pod is the thing the containers are in." The distinction matters. Most of a Kubernetes administrator's job depends on knowing when to deploy what, and nodes can be very, very expensive, depending on where they are run. I wouldn't want someone deploying nodes over and over when what they needed to do was deploy a bunch of pods. + +### What is kubectl? (And how do you pronounce it?) + +This question is one of my higher priority questions, but it may not be relevant for you and your team. In my organization, we don't use a graphical interface to manage our Kubernetes environments, which means command-line actions are all we do. + +So what is [kubectl][6]? It is the command-line interface to Kubernetes. You can get and set anything from there, from gathering logs and events to editing deployments and secrets. It's always helpful to pop in a random question about how to use this tool to test the interviewee's familiarity with kubectl. + +How do you pronounce it? Well, that's up to you (there's a big disagreement on the matter), but I will gladly point you to this great video presentation by my friend [Waldo][7]. + +### What is a namespace? + +I haven't received an answer to this question on multiple interviews. I am not sure that namespaces are used as often in other environments as they are in the organization I work in. I'll give a short answer here: a namespace is a virtual cluster in a pod. This abstraction is what enables you to keep several virtual clusters in various environments for isolation purposes. + +### What is a container? + +It always helps to know what is being deployed in your pod, because what's a deployment without knowing what you're deploying in it? A container is a standard unit of software that packages up code and all its dependencies. Two optional secondary answers I have received and am OK with include: a) a slimmed-down image of an OS and b) an application running in a limited OS environment. Bonus points if you can name orchestration software that uses containers other than [Docker][8], like your favorite public cloud's container service. + +### Other questions + +If you're wondering why I didn't add more to this list of questions, I have an easy answer for you: these are the minimum set of things _you_ should know when you are asking candidates interview questions. The next set of questions should come from a large list of questions based on your specific team, environment, and organization. As you think through these, try to find interesting questions about how technology interacts with each other to see how people think through infrastructure challenges. Think about recent challenges your team had (outages), ask to walk through deployments step-by-step, or about strategies to improve something your team actively wants to improve (like a reduction to deployment time). The less abstract the questions, the more your asking about skills that will actually matter after the interview. + +**[Read more: [How to prepare for a Kubernetes job interview]][9]** + +No two environments will be the same, and this also applies when you are interviewing people. I mix up questions in every interview. I also have a small environment I can use to test interviewees. I always find that answering the questions is the easiest part, and doing the work is the real test you need to give. + +My last bit of advice for anyone giving interviews: If you meet someone who has potential but none of the experience, give them a chance to prove themselves. I wouldn't have the knowledge and experience I have today if someone hadn't seen the potential of what I could do and given me an opportunity. + +What are other important questions to ask interviewees about Kubernetes? Please add your list in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/kubernetes-interview-questions + +作者:[Jessica Repka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1 (Pair programming) +[2]: https://kubernetes.io/ +[3]: https://twitter.com/ChrisShort +[4]: https://kubernetes.io/docs/concepts/architecture/nodes/ +[5]: https://kubernetes.io/docs/concepts/workloads/pods/pod/ +[6]: https://kubernetes.io/docs/reference/kubectl/kubectl/ +[7]: https://opensource.com/article/18/12/kubectl-definitive-pronunciation-guide +[8]: https://opensource.com/resources/what-docker +[9]: https://enterprisersproject.com/article/2019/2/kubernetes-job-interview-questions-how-prepare From dc3f80ccbdddf31037b00f312135a164e8df0ef3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:16:22 +0800 Subject: [PATCH 160/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191217=20How=20?= =?UTF-8?q?open=20source=20eases=20the=20shift=20to=20a=20hybrid=20cloud?= =?UTF-8?q?=20strategy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191217 How open source eases the shift to a hybrid cloud strategy.md --- ...es the shift to a hybrid cloud strategy.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/tech/20191217 How open source eases the shift to a hybrid cloud strategy.md diff --git a/sources/tech/20191217 How open source eases the shift to a hybrid cloud strategy.md b/sources/tech/20191217 How open source eases the shift to a hybrid cloud strategy.md new file mode 100644 index 0000000000..8e732f31b9 --- /dev/null +++ b/sources/tech/20191217 How open source eases the shift to a hybrid cloud strategy.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How open source eases the shift to a hybrid cloud strategy) +[#]: via: (https://opensource.com/article/19/12/open-source-hybrid-cloud) +[#]: author: (Bart Copeland https://opensource.com/users/bartcopeland) + +How open source eases the shift to a hybrid cloud strategy +====== +Open source software is key to adopting a multicloud or hybrid cloud +strategy. +![Person on top of a mountain, arm raise][1] + +Cloud adoption continues to grow as organizations seek to move away from legacy and monolithic strategies. Cloud-specific spending is expected to grow at more than six times the rate of general IT spending through 2020, according to [McKinsey Research][2]. But cloud adoption raises fear of [vendor lock-in][3], which is preventing many companies from going all-in on public cloud. This has led to a rise in multi-cloud and hybrid cloud deployments, which also have their challenges. + +Open source technology is the key to unlocking the value in a hybrid and multi-cloud strategy. + +### What's the appeal of a hybrid cloud strategy? + +The hybrid cloud market is growing rapidly because it offers the benefits of the cloud without some of the drawbacks. It typically costs less to move storage to the cloud than it does to maintain a private data center. At the same time, there are certain mission-critical applications and/or sensitive data that an organization may still want to keep on-premise, which is why hybrid cloud–a mix of private and public, on-prem and off-prem–is appealing. + +This is why [58 percent of enterprises][4] have a hybrid cloud strategy, according to the Rightscale State of the Cloud 2019 report. It is also why IBM acquired Red Hat for the kingly sum of $34 billion. IBM CEO Ginni Rometty noted at the time that hybrid cloud is a $1 trillion market and that IBM’s goal is to be number one in that market. + +### Common challenges of moving to a hybrid cloud strategy + +One challenge is the lack of a strategic plan. According to [McKinsey Research][2], many companies fall into the trap of thinking that simply moving IT systems to the cloud is equivalent to a transformational digital strategy. The "lift and shift" approach is not enough to enjoy all the benefits of the cloud, though. + +Cybersecurity applications provide a good case in point. The traditional perimeter approach to security won’t translate well to the cloud, whose approach must be quite different since a cloud perimeter is nearly impossible to define. If organizations are relying on legacy perimeter security to keep their holdings in the cloud safe, they are in for a nasty surprise. + +Another challenge to effective cloud migration is the status quo. For many companies, it comes down to the mindset of "If it’s not broken, why fix it? If it works fine as it is, why move it?" While many organizations understand the need for and benefits of having newer applications in the cloud, it’s not always obvious whether it also makes sense to move legacy applications over, too. In the case of cybersecurity, it very well may not be, but other applications may be best served with a move to the cloud. + +To further complicate matters, public cloud providers like Microsoft Azure, Google Cloud, and AWS [are not immune to outages][5]. Whatever the reason for downtime–a database glitch, bad weather, overzealous security features–being able to share workloads across clouds can be key in the event of an outage. + +### Bringing it all together with open source + +Hybrid cloud and open source go hand-in-hand. In fact, many of the public cloud providers rely heavily on different open source technologies and technology stacks to run them, so open source can be used easily across both private and public clouds in most situations. Companies like [Red Hat][6], in fact, were built on the concept of facilitating hybrid cloud. Many of its customers are moving toward an open hybrid cloud strategy. + +This is, in part, because open source provides flexibility and helps avoid the issues of cloud vendor lock-in. In addition, open source technologies bring breadth and depth for managers and developers alike; they give developers the tools they enjoy using. + +Though the cloud market is growing quickly, it is not without its limitations and drawbacks. The majority of enterprises have what they call a hybrid cloud strategy, but it may be less strategic than they think since the "lift and shift" approach falls short. Mindsets need to shift as well to overcome the status quo, and organizations need to guard against cloud outages. + +Vital to a multi-cloud approach is managing distributed workloads. Modern software architecture methodologies break monolithic applications into microservices that can be run wherever it makes sense–on-premise, in the cloud, or across both. By leveraging open source technologies from Linux to containers to Kubernetes, organizations can deploy, run and manage workloads in a secure and optimized manner. This kind of open source approach allows organizations to derive benefits far beyond just "lift and shift" in order to become more efficient, run their processes more cost-effectively, and adopt a more flexible operating model. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/open-source-hybrid-cloud + +作者:[Bart Copeland][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bartcopeland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/developer_mountain_cloud_top_strong_win.jpg?itok=axK3EX-q (Person on top of a mountain, arm raise) +[2]: https://www.mckinsey.com/business-functions/mckinsey-digital/our-insights/cloud-adoption-to-accelerate-it-modernization +[3]: https://searchconvergedinfrastructure.techtarget.com/definition/vendor-lock-in +[4]: https://www.flexera.com/about-us/press-center/rightscale-2019-state-of-the-cloud-report-from-flexera-identifies-cloud-adoption-trends.html +[5]: https://www.crn.com/slide-shows/cloud/the-10-biggest-cloud-outages-of-2018 +[6]: https://siliconangle.com/2019/04/12/red-hat-strategy-validated-as-open-hybrid-cloud-goes-mainstream-googlenext19/ From 50e5112f79cf2d967f3104962fae33e88148e503 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:16:49 +0800 Subject: [PATCH 161/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191217=20Build?= =?UTF-8?q?=20a=20retro=20Apple=20desktop=20with=20the=20Linux=20MLVWM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md --- ...etro Apple desktop with the Linux MLVWM.md | 220 ++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md diff --git a/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md b/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md new file mode 100644 index 0000000000..fb92f01ed6 --- /dev/null +++ b/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md @@ -0,0 +1,220 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a retro Apple desktop with the Linux MLVWM) +[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Build a retro Apple desktop with the Linux MLVWM +====== +This article is part of a special series of 24 days of Linux desktops. +What if old-school Apple computers were built around open source POSIX? +You can find out by building the Macintosh-like Virtual Window Manager. +![Person typing on a 1980's computer][1] + +Imagine traveling into an alternate history where the Apple II GS and MacOS 7 were built upon open source [POSIX][2], using all the same conventions as modern Linux, like plain-text configuration files and modular system design. What would such an OS have enabled for its users? You can answer these questions (and more!) with the [Macintosh-like Virtual Window Manager (MLVWM)][3]. + +![MLVWM running on Slackware 14.2][4] + +### Installing MLVWM + +MLVWM is not an easy installation, and it's probably not in your distribution's software repository. If you have the time to decipher a poorly translated README file, edit some configuration files, gather and resize some old **.xpm** images, and edit an Xorg preference or two, then you can experience MLVWM. Otherwise, this is a novelty window manager with its latest release back in 2000. + +To compile MLVWM, you must have **imake** installed, which provides the **xmkmf** command. You can install imake from your distribution's software repository, or get it directly from [Freedesktop.org][5]. Assuming you have the **xmkmf** command, change into the directory containing the MLVWM source code, and run these commands to build it: + + +``` +$ xmkmf -a +$ make +``` + +After building, the compiled **mlvwm** binary is located in the **mlvwm** directory. Move it to any location [in your path][6] to install it: + + +``` +`$ mv mlvwm/mlvwm /usr/local/bin/` +``` + +#### Editing the config files + +MLVWM is now installed, but it won't launch correctly without adjusting several configuration files and carefully arranging required image files. Sample config files are located in the **sample_rc** directory of the source code you downloaded. Copy the files **Mlvwm-Netscape** and **Mlvwm-Xterm** to your home directory: + + +``` +`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME` +``` + +Move the **Mlvwmrc** file to **$HOME/.mlvwmrc** (yes, you must use a lower-case "m" even though the sample file deceptively begins with a capital letter): + + +``` +`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc` +``` + +Open **.mlwmrc** and find lines 54–55, which define the path (the "IconPath") for the pixmap images that MLVWM uses in its menus and UI: + + +``` +# Set icon search path. It needs before "Style". +IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap +``` + +Adjust the path to match a directory you will fill with your own images (I suggest using **$HOME/.local/share/pixmaps**). MLVWM doesn't provide pixmaps, so it's up to you to provide pixmap icons for the desktop you're building. + +Do this even if you have pixmaps located elsewhere on your system (such as **/usr/share/pixmaps**), because you're going to have to adjust the size of the pixmaps, and you probably don't want to do that on a system-wide level. + + +``` +# Set icon search path. It needs before "Style". +IconPath /home/seth/.local/share/pixmaps +``` + +#### Choosing the pixmaps + +You've defined the **.local/share/pixmaps** directory as the source of pixmaps, but neither the directory nor the images exist yet. Create the directory: + + +``` +`$ mkdir -p $HOME/.local/share/pixmaps` +``` + +Right now, the config file assigns images to menu entries and UI elements, but none of those images exist on your system. To fix this, read through the configuration file and locate every **.xpm** image. For each image listed in the config, add an image with the same file name (or change the file name in the config file) to your IconPath directory. + +The **.mlvwmrc** file is well commented, so you can get a general idea of what you're editing. This is just a first pass, anyway. You can always come back and change the look of your desktop later. + +Here are some examples. + +This code block sets the icon in the upper-left corner of the screen: + + +``` +# Register the menu +Menu Apple, Icon label1.xpm, Stick +``` + +The **label1.xpm** image is actually provided in the source code download's **pixmap** directory, but I prefer to use **Penguin.xpm** from **/usr/share/pixmaps** (on Slackware). Whatever you use, you must place your custom pixmap in **~/.local/share/pixmaps** and either change the pixmap's name in the configuration or rename the pixmap file to match what's currently in the config file. + +This code block defines the applications listed in the left menu: + + +``` +"About this Workstation..." NonSelect, Gray, Action About +"" NonSelect +"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls +"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm +"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm +END +``` + +By following the same syntax as what you see in the configuration file, you can customize the pixmaps and add your own applications to the menu (for instance, I changed **mule** to **emacs**). This is your gateway to your applications in the MLVWM GUI, so list everything you want quick access to. You may also wish to include a shortcut to your **/usr/share/applications** folder. + + +``` +`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications` +``` + +Once you're finished editing the configuration file and adding your own images to your IconPath directory, your pixmaps must all be resized to roughly 16x16 pixels. (MLVWM isn't consistent in its defaults, so there's room for variation.) You can do this as a bulk action using ImageMagick: + + +``` +`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done` +``` + +### Starting MLVWM + +The easiest way to get up and running with MLVWM is to let Xorg do the bulk of the work. First, you must create a **$HOME/.xinitrc** file. I borrowed this one from Slackware, which borrowed it from Xorg: + + +``` +#!/bin/sh +# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $ + +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +sysresources=/etc/X11/xinit/.Xresources +sysmodmap=/etc/X11/xinit/.Xmodmap + +# merge in defaults and keymaps + +if [ -f $sysresources ]; then +    xrdb -merge $sysresources +fi + +if [ -f $sysmodmap ]; then +    xmodmap $sysmodmap +fi + +if [ -f $userresources ]; then +    xrdb -merge $userresources +fi + +if [ -f $usermodmap ]; then +    xmodmap $usermodmap +fi + +# Start the window manager: +if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then +  exec ck-launch-session /usr/local/bin/mlvwm +else +  exec /usr/local/bin/mlvwm +fi +``` + +According to this file, the default action for the **startx** command is to launch MLVWM. However, your distribution may have other ideas about what happens when your graphic server launches (or is killed to be restarted), so this file may do you little good. On many distributions, you can add a **.desktop** file to **/usr/share/xsessions** to have it listed in the GDM or KDM menu, so create a file called **mlvwm.desktop** and enter this text: + + +``` +[Desktop Entry] +Name=Mlvwm +Comment=Macintosh-like virtual window manager +Exec=/usr/local/bin/mlvwm +TryExec=ck-launch-session /usr/local/bin/mlvwm +Type=Application +``` + +Log out from your desktop session and log back into MLVWM. By default, your session manager (KDM, GDM, or LightDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +With GDM: + +![][7] + +With SDDM: + +![][8] + +#### Launching with brute force + +If MLVWM fails to start, try installing XDM, a lightweight session manager that doesn't look at **/usr/share/xsessions** and instead just does whatever the authenticated user's **.xinitrc** proscribes. + +![MLVWM][9] + +### Build your own retro Apple + +The MLVWM desktop is unpolished, imperfect, accurate, and loads of fun. Many of the menu options you see are unimplemented, but you can make them active and meaningful. + +This is your chance to step back in time, change history, and make the old-school Apple line of computers a bastion of open source. Be a revisionist, design your own retro Apple desktop, and, most importantly, have fun. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-mlvwm-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html +[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2) +[5]: http://cgit.freedesktop.org/xorg/util/imake +[6]: https://opensource.com/article/17/6/set-path-linux +[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg +[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg +[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM) From 73213157003346902f680892b739b4a89dafe587 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:17:14 +0800 Subject: [PATCH 162/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191217=20X=20fa?= =?UTF-8?q?ctor:=20Populating=20the=20globe=20with=20open=20leaders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191217 X factor- Populating the globe with open leaders.md --- ... Populating the globe with open leaders.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20191217 X factor- Populating the globe with open leaders.md diff --git a/sources/tech/20191217 X factor- Populating the globe with open leaders.md b/sources/tech/20191217 X factor- Populating the globe with open leaders.md new file mode 100644 index 0000000000..ee58b9f2d1 --- /dev/null +++ b/sources/tech/20191217 X factor- Populating the globe with open leaders.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (X factor: Populating the globe with open leaders) +[#]: via: (https://opensource.com/open-organization/19/12/open-leaders-x-mozilla) +[#]: author: (chadsansing https://opensource.com/users/csansing) + +X factor: Populating the globe with open leaders +====== +Open Leaders X, a growing program supported by Mozilla, aims to +cultivate leaders who think and act openly—all over the world. +![Leaders are catalysts][1] + +At Mozilla, we think of open leadership as a set of principles, practices, and skills people can use to mobilize their communities to solve shared problems and achieve shared goals. Open leaders design and build projects that empower others to collaborate within inclusive communities. + +[Mozilla's Open Leaders program][2] connects and trains leaders from around the world whose communities can help one another address the challenges and opportunities they face in creating a healthier internet, more trustworthy AI, and better online lives for all. + +### Starting small + +Open Leaders began in 2016 with a face-to-face meeting between dozens of scientists interested in creating more open labs, datasets, methods, and communications. Their passion, questions, and insights helped shape "working open workshops," which quickly developed into an open leadership curriculum reaching hundreds of people online—from all across the open ecosystem. + +What began as a small, collaborative inquiry into the nature and possibilities of open science has become a thriving community of open leaders helping one another infuse their projects and cultures with the principles and practices of openness. + +While [Mozilla staffers][3] have historically organized the program, returning graduates have served as the experts, mentors, and community call co-hosts of each subsequent round of programming, contributing their time and expertise back to the program and its participants. They have also helped us at Mozilla better participate in discussions of engagement, value exchange, sustainability, power-sharing, care, and labor (among many, many other interwoven open topics). + +We are humbled by the notion that a meeting of 25 like-minded people dedicated to opening their practice in science has become a network of hundreds of leaders working to connect their home communities and parts of the open ecosystem—like open art, campaigning, data, education, hardware, government, and software—with the [internet health movement][4] and the push for more [trustworthy AI][5]. + +### Growing up + +At Mozilla, we think of open leadership as a set of principles, practices, and skills people can use to mobilize their communities to solve shared problems and achieve shared goals. + +As we tried to think of how best to bring core lessons from the Open Leaders program to the global MozFest community while also sustaining the program, we organized the most recent round of Open Leaders—the last we'll organize for now—as a train-the-trainer program. Working with program graduates, Mozilla staff and fellows, and [leads from 10 different community projects][6], we co-designed Open Leaders X (OLx) to help community members run, connect, and sustain their own open leadership programs. We hoped that by distributing the development and ownership of Open Leaders across the open ecosystem and internet health movement, we could ensure its survival and strengthen its development through community co-ownership. This would allow each program to tailor itself to the needs, challenges, and opportunities each group faces. + +We are so proud of the entire Open Leaders community and especially grateful to our OLx leads and contributors, who took the plunge with us and dove into this new train-the-trainer model. Rather than close the loop on Open Leaders, the decision to make it a community-driven program continues its upward spiral. + +In October, we brought together nearly all 30 of our OLx leads at [MozFest 2019][7], the momentous 10th anniversary of the festival. They launched their programs and issued their calls for applications, as well as their invitations to community members (like you!) to serve as mentors, experts, and guest speakers for each program. In 2020, these 30 leads and their 10 projects will welcome the next 200 open leaders into the community and the internet health movement. + +We look forward to all the new connections we'll make together between these new Open Leaders cohorts and the burgeoning MozFest community. Our goal is to help people across these communities stay connected and engaged with both one another and the open, federated principles and practices of MozFest all year long. + +We can't wait to collaborate, learn together and to discover what's next for Open Leaders, internet health, and more trustworthy AI. + +You are invited to join this work and all of its challenges, learning, and fun! Watch the OLx launch party videos and find links to each program [online][8]! + +You can also check out the [OLx syllabus][9]. You can even look further back at the most recent Open Leaders syllabi from round 7, both the [project track][10] and the [culture track][11]. You can visit [Mozilla Pulse][12], as well, to keep track of each project and [sign up for our newsletter][13] to keep up with our latest programming. + +We hope you'll join the Open Leaders community and visit us at the next MozFest! We can't wait to collaborate, learn together and to discover what's next for Open Leaders, internet health, and more trustworthy AI. + +My theme this week is organizational openness and transparency and today I'd like to highlight a... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/12/open-leaders-x-mozilla + +作者:[chadsansing][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/csansing +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/leaderscatalysts.jpg?itok=f8CwHiKm (Leaders are catalysts) +[2]: https://foundation.mozilla.org/en/opportunity/mozilla-open-leaders/ +[3]: https://foundation.mozilla.org/en/initiatives/open-leadership-events/who-we-are/ +[4]: https://internethealthreport.org/ +[5]: https://medium.com/read-write-participate/update-digging-deeper-on-trustworthy-ai-588fcd01a321 +[6]: https://medium.com/read-write-participate/meet-the-open-leaders-x-cohort-1dc230a4c56a +[7]: https://mozillafestival.org +[8]: https://foundation.mozilla.org/en/blog/streaming-week-open-leaders-x/ +[9]: https://docs.google.com/document/d/1rKvMn0uXSoLvOj7t1jEW9JkQePqhGRu37V1YEMeV8Nw/edit +[10]: https://docs.google.com/document/d/1G_opVoiO1VXlfjs-xvbbHVaF97jZBE3DH-DWxAEqtT4/edit?usp=sharing +[11]: https://docs.google.com/document/d/1dpH_LPZQ2FTUbK1y1tIDrJfYvesFp3Ivwqp1_jju-5E/edit#heading=h.5qlxraoq91j2 +[12]: https://www.mozillapulse.org/projects?keyword=olx +[13]: https://foundation.mozilla.org/en/initiatives/open-leadership-events/ From f6f3646eb4a780dc514dcd2d69d848532723edea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:19:22 +0800 Subject: [PATCH 163/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191218=20Cisco:?= =?UTF-8?q?=205=20hot=20networking=20trends=20for=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191218 Cisco- 5 hot networking trends for 2020.md --- ...Cisco- 5 hot networking trends for 2020.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 sources/talk/20191218 Cisco- 5 hot networking trends for 2020.md diff --git a/sources/talk/20191218 Cisco- 5 hot networking trends for 2020.md b/sources/talk/20191218 Cisco- 5 hot networking trends for 2020.md new file mode 100644 index 0000000000..81f942c347 --- /dev/null +++ b/sources/talk/20191218 Cisco- 5 hot networking trends for 2020.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cisco: 5 hot networking trends for 2020) +[#]: via: (https://www.networkworld.com/article/3505883/cisco-5-hot-networking-trends-for-2020.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Cisco: 5 hot networking trends for 2020 +====== +Cisco exec says SD-WAN, Wi-Fi 6, multi-domain control, virtual networking and the evolving role of network engineers will be big in 2020 +Thinkstock + +[Hot trends][1] in networking for the coming year include [SD-WAN][2], [Wi-Fi 6][3], multi-domain control, virtual networking and the evolving role of the network engineer into that of a network progrmmer, at least according to [Cisco][4]. + +They revolve around the changing shape of networking in general, that is the broadening of [data-center][5] operations into the cloud and the implications of that change, said Anand Oswal, senior vice president of engineering in Cisco’s Enterprise Networking Business. + +“These fundamental shifts in where business processes run and how they’re accessed, is changing how we connect our locations together, how we think about security, the economics of networking, and what we ask of the people who take care of them,” Oswal said. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +[See more predictions about what's big in IT tech for the coming year.][7] + +In [blog][8] outlining the key trends for 2020, Oswal detailed his thoughts about the five areas. + +### Wi-Fi 6 and 5G + +First up, wireless technology – especially Wi-Fi 6 – will get into the enterprise through the employee door and through enterprise access-point refreshes. The latest smartphones from Apple, Samsung, and other manufacturers are Wi-Fi 6 enabled, and Wi-Fi 6 access points are currently shipping to businesses and consumers. + +5G phones are not yet in wide circulation, although that will begin to change in 2020, athough mostly for consumers and towards the end of the year. Oswal wrote that Cisco projects more people will be using Wi-Fi 6 than 5G through 2020.   + +2020 will also see the beginning of a big improvement in how people use Wi-Fi networks. The potential growth of the Cisco-lead OpenRoaming project will make joining participating Wi-Fi networks much easier, Oswal said. [OpenRoaming][9], which uses the underlying technology behind HotSpot 2.0/ IEEE 802.11u promises to let users move seamlessly between wireless networks and LTE without interruption -- emulating mobile network connectivity. Current project partners include Samsung, Boingo, and GlobalReach Technologies. + +2020 will also see the adoption of new frequency bands, including the beginning of the rollout of “millimeter wave” (24Ghz to 100Ghz) spectrum for ultra-fast, but short-range 5G as well as Citizens Broadband Radio Service (CBRS), at about 3.5Ghz. This may lead to new _private_ networks that use LTE and 5G technology, especially for IoT applications. + +“We will also see continued progress in opening up the 6GHz range for unlicensed Wi-Fi usage in the United States and the rest of world,” Oswal wrote. + +As for [5G][10] services, some will roll out in 2020 but “almost none of it will be the ultra-high speed connectivity that we have been promised or that we will see in future years,” Oswal said. “With 5G unable to deliver on that promise initially, we will see a lot of high-speed wireless traffic offloaded to Wi-Fi networks.” + +In the long run, “In combination with the improved performance of both Wi-Fi 6 and (eventually) 5G, we are in for a large – and long-lived – period of innovation in access networking,” Oswal wrote. + +### It’s a SD-WAN world + +“We are seeing a ton of momentum in the SD-WAN area as large numbers of companies need secure access to cloud applications,” Oswal said. The dispersal of connectivity – the growth of multicloud networking – will force many businesses to re-tool their networks in favor of SD-WAN technology, he said. + +“Meanwhile the large cloud service providers, like [Amazon, Google, and  Microsoft][1], are connecting to networking companies – like Cisco – to forge deep partnership links between networking stacks and services,” Oswal wrote.   + +Oswal said he expects such partnerships will only deepen next year, and that concurs with recent analysis by Gartner.   + +“SD-WAN is replacing routing and adding application-aware path selection among multiple links, centralized orchestration and native security, as well as other functions. Consequently, it includes incumbent and emerging vendors from multiple markets (namely routing, security, WAN optimization and SD-WAN), each bringing its own differentiators and limitations,” [Gartner wrote][11] in a recent report. + +In addition Oswal said SD-WAN technology is going to lead to a growth in business for managed service providers (MSPs), many more of which will begin to offer SD-WAN as a service. + +“We expect MSPs to grow at about double the rate of the SD-WAN market itself, and expect that MSPs will begin to hyper-specialize, by industry and network size,” Oswal wrote. + +### All-inclusive multi-domain networks + +In the Cisco world, blending typically siloed domains across the enterprise and cloud to the wide-area network is getting easier, and Oswal says that will continue in 2020. The idea is that its key software components – [Application Centric Infrastructure (ACI) and DNA Center][12] – now enable what Cisco calls multidomain integration, which lets customers set policies to apply uniform access controls to users, devices and applications regardless of where they connect to the network. + +ACI is [Cisco’s software-defined networking][13] ([SDN][13]) data-center package, but it also delivers the company’s intent-based networking technology, which brings customers the ability to automatically implement network and policy changes on the fly and ensure data delivery. + +DNA Center is a key package as it features automation capabilities, assurance setting, fabric provisioning and policy-based segmentation for enterprise networks. Cisco DNA Center gives IT teams the ability to control access through policies using software-defined access (SD-Access), automatically provision through Cisco DNA Automation, virtualize devices through Cisco Network Functions Virtualization (NFV), and lower security risks through segmentation and encrypted traffic analysis. + +“For better management, agility, and especially for security, these multiple domains need to work together,” Oswal wrote. “Each domain’s controller needs to work in a coordinated manner to enable automation, analytics and security across the various domains.” + +The next generation of controller-first architectures for network fabrics allows the unified management of loosely coupled systems using APIs and defined data structures for inter-device and inter-domain communication, Oswal wrote. “The intent-based networking model that enterprises began adopting in 2019 is making network management more straightforward by absorbing the complexities of the network,” he wrote. + +### The network as sensor + +The notion of the [network being used for something more important][14] than speeds and feeds has been talked about for a while, but the idea may be coming home to roost next year.  + +“With software that is able to profile and classify the devices, end points, and applications – even when they are sending fully encrypted data – the network will be able to place the devices into virtual networks automatically, enable the correct rule set to protect those devices, and eventually identify security issues extremely quickly,” Oswal wrote. + +“Ultimately, systems will be able to remediate issues on their own, or at least file their own help-desk tickets. This becomes increasingly important as networks grow increasingly complex.” + +Oswal said this intelligence could prove useful in wireless networks where the network can collect data on how people and things move through and use physical spaces, such as IoT devices in a business or medical devices in a hospital. + +“That data can directly help facility owners optimize their physical spaces, for productivity, ease of navigation, or even to improve retail sales,” Oswal wrote. “These are capabilities that have been rolling out in 2019, but as business execs become aware of the power of this location data, the use of this technology will begin to snowball.” + +### The network engineer career change + +The growing software-oriented network environment is changing the resume requirements of network professional.  “The standard way that network operators work – provisioning network equipment using command-line interfaces like CLI – is nearing the end of the line,” Oswal wrote. “Today, _intent-based networking_ lets us tell the network what we want it to do, and leave the individual device configuration to the larger system itself.” + +Oswal said customers can now  program updates, rollouts, and changes using centralized networking controllers*,* rather than working directly with devices or their own unique interfaces. + +“New networks run by APIs require programming skills to manage,” Oswal wrote.  “Code is the resource behind the creation of new business solutions. It remains critical for individuals to validate their proficiency with new infrastructure and network engineering concepts.” + +Oswal noted that it will not be an easy change because retraining individuals or whole teams can be  expensive, and not everyone will adapt to the new order. + +“For those that do, the benefits are big,” Oswal said. “Network operators will be closer to the businesses they work for, able to better help businesses achieve their digital transformations. The speed and agility they gain thanks to having a programmable network, plus telemetry and analytics, opens up vast new opportunities.” + +This year [Cisco revamped some of its most critical certification][15] and career-development tools in an effort to address the emerging software-oriented network environment. Perhaps one of the biggest additions is the [new set of professional certifications][16] for developers utilizing Cisco’s growing DevNet developer community.    + +The Cisco Certified DevNet Associate, Specialist and Professional certifications will cover software development for applications, automation, DevOps, cloud and IoT. They will also target software developers and network engineers who develop software proficiency to develop applications and automated workflows for operational networks and infrastructure.    + +Join the Network World communities on [Facebook][17] and [LinkedIn][18] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3505883/cisco-5-hot-networking-trends-for-2020.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3489938/what-s-hot-at-the-edge-for-2020-everything.html +[2]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[3]: https://www.networkworld.com/article/3258807/what-is-802-11ax-wi-fi-and-what-will-it-mean-for-802-11ac.html +[4]: https://www.networkworld.com/article/3487831/what-s-hot-for-cisco-in-2020.html +[5]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.networkworld.com/article/3488562/whats-big-in-it-tech-for-the-coming-year.html +[8]: https://blogs.cisco.com/enterprise/enterprise-networking-in-2020-5-trends-to-watch +[9]: https://blogs.cisco.com/wireless/openroaming-seamless-across-wi-fi-6-and-5g?oid=psten016624 +[10]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[11]: https://www.networkworld.com/article/3489480/secure-sd-wan-the-security-vendors-and-their-sd-wan-offerings.html +[12]: https://www.networkworld.com/article/3401523/cisco-software-to-make-networks-smarter-safer-more-manageable.html +[13]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html +[14]: https://www.networkworld.com/article/3400382/cisco-will-use-aiml-to-boost-intent-based-networking.html +[15]: https://www.networkworld.com/article/3401524/cisco-launches-a-developer-community-cert-program.html +[16]: https://www.networkworld.com/article/3446044/are-new-cisco-certs-too-much-network-pros-react.html +[17]: https://www.facebook.com/NetworkWorld/ +[18]: https://www.linkedin.com/company/network-world From 597e6001533b713292775d780eacbad4831e3c14 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:21:07 +0800 Subject: [PATCH 164/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191218=20How=20?= =?UTF-8?q?to=20tell=20if=20you=E2=80=99re=20using=20a=20bash=20builtin=20?= =?UTF-8?q?in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191218 How to tell if you-re using a bash builtin in Linux.md --- ...if you-re using a bash builtin in Linux.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sources/tech/20191218 How to tell if you-re using a bash builtin in Linux.md diff --git a/sources/tech/20191218 How to tell if you-re using a bash builtin in Linux.md b/sources/tech/20191218 How to tell if you-re using a bash builtin in Linux.md new file mode 100644 index 0000000000..466dde98c7 --- /dev/null +++ b/sources/tech/20191218 How to tell if you-re using a bash builtin in Linux.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to tell if you’re using a bash builtin in Linux) +[#]: via: (https://www.networkworld.com/article/3505818/how-to-tell-if-youre-using-a-bash-builtin-in-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to tell if you’re using a bash builtin in Linux +====== +A built-in is a Linux command that's part of whatever shell you're using. Can you tell what commands are built-ins and which are not? +Guenter Guni / Getty Images + +If you’re not sure if you’re running a Linux command or you’re using a bash builtin, don’t stress, it isn’t all that obvious. In fact, you can get very used to commands like **cd** without realizing that they’re part of your shell, unlike commands like **date** and **whoami** that invoke executables (**/bin/date** and **/usr/bin/whoami**). + +Builtins in general are commands that are built into shell interpreters, and bash is especially rich in them, which is a good thing because built-ins by their very nature run a bit faster than commands which have to be loaded into memory when you call them into play. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +In other words, some commands are built into the shell because they pretty much have to be. After all, a command like **cd** needs to change the shell’s view of the world – or at least its perspective on the file system. Others provide the shell with its special ability to loop and evaluate data – like **case**, **for** and **while** commands. In short, these commands make the shell what it is for all of its devoted users. Still others just make commands run a little faster. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +To get a list of bash built-ins, all you have to type is “help”. + +``` +$ help +GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu) +These shell commands are defined internally. Type `help' to see this list. +Type `help name' to find out more about the function `name'. +Use `info bash' to find out more about the shell in general. +Use `man -k' or `info' to find out more about commands not in this list. + +A star (*) next to a name means that the command is disabled. + + job_spec [&] history [-c] [-d offset] [n] or history -an> + (( expression )) if COMMANDS; then COMMANDS; [ elif COMMANDS> + . filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -x comm> + : kill [-s sigspec | -n signum | -sigspec] pi> + [ arg... ] let arg [arg ...] + [[ expression ]] local [option] name[=value] ... + alias [-p] [name[=value] ... ] logout [n] + bg [job_spec ...] mapfile [-d delim] [-n count] [-O origin] [> + bind [-lpsvPSVX] [-m keymap] [-f filename] [> popd [-n] [+N | -N] + break [n] printf [-v var] format [arguments] + builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir] + caller [expr] pwd [-LP] + case WORD in [PATTERN [| PATTERN]...) COMMAN> read [-ers] [-a array] [-d delim] [-i text]> + cd [-L|[-P [-e]] [-@]] [dir] readarray [-d delim] [-n count] [-O origin]> + command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] or reado> + compgen [-abcdefgjksuv] [-o option] [-A acti> return [n] + complete [-abcdefgjksuv] [-pr] [-DEI] [-o op> select NAME [in WORDS ... ;] do COMMANDS; d> + compopt [-o|+o option] [-DEI] [name ...] set [-abefhkmnptuvxBCHP] [-o option-name] [> + continue [n] shift [n] + coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...] + declare [-aAfFgilnrtux] [-p] [name[=value] .> source filename [arguments] + dirs [-clpv] [+N] [-N] suspend [-f] + disown [-h] [-ar] [jobspec ... | pid ...] test [expr] + echo [-neE] [arg ...] time [-p] pipeline + enable [-a] [-dnps] [-f filename] [name ...> times + eval [arg ...] trap [-lp] [[arg] signal_spec ...] + exec [-cl] [-a name] [command [arguments ...> true + exit [n] type [-afptP] name [name ...] + export [-fn] [name[=value] ...] or export -> typeset [-aAfFgilnrtux] [-p] name[=value] .> + false ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] + fc [-e ename] [-lnr] [first] [last] or fc -s> umask [-p] [-S] [mode] + fg [job_spec] unalias [-a] name [name ...] + for NAME [in WORDS ... ] ; do COMMANDS; don> unset [-f] [-v] [-n] [name ...] + for (( exp1; exp2; exp3 )); do COMMANDS; don> until COMMANDS; do COMMANDS; done + function name { COMMANDS ; } or name () { CO> variables - Names and meanings of some shel> + getopts optstring name [arg] wait [-fn] [id ...] + hash [-lr] [-p pathname] [-dt] [name ...] while COMMANDS; do COMMANDS; done + help [-dms] [pattern ...] { COMMANDS ; } +``` + +You might notice that some of these built-ins (e.g., **echo** and **kill**) also exist as executables. + +``` +$ ls -l /bin/echo /bin/kill +-rwxr-xr-x 1 root root 39256 Sep 5 06:38 /bin/echo +-rwxr-xr-x 1 root root 30952 Aug 8 12:46 /bin/kill +``` + +One quick way to determine whether the command you are using is a bash built-in or not is to use the command “command”. Yes, the command is called “command”. Try it with a **-V** (capital V) option like this: + +``` +$ command -V command +command is a shell builtin +$ command -V echo +echo is a shell builtin +$ command -V date +date is hashed (/bin/date) +``` + +When you see a “command is hashed” message like the one above, that means that the command has been put into a hash table for quicker lookup. + +### **Looking for help in other shells** + +If you switch shells and try running “help”, you’ll notice that some support this command and others do not. You can run a command like this in bash to see what each of the shells on your system will tell you: + +``` +for shell in `ls /bin/*sh` +do + echo $shell + $shell -c "help" + echo =============== +done +``` + +This loop will try running the help command in each of the shells in /bin. The $shell -c (e.g., zsh -c) syntax will run just the single help command in that shell and then exit. + +### How to tell what shell you're currently using + +If you switch shells you can’t depend on $SHELL to tell you what shell you’re currently using because $SHELL is just an environment variable that is set when you log in and doesn't necessarily reflect your current shell. Try **ps -p $$** instead as shown in these examples: + +``` +$ ps -p $$ + PID TTY TIME CMD +18340 pts/0 00:00:00 bash <== +$ /bin/dash +$ ps -p $$ + PID TTY TIME CMD +19517 pts/0 00:00:00 dash <== +``` + +Built-ins are extremely useful and give each shell a lot of its character. If you use some particular shell all of the time, it’s easy to lose track of which commands are part of your shell and which are not. Differentiating a shell built-in from a Linux executable requires only a little extra effort. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3505818/how-to-tell-if-youre-using-a-bash-builtin-in-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 8557530554bbd0f786616f216b084749b76d9c08 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 19 Dec 2019 01:49:28 +0800 Subject: [PATCH 165/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191217=20SD-WAN?= =?UTF-8?q?=20management=20means=20more=20than=20reviewing=20logs=20and=20?= =?UTF-8?q?parsing=20events?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191217 SD-WAN management means more than reviewing logs and parsing events.md --- ... than reviewing logs and parsing events.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/talk/20191217 SD-WAN management means more than reviewing logs and parsing events.md diff --git a/sources/talk/20191217 SD-WAN management means more than reviewing logs and parsing events.md b/sources/talk/20191217 SD-WAN management means more than reviewing logs and parsing events.md new file mode 100644 index 0000000000..89a9e3acc9 --- /dev/null +++ b/sources/talk/20191217 SD-WAN management means more than reviewing logs and parsing events.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SD-WAN management means more than reviewing logs and parsing events) +[#]: via: (https://www.networkworld.com/article/3490333/sd-wan-management-means-more-than-reviewing-logs-and-parsing-events.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +SD-WAN management means more than reviewing logs and parsing events +====== +Creating a single view of the different types of data requires specialized skills, custom integration and a significant budget. Just look at the SIEM. +Getty Images + +By creating a single view of all network data, you can do things better like correlating threat information to identify real attacks or keep a log of packet statistics to better diagnose intermittent networking problems. + +However, to turn data into value with the limitations of traditional systems, we must be creative with the solution. We must find ways to integrate the different repositories in various appliances. It’s not an easy task but an architectural shift that I’ve written about in the past, SASE (Secure Access Service Edge), should help significantly. + +SASE is a new enterprise networking technology category introduced by Gartner in 2019. It represents a change in how we connect our sites, users, and cloud resources. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +This can be of considerable support, especially when it comes to the challenges faced with SIEM (Security Information and Event Management). + +### Creating a single view is challenging + +Creating a single view of the different types of data requires specialized skills, custom integration, and a significant budget. The SIEM is used to bring data from multiple products, apply rules and orchestrate a variety of platforms to act together. In reality, there is a lot of custom integration involved. + +The questions that surface is; how do logs get into the SIEM when off the network? How do you normalize the data, write the rules to detect for suspicious activity and then investigate if there are legitimate alerts? Unfortunately, the results are terrible for the investment that people make. The SIEM can’t be performed in a small organization. You will need the resources to pull it off. + +### Challenges with the SIEM + +In a previous consultancy role, I experienced first-hand the challenges of running a SIEM. Ultimately, the company had to improve its security monitoring. Like most, they came across the same problem and recognized there was a big gap when it came to detection. + +[The time of 5G is almost here][2] + +When I first came across the potentials of the SIEM, like most, I was thoroughly excited by its hype. Now, there was a tool that allowed me to take my ideas and run them against numerous rich data sets. From these sets, I could get immediately gain insight into threats on the network and act. However, this is far from reality - the SIEM is complex. + +### Different data from different devices + +Both security and networking store and expose data differently. Each of them carries out an individual role and have access to different data. Data can be abstracted from the management, control and data planes to build analytics that can be queried. This results in multiple levels of data available for analysis. Essentially, for this, you need to be an expert in each of these planes. + +Preparing all the data gathered from your entire infrastructure is complicated. Developing a timeline of events requires mastering a range of protocols and APIs just to retrieve the necessary data from networking and security appliances. Therefore, it can be a challenge to find the right data for your problem. + +### First, you need to collect the right data + +Firstly, you need to collect the right data - the SIEM is only as good as the data you feed it with. This emerges the urge for the right data that needs to get loaded to the SIEM. Since the data available with SIEM rules is provided from logs and event data from other software products, the quality of the data comes down to what was first chosen to be logged. This is compounded by the accuracy/availability of the SIEM vendor's connector. + +The data may be fed into the SIEM with Syslog, which requires parsing, loss of data and context from the original source. Evidently, a lot of the times, the SIEM is loaded with useless data. Many often stumble with this first step. + +### Aggregate the data + +When new threats materialize, it’s challenging to gather more data to support the new detection rules. There is also a long lead time associated with collecting new data and putting the brakes on agility. In short, the SIEM requires extensive data collection infrastructure and inter-team collaboration. + +### Normalize the data + +There will also be some kind of normalizing event where the data is cleaned up. Here, data interpretation and normalization technologies are needed to store the event data in a common format for analysis. + +A big claim-to-fame for the SIEM products is that they normalize data input. If you examine a windows security event, there is a big distinction between each of these events. Therefore, it’s recommended not to count on the SIEM products to interpret the inputs they receive. + +### No investigation support + +The SIEM has no investigation support. Hence, once the data is in your SIEM, you must be the one to tell the SIEM what to do with it. It’s like buying an alarm clock without the batteries. Consider an intrusion detection system, we all know that a skilled analyst is required to translate the output into actionable intelligence; a SIEM is no different. + +Typically, the SIEM rules are targeted for detecting the activities of interest rather than investigating them. For example, an event can only tell you that a file was uploaded. However, it tells nothing about what type of site it was uploaded to, where it came from and what the file was. + +This, predominantly, involves investigation between the security analyst and the operations team. Performing the querying and utilizing this information requires specialized skills and knowledge. + +### Deployment/resource-heavy + +A lot of resources are spent to manage SIEM. Time is needed for deploying agents, parsing logs, or performing the upgrade. Concisely, SIEM technology requires 24x7 monitoring and maintenance. By and large, the SIEM takes too long to deploy and some of these stages can even take years to complete. You really need a handful of full-time security analysts to do this. As it stands, there is a worldwide shortage of experienced security analysts. + +### Point solutions address one issue + +The way networking and security have been geared up is that we are sold everything in pieces. We have point solutions that only address one issue. Then there are servers, routers, switches and a variety of security devices. When a device operates within its own domain, it will only see that domain. Therefore, these point solutions need to be integrated so the user can form a picture of what is happening on the network. + +Consider an IDS, it looks at individual packets and tries to ascertain whether there is a threat or not. Practically, it does not have a holistic overall view of what is truly happening in networking. So, when you actually identity there was a problem, you simply don’t have the right information at hand to identify who the user is, what it does and what happened. + +For threat investigation, the user will need to log on to other systems and glue the information. This will result in a high number of false positives in a world that already has alert-fatigue. + +### How SASE can help – a common datastore + +Significantly, SASE converges the functions of both networking and security into a unified and global cloud-native service. Therefore, it pulls data from both the domains into a common data store. There are of course many benefits to this but one of the substantial benefits is troubleshooting. + +SASE vendors could make it very easy to drill deep into the networking and security events that should already be stored and normalized in a common data warehouse. SASE unlocks the potential for super-efficient troubleshooting without the pain of deploying a SIEM. + +A case in point is Cato network’s recent announcement of [Cato Instant*Insight][3]. The new feature to its SASE platform provides a single tool for mining the security and networking event data generated across a customer’s Cato instance. That’s how SASE helps. Profoundly, everything becomes easier when your networking and security data is being gathered by one platform. + +With data pulled together, investigation and analysis become easier. Cato Instant*Insight, for example, organizes the millions of networking and security events tracked by Cato into a single and queryable timeline. Here we have an automated aggregation, faceted search, and a built-in network analysis workbench. + +[Netsurion][4], another SD-WAN vendor, provides a managed SIEM service. This is offered as SOC-as-a-Service. However, with this and other managed SIEMs, there may still be a strong separation between the network domain and a security domain. In the sense that they’re only gathering security data and not network data. Therefore, both NOC and SOC teams have a fragmented view. And the common challenge for the enterprise will still remain. + +With the SIEM, there is no such thing as delivering visibility out-of-the-box. Realistically, it requires extensive custom integration and development. For many companies, SIEMs wasn’t feasible. The integration costs were just too high and too much time was needed to gather baseline data. + +But that’s all premised on a misconception that you continue to build your network from the appliances from different vendors. If you were to replace appliances with a converged cloud infrastructure, then you eliminate much of the challenge of the SIEM. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][5]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3490333/sd-wan-management-means-more-than-reviewing-logs-and-parsing-events.html + +作者:[Matt Conran][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.networkworld.com/article/3354477/mobile-world-congress-the-time-of-5g-is-almost-here.html +[3]: https://www.catonetworks.com/news/it-managers-analyze-1-million-events-in-1-second-at-no-charge-with-cato-instant-insight/ +[4]: https://www.netsurion.com/solutions/threat-protection +[5]: https://www.networkworld.com/contributor-network/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 84f79f5ab98446490a215d7229c4eefcd2184a5e Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 19 Dec 2019 08:52:35 +0800 Subject: [PATCH 166/676] translated --- ...rted with Lumina for your Linux desktop.md | 73 ------------------- ...rted with Lumina for your Linux desktop.md | 67 +++++++++++++++++ 2 files changed, 67 insertions(+), 73 deletions(-) delete mode 100644 sources/tech/20191214 Get started with Lumina for your Linux desktop.md create mode 100644 translated/tech/20191214 Get started with Lumina for your Linux desktop.md diff --git a/sources/tech/20191214 Get started with Lumina for your Linux desktop.md b/sources/tech/20191214 Get started with Lumina for your Linux desktop.md deleted file mode 100644 index c624b43d71..0000000000 --- a/sources/tech/20191214 Get started with Lumina for your Linux desktop.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with Lumina for your Linux desktop) -[#]: via: (https://opensource.com/article/19/12/linux-lumina-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Get started with Lumina for your Linux desktop -====== -This article is part of a special series of 24 days of Linux desktops. -The Lumina desktop is a shortcut to a quick and sensible Fluxbox-based -desktop with all the things you can't live without. -![Lightbulb][1] - -For a good number of years, there was a desktop operating system (OS) based on FreeBSD called PC-BSD. It was intended as an OS for general use, which was noteworthy because BSD development mostly focuses on servers. For most of its life, PC-BSD shipped with the KDE desktop by default, but the more KDE came to depend on Linux-specific technology, the more PC-BSD migrated away from it. PC-BSD became [Trident][2], and its default desktop is [Lumina][3], a collection of widgets written to use the same Qt toolkit that KDE is based upon, running on the Fluxbox window manager. - -You may find the Lumina desktop in your Linux distribution's software repository or in BSD's ports tree. If you install Lumina and you're already running another desktop, you may find yourself with redundant applications (two PDF readers, two file managers, and so on) because Lumina includes a few integrated applications. If you just want to try the Lumina desktop, you can install a Lumina-based BSD distribution in a virtual machine, such as [GNOME Boxes][4]. - -If you install Lumina on your current OS, you must log out of your current desktop session so you can log into your new one. By default, your session manager (SDDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -With GDM: - -![Selecting your desktop in GDM][5] - -With SDDM: - -![Selecting your desktop in KDM][6] - -### Lumina desktop - -Lumina delivers a simple and lightweight desktop environment. There's a panel at the bottom of the screen containing an application menu on the left, a taskbar in the middle, and a system tray on the right. There are icons on the desktop providing quick access to common applications and locations. - -In addition to this basic desktop structure, Lumina features a custom file manager, PDF viewer, screenshot tool, media player, text editor, and archive tool. There's also a configuration utility to help you customize your Lumina desktop, and you can find further configuration options by right-clicking on the desktop. - -![Lumina desktop running on Project Trident][7] - -Lumina is very similar to several Linux lightweight desktops, especially LXQT, except without any reliance upon Linux-based desktop frameworks like ConsoleKit, PolicyKit, D-Bus, or systemd. Whether or not that holds any advantage for you depends on the OS you're running. After all, if you're already running Linux with access to those features, using a desktop that doesn't utilize them may not make much sense and cost you features. If you're running BSD, then running Fluxbox with Lumina widgets could mean not having to install the Linux-compatible libraries from ports. - -### Why you should use Lumina - -Lumina is simple enough in design that it doesn't have many features you can't implement on your own by installing Fluxbox along with your favorite components ([PCManFM][8] for file management, a variety of [LXQt apps][9], [Tint2][10] for a panel, and so on). But this is open source, and users of open source love to find ways to avoid reinventing the wheel (almost as much as we love reinventing the wheel). - -The Lumina desktop is a shortcut to a quick and sensible Fluxbox-based desktop with all the things you can't live without and very few of the finer details you'll want to configure yourself. Give the Lumina desktop a try to see if it's the desktop for you. - -KDE originally stood for Kool Desktop Environment, but is now known by many as the K Desktop... - -A brief overview of PC-BSD and thoughts about the distribution. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/linux-lumina-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb) -[2]: https://project-trident.org/ -[3]: https://lumina-desktop.org/ -[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization -[5]: https://opensource.com/sites/default/files/uploads/advent-gdm_400x400_1.jpg (Selecting your desktop in GDM) -[6]: https://opensource.com/sites/default/files/uploads/advent-kdm_400x400_1.jpg (Selecting your desktop in KDM) -[7]: https://opensource.com/sites/default/files/uploads/advent-lumina.jpg (Lumina desktop running on Project Trident) -[8]: https://wiki.lxde.org/en/PCManFM -[9]: http://lxqt.org -[10]: https://opensource.com/article/19/1/productivity-tool-tint2 diff --git a/translated/tech/20191214 Get started with Lumina for your Linux desktop.md b/translated/tech/20191214 Get started with Lumina for your Linux desktop.md new file mode 100644 index 0000000000..d1520e3b5c --- /dev/null +++ b/translated/tech/20191214 Get started with Lumina for your Linux desktop.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Lumina for your Linux desktop) +[#]: via: (https://opensource.com/article/19/12/linux-lumina-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在 Linux 桌面中开始使用 Lumina +====== +本文是 24 天 Linux 桌面特别系列的一部分。Lumina 是快速、合理的基于 Fluxbox 的快捷方式桌面,它具有你无法缺少的所有功能。 +![Lightbulb][1] + +多年来,有一个基于 FreeBSD 的桌面操作系统(OS),称为 PC-BSD。它旨在作为一般使用的系统,因此值得注意,因为 BSD 主要用于服务器。大多数时候,PC-BSD 默认带 KDE 桌面,但是 KDE 越来越依赖于 Linux 特定的技术,因此有越来越多的 PC-BSD 从中迁移出来。PC-BSD 变成了 [Trident][2],它的默认桌面是 [Lumina][3],它是一组小部件,它们使用与 KDE 相同的基于 Qt 的工具箱,运行在 Fluxbox 窗口管理器中。 + +你可以在 Linux 发行版的软件仓库或 BSD 的 port 树中找到 Lumina 桌面。如果你安装了 Lumina 并且已经在运行另一个桌面,那么你可能会发现有冗余的应用(两个 PDF 阅读器、两个文件管理器,等等),因为 Lumina 包含一些集成的应用。如果你只想尝试 Lumina 桌面,那么可以在虚拟机如 [GNOME Boxes][4] 中安装基于 Lumina 的 BSD 发行版。 + +如果在当前的操作系统上安装 Lumina,那么必须注销当前的桌面会话,才能登录到新的会话。默认情况下,会话管理器(SDDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 + +在 GDM 中: + +![Selecting your desktop in GDM][5] + +在 SDDM 中: + +![Selecting your desktop in KDM][6] + +### Lumina 桌面 + +Lumina 提供了一个简单而轻巧的桌面环境。屏幕底部有一个面板,它的左侧是应用菜单,中间是任务栏,右边是系统托盘。桌面上有图标,可以快速访问常见的应用和路径。 + +除了这个基本的桌面结构外,Lumina 还有自定义文件管理器、PDF 查看器,截图工具、媒体播放器、文本编辑器和存档工具。还有一个配置程序可以帮助你自定义 Lumina 桌面,并且右键单击桌面可以找到更多配置选项。 + +![Lumina desktop running on Project Trident][7] + +Lumina 与几个 Linux 轻量级桌面非常相似,尤其是 LXQT,不同之处在于 Lumina 完全不依赖于基于 Linux 的桌面框架,例如 ConsoleKit、PolicyKit、D-Bus 或 systemd。对于你而言,这是否具有优势取决于所运行的操作系统。毕竟,如果你运行的是可以访问这些功能的 Linux,那么使用不使用这些特性的桌面可能就没有多大意义,还会减少功能。如果你运行的是 BSD,那么在 Fluxbox 中运行 Lumina 部件意味着你不必从 port 安装 Linux 兼容库。 + +### 为什么要使用 Lumina + +Lumina 设计简单,没有很多功能,你无法通过安装 Fluxbox 以及自己喜欢的组件来实现([PCManFM][8] 用于文件管理、各种 [LXQt 应用][9 ]、[Tint2][10] 面板等)。但它是开源的,开源用户喜欢寻找避免重复发明轮子的方法(几乎与我们喜欢重新发明轮子一样多)。 + +Lumina 桌面是快速而合理的基于 Fluxbox 的桌面快捷方式,它具有你无法缺少的所有功能,并且你很少需要调整细节。试一试 Lumina 桌面,看看它是否适合你。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-lumina-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb) +[2]: https://project-trident.org/ +[3]: https://lumina-desktop.org/ +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://opensource.com/sites/default/files/uploads/advent-gdm_400x400_1.jpg (Selecting your desktop in GDM) +[6]: https://opensource.com/sites/default/files/uploads/advent-kdm_400x400_1.jpg (Selecting your desktop in KDM) +[7]: https://opensource.com/sites/default/files/uploads/advent-lumina.jpg (Lumina desktop running on Project Trident) +[8]: https://wiki.lxde.org/en/PCManFM +[9]: http://lxqt.org +[10]: https://opensource.com/article/19/1/productivity-tool-tint2 From 0fdbda53b9a9a7a28786e963baee82080681764c Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 19 Dec 2019 09:05:54 +0800 Subject: [PATCH 167/676] translating --- sources/tech/20191210 Customize your Linux desktop with FVWM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191210 Customize your Linux desktop with FVWM.md b/sources/tech/20191210 Customize your Linux desktop with FVWM.md index 2e49ce787a..f238fdc121 100644 --- a/sources/tech/20191210 Customize your Linux desktop with FVWM.md +++ b/sources/tech/20191210 Customize your Linux desktop with FVWM.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 771d0c73ef8c8b9ea533df9cbf204a1b37d20ef9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 19 Dec 2019 09:43:58 +0800 Subject: [PATCH 168/676] Rename sources/tech/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md to sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md --- ...19.3 -Tricia- Released- Here-s What-s New and How to Get it.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md (100%) diff --git a/sources/tech/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md b/sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md similarity index 100% rename from sources/tech/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md rename to sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md From 10c043a9302732f72c76cfe5795c560e8ae2da01 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 19 Dec 2019 09:50:46 +0800 Subject: [PATCH 169/676] PRF --- ...Snippets To Pastebin-like Services From Commandline.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md index 1c60f5abfb..d594a03587 100644 --- a/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md +++ b/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Easily Upload Text Snippets To Pastebin-like Services From Commandline) @@ -12,7 +12,7 @@ ![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-720x340.png) -每当需要在线共享代码片段时,我们想到的第一个便是 Pastebin.com,这是 Paul Dixon 于 2002 年推出的在线文本共享网站。现在,有几种可供选择的文本共享服务可以上传和共享文本片段、错误日志、配置文件、命令输出或任何类型的文本文件。如果你碰巧经常使用各种类似于 Pastebin 的服务来共享代码,那么这对你来说确实是个好消息。向 Wgetpaste 打个招呼吧,它是一个命令行 BASH 实用程序,可轻松地将文本摘要上传到类似 pastebin 的服务中。使用 Wgetpaste 脚本,任何人都可以与自己的朋友、同事或想在类似 Unix 的系统中的命令行中查看/使用/查看代码的人快速共享文本片段。 +每当需要在线共享代码片段时,我们想到的第一个便是 Pastebin.com,这是 Paul Dixon 于 2002 年推出的在线文本共享网站。现在,有几种可供选择的文本共享服务可以上传和共享文本片段、错误日志、配置文件、命令输出或任何类型的文本文件。如果你碰巧经常使用各种类似于 Pastebin 的服务来共享代码,那么这对你来说确实是个好消息。向 Wgetpaste 打个招呼吧,它是一个命令行 BASH 实用程序,可轻松地将文本摘要上传到类似 Pastebin 的服务中。使用 Wgetpaste 脚本,任何人都可以与自己的朋友、同事或想在类似 Unix 的系统中的命令行中查看/使用/审查代码的人快速共享文本片段。 ### 安装 Wgetpaste @@ -84,7 +84,7 @@ Your paste can be seen here: https://paste.pound-python.org/show/eO0aQjTgExP0wT5 ![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-2.png) -你也可以使用 `tee` 命令显示粘贴的内容,而不是盲目地上传它们。 +你也可以使用 `tee` 命令显示粘贴的内容,而不是盲目地上传它们。 为此,请使用如下的 `-t` 选项。 @@ -233,7 +233,7 @@ via: https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-li 作者:[SK][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8ccd3cc3315818af64389b6c204a654d3b4ceb9b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 19 Dec 2019 09:51:20 +0800 Subject: [PATCH 170/676] PUB @wxy https://linux.cn/article-11691-1.html --- ...ext Snippets To Pastebin-like Services From Commandline.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md (99%) diff --git a/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/published/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md similarity index 99% rename from translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md rename to published/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md index d594a03587..d92f3a4b24 100644 --- a/translated/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md +++ b/published/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11691-1.html) [#]: subject: (Easily Upload Text Snippets To Pastebin-like Services From Commandline) [#]: via: (https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From ded3e9921a7cc8770f93c67ae6106f88e1871176 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 19 Dec 2019 10:50:49 +0800 Subject: [PATCH 171/676] PRF @LuuMing --- .../tech/20190322 Easy means easy to debug.md | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/translated/tech/20190322 Easy means easy to debug.md b/translated/tech/20190322 Easy means easy to debug.md index 58ac5ffcf6..32e02cfeb4 100644 --- a/translated/tech/20190322 Easy means easy to debug.md +++ b/translated/tech/20190322 Easy means easy to debug.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) -[#]: translator: ( luming) -[#]: reviewer: ( ) +[#]: translator: (LuuMing) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Easy means easy to debug) @@ -9,49 +9,54 @@ 简单就是易于调试 ====== -对于框架、库或者工具来说,怎样做才算是“简单”?也许有很多的定义,但我的理解通常是易于调试。我经常见到人们宣传某个特定的程序、框架、库、文件格式是简单的,因为它们会说“看,我只需要这么一点工作量就能够完成某项工作,这太简单了”。非常好,但并不完善。 + +对于框架、库或者工具来说,怎样做才算是“简单”?也许有很多的定义,但我的理解通常是**易于调试**。我经常见到人们宣传某个特定的程序、框架、库、文件格式或者其它什么东西是简单的,因为他们会说“看,我只需要这么一点工作量就能够完成某项工作,这太简单了”。非常好,但并不完善。 你可能只编写一次软件,但几乎总要经历好几个调试周期。注意我说的调试周期并不意味着“代码里面有 bug 你需要修复”,而是说“我需要再看一下这份代码来修复 bug”。为了调试代码,你需要理解它,因此“易于调试”延伸来讲就是“易于理解”。 -抽象使得程序易于编写,但往往是以难以理解为代价。有时候这是一个很好的折中,但通常不是。大体上,如果能使程序在日后易于理解和调试,我很乐意花更多的时间来写一些东西,因为这样可以省时间。 +抽象使得程序易于编写,但往往是以难以理解为代价。有时候这是一个很好的折中,但通常不是。大体上,如果能使程序在日后易于理解和调试,我很乐意花更多的时间来写一些东西,因为这样实际上更省时间。 -简洁并不是让程序易于调试的唯一方法,但它也许是最重要的。良好的文档也是,但不幸的是它太少了。(注意,质量并不取决于字数!) +简洁并不是让程序易于调试的**唯一**方法,但它也许是最重要的。良好的文档也是,但不幸的是好的文档太少了。(注意,质量并**不**取决于字数!) -这种影响是真是存在的。难以调试的程序会有更多的 bug,即使最初的 bug 数量与易于调试的程序完全相同,这简简单单是因为修复 bug 更加困难、更花时间。 +这种影响是真是存在的。难以调试的程序会有更多的 bug,即使最初的 bug 数量与易于调试的程序完全相同,而是因为修复 bug 更加困难、更花时间。 在公司的环境中,把时间花在难以修复的 bug 上通常被认为是不划算的投资。而在开源的环境下,人们花的时间会更少。(大多数项目都有一个或多个定期的维护者,但成百上千的贡献者提交的仅只是几个补丁) -这并不全是 1974 年由 Brian W. Kernighan 和 P. J. Plauger 合著的小说《编程风格的元素》中的观点: +--- + +这并不全是 1974 年由 Brian W. Kernighan 和 P. J. Plauger 合著的《编程风格的元素The Elements of Programming Style》中的观点: > 每个人都知道调试比起编写程序困难两倍。当你写程序的时候耍小聪明,那么将来应该怎么去调试? -我见过许多写起来精妙,但却导致难以调试的代码。我会在下面列出几种样例。争论这些东西本身有多坏并不是我的本意,我仅想强调对于“易于使用”和“易于调试”之间的折中。 - * ORM对象关系映射 库可以让数据库查询变得简单,代价是一旦你想解决某个问题,事情就变得难以理解。 +我见过许多看起来写起来“极尽精妙”,但却导致难以调试的代码。我会在下面列出几种样例。争论这些东西本身有多坏并不是我的本意,我仅想强调对于“易于使用”和“易于调试”之间的折中。 -* 许多测试框架让调试变得困难。Ruby 的 rspec 就是一个很好的例子。有一次我不小心使用错了,结果花了很长时间搞清楚哪里出了问题(因为它给出错误提示非常含糊)。 +* ORM对象关系映射 库可以让数据库查询变得简单,代价是一旦你想解决某个问题,事情就变得难以理解。 +* 许多测试框架让调试变得困难。Ruby 的 rspec 就是一个很好的例子。有一次我不小心使用错了,结果花了很长时间搞清楚**究竟**哪里出了问题(因为它给出错误提示非常含糊)。 -我在《[测试并非万能][1]》这篇文章中写了更多关于以上的例子。 - -* 我用过的许多 JavaScript 框架都很难完全理解。Clever(LCTT 译注:一种 JS 框架)的声明语句一向很有逻辑,直到某条语句和你的预期不符,这时你就只能指望 Stack Overflow 上的某篇文章或 GitHub 上的某个回帖来帮助你了。 - -这些函数库确实让任务变得非常简单,使用它们也没有什么错。但通常人们都过于关注“易于使用”而忽视了“易于调试”这一点。 + 我在《[测试并非万能][1]》这篇文章中写了更多关于以上的例子。 +* 我用过的许多 JavaScript 框架都很难完全理解。Clever(LCTT 译注:一种 JS 框架)的语句一向很有逻辑,直到某条语句不能如你预期的工作,这时你就只能指望 Stack Overflow 上的某篇文章或 GitHub 上的某个回帖来帮助你了。 + 这些函数库**确实**让任务变得非常简单,使用它们也没有什么错。但通常人们都过于关注“易于使用”而忽视了“易于调试”这一点。 * Docker 非常棒,并且让许多事情变得非常简单,直到你看到了这条提示: -``` + + ``` ERROR: for elasticsearch Cannot start service elasticsearch: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:258: applying cgroup configuration for process caused \"failed to write 898 to cgroup.procs: write /sys/fs/cgroup/cpu,cpuacct/docker/b13312efc203e518e3864fc3f9d00b4561168ebd4d9aad590cc56da610b8dd0e/cgroup.procs: invalid argument\"" ``` -或者这条: -``` + + 或者这条: + + ``` ERROR: for elasticsearch Cannot start service elasticsearch: EOF ``` -那么...现在看起来呢? + + 那么...你怎么看? * `Systemd` 比起 `SysV`、`init.d` 脚本更加简单,因为编写 `systemd` 单元文件比起编写 `shell` 脚本更加方便。这也是 Lennart Poetterin 在他的 [systemd 神话][2] 中解释 `systemd` 为何简单时使用的论点。 -我非常赞同 Poettering 的观点——也可以看 [shell 脚本陷阱][3] 这篇文章。但是这种角度并不全面。单元文件简单的背后意味着 `systemd` 作为一个整体要复杂的多,并且用户确实会受到它的影响。看看我遇到的这个[问题][4]和为它所做的[修复][5]。看起来很简单吗? + 我非常赞同 Poettering 的观点——也可以看 [shell 脚本陷阱][3] 这篇文章。但是这种角度并不全面。单元文件简单的背后意味着 `systemd` 作为一个整体要复杂的多,并且用户确实会受到它的影响。看看我遇到的这个[问题][4]和为它所做的[修复][5]。看起来很简单吗? -------------------------------------------------------------------------------- @@ -61,7 +66,7 @@ via: https://arp242.net/weblog/easy.html 作者:[Martin Tournoij][a] 选题:[lujun9972][b] 译者:[LuuMing](https://github.com/LuuMing) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -71,4 +76,4 @@ via: https://arp242.net/weblog/easy.html [2]: http://0pointer.de/blog/projects/the-biggest-myths.html [3]:https://www.arp242.net/shell-scripting-trap.html [4]:https://unix.stackexchange.com/q/185495/33645 -[5]:https://cgit.freedesktop.org/systemd/systemd/commit/?id=6e392c9c45643d106673c6643ac8bf4e65da13c1 \ No newline at end of file +[5]:https://cgit.freedesktop.org/systemd/systemd/commit/?id=6e392c9c45643d106673c6643ac8bf4e65da13c1 From f0782c92ebdfa0fc7da95f2fb3e7bde6e216206b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 19 Dec 2019 10:51:12 +0800 Subject: [PATCH 172/676] PUB @LuuMing https://linux.cn/article-11693-1.html --- .../tech => published}/20190322 Easy means easy to debug.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190322 Easy means easy to debug.md (98%) diff --git a/translated/tech/20190322 Easy means easy to debug.md b/published/20190322 Easy means easy to debug.md similarity index 98% rename from translated/tech/20190322 Easy means easy to debug.md rename to published/20190322 Easy means easy to debug.md index 32e02cfeb4..8777acf660 100644 --- a/translated/tech/20190322 Easy means easy to debug.md +++ b/published/20190322 Easy means easy to debug.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (LuuMing) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11693-1.html) [#]: subject: (Easy means easy to debug) [#]: via: (https://arp242.net/weblog/easy.html) [#]: author: (Martin Tournoij https://arp242.net/) From df3ba9257e13e3f1e2c55d2de369d454db03b02b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 19 Dec 2019 11:14:12 +0800 Subject: [PATCH 173/676] Rename sources/tech/20191217 How open source eases the shift to a hybrid cloud strategy.md to sources/talk/20191217 How open source eases the shift to a hybrid cloud strategy.md --- ... How open source eases the shift to a hybrid cloud strategy.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191217 How open source eases the shift to a hybrid cloud strategy.md (100%) diff --git a/sources/tech/20191217 How open source eases the shift to a hybrid cloud strategy.md b/sources/talk/20191217 How open source eases the shift to a hybrid cloud strategy.md similarity index 100% rename from sources/tech/20191217 How open source eases the shift to a hybrid cloud strategy.md rename to sources/talk/20191217 How open source eases the shift to a hybrid cloud strategy.md From 11535e1fd761ef5265ac3e1fb84b279d9a71ea5d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 19 Dec 2019 11:16:06 +0800 Subject: [PATCH 174/676] Rename sources/tech/20191217 X factor- Populating the globe with open leaders.md to sources/talk/20191217 X factor- Populating the globe with open leaders.md --- .../20191217 X factor- Populating the globe with open leaders.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191217 X factor- Populating the globe with open leaders.md (100%) diff --git a/sources/tech/20191217 X factor- Populating the globe with open leaders.md b/sources/talk/20191217 X factor- Populating the globe with open leaders.md similarity index 100% rename from sources/tech/20191217 X factor- Populating the globe with open leaders.md rename to sources/talk/20191217 X factor- Populating the globe with open leaders.md From c9ddc6259a2cc29d9b055200099cc3768b95ed4a Mon Sep 17 00:00:00 2001 From: Hank Chow <280630620@qq.com> Date: Thu, 19 Dec 2019 13:32:13 +0800 Subject: [PATCH 175/676] hankchow translated --- .../20191017 How to type emoji on Linux.md | 146 ----------------- .../20191017 How to type emoji on Linux.md | 148 ++++++++++++++++++ 2 files changed, 148 insertions(+), 146 deletions(-) delete mode 100644 sources/tech/20191017 How to type emoji on Linux.md create mode 100644 translated/tech/20191017 How to type emoji on Linux.md diff --git a/sources/tech/20191017 How to type emoji on Linux.md b/sources/tech/20191017 How to type emoji on Linux.md deleted file mode 100644 index f4396b8240..0000000000 --- a/sources/tech/20191017 How to type emoji on Linux.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to type emoji on Linux) -[#]: via: (https://opensource.com/article/19/10/how-type-emoji-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to type emoji on Linux -====== -The GNOME desktop makes it easy to use emoji in your communications. -![A cat under a keyboard.][1] - -Emoji are those fanciful pictograms that snuck into the Unicode character space. They're all the rage online, and people use them for all kinds of surprising things, from signifying reactions on social media to serving as visual labels for important file names. There are many ways to enter Unicode characters on Linux, but the GNOME desktop makes it easy to find and type an emoji. - -![Emoji in Emacs][2] - -### Requirements - -For this easy method, you must be running Linux with the [GNOME][3] desktop. - -You must also have an emoji font installed. There are many to choose from, so do a search for _emoji_ using your favorite software installer application or package manager. - -For example, on Fedora: - - -``` -$ sudo dnf search emoji -emoji-picker.noarch : An emoji selection tool -unicode-emoji.noarch : Unicode Emoji Data Files -eosrei-emojione-fonts.noarch : A color emoji font -twitter-twemoji-fonts.noarch : Twitter Emoji for everyone -google-android-emoji-fonts.noarch : Android Emoji font released by Google -google-noto-emoji-fonts.noarch : Google “Noto Emoji” Black-and-White emoji font -google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emoji font -[...] -``` - -On Ubuntu or Debian, use **apt search** instead. - -I'm using [Google Noto Color Emoji][4] in this article. - -### Get set up - -To get set up, launch GNOME's Settings application. - - 1. In Settings, click the **Region & Language** category in the left column. - 2. Click the plus symbol (**+**) under the **Input Sources** heading to bring up the **Add an Input Source** panel. - - - -![Add a new input source][5] - - 3. In the **Add an Input Source** panel, click the hamburger menu at the bottom of the input list. - - - -![Add an Input Source panel][6] - - 4. Scroll to the bottom of the list and select **Other**. - 5. In the **Other** list, find **Other (Typing Booster)**. (You can type **boost** in the search field at the bottom to filter the list.) - - - -![Find Other \(Typing Booster\) in inputs][7] - - 6. Click the **Add** button in the top-right corner of the panel to add the input source to GNOME. - - - -Once you've done that, you can close the Settings window. - -#### Switch to Typing Booster - -You now have a new icon in the top-right of your GNOME desktop. By default, it's set to the two-letter abbreviation of your language (**en** for English, **eo** for Esperanto, **es** for Español, and so on). If you press the **Super** key (the key with a Linux penguin, Windows logo, or Mac Command symbol) and the **Spacebar** together on your keyboard, you will switch input sources from your default source to the next on your input list. In this example, you only have two input sources: your default language and Typing Booster. - -Try pressing **Super**+**Spacebar** together and watch the input name and icon change. - -#### Configure Typing Booster - -With the Typing Booster input method active, click the input sources icon in the top-right of your screen, select **Unicode symbols and emoji predictions**, and set it to **On**. - -![Set Unicode symbols and emoji predictions to On][8] - -This makes Typing Booster dedicated to typing emoji, which isn't all Typing Booster is good for, but in the context of this article it's exactly what is needed. - -### Type emoji - -With Typing Booster still active, open a text editor like Gedit, a web browser, or anything that you know understands Unicode characters, and type "_thumbs up_." As you type, Typing Booster searches for matching emoji names. - -![Typing Booster searching for emojis][9] - -To leave emoji mode, press **Super**+**Spacebar** again, and your input source goes back to your default language. - -### Switch the switcher - -If the **Super**+**Spacebar** keyboard shortcut is not natural for you, then you can change it to a different combination. In GNOME Settings, navigate to **Devices** and select **Keyboard**. - -In the top bar of the **Keyboard** window, search for **Input** to filter the list. Set **Switch to next input source** to a key combination of your choice. - -![Changing keystroke combination in GNOME settings][10] - -### Unicode input - -The fact is, keyboards were designed for a 26-letter (or thereabouts) alphabet along with as many numerals and symbols. ASCII has more characters than what you find on a typical keyboard, to say nothing of the millions of characters within Unicode. If you want to type Unicode characters into a modern Linux application but don't want to switch to Typing Booster, then you can use the Unicode input shortcut. - - 1. With your default language active, open a text editor like Gedit, a web browser, or any application you know accepts Unicode. - 2. Press **Ctrl**+**Shift**+**U** on your keyboard to enter Unicode entry mode. Release the keys. - 3. You are currently in Unicode entry mode, so type a number of a Unicode symbol. For instance, try **1F44D** for a 👍 symbol, or **2620** for a ☠ symbol. To get the number code of a Unicode symbol, you can search the internet or refer to the [Unicode specification][11]. - - - -### Pragmatic emoji-ism - -Emoji are fun and expressive. They can make your text unique to you. They can also be utilitarian. Because emoji are Unicode characters, they can be used anywhere a font can be used, and they can be used the same way any alphabetic character can be used. For instance, if you want to mark a series of files with a special symbol, you can add an emoji to the name, and you can filter by that emoji in Search. - -![Labeling a file with emoji][12] - -Use emoji all you want because Linux is a Unicode-friendly environment, and it's getting friendlier with every release. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/how-type-emoji-linux - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead_cat-keyboard.png?itok=fuNmiGV- (A cat under a keyboard.) -[2]: https://opensource.com/sites/default/files/uploads/emacs-emoji.jpg (Emoji in Emacs) -[3]: https://www.gnome.org/ -[4]: https://www.google.com/get/noto/help/emoji/ -[5]: https://opensource.com/sites/default/files/uploads/gnome-setting-region-add.png (Add a new input source) -[6]: https://opensource.com/sites/default/files/uploads/gnome-setting-input-list.png (Add an Input Source panel) -[7]: https://opensource.com/sites/default/files/uploads/gnome-setting-input-other-typing-booster.png (Find Other (Typing Booster) in inputs) -[8]: https://opensource.com/sites/default/files/uploads/emoji-input-on.jpg (Set Unicode symbols and emoji predictions to On) -[9]: https://opensource.com/sites/default/files/uploads/emoji-input.jpg (Typing Booster searching for emojis) -[10]: https://opensource.com/sites/default/files/uploads/gnome-setting-keyboard-switch-input.jpg (Changing keystroke combination in GNOME settings) -[11]: http://unicode.org/emoji/charts/full-emoji-list.html -[12]: https://opensource.com/sites/default/files/uploads/file-label.png (Labeling a file with emoji) diff --git a/translated/tech/20191017 How to type emoji on Linux.md b/translated/tech/20191017 How to type emoji on Linux.md new file mode 100644 index 0000000000..86dc42d4ef --- /dev/null +++ b/translated/tech/20191017 How to type emoji on Linux.md @@ -0,0 +1,148 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to type emoji on Linux) +[#]: via: (https://opensource.com/article/19/10/how-type-emoji-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Linux 系统中输入 emoji +====== +使用 GNOME 桌面可以让你在文字中轻松加入 emoji。 + +![A cat under a keyboard.][1] + +emoji 是潜藏在 Unicode 字符空间里的有趣表情图,它们已经风靡于整个互联网。emoji 可以用来在社交媒体上表示自己的心情状态,也可以作为重要文件名的视觉标签,总之它们的各种用法层出不穷。在 Linux 系统中有很多种方式可以输入 Unicode 字符,但 GNOME 桌面能让你更轻松地查找和输入 emoji。 + +![Emoji in Emacs][2] + +### 准备工作 + +首先,你需要一个运行 [GNOME][3] 桌面的 Linux 系统。 + +同时还需要安装一款支持 emoji 的字体。符合这个要求的字体有很多,使用你喜欢的软件包管理器直接搜索 `emoji` 并选择一款安装就可以了。 + +例如在 Fedora 上: + + +``` +$ sudo dnf search emoji +emoji-picker.noarch : An emoji selection tool +unicode-emoji.noarch : Unicode Emoji Data Files +eosrei-emojione-fonts.noarch : A color emoji font +twitter-twemoji-fonts.noarch : Twitter Emoji for everyone +google-android-emoji-fonts.noarch : Android Emoji font released by Google +google-noto-emoji-fonts.noarch : Google “Noto Emoji” Black-and-White emoji font +google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emoji font +[...] +``` + +对于 Ubuntu 或者 Debian,需要使用 `apt search`。 + +在这篇文章中,我会使用 [Google Noto Color Emoji][4] 这款字体为例。 + +### 设置 + +要开始设置,首先打开 GNOME 的设置面板。 + + 1. 在左边侧栏中,选择“地区与语言Region & Language”类别 + 2. 点击“输入源Input Sources”选项下方的加号(+)打开“添加输入源Add an Input Source”面板 + + + +![Add a new input source][5] + + 3. 在“添加输入源Add an Input Source”面板中,点击底部的菜单按钮 + + + +![Add an Input Source panel][6] + + 4. 滑动到列表底部并选择“其它Other” + 5. 在“其它Other”列表中,找到“其它Other快速输入Typing Booster)” + + + +![Find Other \(Typing Booster\) in inputs][7] + + 6. 点击右上角的“添加Add”按钮,将输入源添加到 GNOME 桌面 + + + +以上操作完成之后,就可以关闭设置面板了。 + +#### 切换到快速输入 + +现在 GNOME 桌面的右上角会出现一个新的图标,一般情况下是当前语言的双字母缩写(例如英语是 en,世界语是 eo,西班牙语是 es,等等)。如果你按下了超级键Super key(也就是键盘上带有 Linux 企鹅/Windows 徽标/Mac Command 标志的键)+空格键的组合键,就会切换到输入列表中的下一个输入源。在这里,我们只有两个输入源,也就是默认语言和快速输入。 + +你可以尝试使用一下这个组合键,观察图标的变化。 + +#### 配置快速输入 + +在快速输入模式下,点击右上角的输入源图标,选择“Unicode 符号和 emoji 联想Unicode symbols and emoji predictions”选项,设置为“On”。 + +![Set Unicode symbols and emoji predictions to On][8] + +现在快速输入模式已经可以输入 emoji 了。这正是我们现在所需要的,当然快速输入模式的功能也并不止于此。 + +### 输入 emoji + +在快速输入模式下,打开一个文本编辑器,或者网页浏览器,又或者是任意一种支持输入 Unicode 字符的软件,输入“thumbs up”,快速输入模式就会帮你迅速匹配的 emoji 了。 + +![Typing Booster searching for emojis][9] + +要退出 emoji 模式,只需要再次使用超级键+空格键的组合键,输入源就会切换回你的默认输入语言。 + +### 使用其它切换方式 + +如果你觉得超级键+空格键这个组合用起来不顺手,你也可以换成其它键的组合。在 GNOME 设置面板中选择“设备Device”→“键盘Keyboard”。 + +在“键盘Keyboard”页面中,将“切换到下一个输入源Switch to next input source”更改为你喜欢的组合键。 + +![Changing keystroke combination in GNOME settings][10] + +### 输入 Unicode + +实际上,现代键盘的设计只是为了输入 26 个字母以及尽可能多的数字和符号。但 ASCII 字符的数量已经比键盘上能看到的字符多得多了,遑论上百万个 Unicode 字符。因此,如果你想要在 Linux 应用程序中输入 Unicode,但又不想使用快速输入,你可以尝试一下 Unicode 输入。 + + 1. 打开任意一种支持输入 Unicode 字符的软件,但仍然使用你的默认输入语言 + 2. 使用 ctrl+shift+U 组合键进入 Unicode 输入模式 + 3. 在 Unicode 输入模式下,只需要输入某个 Unicode 字符的对应序号,就实现了对这个 Unicode 字符的输入。例如 `1F44D` 对应的是 👍,而 `2620` 则对应了 ☠。想要查看所有 Unicode 字符的对应序号,可以参考 [Unicode 规范][11]。 + + + +### emoji 的实用性 + +emoji 可以让你的文本变得与众不同,这就是它们有趣和富有表现力的体现。同时 emoji 也有很强的实用性,因为它们本质上是 Unicode 字符,在很多支持自定义字体的地方都可以用到它们,而且跟使用其它常规字符没有什么太大的差别。因此,你可以使用 emoji 来对不同的文件做标记,在搜索的时候就可以使用 emoji 把这些文件快速筛选出来。 + +![Labeling a file with emoji][12] + +你可以在 Linux 中尽情地使用 emoji,因为 Linux 是一个对 Unicode 友好的环境,未来也会对 Unicode 有着越来越好的支持。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-type-emoji-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead_cat-keyboard.png?itok=fuNmiGV- "A cat under a keyboard." +[2]: https://opensource.com/sites/default/files/uploads/emacs-emoji.jpg "Emoji in Emacs" +[3]: https://www.gnome.org/ +[4]: https://www.google.com/get/noto/help/emoji/ +[5]: https://opensource.com/sites/default/files/uploads/gnome-setting-region-add.png "Add a new input source" +[6]: https://opensource.com/sites/default/files/uploads/gnome-setting-input-list.png "Add an Input Source panel" +[7]: https://opensource.com/sites/default/files/uploads/gnome-setting-input-other-typing-booster.png "Find Other (Typing Booster) in inputs" +[8]: https://opensource.com/sites/default/files/uploads/emoji-input-on.jpg "Set Unicode symbols and emoji predictions to On" +[9]: https://opensource.com/sites/default/files/uploads/emoji-input.jpg "Typing Booster searching for emojis" +[10]: https://opensource.com/sites/default/files/uploads/gnome-setting-keyboard-switch-input.jpg "Changing keystroke combination in GNOME settings" +[11]: http://unicode.org/emoji/charts/full-emoji-list.html +[12]: https://opensource.com/sites/default/files/uploads/file-label.png "Labeling a file with emoji" + From 826be81b1e829225c5a921f2322f461626dcb07b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Dec 2019 00:54:06 +0800 Subject: [PATCH 176/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191220=20How=20?= =?UTF-8?q?to=20Start,=20Stop=20&=20Restart=20Services=20in=20Ubuntu=20and?= =?UTF-8?q?=20Other=20Linux=20Distributions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md --- ...in Ubuntu and Other Linux Distributions.md | 183 ++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md b/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..7026071748 --- /dev/null +++ b/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/start-stop-restart-services-linux/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions +====== + +Services are essential background processes that are usually run while booting up and shut down with the OS. + +If you are a sysadmin, you’ll deal with the service regularly. + +If you are a normal desktop user, you may come across the need to restart a service like [setting up Barrier for sharing mouse and keyboard between computers][1]. or when you are [using ufw to setup firewall][2]. + +Today I will show you two different ways you can manage services. You’ll learn to start, stop and restart services in Ubuntu or any other Linux distribution. + +systemd vs init + +Ubuntu and many other distributions these days use systemd instead of the good old init. + +In systemd, you manage sevices with systemctl command. + +In init, you manage service with service command. + +You’ll notice that even though your Linux system uses systemd, it is still able to use the service command (intended to be used with init system). This is because service command is actually redirect to systemctl. It’s sort of backward compatibility introduced by systemd because sysadmins were habitual of using the service command. + +I’ll show both systemctl and service command in this tutorial. + +_I am Ubuntu 18.04 here, but the process (no pun intended) is the same for other versions._ + +### Method 1: Managing services in Linux with systemd + +I am starting with systemd because of the obvious reason of its widespread adoption. + +#### 1\. List all services + +In order to manage the services, you first need to know what services are available on your system. + +You can use the systemd command to list all the services on your Linux system: + +``` +systemctl list-unit-files --type service -all +``` + +![systemctl list-unit-files][3] + +This command will output the state of all services. The value of a service’s state can be enabled, disabled, masked (inactive until mask is unset), static and generated. + +Combine it with the [grep command][4] and you can **display just the running services**: + +``` +sudo systemctl | grep running +``` + +![Display running services systemctl][5] + +Now that you know how to reference all different services, you can start actively managing them. + +**Note:** ***<service-***_**name>**_ _in the commands should be replaced by the name of the service you wish to manage (e.g. network-manager, ufw etc.)._ + +#### **2\. Start a** service + +To start a service in Linux, you just need to use its name like this: + +``` +systemctl start +``` + +#### 3\. **Stop** a service + +To stop a systemd service, you can use the stop option of systemctl command: + +``` +systemctl stop +``` + +#### 4\. Re**start** a service + +To restart a service in Linux with systemd, you can use: + +``` +systemctl restart +``` + +#### 5\. Check the status of a service + +You can confirm that you have successfully executed a certain action by printing the service status: + +``` +systemctl status +``` + +This will output information in the following manner: + +![systemctl status][6] + +That was systemd. Let’s switch to init now. + +### Method 2: Managing services in Linux with init + +The commands in init are also as simple as system. + +#### 1\. List all services + +To list all the Linux services, use + +``` +service --status-all +``` + +![service –status-all][7] + +The services preceded by **[ – ]** are **disabled** and those with **[ + ]** are **enabled**. + +#### **2\. Start** a service + +To start a service in Ubuntu and other distributions, use this command: + +``` +service start +``` + +#### **3\. Stop** a service + +Stopping a service is equally easy. + +``` +service stop +``` + +#### 4\. Re**start** a service + +If you want to restart a service, the command is: + +``` +service restart +``` + +#### 5\. Check the status of a service + +Furthermore, to check if your intended result was achieved, you can output the service ****status**:** + +``` +service status +``` + +This will output information in the following manner: + +![service status][8] + +This will, most importantly, tell you if a certain service is active **(**running**)** or not. + +**Wrapping Up** + +Today I detailed two very simple methods of managing services on Ubuntu or any other Linux system. I hope this article was helpful to you. + +Which method do you prefer? Let us know in the comment section below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/start-stop-restart-services-linux/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/keyboard-mouse-sharing-between-computers/ +[2]: https://itsfoss.com/set-up-firewall-gufw/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_list_services.png?ssl=1 +[4]: https://linuxhandbook.com/grep-command-examples/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_grep_running.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_status.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status_all.png?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status.jpg?ssl=1 From 5cc6600ae3fd139dec27d1fc7a690833bef82c85 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Dec 2019 00:55:40 +0800 Subject: [PATCH 177/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191219=20Go=20m?= =?UTF-8?q?ouseless=20with=20the=20Linux=20Ratpoison=20window=20manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191219 Go mouseless with the Linux Ratpoison window manager.md --- ...with the Linux Ratpoison window manager.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20191219 Go mouseless with the Linux Ratpoison window manager.md diff --git a/sources/tech/20191219 Go mouseless with the Linux Ratpoison window manager.md b/sources/tech/20191219 Go mouseless with the Linux Ratpoison window manager.md new file mode 100644 index 0000000000..fa66d18314 --- /dev/null +++ b/sources/tech/20191219 Go mouseless with the Linux Ratpoison window manager.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go mouseless with the Linux Ratpoison window manager) +[#]: via: (https://opensource.com/article/19/12/ratpoison-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Go mouseless with the Linux Ratpoison window manager +====== +This article is part of a special series of 24 days of Linux desktops. +If you'd rather live in a terminal all day and avoid mousing around, the +Ratpoison window manager is the solution for you. +![Buildings with different color windows][1] + +Maybe you don't like desktops. Maybe even a lightweight window manager seems excessive to you. Maybe all you really use is a graphical user interface (GUI) application or two, and you're otherwise perfectly happy living in a terminal all day. If one or more of these sentiments sound familiar, then [Ratpoison][2] is the solution. + +![Ratpoison][3] + +The Ratpoison window manager models itself after [GNU Screen][4]. All window controls are performed with keyboard shortcuts, so you don't have to grab the mouse just to move a window out of your way. The trade-off is that it's impossibly minimalistic, which is, conveniently, also its greatest strength. + +### Installing Ratpoison + +Install Ratpoison from your distribution's software repository. After installing it, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +With GDM: + +![][5] + +With SDDM: + +![][6] + +### Ratpoison desktop tour + +The first time you log into Ratpoison, you are greeted by a black screen with some text in the upper-right corner telling you that you can press **Ctrl+t** for help. + +That's all there is to the Ratpoison desktop. + +### Interacting with Ratpoison + +Ratpoison documentation uses Emacs-style notation for keyboard controls, so I'll use the same notation in this article. If you're unfamiliar with Emacs or GNU Screen, it can look confusing at first, so here's explicit instruction on how to "decode" this style of notation. The Control key on your keyboard is written as **C-**. To trigger Ratpoison's command mode, you press **C-t**, which means that you press **Ctrl+t**. + +Since the **C-t** shortcut puts you into command mode, it's expected that some other key sequence will follow. For instance, to launch an xterm window, press **Ctrl+t**, just as you would when opening a new tab in a web browser, then press **c**. This may feel a little unnatural at first, because most of the keyboard shortcuts you're used to probably involve only one action. Ratpoison (and GNU Screen and Emacs) more often involve two. + +The first application you probably should launch is either Emacs or a terminal. + +In Ratpoison, your terminal is your exclusive gateway to the rest of the computer because there's no application menu or icons to click. The default terminal is the humble xterm, and it's available with the **C-t c** shortcut (I remember the **c** as being short for "console"). + +#### Launching applications + +I usually start with Emacs instead, because it has most of the features I use anyway, including the **shell** terminal and the **dired** file manager. To start an arbitrary application in Ratpoison, press **C-t** and then the **!** (exclamation point) symbol. This provides a prompt in the upper-right corner of the screen. Type the command for the application you want to start and press **Return** or **Enter** to launch it. + +#### Switching windows + +Each application you launch takes over the entire screen by default. That means if [urxvt][7] is running, and then you launch Emacs, you can no longer interact with urxvt. Because switching back and forth between two application windows is a pretty common task, Ratpoison assigns it to the same keystroke as your usual Ratpoison command: **C-t C-t**. That means you press **Ctrl+t** once, and then **Ctrl+t** a second time. This is a toggle, like the default (at least in KDE and GNOME) behavior of a quick **Alt+Tab**. + +To cycle through all open windows, use **C-t n** for _next_ and **C-t p** for _previous_. + +#### Tiling window manager + +You're free to use Ratpoison as a full-screen viewscreen, but most of us are used to seeing more than one window at a time. To allow that, Ratpoison lets you split your screen into frames or tiles and launch an application within each space. + +![Ratpoison in split-screen mode][8] + +With at least one application open, you can split the screen horizontally with **C-t s** (that's a lowercase "s") or vertically with **C-t S** (that's a capital "S"). + +To switch to another frame, use **C-t Tab**. + +To remove another frame, press **C-t R**. + +#### Moving windows in split-screen mode + +Rearranging frames when Ratpoison has been split into several parts is done with the **Ctrl** key and a corresponding **Arrow** key. For instance, suppose you have a vertical split in the top half of your screen and a single frame in the bottom half. If an application is in the top-left frame, and you want to move it to the lower half of the screen, then—with that application active (use **C-t Tab** to get there)—press **C-t** to enter command mode and then **C-Down** (that's **Ctrl** with the **Down arrow** key). The application moves to the bottom half of the screen, with the application that took up the bottom half moving into the top-left. + +To move that application to the top-right frame instead, press **C-t Right** (**Ctrl** with the **Right arrow** key). + +To remove the top-left frame entirely, use **C-t R**. This doesn't kill the application in the frame, it only removes the frame from your viewport. The application that once occupied the frame is sent to the background and can be reached by cycling through the windows as usual (**C-t n**, for instance). + +### Why you need to try Ratpoison + +Ratpoison is a great example of an early (but current) tiling window manager. Other window managers like it exist, and some desktops even borrow concepts from this tradition by offering tiling features (KWin in KDE, for example, has an option to spawn new windows in tiles across the desktop). + +If you've never used a tiling window manager, you owe it to yourself to try at least once. First, make it a goal to use Ratpoison. Then make it a goal to get through a whole afternoon without your mouse. Once you get the hang of it, you might be surprised at how quickly you can work. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ratpoison-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colors-colorful-box-rectangle.png?itok=doWmqCdf (Buildings with different color windows) +[2]: https://www.nongnu.org/ratpoison/ +[3]: https://opensource.com/sites/default/files/uploads/advent-ratpoison.png (Ratpoison) +[4]: https://opensource.com/article/17/3/introduction-gnu-screen +[5]: https://opensource.com/sites/default/files/advent-gdm_1.jpg +[6]: https://opensource.com/sites/default/files/advent-kdm_0.jpg +[7]: https://opensource.com/article/19/10/why-use-rxvt-terminal +[8]: https://opensource.com/sites/default/files/uploads/advent-ratpoison-split.jpg (Ratpoison in split-screen mode) From a4f99f904d2043c3a6d1977f06629b10119b69aa Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Dec 2019 00:56:21 +0800 Subject: [PATCH 178/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191219=20Kubern?= =?UTF-8?q?etes=20namespaces=20for=20beginners?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191219 Kubernetes namespaces for beginners.md --- ...219 Kubernetes namespaces for beginners.md | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 sources/tech/20191219 Kubernetes namespaces for beginners.md diff --git a/sources/tech/20191219 Kubernetes namespaces for beginners.md b/sources/tech/20191219 Kubernetes namespaces for beginners.md new file mode 100644 index 0000000000..18839c3f4f --- /dev/null +++ b/sources/tech/20191219 Kubernetes namespaces for beginners.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Kubernetes namespaces for beginners) +[#]: via: (https://opensource.com/article/19/12/kubernetes-namespaces) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +Kubernetes namespaces for beginners +====== +What is a namespace and why do you need it? +![Ship captain sailing the Kubernetes seas][1] + +What is in a Kubernetes namespace? As Shakespeare once wrote, which we call a namespace, by any other name, would still be a virtual cluster. By virtual cluster, I mean Kubernetes can offer multiple Kubernetes clusters on a single cluster, much like a virtual machine is an abstraction of its host. According to the [Kubernetes docs][2]: + +> Kubernetes supports multiple virtual clusters backed by the same physical cluster. These virtual clusters are called namespaces. + +Why do you need to use namespaces? In one word: isolation. + +Isolation has many advantages, including that it supports secure and clean environments. If you are the owner of the infrastructure and are supporting developers, isolation is fairly important. The last thing you need is someone who is unfamiliar with how your cluster is built going and changing the system configuration—and possibly disabling everyone's ability to log in. + +### The namespaces that start it all + +The first three namespaces created in a cluster are always **default**, **kube-system**, and **kube-public**. While you can technically deploy within these namespaces, I recommend leaving these for system configuration and not for your projects.  + + * **Default** is for deployments that are not given a namespace, which is a quick way to create a mess that will be hard to clean up if you do too many deployments without the proper information. I leave this alone because it serves that one purpose and has confused me on more than one occasion. + * **Kube-system** is for all things relating to, you guessed it, the Kubernetes system. Any deployments to this namespace are playing a dangerous game and can accidentally cause irreparable damage to the system itself. Yes, I have done it; I do not recommend it. + * **Kube-public** is readable by everyone, but the namespace is reserved for system usage. + + + +### Using namespaces for isolation + +I have used namespaces for isolation in a couple of ways. I use them most often to split many users' projects into separate environments. This is useful in preventing cross-project contamination since namespaces provide independent environments. Users can install multiple versions of Jenkins, for example, and their environmental variables won't collide if they are in different namespaces. + +This separation also helps with cleanup. If development groups are working on various projects that suddenly become obsolete, you can delete the namespace and remove everything in one swift movement with **kubectl delete ns <$NAMESPACENAME>**. (Please make sure it's the right namespace. I deleted the wrong one in production once, and it's not pretty.) + +Be aware that this can cause damage across teams and problems for you if you are the infrastructure owner. For example, if you create a namespace with some special, extra-secure DNS functions and the wrong person deletes it, all of your pods and their running applications will be removed with the namespace. Any use of **delete** should be reviewed by a peer (through [GitOps][3]) before hitting the cluster. + +While the official documentation suggests not using multiple namespaces [with 10 or fewer users][2], I still use them in my own cluster for architectural purposes. The cleaner the cluster, the better. + +### What admins need to know about namespaces + +For starters, namespaces cannot be nested in other namespaces. There can be only one namespace with deployments in it. You don't have to use namespaces for versioned projects, but you can always use the labels to separate versioned apps with the same name. Namespaces divide resources between users using resource quotas; for example, _this namespace can only have x_ _number_ _of nodes_. Finally, all namespaces scope down to a unique name for the resource type. + +### Namespace commands in action + +To try out the following namespace commands, you need to have [Minikube][4], [Helm][5], and the [kubectl][6] command line installed. For information about installing them, see my article [_Security scanning your DevOps pipeline_][7] or each project's homepage. I am using the most recent release of Minikube. The manual installation is fast and has consistently worked correctly the first time. + +To get your first set of namespaces: + + +``` +jess@Athena:~$ kubectl get namespace +NAME            STATUS   AGE +default         Active   5m23s +kube-public     Active   5m24s +kube-system     Active   5m24s +``` + +To create a namespace: + + +``` +jess@Athena:~$ kubectl create namespace athena +namespace/athena created +``` + +Now developers can deploy to the namespace you created; for example, here's a small and easy Helm chart: + + +``` +jess@Athena:~$ helm install teset-deploy stable/redis --namespace athena +NAME: teset-deploy +LAST DEPLOYED: Sat Nov 23 13:47:43 2019 +NAMESPACE: athena +STATUS: deployed +REVISION: 1 +TEST SUITE: None +NOTES: +** Please be patient while the chart is being deployed ** +Redis can be accessed via port 6379 on the following DNS names from within your cluster: + +teset-deploy-redis-master.athena.svc.cluster.local for read/write operations +teset-deploy-redis-slave.athena.svc.cluster.local for read-only operations +``` + +To get your password: + + +``` +`export REDIS_PASSWORD=$(kubectl get secret --namespace athena teset-deploy-redis -o jsonpath="{.data.redis-password}" | base64 --decode)` +``` + +To connect to your Redis server: + + 1. Run a Redis pod that you can use as a client: [code] kubectl run --namespace athena teset-deploy-redis-client --rm --tty -i --restart='Never' \ +        --env REDIS_PASSWORD=$REDIS_PASSWORD \ +\--image docker.io/bitnami/redis:5.0.7-debian-9-r0 -- bash +``` + 2. Connect using the Redis CLI: [code] redis-cli -h teset-deploy-redis-master -a $REDIS_PASSWORD +redis-cli -h teset-deploy-redis-slave -a $REDIS_PASSWORD +``` + + + +To connect to your database from outside the cluster: + + +``` +kubectl port-forward --namespace athena svc/teset-deploy-redis-master 6379:6379 & +redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD +``` + +Now that this deployment is out, you have a chart deployed in your namespace named **test-deploy**. + +To look at what pods are in your namespace: + + +``` +jess@Athena:~$ kubectl get pods --namespace athena +NAME                            READY   STATUS  RESTARTS   AGE +teset-deploy-redis-master-0   1/1       Running   0             2m38s +teset-deploy-redis-slave-0      1/1     Running   0             2m38s +teset-deploy-redis-slave-1      1/1     Running   0             90s +``` + +At this point, you have officially isolated your application to a single namespace and created one virtual cluster that talks internally only to itself. + +Delete everything with a single command: + + +``` +jess@Athena:~$ kubectl delete namespace athena +namespace "athena" deleted +``` + +Because this deletes the application's entire internal configuration, the delete may take some time, depending on how large your deployment is. + +Double-check that everything has been removed: + + +``` +jess@Athena:~$ kubectl get pods --all-namespaces +NAMESPACE       NAME                            READY   STATUS  RESTARTS   AGE +kube-system   coredns-5644d7b6d9-4vxv6          1/1     Running   0             32m +kube-system   coredns-5644d7b6d9-t5wn7          1/1     Running   0             32m +kube-system   etcd-minikube                     1/1     Running   0             31m +kube-system   kube-addon-manager-minikube       1/1     Running   0             32m +kube-system   kube-apiserver-minikube           1/1     Running   0             31m +kube-system   kube-controller-manager-minikube  1/1     Running   0             31m +kube-system   kube-proxy-5tdmh                  1/1     Running   0             32m +kube-system   kube-scheduler-minikube           1/1     Running   0             31m +kube-system   storage-provisioner               1/1     Running   0             27m +``` + +This is a list of all the pods and all the known namespaces where they live. As you can see, the application and namespace you previously made are now gone. + +### Namespaces in practice + +I currently use namespaces for security purposes, including reducing the privileges of users with limitations. You can limit everything—from which roles can access a namespace to their quota levels for cluster resources, like CPUs. For example, I use resource quotas and role-based access control (RBAC) configurations to confirm that a namespace is accessible only by the appropriate service accounts. + +On the isolation side of security, I don't want my home Jenkins application to be accessible over a trusted local network as secure images that have public IP addresses (and thus, I have to assume, could be compromised). + +Namespaces can also be helpful for budgeting purposes if you have a hard budget on how much you can use in your cloud platform for nodes (or, in my case, how much I can deploy before [segfaulting][8] my home server). Although this is out of scope for this article, and it's complicated, it is worth researching and taking advantage of to prevent overextending your cluster. + +### Conclusion + +Namespaces are a great way to isolate projects and applications. This is just a quick introduction to the topic, so I encourage you to do more advanced research on namespaces and use them more in your work. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/kubernetes-namespaces + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ +[3]: https://www.weave.works/blog/gitops-operations-by-pull-request +[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/ +[5]: https://helm.sh/ +[6]: https://kubernetes.io/docs/tasks/tools/install-kubectl/ +[7]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[8]: https://en.wikipedia.org/wiki/Segmentation_fault From 14d948b9ba87664f35f859bd6f21bc75f625a2a6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Dec 2019 00:57:42 +0800 Subject: [PATCH 179/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191219=20Creati?= =?UTF-8?q?ng=20a=20Bash=20script=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191219 Creating a Bash script template.md --- ...0191219 Creating a Bash script template.md | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 sources/tech/20191219 Creating a Bash script template.md diff --git a/sources/tech/20191219 Creating a Bash script template.md b/sources/tech/20191219 Creating a Bash script template.md new file mode 100644 index 0000000000..3cfd549c3d --- /dev/null +++ b/sources/tech/20191219 Creating a Bash script template.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Creating a Bash script template) +[#]: via: (https://opensource.com/article/19/12/bash-script-template) +[#]: author: (David Both https://opensource.com/users/dboth) + +Creating a Bash script template +====== +In the second article in this series, create a fairly simple template +that you can use as a starting point for other Bash programs, then test +it. +![A person programming][1] + +In the [first article][2] in this series, you created a very small, one-line Bash script and explored the reasons for creating shell scripts and why they are the most efficient option for the system administrator, rather than compiled programs. + +In this second article, you will begin creating a Bash script template that can be used as a starting point for other Bash scripts. The template will ultimately contain a Help facility, a licensing statement, a number of simple functions, and some logic to deal with those options and others that might be needed for the scripts that will be based on this template. + +### Why create a template? + +Like automation in general, the idea behind creating a template is to be the "[lazy sysadmin][3]." A template contains the basic components that you want in all of your scripts. It saves time compared to adding those components to every new script and makes it easy to start a new script. + +Although it can be tempting to just throw a few command-line Bash statements together into a file and make it executable, that can be counterproductive in the long run. A well-written and well-commented Bash program with a Help facility and the capability to accept command-line options provides a good starting point for sysadmins who maintain the program, which includes the programs that _you_ write and maintain. + +### The requirements + +You should always create a set of requirements for every project you do. This includes scripts, even if it is a simple list with only two or three items on it. I have been involved in many projects that either failed completely or failed to meet the customer's needs, usually due to the lack of a requirements statement or a poorly written one. + +The requirements for this Bash template are pretty simple: + + 1. Create a template that can be used as the starting point for future Bash programming projects. + 2. The template should follow standard Bash programming practices. + 3. It must include: + * A heading section that can be used to describe the function of the program and a changelog + * A licensing statement + * A section for functions + * A Help function + * A function to test whether the program user is root + * A method for evaluating command-line options + + + +### The basic structure + +A basic Bash script has three sections. Bash has no way to delineate sections, but the boundaries between the sections are implicit. + + * All scripts must begin with the shebang (**#!**), and this must be the first line in any Bash program. + * The functions section must begin after the shebang and before the body of the program. As part of my need to document everything, I place a comment before each function with a short description of what it is intended to do. I also include comments inside the functions to elaborate further. Short, simple programs may not need functions. + * The main part of the program comes after the function section. This can be a single Bash statement or thousands of lines of code. One of my programs has a little over 200 lines of code, not counting comments. That same program has more than 600 comment lines. + + + +That is all there is—just three sections in the structure of any Bash program. + +### Leading comments + +I always add more than this for various reasons. First, I add a couple of sections of comments immediately after the shebang. These comment sections are optional, but I find them very helpful. + +The first comment section is the program name and description and a change history. I learned this format while working at IBM, and it provides a method of documenting the long-term development of the program and any fixes applied to it. This is an important start in documenting your program. + +The second comment section is a copyright and license statement. I use GPLv2, and this seems to be a standard statement for programs licensed under GPLv2. If you use a different open source license, that is fine, but I suggest adding an explicit statement to the code to eliminate any possible confusion about licensing. Scott Peterson's article [_The source code is the license_][4] helps explain the reasoning behind this. + +So now the script looks like this: + + +``` +#!/bin/bash +################################################################################ +#                              scriptTemplate                                  # +#                                                                              # +# Use this template as the beginning of a new program. Place a short           # +# description of the script here.                                              # +#                                                                              # +# Change History                                                               # +# 11/11/2019  David Both    Original code. This is a template for creating     # +#                           new Bash shell scripts.                            # +#                           Add new history entries as needed.                 # +#                                                                              # +#                                                                              # +################################################################################ +################################################################################ +################################################################################ +#                                                                              # +#  Copyright (C) 2007, 2019 David Both                                         # +#  [LinuxGeek46@both.org][5]                                                        # +#                                                                              # +#  This program is free software; you can redistribute it and/or modify        # +#  it under the terms of the GNU General Public License as published by        # +#  the Free Software Foundation; either version 2 of the License, or           # +#  (at your option) any later version.                                         # +#                                                                              # +#  This program is distributed in the hope that it will be useful,             # +#  but WITHOUT ANY WARRANTY; without even the implied warranty of              # +#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # +#  GNU General Public License for more details.                                # +#                                                                              # +#  You should have received a copy of the GNU General Public License           # +#  along with this program; if not, write to the Free Software                 # +#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # +#                                                                              # +################################################################################ +################################################################################ +################################################################################ + +echo "hello world!" +``` + +Run the revised program to verify that it still works as expected. + +### About testing + +Now is a good time to talk about testing. + +> "_There is always one more bug."_ +> — Lubarsky's Law of Cybernetic Entomology + +Lubarsky—whoever that might be—is correct. You can never find all the bugs in your code. For every bug I find, there always seems to be another that crops up, usually at a very inopportune time. + +Testing is not just about programs. It is also about verification that problems—whether caused by hardware, software, or the seemingly endless ways users can find to break things—that are supposed to be resolved actually are. Just as important, testing is also about ensuring that the code is easy to use and the interface makes sense to the user. + +Following a well-defined process when writing and testing shell scripts can contribute to consistent and high-quality results. My process is simple: + + 1. Create a simple test plan. + 2. Start testing right at the beginning of development. + 3. Perform a final test when the code is complete. + 4. Move to production and test more. + + + +#### The test plan + +There are lots of different formats for test plans. I have worked with the full range—from having it all in my head; to a few notes jotted down on a sheet of paper; and all the way to a complex set of forms that require a full description of each test, which functional code it would test, what the test would accomplish, and what the inputs and results should be. + +Speaking as a sysadmin who has been (but is not now) a tester, I try to take the middle ground. Having at least a short written test plan will ensure consistency from one test run to the next. How much detail you need depends upon how formal your development and test functions are. + +The sample test plan documents I found using Google were complex and intended for large organizations with very formal development and test processes. Although those test plans would be good for people with "test" in their job title, they do not apply well to sysadmins' more chaotic and time-dependent working conditions. As in most other aspects of the job, sysadmins need to be creative. So here is a short list of things to consider including in your test plan. Modify it to suit your needs: + + * The name and a short description of the software being tested + * A description of the software features to be tested + * The starting conditions for each test + * The functions to follow for each test + * A description of the desired outcome for each test + * Specific tests designed to test for negative outcomes + * Tests for how the program handles unexpected inputs + * A clear description of what constitutes pass or fail for each test + * Fuzzy testing, which is described below + + + +This list should give you some ideas for creating your test plans. Most sysadmins should keep it simple and fairly informal. + +#### Test early—test often + +I always start testing my shell scripts as soon as I complete the first portion that is executable. This is true whether I am writing a short command-line program or a script that is an executable file. + +I usually start creating new programs with the shell script template. I write the code for the Help function and test it. This is usually a trivial part of the process, but it helps me get started and ensures that things in the template are working properly at the outset. At this point, it is easy to fix problems with the template portions of the script or to modify it to meet needs that the standard template does not. + +Once the template and Help function are working, I move on to creating the body of the program by adding comments to document the programming steps required to meet the program specifications. Now I start adding code to meet the requirements stated in each comment. This code will probably require adding variables that are initialized in that section of the template—which is now becoming a shell script. + +This is where testing is more than just entering data and verifying the results. It takes a bit of extra work. Sometimes I add a command that simply prints the intermediate result of the code I just wrote and verify that. For more complex scripts, I add a **-t** option for "test mode." In this case, the internal test code executes only when the **-t** option is entered on the command line. + +#### Final testing + +After the code is complete, I go back to do a complete test of all the features and functions using known inputs to produce specific outputs. I also test some random inputs to see if the program can handle unexpected input. + +Final testing is intended to verify that the program is functioning essentially as intended. A large part of the final test is to ensure that functions that worked earlier in the development cycle have not been broken by code that was added or changed later in the cycle. + +If you have been testing the script as you add new code to it, you may think there should not be any surprises during the final test. Wrong! There are always surprises during final testing. Always. Expect those surprises, and be ready to spend time fixing them. If there were never any bugs discovered during final testing, there would be no point in doing a final test, would there? + +#### Testing in production + +Huh—what? + +> "Not until a program has been in production for at least six months will the most harmful error be discovered." +> — Troutman's Programming Postulates + +Yes, testing in production is now considered normal and desirable. Having been a tester myself, this seems reasonable. "But wait! That's dangerous," you say. My experience is that it is no more dangerous than extensive and rigorous testing in a dedicated test environment. In some cases, there is no choice because there is no test environment—only production. + +Sysadmins are no strangers to the need to test new or revised scripts in production. Anytime a script is moved into production, that becomes the ultimate test. The production environment constitutes the most critical part of that test. Nothing that testers can dream up in a test environment can fully replicate the true production environment. + +The allegedly new practice of testing in production is just the recognition of what sysadmins have known all along. The best test is production—so long as it is not the only test. + +#### Fuzzy testing + +This is another of those buzzwords that initially caused me to roll my eyes. Its essential meaning is simple: have someone bang on the keys until something happens, and see how well the program handles it. But there really is more to it than that. + +Fuzzy testing is a bit like the time my son broke the code for a game in less than a minute with random input. That pretty much ended my attempts to write games for him. + +Most test plans utilize very specific input that generates a specific result or output. Regardless of whether the test defines a positive or negative outcome as a success, it is still controlled, and the inputs and results are specified and expected, such as a specific error message for a specific failure mode. + +Fuzzy testing is about dealing with randomness in all aspects of the test, such as starting conditions, very random and unexpected input, random combinations of options selected, low memory, high levels of CPU contending with other programs, multiple instances of the program under test, and any other random conditions that you can think of to apply to the tests. + +I try to do some fuzzy testing from the beginning. If the Bash script cannot deal with significant randomness in its very early stages, then it is unlikely to get better as you add more code. This is a good time to catch these problems and fix them while the code is relatively simple. A bit of fuzzy testing at each stage is also useful in locating problems before they get masked by even more code. + +After the code is completed, I like to do some more extensive fuzzy testing. Always do some fuzzy testing. I have certainly been surprised by some of the results. It is easy to test for the expected things, but users do not usually do the expected things with a script. + +### Previews of coming attractions + +This article accomplished a little in the way of creating a template, but it mostly talked about testing. This is because testing is a critical part of creating any kind of program. In the next article in this series, you will add a basic Help function along with some code to detect and act on options, such as **-h**, to your Bash script template. + +### Resources + + * [How to program with Bash: Syntax and tools][6] + * [How to program with Bash: Logical operators and shell expansions][7] + * [How to program with Bash: Loops][8] + + + +* * * + +_This series of articles is partially based on Volume 2, Chapter 10 of David Both's three-part Linux self-study course, [Using and Administering Linux—Zero to SysAdmin][9]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/bash-script-template + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://opensource.com/article/19/12/introduction-automation-bash-scripts +[3]: https://opensource.com/article/18/7/how-be-lazy-sysadmin +[4]: https://opensource.com/article/17/12/source-code-license +[5]: mailto:LinuxGeek46@both.org +[6]: https://opensource.com/article/19/10/programming-bash-syntax-tools +[7]: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions +[8]: https://opensource.com/article/19/10/programming-bash-loops +[9]: http://www.both.org/?page_id=1183 From a99a8a29e2a7b035c2a983f88f2b3336ad0d716e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Dec 2019 00:58:07 +0800 Subject: [PATCH 180/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191218=20How=20?= =?UTF-8?q?tracking=20pixels=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191218 How tracking pixels work.md --- .../tech/20191218 How tracking pixels work.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 sources/tech/20191218 How tracking pixels work.md diff --git a/sources/tech/20191218 How tracking pixels work.md b/sources/tech/20191218 How tracking pixels work.md new file mode 100644 index 0000000000..596d007175 --- /dev/null +++ b/sources/tech/20191218 How tracking pixels work.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How tracking pixels work) +[#]: via: (https://jvns.ca/blog/how-tracking-pixels-work/) +[#]: author: (Julia Evans https://jvns.ca/) + +How tracking pixels work +====== + +I spent some time talking to a reporter yesterday about how advertisers track people on the internet. We had a really fun time looking at Firefox’s developer tools together (I’m not an internet privacy expert, but I do know how to use the network tab in developer tools!) and I learned a few things about how tracking pixels actually work in practice! + +### the question: how does Facebook know that you went to Old Navy? + +I often hear about this slightly creepy internet experience: you’re looking at a product online, and a day later see an ad for the same boots or whatever that you were looking at. This is called “retargeting”, but how does it actually work exactly in practice? + +In this post we’ll experiment a bit and see exactly how Facebook can know what products you’ve looked at online! I’m using Facebook as an example in this blog post just because it’s easy to find websites with Facebook tracking pixels on them but of course almost every internet advertising company does this kind of tracking. + +### the setup: allow third party trackers, turn off my adblocker + +I use Firefox, and by default Firefox blocks a lot of this kind of tracking. So I needed to modify my Firefox privacy settings to get this tracking to work. + +I changed my privacy settings from the default ([screenshot][1]) to a custom setting that allows third-party trackers ([screenshot][2]). I also disabled some privacy extensions I usually have running. + +### tracking pixels: it’s not the gif, it’s the query parameters + +A tracking pixel is a 1x1 gif that sites use to track you. By itself, obviously a tiny 1x1 gif doesn’t do too much. So how do tracking pixels track you? 2 ways: + + 1. Sites use the **query parameters** in the tracking pixel to add extra information like the URL of the page you’re visiting. So instead of just requesting `https://www.facebook.com/tr/` (which is a 44-byte 1x1 gif), it’ll request `https://www.facebook.com/tr/?the_website_you're_on`. (email marketers use similar tricks to figure out if you’ve opened an email, by giving the tracking pixel a unique URL) + 2. Sites send **cookies** with the tracking pixel so that they can tell that the person who visited oldnavy.com is the same as the person who’s using Facebook on the same computer. + + + +### the Facebook tracking pixel on Old Navy’s website + +To test this out, I went to look at a product on the Old Navy site with the URL [https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1][3] (a “Soft-Brushed Plaid Topcoat for Men”). + +When I did that, the Javascript running on that page (presumably [this code][4]) sent a request to facebook.com that looks like this in Developer tools: (I censored most of the cookie values because some of them are my login cookies :) ) + +![][5] + +Let’s break down what’s happening: + + 1. My browser sends a request to ` https://www.facebook.com/tr/?id=937725046402747&ev=PageView&dl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fproduct.do%3Fpid%3D504753002%26cid%3D1125694%26pcid%3Dxxxxxx0%26vid%3D1%26grid%3Dpds_0_109_1%23pdp-page-content&rl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fcategory.do%3Fcid%3D1135640%26mlink%3D5155%2Cm_mts_a&if=false&ts=1576684838096&sw=1920&sh=1080&v=2.9.15&r=stable&a=tmtealium&ec=0&o=30&fbp=fb.1.1576684798512.1946041422&it=15xxxxxxxxxx4&coo=false&rqm=GET` + 2. With that request, it sends a cookie called `fr` which is set to `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.` (which I guess is my Facebook ad tracking ID) + + + +So the three most notable things that are being sent in the tracking pixel query string are: + + * the page I visited: [https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1#pdp-page-content][6] + * the page that referred me to that page: [https://oldnavy.gap.com/browse/category.do?cid=1135640&mlink=5155,m_mts_a][7] + * an identifier cookie for me: `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.` + + + +### now let’s visit Facebook! + +Next, let’s visit Facebook, where I’m logged in. What cookies is my browser sending Facebook? + +Unsurprisingly, it’s the same `fr` cookie from before: `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.`. So Facebook now definitely knows that I (Julia Evans, the person with this Facebook account) visited the Old Navy website a couple of minutes ago and looked at a “Soft-Brushed Plaid Topcoat for Men”, because they can use that identifier to match up the data. + +### these cookies are third-party cookies + +The `fr` cookie that Facebook is using to track what websites I go to is called a “third party cookie”, because Old Navy’s website is using it to identify me to a third party (facebook.com). This is different from first-party cookies, which are used to keep you logged in. + +Safari and Firefox both block many third-party cookies by default (which is why I had to change Firefox’s privacy settings to get this experiment to work), and as of today Chrome doesn’t (presumably because Chrome is owned by an ad company). + +### sites have lots of tracking pixels + +Like I expected, sites have **lots** of tracking pixels. For example, wrangler.com loaded 19 different tracking pixels in my browser from a bunch of different domains. The tracking pixels on wrangler.com came from: `ct.pinterest.com`, `af.monetate.net`, `csm.va.us.criteo.net`, `google-analytics.com`, `dpm.demdex.net`, `google.ca`, `a.tribalfusion.com`, `data.photorank.me`, `stats.g.doubleclick.net`, `vfcorp.dl.sc.omtrdc.net`, `ib.adnxs.com`, `idsync.rlcdn.com`, `p.brsrvr.com`, and `adservice.google.com`. + +For most of these trackers, Firefox helpfully pointed out that it would have blocked them if I was using the standard Firefox privacy settings: + +![][8] + +### why browsers matter + +The reason browsers matter so much is that your browser has the final word on what information it sends about you to which websites. The Javascript on the Old Navy’s website can ask your browser to send tracking information about you to Facebook, but your browser doesn’t have to do it! It can decide “oh yeah, I know that facebook.com/tr/ is a tracking pixel, I don’t want my users to be tracked, I’m just not going to send that request”. + +And it can make that behaviour configurable by changing browser settings or installing browser extensions, which is why there are lots of privacy extensions. + +### it’s fun to see how this works! + +I think it’s fun to see how cookies / tracking pixels are used to track you in practice, even if it’s kinda creepy! I sort of knew how this worked before but I’d never actually looked at the cookies on a tracking pixel myself or what kind of information it was sending in its query parameters exactly. + +And if you know how it works, it’s a easier to figure out how to be tracked less! + +### what can you do? + +I do a few small things to get tracked on the internet a little less: + + * install an adblocker (like ublock origin or something), which will block a lot of tracker domains + * use Firefox/Safari instead of Chrome (which have stronger default privacy settings right now) + * use the [Facebook Container][9] Firefox extension, which takes extra steps to specifically prevent Facebook from tracking you + + + +There are still lots of other ways to be tracked on the internet (especially when using mobile apps where you don’t have the same kind of control as with your browser), but I like understanding how this one method of tracking works and think it’s nice to be tracked a little bit less. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/how-tracking-pixels-work/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/images/trackers.png +[2]: https://jvns.ca/images/firefox-insecure-settings.png +[3]: https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1 +[4]: https://developers.facebook.com/docs/facebook-pixel/implementation/ +[5]: https://jvns.ca/images/fb-old-navy.png +[6]: https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1#pdp-page-content +[7]: https://oldnavy.gap.com/browse/category.do?cid=1135640&mlink=5155,m_mts_a +[8]: https://jvns.ca/images/firefox-helpful.png +[9]: https://addons.mozilla.org/en-CA/firefox/addon/facebook-container/ From ed3c459136d7df7c9af2c8feebfaa08250783e9c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Dec 2019 01:00:07 +0800 Subject: [PATCH 181/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191219=20Bamboo?= =?UTF-8?q?=20Systems=20redesigns=20server=20motherboards=20for=20greater?= =?UTF-8?q?=20performance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191219 Bamboo Systems redesigns server motherboards for greater performance.md --- ...er motherboards for greater performance.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/talk/20191219 Bamboo Systems redesigns server motherboards for greater performance.md diff --git a/sources/talk/20191219 Bamboo Systems redesigns server motherboards for greater performance.md b/sources/talk/20191219 Bamboo Systems redesigns server motherboards for greater performance.md new file mode 100644 index 0000000000..44234d2b72 --- /dev/null +++ b/sources/talk/20191219 Bamboo Systems redesigns server motherboards for greater performance.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bamboo Systems redesigns server motherboards for greater performance) +[#]: via: (https://www.networkworld.com/article/3490385/bamboo-systems-redesigns-server-motherboards-for-greater-performance.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Bamboo Systems redesigns server motherboards for greater performance +====== +Bamboo Systems, formerly Kaleao, claims its motherboard architecture is more power efficient than traditional designs that cater to x86 processors. +Thinkstock + +UK chip designer Kaleao has re-launched as Bamboo Systems with some pre-Series A funding and claims its [Arm][1]-based server chips will be considerably more power efficient than the competition. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Bamboo is targeting x86 servers, which have a 95% market share, unlike Marvell with its [ThunderX2][3] and Ampere Systems with its [eMAG Arm processors][4]. The company argues that the two Arm processors are no different than x86. + +“Marvell and Ampere are chip manufacturers that have built a chip to pretty much slot into the motherboard and chassis configuration that an Intel/AMD chip would fit into. They are therefore going head on against Intel/AMD as chip manufacturers – and history is showing, not creating a sustainable solution for the OEMs,” says John Goodacre, co-founder and chief scientific officer of Bamboo.  + +[][5] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][5] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The motherboard is changed, but the CPU and software layer are not. Currently the company is in the prototype stage. Its server is based on Samsung Arm Cortex-A57 design, so the CPU itself is not changed. Even though they have essentially thrown out traditional motherboard design, Goodacre said the software is fully compatible and will run unchanged. So Linux and Arm-based apps will all run. + +Goodacre, a 17-year veteran of Arm and researcher at the University of Manchester working on exascale research projects, said just putting more cores in a die in a workstation designed system isn’t the most power efficient way to build scale out power efficient servers. + +“We realized that the system architecture was where your power was consumed more than instruction set. There have been several Arm chips [in servers] and they show the difference in power efficiency in an Arm gives you a few tens of percent. There is very little power efficiency in Arm over x86,” he said. + +What he noticed was that because of the motherboard and all of its ports, like USB and I/O, a lot of power was wasted on the motherboard resources. Kaleo, now Bamboo, redesigned the whole motherboard where things like I/O and memory are pooled, so doubling the processor count doesn’t require doubling of motherboards. + +This means a shared infrastructure with pooling of non-CPU resources and NVMe to scale up storage. A 3U box can hold up to 192 eight-core servers, 42 U.2 SSDs and 192 directly attached SATA 6 drives. + +“The concept of a motherboard is gone. Instead, you put the infrastructure to support processors. We build clusters of machines on boards where the infrastructure is shared across processor elements,” he said. + +The result, he claims, is the Bamboo system can deliver the same amount of web traffic in 10x less server space for 5x less energy. “One rack of our stuff equals 10 racks of the competition,” said Goodacre. + +Bamboo says it will announce more details in early January. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3490385/bamboo-systems-redesigns-server-motherboards-for-greater-performance.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3306447/a-new-arm-based-server-processor-challenges-for-the-data-center.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3271073/cavium-launches-thunderx2-arm-based-server-processors.html +[4]: https://www.networkworld.com/article/3482248/ampere-preps-an-80-core-arm-processor-for-the-cloud.html +[5]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From ef9ccd7df101fe8ea5976ccf11ab238c47d31f10 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 20 Dec 2019 01:00:35 +0800 Subject: [PATCH 182/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191213=20Space-?= =?UTF-8?q?data-as-a-service=20prepares=20to=20take=20off?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191213 Space-data-as-a-service prepares to take off.md --- ...-data-as-a-service prepares to take off.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/talk/20191213 Space-data-as-a-service prepares to take off.md diff --git a/sources/talk/20191213 Space-data-as-a-service prepares to take off.md b/sources/talk/20191213 Space-data-as-a-service prepares to take off.md new file mode 100644 index 0000000000..a78abf7976 --- /dev/null +++ b/sources/talk/20191213 Space-data-as-a-service prepares to take off.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Space-data-as-a-service prepares to take off) +[#]: via: (https://www.networkworld.com/article/3489484/space-data-as-a-service-prepares-to-take-off.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Space-data-as-a-service prepares to take off +====== +Development of IoT services in space will require ruggedized edge computing. OrbitsEdge, a vendor has announced a deal with HPE for development. +REUTERS/Joe Skipper/File Photo + +Upcoming space commercialization will require hardened edge-computing environments in a small footprint with robust links back to Earth, says vendor [OrbitsEdge][1], which recently announced that it had started collaborating with Hewlett Packard Enterprise on computing-in-orbit solutions. + +OrbitsEdge says it’s the first to provide a commercial [data-center][2] environment for installing in orbit, and will be using HPE’s Edgeline Converged Edge System in a hardened, satellite [micro-data-center][3] platform that it’s selling called SatFrame. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +The idea is “to run analytics such as artificial intelligence (AI) on the vast amounts of data that will be created as space is commercialized,” says Barbara Stinnett, CEO of OrbitsEdge, in a [press release][5]. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +### Why data in space? + +[IoT][7] data collection along with analysis and experimental testing are two examples of space industrialization that the company gives as use cases for its micro-data center product. However, commercial use of space also includes imagery, communications, weather forecasting and navigation. Space tourism and commercial recovery of space resources, such as mined raw materials from asteroids are likely to be future space-uses, too. + +Also, manufacturing – taking advantage of vacuums and zero-gravity environments – is among the economic activities that could take advantage of number crunching in orbit. + +Additionally, [Cloud Constellation Corp., a company I wrote about in 2017, unrelated to OrbitsEdge or HPE, reckons highly sensitive data should be stored isolated][8] [in][8] [space][8]. That would be the “ultimate air-gap security,” it describes its [SpaceBelt][9] product. + +### Why edge in space? + +OrbitsEdge believes that data must be processed where it is collected, in space, in order to reduce transmission bottlenecks as streams are piped back to Earth stations. “Due to the new wave of low-cost commercial space activity, the bottleneck will get worse,” the company explains on its website. + +What it means is that getting satellites into space is now cheap and is getting cheaper (due primarily to reusable rocket technology), but that there’s a problem getting the information back to traditional cloud environments on the surface of the Earth; there’s not enough backhaul data capacity, and that increases processing costs. Therefore, the cloud needs to move to the data-collection point: It’s “IoT above the cloud,” ObitsEdge cleverly taglines. + +### How it works + +Satellite-mounted solar arrays collect power from the sun. They fill batteries to be used when the satellite is in the shadow of Earth. + +Cooling- and radiation-shielding protect a standard 5U, 19-inch server rack. There’s a separate rack for the avionics. Then integrated, traditional space-to-space, and space-to-ground radio communications handle the comms. Future-proofing is also considered: laser data pipes, too, could be supported, the company says. + +#### On Earth option + +Interestingly, the company is also pitching its no-maintenance, low Earth orbit (LEO)-geared product as being suitable for terrestrial extreme environments, too. OrbitsEdge claims that SatFrame is robust enough for extreme chemical and temperature environments on Earth. Upselling, it also says that one could combine two micro-data centers: a LEO SatFrame running HPE’s Edgeline, communicating with another one in an extreme on-Earth location—one at the Poles, maybe. + +“To keep up with the rate of change and the number of satellites being launched into low Earth orbit, new services have to be made available,” OrbitsEdge says. “Shipping data back to terrestrial clouds is impractical, however today it is the only choice,” it says. + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3489484/space-data-as-a-service-prepares-to-take-off.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://orbitsedge.com/ +[2]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[3]: https://www.networkworld.com/article/3445382/10-hot-micro-data-center-startups-to-watch.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://orbitsedge.com/press-releases/f/orbitsedge-oem-agreement-with-hewlett-packard-enterprise +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[8]: https://www.networkworld.com/article/3200242/data-should-be-stored-data-in-space-firm-says.html +[9]: http://spacebelt.com/ +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world From a786c025366be3ef21f0ece78aefebd25193ef65 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 20 Dec 2019 09:01:01 +0800 Subject: [PATCH 183/676] translated --- ...virtual machines with Cockpit in Fedora.md | 99 ------------------- ...virtual machines with Cockpit in Fedora.md | 99 +++++++++++++++++++ 2 files changed, 99 insertions(+), 99 deletions(-) delete mode 100644 sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md create mode 100644 translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md diff --git a/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md b/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md deleted file mode 100644 index 7fd09b985d..0000000000 --- a/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Create virtual machines with Cockpit in Fedora) -[#]: via: (https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/) -[#]: author: (Karlis KavacisPaul W. Frields https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/) - -Create virtual machines with Cockpit in Fedora -====== - -![][1] - -This article shows you how to install the software you need to use Cockpit to create and manage virtual machines on Fedora 31. Cockpit is [an interactive admin interface][2] that lets you access and manage systems from any supported web browser. With [virt-manager being deprecated][3] users are encouraged to use Cockpit instead, which is meant to replace it. - -Cockpit is an actively developed project, with many plugins available that extend how it works. For example, one such plugin is “Machines,” which interacts with libvirtd and lets users create and manage virtual machines. - -### Installing software - -The required software prerequisites are _libvirt_, _cockpit_ and _cockpit-machines_. To install them on Fedora 31, run the following command from a terminal [using sudo][4]: - -``` -$ sudo dnf install libvirt cockpit cockpit-machines -``` - -Cockpit is also included as part of the “Headless Management” package group. This group is useful for a Fedora based server that you only access through a network. In that case, to install it, use this command: - -``` -$ sudo dnf groupinstall "Headless Management" -``` - -### Setting up Cockpit services - -After installing the necessary packages it’s time to enable the services. The _libvirtd_ service runs the virtual machines, while Cockpit has a socket activated service to let you access the Web GUI: - -``` -$ sudo systemctl enable libvirtd --now -$ sudo systemctl enable cockpit.socket --now -``` - -This should be enough to run virtual machines and manage them through Cockpit. Optionally, if you want to access and manage your machine from another device on your network, you need to expose the service to the network. To do this, add a new rule in your firewall configuration: - -``` -$ sudo firewall-cmd --zone=public --add-service=cockpit --permanent -$ sudo firewall-cmd --reload -``` - -To confirm the services are running and no issues occurred, check the status of the services: - -``` -$ sudo systemctl status libvirtd -$ sudo systemctl status cockpit.socket -``` - -At this point everything should be working. The Cockpit web GUI should be available at or . Or, enter the local network IP in a web browser on any other device connected to the same network. (Without SSL certificates setup, you may need to allow a connection from your browser.) - -### Creating and installing a machine - -Log into the interface using the user name and password for that system. You can also choose whether to allow your password to be used for administrative tasks in this session. - -Select _Virtual Machines_ and then select _Create VM_ to build a new box. The console gives you several options: - - * Download an OS using Cockpit’s built in library - * Use install media already downloaded on the system you’re managing - * Point to a URL for an OS installation tree - * Boot media over the network via the [PXE][5] protocol - - - -Enter all the necessary parameters. Then select _Create_ to power up the new virtual machine. - -At this point, a graphical console appears. Most modern web browsers let you use your keyboard and mouse to interact with the VM console. Now you can complete your installation and use your new VM, just as you would [via virt-manager in the past][6]. - -* * * - -_Photo by [Miguel Teixeira][7] on [Flickr][8] (CC BY-SA 2.0)._ - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/ - -作者:[Karlis KavacisPaul W. Frields][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/create-vm-cockpit-816x345.jpg -[2]: https://cockpit-project.org/ -[3]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.0_release_notes/rhel-8_0_0_release#virtualization_4 -[4]: https://fedoramagazine.org/howto-use-sudo/ -[5]: https://en.wikipedia.org/wiki/Preboot_Execution_Environment -[6]: https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/ -[7]: https://flickr.com/photos/miguelteixeira/ -[8]: https://flickr.com/photos/miguelteixeira/2964851828/ diff --git a/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md b/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md new file mode 100644 index 0000000000..ed0fd20db9 --- /dev/null +++ b/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create virtual machines with Cockpit in Fedora) +[#]: via: (https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/) +[#]: author: (Karlis KavacisPaul W. Frields https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/) + +在 Fedora 中使用 Cockpit 创建虚拟机 +====== + +![][1] + +本文向你展示如何在 Fedora 31 上使用安装 Cockpit 所需软件来创建和管理虚拟机。Cockpit 是一个[交互式管理界面][2],可让你在任何受支持的 Web 浏览器上访问和管理系统。随着 [virt-manager 正逐渐废弃][3],用户被鼓励使用 Cockpit 来替换它。 + +Cockpit 是一个积极开发的项目,它有许多扩展其工作的插件。例如,其中一个是 “Machines”,它与 libvirtd 交互并允许用户创建和管理虚拟机。 + +### 安装软件 + +先决所需软件是 _libvirt _、_ cockpit_ 和 _cockpit-machines_。要将它们安装在 Fedora 31 上,请在终端[使用 sudo][4] 运行以下命令: + +``` +$ sudo dnf install libvirt cockpit cockpit-machines +``` + +Cockpit 也在 “Headless Management” 软件包组中。该组对于仅通过网络访问的基于 Fedora 的服务器很有用。在这里,请使用以下命令进行安装: + +``` +$ sudo dnf groupinstall "Headless Management" +``` + +### 设置 Cockpit 服务 + +安装了必要的软件包后,就该启用服务了。 _libvirtd_ 服务运行虚拟机,而 Cockpit 有一个激活的套接字服务,可让你访问 Web GUI: + +``` +$ sudo systemctl enable libvirtd --now +$ sudo systemctl enable cockpit.socket --now +``` + +这应该足以运行虚拟机并通过 Cockpit 对其进行管理。(可选)如果要从网络上的另一台设备访问并管理计算机,那么需要将该服务开放给网络。为此,请在防火墙配置中添加新规则: + +``` +$ sudo firewall-cmd --zone=public --add-service=cockpit --permanent +$ sudo firewall-cmd --reload +``` + +要确认服务正在运行并且没有发生任何问题,请检查服务的状态: + +``` +$ sudo systemctl status libvirtd +$ sudo systemctl status cockpit.socket +``` + +此时一切都应该正常工作。Cockpit Web GUI 应该可通过 访问。或者,在连接到同一网络的任何其他设备上的 Web 浏览器中输入本地网络 IP。(如果未设置 SSL 证书,那么可能需要允许来自浏览器的连接。) + +### 创建和安装机器 + +使用系统的用户名和密码登录界面。你还可以选择是否允许在此会话中将密码用于管理任务。 + +选择 _Virtual Machines_,然后选择_ Create VM_ 来创建一台新的虚拟机。控制台为你提供几个选项: + + * 使用 Cockpit 的内置库下载操作系统 + * 使用系统上已下载的安装媒体 + * 指向系统安装树的 URL + * 通过 [PXE][5] 协议通过网络引导媒体 + + + +输入所有必要的参数。然后选择 _Create_ 启动新虚拟机。 + +此时,将出现一个图形控制台。大多数现代 Web 浏览器都允许你使用键盘和鼠标与 VM 控制台进行交互。现在,你可以完成安装并使用新的 VM,就像[过去通过 virt-manager][6] 一样。 + +* * * + +_照片由 [Miguel Teixeira][7] 发布于 [Flickr][8](CC BY-SA 2.0)_ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/ + +作者:[Karlis KavacisPaul W. Frields][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/create-vm-cockpit-816x345.jpg +[2]: https://cockpit-project.org/ +[3]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.0_release_notes/rhel-8_0_0_release#virtualization_4 +[4]: https://fedoramagazine.org/howto-use-sudo/ +[5]: https://en.wikipedia.org/wiki/Preboot_Execution_Environment +[6]: https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/ +[7]: https://flickr.com/photos/miguelteixeira/ +[8]: https://flickr.com/photos/miguelteixeira/2964851828/ From 613bde2df30605fced879e24aad2f02d19676464 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 20 Dec 2019 09:05:27 +0800 Subject: [PATCH 184/676] PRF&PUB @wxy https://linux.cn/article-11695-1.html --- ...nnotate screenshots on Linux with Ksnip.md | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) rename {translated/tech => published}/20191211 Annotate screenshots on Linux with Ksnip.md (78%) diff --git a/translated/tech/20191211 Annotate screenshots on Linux with Ksnip.md b/published/20191211 Annotate screenshots on Linux with Ksnip.md similarity index 78% rename from translated/tech/20191211 Annotate screenshots on Linux with Ksnip.md rename to published/20191211 Annotate screenshots on Linux with Ksnip.md index be9e674b41..2e940a50cd 100644 --- a/translated/tech/20191211 Annotate screenshots on Linux with Ksnip.md +++ b/published/20191211 Annotate screenshots on Linux with Ksnip.md @@ -1,18 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11695-1.html) [#]: subject: (Annotate screenshots on Linux with Ksnip) [#]: via: (https://opensource.com/article/19/12/annotate-screenshots-linux-ksnip) [#]: author: (Clayton Dewey https://opensource.com/users/cedewey) 在 Linux 上使用 Ksnip 注释截图 ====== -Ksnip 让你能轻松地在 Linux 中创建和标记截图。 + +> Ksnip 让你能轻松地在 Linux 中创建和标记截图。 + ![a checklist for a team][1] -我最近从 MacOS 切换到了 [Elementary OS][2],这是一个专注于易用性和隐私性的 Linux 发行版。作为用户体验设计师和免费软件支持者,我会经常截图并进行注释。在尝试了几种不同的工具之后,到目前为止,我最喜欢的工具是 [Ksnip][3],它是 GPLv2 许可下的一种开源工具。 +我最近从 MacOS 切换到了 [Elementary OS][2],这是一个专注于易用性和隐私性的 Linux 发行版。作为用户体验设计师和自由软件支持者,我会经常截图并进行注释。在尝试了几种不同的工具之后,到目前为止,我最喜欢的工具是 [Ksnip][3],它是 GPLv2 许可下的一种开源工具。 ![Ksnip screenshot][4] @@ -20,22 +22,19 @@ Ksnip 让你能轻松地在 Linux 中创建和标记截图。 使用你首选的包管理器安装 Ksnip。我通过 Apt 安装了它: - ``` -`sudo apt-get install ksnip` +sudo apt-get install ksnip ``` ### 配置 Ksnip 有许多配置选项,包括: - * 保存截图的地方 -  * 默认截图的文件名 -  * 图像采集器行为 -  * 光标颜色和宽度 -  * 文字字体 - - +* 保存截图的地方 +* 默认截图的文件名 +* 图像采集器行为 +* 光标颜色和宽度 +* 文字字体 你也可以将其与你的 Imgur 帐户集成。 @@ -45,7 +44,7 @@ Ksnip 有许多配置选项,包括: Ksnip 提供了大量的[功能][6]。我最喜欢的 Ksnip 部分是它拥有我需要的所有注释工具(还有一个我没想到的工具!)。 -您可以使用以下注释: +你可以使用以下注释: * 钢笔 * 记号笔 @@ -53,8 +52,6 @@ Ksnip 提供了大量的[功能][6]。我最喜欢的 Ksnip 部分是它拥有 * 椭圆 * 文字 - - 你还可以模糊区域来移除敏感信息。还有使用我最喜欢的新工具:用于在界面上表示步骤的带数字的点。 ### 关于作者 @@ -63,7 +60,7 @@ Ksnip 提供了大量的[功能][6]。我最喜欢的 Ksnip 部分是它拥有 当我问到是什么启发了他编写 Ksnip 时,他说: ->“几年前我从 Windows 切换到 Linux,却没有了在 Windows 中常用的 Windows Snipping Tool。当时的所有其他截图工具要么很大(很多按钮和复杂功能),要么缺少诸如注释等关键功能,所以我决定编写一个简单的 Windows Snipping Tool 克隆版,但是随着时间的流逝,它开始有越来越多的功能。“ +> “几年前我从 Windows 切换到 Linux,却没有了在 Windows 中常用的 Windows Snipping Tool。当时的所有其他截图工具要么很大(很多按钮和复杂功能),要么缺少诸如注释等关键功能,所以我决定编写一个简单的 Windows Snipping Tool 克隆版,但是随着时间的流逝,它开始有越来越多的功能。“ 这正是我在评估截图工具时发现的。他花时间构建解决方案并免费共享给他人使用,这真是太好了。 @@ -77,7 +74,7 @@ Damir 最需要的是帮助开发 Ksnip。他和他的妻子很快就会有孩 * * * -_此文章最初发表在 [Agaric Tech Cooperative 的博客][9]上,并经允许重新发布。_ +> 此文章最初发表在 [Agaric Tech Cooperative 的博客][9]上,并经允许重新发布。 -------------------------------------------------------------------------------- @@ -86,7 +83,7 @@ via: https://opensource.com/article/19/12/annotate-screenshots-linux-ksnip 作者:[Clayton Dewey][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6ad2d9abeb30a602e669f2bdb02e420d0ec798c5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 20 Dec 2019 09:16:53 +0800 Subject: [PATCH 185/676] translating --- ...20191217 Build a retro Apple desktop with the Linux MLVWM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md b/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md index fb92f01ed6..4090744fb8 100644 --- a/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md +++ b/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 25eea7d5addd88a41f6d0158bbc71e7be753244e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 20 Dec 2019 09:45:57 +0800 Subject: [PATCH 186/676] PRF @HankChow --- ...y steps to update your apps to Python 3.md | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/translated/tech/20191210 3 easy steps to update your apps to Python 3.md b/translated/tech/20191210 3 easy steps to update your apps to Python 3.md index 566eb735c8..74bb19f585 100644 --- a/translated/tech/20191210 3 easy steps to update your apps to Python 3.md +++ b/translated/tech/20191210 3 easy steps to update your apps to Python 3.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (3 easy steps to update your apps to Python 3) @@ -9,23 +9,23 @@ 将你的应用迁移到 Python 3 的三个步骤 ====== -Python 2 气数将尽,是时候将你的项目从 Python 2 迁移到 Python 3 了。 + +> Python 2 气数将尽,是时候将你的项目从 Python 2 迁移到 Python 3 了。 ![Hands on a keyboard with a Python book ][1] -Python 2.x 很快就要[失去官方支持][2]了,尽管如此,从 Python 2 迁移到 Python 3 却并没有想象中那么难。我在上周用了一个晚上的时间将一个 3D 渲染器及其对应的 [PySide][3] 迁移到 Python 3,回想起来,尽管在迁移过程中无可避免地会遇到一些牵一发而动全身的修改,但整个过程相比起痛苦的重构来说简直是出奇地简单。 +Python 2.x 很快就要[失去官方支持][2]了,尽管如此,从 Python 2 迁移到 Python 3 却并没有想象中那么难。我在上周用了一个晚上的时间将一个 3D 渲染器的前端代码及其对应的 [PySide][3] 迁移到 Python 3,回想起来,尽管在迁移过程中无可避免地会遇到一些牵一发而动全身的修改,但整个过程相比起痛苦的重构来说简直是出奇地简单。 每个人都别无选择地有各种必须迁移的原因:或许是觉得已经拖延太久了,或许是依赖了某个在 Python 2 下不再维护的模块。但如果你仅仅是想通过做一些事情来对开源做贡献,那么把一个 Python 2 应用迁移到 Python 3 就是一个简单而又有意义的做法。 无论你从 Python 2 迁移到 Python 3 的原因是什么,这都是一项重要的任务。按照以下三个步骤,可以让你把任务完成得更加清晰。 -### 1\. 使用 2to3 +### 1、使用 2to3 从几年前开始,Python 在你或许还不知道的情况下就已经自带了一个名叫 [2to3][4] 的脚本,它可以帮助你实现大部分代码从 Python 2 到 Python 3 的自动转换。 下面是一段使用 Python 2.6 编写的代码: - ``` #!/usr/bin/env python # -*- coding: utf-8 -*- @@ -39,12 +39,12 @@ print ord(mystring[-1]) ``` $ 2to3 example.py RefactoringTool: Refactored example.py -\--- example.py     (original) -+++ example.py     (refactored) +--- example.py (original) ++++ example.py (refactored) @@ -1,5 +1,5 @@ - #!/usr/bin/env python - # -*- coding: utf-8 -*- -  + #!/usr/bin/env python + # -*- coding: utf-8 -*- + -mystring = u'abcdé' -print ord(mystring[-1]) +mystring = 'abcdé' @@ -53,8 +53,7 @@ RefactoringTool: Files that need to be modified: RefactoringTool: example.py ``` -在默认情况下,2to3 只会对迁移到 Python 3 时必须作出修改的代码进行标示,在输出结果中显示的 Python 3 代码是直接可用的,但你可以在 2to3 加上 `-w` 或者 `--write` 参数,这样它就可以直接按照给出的方案修改你的 Python 2 代码文件了。 - +在默认情况下,`2to3` 只会对迁移到 Python 3 时必须作出修改的代码进行标示,在输出结果中显示的 Python 3 代码是直接可用的,但你可以在 2to3 加上 `-w` 或者 `--write` 参数,这样它就可以直接按照给出的方案修改你的 Python 2 代码文件了。 ``` $ 2to3 -w example.py @@ -63,17 +62,16 @@ RefactoringTool: Files that were modified: RefactoringTool: example.py ``` -2to3 脚本不仅仅对单个文件有效,你还可以把它用于一个目录下的所有 Python 文件,同时它也会递归地对所有子目录下的 Python 文件都生效。 +`2to3` 脚本不仅仅对单个文件有效,你还可以把它用于一个目录下的所有 Python 文件,同时它也会递归地对所有子目录下的 Python 文件都生效。 -### 2\. 使用 Pylint 或 Pyflakes +### 2、使用 Pylint 或 Pyflakes -有一些不良的代码习惯在 Python 2 下运行是没有异常的,在 Python 3 下运行则会或多或少报出错误,并且这些代码无法通过语法转换来修复,所以 2to3 对它们没有效果,但一旦使用 Python 3 来运行就会产生报错。 +有一些不良的代码在 Python 2 下运行是没有异常的,在 Python 3 下运行则会或多或少报出错误,这种情况并不鲜见。因为这些不良代码无法通过语法转换来修复,所以 `2to3` 对它们没有效果,但一旦使用 Python 3 来运行就会产生报错。 -对于这种情况,你需要使用 [Pylint][5]、[Pyflakes][6](或封装好的 [flake8][7])这类工具。其中我更喜欢 Pyflakes,它会忽略代码风格上的差异,在这一点上它和 Pylint 不同。尽管代码优美是 Python 的一大特点,但在代码迁移的层面上,“让代码功能保持一致”无疑比“让代码风格保持一致”重要得多/ +要找出这种问题,你需要使用 [Pylint][5]、[Pyflakes][6](或 [flake8][7] 封装器)这类工具。其中我更喜欢 Pyflakes,它会忽略代码风格上的差异,在这一点上它和 Pylint 不同。尽管代码优美是 Python 的一大特点,但在代码迁移的层面上,“让代码功能保持一致”无疑比“让代码风格保持一致”重要得多。 以下是 Pyflakes 的输出样例: - ``` $ pyflakes example/maths example/maths/enum.py:19: undefined name 'cmp' @@ -87,7 +85,6 @@ example/maths/enum.py:208: local variable 'e' is assigned to but never used 值得注意的是第 19 行这个容易产生误导的错误。从输出来看你可能会以为 `cmp` 是一个在使用前未定义的变量,实际上 `cmp` 是 Python 2 的一个内置函数,而它在 Python 3 中被移除了。而且这段代码被放在了 `try` 语句块中,除非认真检查这段代码的输出值,否则这个问题很容易被忽略掉。 - ```     try:         result = cmp(self.index, other.index) @@ -99,13 +96,12 @@ example/maths/enum.py:208: local variable 'e' is assigned to but never used 在代码迁移过程中,你会发现很多原本在 Python 2 中能正常运行的函数都发生了变化,甚至直接在 Python 3 中被移除了。例如 PySide 的绑定方式发生了变化、`importlib` 取代了 `imp` 等等。这样的问题只能见到一个解决一个,而涉及到的功能需要重构还是直接放弃,则需要你自己权衡。但目前来说,大多数问题都是已知的,并且有[完善的文档记录][8]。所以难的不是修复问题,而是找到问题,从这个角度来说,使用 Pyflake 是很有必要的。 -### 3\. 修复被破坏的 Python 2 代码 +### 3、修复被破坏的 Python 2 代码 -尽管 2to3 脚本能够帮助你把代码修改成兼容 Python 3 的形式,但对于一个完整的代码库,它就显得有点无能为力了,因为一些老旧的代码在 Python 3 中可能需要不同的结构来表示。在这样的情况下,只能人工进行修改。 +尽管 `2to3` 脚本能够帮助你把代码修改成兼容 Python 3 的形式,但对于一个完整的代码库,它就显得有点无能为力了,因为一些老旧的代码在 Python 3 中可能需要不同的结构来表示。在这样的情况下,只能人工进行修改。 例如以下代码在 Python 2.6 中可以正常运行: - ``` class CLOCK_SPEED:         TICKS_PER_SECOND = 16 @@ -116,8 +112,7 @@ class FPS:         STATS_UPDATE_FREQUENCY = CLOCK_SPEED.TICKS_PER_SECOND ``` -类似 2to3 和 Pyflakes 这些自动化工具并不能发现其中的问题,但如果上述代码使用 Python 3 来运行,解释器会认为 `CLOCK_SPEED.TICKS_PER_SECOND` 是未被明确定义的。因此就需要把代码改成面向对象的结构: - +类似 `2to3` 和 Pyflakes 这些自动化工具并不能发现其中的问题,但如果上述代码使用 Python 3 来运行,解释器会认为 `CLOCK_SPEED.TICKS_PER_SECOND` 是未被明确定义的。因此就需要把代码改成面向对象的结构: ``` class CLOCK_SPEED: @@ -131,7 +126,7 @@ class FPS:         STATS_UPDATE_FREQUENCY = CLOCK_SPEED.TICKS_PER_SECOND() ``` -你也许会认为如果把 `TICKS_PER_SECOND()` 改写为一个构造函数能让代码看起来更加简洁,但这样就需要把这个方法的调用形式从 `CLOCK_SPEED.TICKS_PER_SECOND()` 改为 `CLOCK_SPEED()` 了,这样的改动或多或少会对整个库造成一些未知的影响。如果你对整个代码库的结构烂熟于心,那么你确实可以随心所欲地作出这样的修改。但我通常认为,只要我做出了修改,都可能会影响到其它代码中的至少三处地方,因此我更倾向于不使代码的结构发生改变。 +你也许会认为如果把 `TICKS_PER_SECOND()` 改写为一个构造函数(用 `__init__` 函数设置默认值)能让代码看起来更加简洁,但这样就需要把这个方法的调用形式从 `CLOCK_SPEED.TICKS_PER_SECOND()` 改为 `CLOCK_SPEED()` 了,这样的改动或多或少会对整个库造成一些未知的影响。如果你对整个代码库的结构烂熟于心,那么你确实可以随心所欲地作出这样的修改。但我通常认为,只要我做出了修改,都可能会影响到其它代码中的至少三处地方,因此我更倾向于不使代码的结构发生改变。 ### 坚持信念 @@ -146,14 +141,14 @@ via: https://opensource.com/article/19/12/update-apps-python-3 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/seth [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd "Hands on a keyboard with a Python book " -[2]: https://opensource.com/article/19/11/end-of-life-python-2 +[2]: https://linux.cn/article-11629-1.html [3]: https://pypi.org/project/PySide/ [4]: https://docs.python.org/3.1/library/2to3.html [5]: https://opensource.com/article/19/10/python-pylint-introduction From 9d8be2a78de5b97f10a652498603f23689ba19ee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 20 Dec 2019 09:54:21 +0800 Subject: [PATCH 187/676] PUB @HankChow https://linux.cn/article-11696-1.html --- ...20191210 3 easy steps to update your apps to Python 3.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191210 3 easy steps to update your apps to Python 3.md (98%) diff --git a/translated/tech/20191210 3 easy steps to update your apps to Python 3.md b/published/20191210 3 easy steps to update your apps to Python 3.md similarity index 98% rename from translated/tech/20191210 3 easy steps to update your apps to Python 3.md rename to published/20191210 3 easy steps to update your apps to Python 3.md index 74bb19f585..19ff8e16db 100644 --- a/translated/tech/20191210 3 easy steps to update your apps to Python 3.md +++ b/published/20191210 3 easy steps to update your apps to Python 3.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11696-1.html) [#]: subject: (3 easy steps to update your apps to Python 3) [#]: via: (https://opensource.com/article/19/12/update-apps-python-3) [#]: author: (Seth Kenlon https://opensource.com/users/seth) @@ -12,7 +12,7 @@ > Python 2 气数将尽,是时候将你的项目从 Python 2 迁移到 Python 3 了。 -![Hands on a keyboard with a Python book ][1] +![](https://img.linux.net.cn/data/attachment/album/201912/20/095224r0kp79s0cnc0z77p.jpg) Python 2.x 很快就要[失去官方支持][2]了,尽管如此,从 Python 2 迁移到 Python 3 却并没有想象中那么难。我在上周用了一个晚上的时间将一个 3D 渲染器的前端代码及其对应的 [PySide][3] 迁移到 Python 3,回想起来,尽管在迁移过程中无可避免地会遇到一些牵一发而动全身的修改,但整个过程相比起痛苦的重构来说简直是出奇地简单。 From 2a84ce3b9050093f885c6aa58040a2ebb7c354d3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 20 Dec 2019 10:24:06 +0800 Subject: [PATCH 188/676] PRF @geekpi --- ...onfigure Openbox for your Linux desktop.md | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/translated/tech/20191212 How to configure Openbox for your Linux desktop.md b/translated/tech/20191212 How to configure Openbox for your Linux desktop.md index 5c6879119f..d8fef55c8f 100644 --- a/translated/tech/20191212 How to configure Openbox for your Linux desktop.md +++ b/translated/tech/20191212 How to configure Openbox for your Linux desktop.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to configure Openbox for your Linux desktop) @@ -9,16 +9,18 @@ 如何为 Linux 桌面配置 Openbox ====== -本文是 24 天 Linux 桌面特别系列的一部分。Openbox 窗口管理器占用很小的系统资源、易于配置、使用愉快。 -![open with sky and grass][1] -你可能不知道使用过 [Openbox][2] 桌面:尽管 Openbox 本身是一个出色的窗口管理器,但它还是 LXDE 和 LXQT 等桌面环境的窗口管理器“引擎”,它甚至可以管理 KDE 和 GNOME。除了作为多个桌面的基础之外,Openbox 可以说是最简单的窗口管理器之一,可以为那些不想学习所有配置选项的人配置。通过使用基于菜单的 **obconf** 的配置应用,可以像在 GNOME 或 KDE 这样的完整桌面中一样轻松地设置所有常用首选项。 +> 本文是 24 天 Linux 桌面特别系列的一部分。Openbox 窗口管理器占用很小的系统资源、易于配置、使用愉快。 + +![](https://img.linux.net.cn/data/attachment/album/201912/20/102327hdl3gcychsc53y3m.jpg) + +你可能不知道你使用过 [Openbox][2] 桌面:尽管 Openbox 本身是一个出色的窗口管理器,但它还是 LXDE 和 LXQT 等桌面环境的窗口管理器“引擎”,它甚至可以管理 KDE 和 GNOME。除了作为多个桌面的基础之外,Openbox 可以说是最简单的窗口管理器之一,可以为那些不想学习那么多配置选项的人配置。通过使用基于菜单的 obconf 的配置应用,可以像在 GNOME 或 KDE 这样的完整桌面中一样轻松地设置所有常用首选项。 ### 安装 Openbox -你可能会在 Linux 发行版的软件仓库中找到 Openbox,但也可以在 [Openbox.org][3] 中找到它。如果你已经在运行其他桌面,那么可以安全地在同一系统上安装 Openbox,因为 Openbox 除了几个配置面板之外,不包括任何捆绑的应用。 +你可能会在 Linux 发行版的软件仓库中找到 Openbox,也可以在 [Openbox.org][3] 中找到它。如果你已经在运行其他桌面,那么可以安全地在同一系统上安装 Openbox,因为 Openbox 除了几个配置面板之外,不包括任何捆绑的应用。 -安装后,退出当前桌面会话,以便你可以登录 Openbox 桌面。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,这取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 +安装后,退出当前桌面会话,以便你可以登录 Openbox 桌面。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,这取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该选择。 要使用 GDM 覆盖它: @@ -30,17 +32,17 @@ ### 配置 Openbox 桌面 -默认情况下,Openbox 包含 **obconf** 应用,你可以使用它来选择和安装主题,修改鼠标行为,设置桌面首选项等。你可能会在仓库中发现其他配置应用,如 **obmenu** ,用于配置窗口管理器的其他部分。 +默认情况下,Openbox 包含 obconf 应用,你可以使用它来选择和安装主题、修改鼠标行为、设置桌面首选项等。你可能会在仓库中发现其他配置应用,如 obmenu,用于配置窗口管理器的其他部分。 ![Openbox Obconf configuration application][6] -建立你自己的桌面体验相对容易。它有一些所有常见的桌面组件,例如系统托盘 [stalonetray][7]、任务栏 [Tint2][8] 或 [Xfce4-panel][9] 等几乎你能想到的。任意组合应用,直到拥有梦想的开源桌面为止。 +构建你自己的桌面环境相对容易。它有一些所有常见的桌面组件,例如系统托盘 [stalonetray][7]、任务栏 [Tint2][8] 或 [Xfce4-panel][9] 等几乎你能想到的。任意组合应用,直到拥有梦想的开源桌面为止。 ![Openbox][10] ### 为何使用 Openbox -Openbox 占用很小的系统资源、易于配置、使用愉快。它基本不会弹出,因此会是一个容易熟悉的系统。你永远不会知道你面前的桌面秘密使用了 Openbox 作为窗口管理器(知道如何自定义它会不会很高兴?)。如果开源吸引你,那么试试看 Openbox。 +Openbox 占用的系统资源很小、易于配置、使用起来很愉悦。它基本不会让你感觉到阻碍,会是一个容易熟悉的系统。你永远不会知道你面前的桌面环境秘密使用了 Openbox 作为窗口管理器(知道如何自定义它会不会很高兴?)。如果开源吸引你,那么试试看 Openbox。 -------------------------------------------------------------------------------- @@ -49,7 +51,7 @@ via: https://opensource.com/article/19/12/openbox-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From baec0d1a33479285ad5f4f1fe44d056725b63e3d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 20 Dec 2019 10:27:26 +0800 Subject: [PATCH 189/676] PUB @geekpi https://linux.cn/article-11698-1.html --- ...0191212 How to configure Openbox for your Linux desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191212 How to configure Openbox for your Linux desktop.md (98%) diff --git a/translated/tech/20191212 How to configure Openbox for your Linux desktop.md b/published/20191212 How to configure Openbox for your Linux desktop.md similarity index 98% rename from translated/tech/20191212 How to configure Openbox for your Linux desktop.md rename to published/20191212 How to configure Openbox for your Linux desktop.md index d8fef55c8f..d400c04d36 100644 --- a/translated/tech/20191212 How to configure Openbox for your Linux desktop.md +++ b/published/20191212 How to configure Openbox for your Linux desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11698-1.html) [#]: subject: (How to configure Openbox for your Linux desktop) [#]: via: (https://opensource.com/article/19/12/openbox-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 0fce3113367954ffb377bc2cf88e54ec7c19b823 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 21 Dec 2019 00:56:57 +0800 Subject: [PATCH 190/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191221=20Pop!?= =?UTF-8?q?=5FOS=20vs=20Ubuntu:=20Which=20One=20is=20Better=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md --- ... Pop-_OS vs Ubuntu- Which One is Better.md | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md diff --git a/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md new file mode 100644 index 0000000000..dfa07d8896 --- /dev/null +++ b/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?) +[#]: via: (https://itsfoss.com/pop-os-vs-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Pop!_OS vs Ubuntu: Which One is Better? +====== + +Well, you might find it easy to pick one from the list of [best Linux distributions][1]. However, it is often confusing to compare two similar Linux distros, just like Pop!_OS vs Ubuntu. + +Interestingly, Pop!_OS is based on [Ubuntu][2]. So, what is the difference between Pop!_OS and Ubuntu? Why should you choose one over other? + +In this article, I’m going to compare Pop!_OS and Ubuntu (both of which happen to be my favorites). + +**Note:** _You might find some of the points opinionated, this article is just a reference for the comparison. With constant developments and updates to Linux distros, a lot can change over time._ + +### Comparing Ubuntu and Pop!_OS + +![Pop!_OS Vs Ubuntu][3] + +Spotting the similarity helps you distinguish other differences. So, let me start noting down some of the obvious similarities. + +Like I mentioned, Pop!_OS is a Linux distribution on top of Ubuntu. So, you get all the benefits of using Ubuntu (technically the same thing at its core) when you use Pop!_OS. + +They both ship with the [GNOME desktop environment][4] by default and hence they feature a similar user interface (UI). + +Without going into all the under-the-hood differences, I will be highlighting some important ones here. + +#### User Experience & Theming + +![Pop!_OS][5] + +A lot of users think that Pop!_OS is just Ubuntu with a different skin. + +From my experience, I’ll mention that it is not entirely true. + +Yes, they both rock [GNOME desktop environment][4] – however, Pop!_OS just feels more polished. + +In addition to the look and feel, [Ubuntu customizes the GNOME experience][6] by adding a dock and a few more tricks. You might find it better if you like a customized GNOME experience. + +But, if you prefer a pure GNOME experience, Pop!_OS gives you that by default. + +I cannot convince you enough until you try it out for yourself. But, the overall color scheme, icons, and the theme that goes on in Pop!_OS is arguably more pleasing as a superior user experience. + +It can be a subjective thing – but it is what I observed. You can also check out the video tour for Ubuntu 19.10 to check it out for yourself: + +#### Ease of Installing Third-Party Apps + +![Pop Os PPA][7] + +Ubuntu puts a lot of emphasis on Snap packages. This increases the number of application it offers. + +But there are some major issues with Snap packages. They take too much of disk space and they take a lot of time to start. + +This is why I prefer using the APT version of any application. + +Why am I telling you this? + +Because Pop!_OS has its [own official PPA][8] which is enabled by default. You’ll find some useful applications like Android Studio, TensorFlow in here. No need to download a 1 GB snap package for the Android Studio. Just use [apt-get install][9] and get done with it. + +#### Pre-installed Applications + +![Ubuntu installation slideshow][10] + +It may not be the biggest deal-breaker for some but having a lot of pre-installed apps could affect the experience and performance. Even if it does not affect the performance – some users just prefer fewer pre-installed apps. + +Pop!_OS comes bundled with fewer default apps (potentially less bloatware, if I may call it that) when compared to Ubuntu. + +Yet again, this is something subjective. If you want to have more apps pre-installed, you may consider Ubuntu over Pop!_OS. + +#### Snap Package Support + +![][11] + +For users comfortable with the snap packages, Ubuntu’s software center is a slightly better solution to Pop!_OS shop because you can have snap packages listed right in your software center. + +You cannot filter the snap packages in the software center but it will be easier to install a snap package when you notice one (look at the details for the source of the app as ‘_Snap store_‘ / ‘_Snapcraft_‘) in the Software Center. + +Pop!_OS does support snap packages as well – if you’re confused. But, you won’t find them through the Pop!_OS shop, that’s the only difference here. + +If you are not sure what a snap package is and what it does, you can check out our article on [installing snap apps on Linux][12]. + +#### Separate NVIDIA/AMD ISO File + +![ISOs][13] + +Technically, it isn’t a part of the comparison internally but it is a factor that some users care for. + +So, it is worth highlighting that Pop!_OS provides separate ISOs. One for the systems with NVIDIA graphics card and another for systems with/without AMD graphics. + +With Ubuntu 19.10, you get NVIDIA drivers on the Ubuntu ISO but there is no such thing for AMD graphics. + +#### Reliability & Issues + +Unquestionably, both the [distributions are beginner-friendly][14] and quite reliable. You might want to hold on to a Long Term Support (LTS) release if you want better reliability and fewer issues. + +When a new version of Ubuntu comes up, Pop!_OS works on it and potentially fixes the issues that users encounter on Ubuntu’s original release before making the new upgrade available. This gives them a slight edge but that’s nothing substantial because those fixes eventually reach Ubuntu. + +#### Performance + +The performance will highly depend on what you have installed and the hardware configuration you install it on. + +Unless you have a super old system, both distributions seem to perform very well. + +I’m rocking an i5-7400 processor coupled with 16 Gigs of RAM (with a GTX 1050ti Graphics Card) and I find the experience good enough on both the distros. + +Of course, you could manually do a few optimization tweaks to fit your requirements – if either of them does not work out for your hardware configuration. + +But, if you want to get your hands on a System76 laptop, Pop!_OS will prove to be [the Apple of Linux space][15] because Pop!_OS has been tailored for their hardware, unlike Ubuntu. + +#### Hardware Compatibility + +This is definitely something to consider when comparing other Linux distributions. However, in this case, there’s really no significant difference. + +You might consider Pop!_OS to constantly work with newer hardware configurations because they primarily tailor the OS for their laptops with a variety of configurations. And, it’s just an observation – not a fact. + +**Wrapping Up** + +I know it’s not easy to choose one among the two popular Linux distro without trying them out. If it’s a possibility, I’ll recommend you to give them both a try while keeping this comparison for reference. + +What’s your choice between these two? Did I miss something in the comparison? Let me know in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pop-os-vs-ubuntu/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-distributions/ +[2]: https://ubuntu.com/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/pop_os_vs_ubuntu.png?ssl=1 +[4]: https://www.gnome.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-UI.jpg?ssl=1 +[6]: https://itsfoss.com/gnome-tricks-ubuntu/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-ppa.jpg?ssl=1 +[8]: https://launchpad.net/~system76/+archive/ubuntu/pop/ +[9]: https://itsfoss.com/apt-get-linux-guide/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?resize=800%2C516&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/snapcraft.jpg?ssl=1 +[12]: https://itsfoss.com/install-snap-linux/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/iso-amd-nvidia-pop-os.jpg?ssl=1 +[14]: https://itsfoss.com/best-linux-beginners/ +[15]: https://www.phoronix.com/scan.php?page=news_item&px=System76-Integrated-Vision From b23dd3a16d860ab54a5c550ccfd5ecbac4564079 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 21 Dec 2019 00:57:25 +0800 Subject: [PATCH 191/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191220=20Why=20?= =?UTF-8?q?Vim=20fans=20love=20the=20Herbstluftwm=20Linux=20window=20manag?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md --- ...e the Herbstluftwm Linux window manager.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md diff --git a/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md new file mode 100644 index 0000000000..94f7ecc281 --- /dev/null +++ b/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why Vim fans love the Herbstluftwm Linux window manager) +[#]: via: (https://opensource.com/article/19/12/herbstluftwm-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Why Vim fans love the Herbstluftwm Linux window manager +====== +This article is part of a special series of 24 days of Linux desktops. +If you're a Vim fan, check out herbstluftwm, a tile-based Linux window +manager that takes the "Vim way" as inspiration. +![OpenStack source code \(Python\) in VIM][1] + +Everybody loves Vim (aside from Dvorak and Emacs users). Vim is so popular that there are entire web browsers dedicated to navigating the web with Vim keybindings, a Vim mode in the wildly popular [Zsh][2] terminal emulator, and even a text editor. There's also a window manager called [herbstluftwm][3] that models itself partly after the "Vim way." Herbstluftwm does away with windows, as such, and replaces them with tiles, or quadrants, into which applications are loaded and used. You use the keyboard (**Alt+h**, **Alt+j**, **Alt+k**, and **Alt+l**) to navigate from one tile to another. + +![Herbstluftwm][4] + +Install herbstluftwm from your distribution's software repository. After installing it, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +With GDM: + +![][5] + +With SDDM: + +![][6] + +### Herbstluftwm desktop tour + +The first time you log into herbstluftwm, you are greeted with nothing but a green screen with a darker green border around the edges. What you're seeing is the initial tile with no application loaded into it. To start the default application, xterm, press **Alt+Return**. + +The documentation emphasizes the **$HOME/.config/herbstluftwm/autostart** configuration file as a way to start important applications when you log in. For applications you don't necessarily want to start every time you log in, you can use xterm as your launch daemon. As usual, placing an ampersand (**&**) symbol after the command returns control of the shell to you. To start Emacs, for instance: + + +``` +`% emacs &` +``` + +This launches an Emacs window in a new tile and returns you to a prompt. + +![Emacs running in Herbstluftwm][7] + +#### Switching tiles + +To move from one tile to another, use the classic Vim navigation combination of **h**, **j**, **k**, or **l**, along with the **Alt** key. For example, to switch from the terminal to an application in a tile below it (i.e., at the bottom of the screen), press **Alt+j**. To navigate back up, **Alt+k**. Left and right navigations are **Alt+h** and **Alt+l**, respectively. + +#### Split screen + +You can manually split a screen vertically with **Alt+o** and horizontally with **Alt+u**. + +To remove an empty tile, navigate into it and press **Alt+r**. + +### Configuring herbstluftwm + +Aside from the **Alt** keybindings, you communicate with herbstluftwm through the **herbstclient** command. This command can be used interactively from a shell, or you can preserve your preferences in a configuration file. + +You can view all attributes available in Herbstluftwm with: + + +``` +`$ herbstclient attr` +``` + +Herbstluftwm's default behavior is defined in the default config file, which you can copy to your home directory and modify. Upon launch, herbstluftwm executes the commands contained in the config file. For instance, if you find it awkward to use keybindings centered around the **Alt** key, which is traditionally a key reserved for in-application shortcuts, you can change the key used to trigger herbstluftwm actions in the config file: + + +``` +% mkdir ~/.config/herbstluftwm +% cp /usr/xdg/herbstluftwm/autostart \ +~/.config/herbstluftwm +% sed -i 's/Mod=Mod1/Mod=Mod4/' ~/.config/herbstluftwm +% herbstclient reload +``` + +This changes the herbstluftwm modifier to the Super key (the "Windows" or "Tux" key, depending on your keyboard). + +Using the autostart file, you can set custom keybindings, create tags for applications of a specific type so you can tile applications in a consistent way, and do much more. + +### Why you need to try herbstluftwm + +Herbstluftwm is a fine example of a tiling window manager. It tiles windows by default and lets the user define exceptions to global rules. It uses Vim-like navigation but allows for quick and easy overrides. It's very likely the tiling manager you've been looking for, so try it soon. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/herbstluftwm-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM) +[2]: https://opensource.com/article/19/9/getting-started-zsh +[3]: https://herbstluftwm.org +[4]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm.png (Herbstluftwm) +[5]: https://opensource.com/sites/default/files/advent-gdm_1.jpg +[6]: https://opensource.com/sites/default/files/advent-kdm_0.jpg +[7]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm-emacs.jpg (Emacs running in Herbstluftwm) From ff099bd879304a264a7c53e3d946139bb21169e3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 21 Dec 2019 00:57:54 +0800 Subject: [PATCH 192/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191220=204=20wa?= =?UTF-8?q?ys=20to=20volunteer=20this=20holiday=20season?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191220 4 ways to volunteer this holiday season.md --- ...4 ways to volunteer this holiday season.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20191220 4 ways to volunteer this holiday season.md diff --git a/sources/tech/20191220 4 ways to volunteer this holiday season.md b/sources/tech/20191220 4 ways to volunteer this holiday season.md new file mode 100644 index 0000000000..e425a5ef21 --- /dev/null +++ b/sources/tech/20191220 4 ways to volunteer this holiday season.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways to volunteer this holiday season) +[#]: via: (https://opensource.com/article/19/12/ways-volunteer) +[#]: author: (John Jones https://opensource.com/users/johnjones4) + +4 ways to volunteer this holiday season +====== +Looking to spread some holiday cheer? Donate your talents to open source +organizations that help communities in need. +![Gift box opens with colors coming out][1] + +Social impact happens when leaders deploy individuals and resources to make positive change, but many social efforts are lacking technology resources that are up to the task of serving these change-makers. However, there are organizations helping to accelerate tech for good by connecting developers who want to make a change with communities and nonprofits who desperately need better technology. These organizations often serve specific audiences and recruit specific kinds of technologists, but they all share a common thread: open source. + +As developers, we all seek to participate in the open source community for a variety of reasons. Some participate for professional development, some participate so that they may collaborate with a vast, impressive network of technologists, and others participate because they know their contributions are necessary for the success of a project. Why not also volunteer your talents as a developer to an effort that needs them, and contribute to open source all at the same time? The organizations below are prime examples of how you can do that. + +### Code for America + +Code for America is an example of how government can still be by the people and for the people in the digital age. Through its Brigade Network, the organization has cultivated a national alliance of volunteer programmers, data scientists, concerned citizens, and designers organized in cities all over the United States. These local affiliates host regular meet-ups which are open to the community to both pitch new projects to the group and collaborate on ongoing efforts. To match volunteers with projects, the brigades’ websites often list the specific skills needed for a project such as data analysis, content creation, and JavaScript. While the brigades focus on local issues, shared experiences like natural disasters can foster collaboration. For example, a multi-brigade effort from the New Orleans, Houston, and Tampa Bay teams developed a hurricane response website that can be quickly adapted to different cities when disaster strikes. + +To get involved, visit Code for America’s [website][2] for a list of its over 70 brigades, and a path for individuals to start their own if there is not one already in their community. + +### Code for Change + +Code for Change shows that social impact can start even in high school. A group of high school coders in Indianapolis started their own club to give back to local organizations by creating open source software solutions to issues in their community. Code for Change encourages local organizations to reach out with a project idea, and the student group steps in to develop a completely free and open source solution. The group has developed projects such as "Sapphire," which optimized volunteer management systems for a local refugee organization, and a Civil Rights Commission complaint form that makes it easier for citizens to voice their concerns online. + +For more information on how to create a Code for Change chapter in your own community, [visit their website][3]. + +### Python for Good/Ruby for Good + +Python for Good and Ruby for Good are twin annual events in Portland, Oregon and Fairfax, Virginia, that bring people together to develop and program solutions for those respective communities. Over a weekend, individuals get together to hear pitches from local nonprofits and tackle their issues by building open source solutions. In 2017, Ruby For Good participants created "Justice for Juniors," which mentors and tutors current and formerly incarcerated youths to integrate them back into the community. Participants have also created "Diaperbase," an inventory management system that has been used by diaper banks all over the United States. One of the main objectives of these events is to bring organizations and people from seemingly different industries and mindsets to come together for a common good. Companies can sponsor the events, nonprofits can submit project ideas, and people of all skill levels can register to attend the event and contribute. Through their bicoastal efforts, Ruby for Good and Python for Good are living up to their motto of "making the world gooder." + +[Ruby for Good][4] is held in the summer and hosted on George Mason’s campus in Fairfax, Virginia. + +### Social Coder + +UK-based Ed Guiness created Social Coder to bring together volunteers and charities to create and use open source projects for nonprofits across six continents. Social Coder actively recruits a network of skilled IT volunteers from all over the world and matches them to charities and nonprofits registered through Social Coder. Projects can range from simple website updates to entire mobile app development. + +For example, PHASE Worldwide, a small non-governmental association supporting efforts in Nepal, got access to key support and expertise leveraging open source technology because of Social Coder. + +While a bulk of the charities already partnered with Social Coder are based in the UK, organizations in other countries are welcome. Through their website, individuals can register to work on social software projects and connect with organizations and charities seeking their help. + +Individuals interested in volunteering with Social Coder can sign up [here][5]. + +The four-day-long siege of a Nairobi mall ended Tuesday with a death toll of more than 60 people –... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ways-volunteer + +作者:[John Jones][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/johnjones4 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://brigade.codeforamerica.org/ +[3]: http://codeforchange.herokuapp.com/ +[4]: https://rubyforgood.org/ +[5]: https://socialcoder.org/Home/Programmer From d7b4759c3a19e44e8e36ae1c775f1afafdfadd6b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 21 Dec 2019 00:58:34 +0800 Subject: [PATCH 193/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191220=20How=20?= =?UTF-8?q?to=20add=20a=20Help=20facility=20to=20your=20Bash=20program?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191220 How to add a Help facility to your Bash program.md --- ...dd a Help facility to your Bash program.md | 346 ++++++++++++++++++ 1 file changed, 346 insertions(+) create mode 100644 sources/tech/20191220 How to add a Help facility to your Bash program.md diff --git a/sources/tech/20191220 How to add a Help facility to your Bash program.md b/sources/tech/20191220 How to add a Help facility to your Bash program.md new file mode 100644 index 0000000000..d51466411f --- /dev/null +++ b/sources/tech/20191220 How to add a Help facility to your Bash program.md @@ -0,0 +1,346 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to add a Help facility to your Bash program) +[#]: via: (https://opensource.com/article/19/12/help-bash-program) +[#]: author: (David Both https://opensource.com/users/dboth) + +How to add a Help facility to your Bash program +====== +In the third article in this series, learn about using functions as you +create a simple Help facility for your Bash script. +![bash logo on green background][1] + +In the [first article][2] in this series, you created a very small, one-line Bash script and explored the reasons for creating shell scripts and why they are the most efficient option for the system administrator, rather than compiled programs. In the [second article][3], you began the task of creating a fairly simple template that you can use as a starting point for other Bash programs, then explored ways to test it. + +This third of the four articles in this series explains how to create and use a simple Help function. While creating your Help facility, you will also learn about using functions and how to handle command-line options such as **-h**. + +### Why Help? + +Even fairly simple Bash programs should have some sort of Help facility, even if it is fairly rudimentary. Many of the Bash shell programs I write are used so infrequently that I forget the exact syntax of the command I need. Others are so complex that I need to review the options and arguments even when I use them frequently. + +Having a built-in Help function allows you to view those things without having to inspect the code itself. A good and complete Help facility is also a part of program documentation. + +### About functions + +Shell functions are lists of Bash program statements that are stored in the shell's environment and can be executed, like any other command, by typing their name at the command line. Shell functions may also be known as procedures or subroutines, depending upon which other programming language you are using. + +Functions are called in scripts or from the command-line interface (CLI) by using their names, just as you would for any other command. In a CLI program or a script, the commands in the function execute when they are called, then the program flow sequence returns to the calling entity, and the next series of program statements in that entity executes. + +The syntax of a function is: + + +``` +`FunctionName(){program statements}` +``` + +Explore this by creating a simple function at the CLI. (The function is stored in the shell environment for the shell instance in which it is created.) You are going to create a function called **hw**, which stands for "hello world." Enter the following code at the CLI and press **Enter**. Then enter **hw** as you would any other shell command: + + +``` +[student@testvm1 ~]$ hw(){ echo "Hi there kiddo"; } +[student@testvm1 ~]$ hw +Hi there kiddo +[student@testvm1 ~]$ +``` + +OK, so I am a little tired of the standard "Hello world" starter. Now, list all of the currently defined functions. There are a lot of them, so I am showing just the new **hw** function. When it is called from the command line or within a program, a function performs its programmed task and then exits and returns control to the calling entity, the command line, or the next Bash program statement in a script after the calling statement: + + +``` +[student@testvm1 ~]$ declare -f | less +<snip> +hw () +{ +    echo "Hi there kiddo" +} +<snip> +``` + +Remove that function because you do not need it anymore. You can do that with the **unset** command: + + +``` +[student@testvm1 ~]$ unset -f hw ; hw +bash: hw: command not found +[student@testvm1 ~]$ +``` + +### Creating the Help function + +Open the **hello** program in an editor and add the Help function below to the **hello** program code after the copyright statement but before the **echo "Hello world!"** statement. This Help function will display a short description of the program, a syntax diagram, and short descriptions of the available options. Add a call to the Help function to test it and some comment lines that provide a visual demarcation between the functions and the main portion of the program: + + +``` +################################################################################ +# Help                                                                         # +################################################################################ +Help() +{ +   # Display Help +   echo "Add description of the script functions here." +   echo +   echo "Syntax: scriptTemplate [-g|h|v|V]" +   echo "options:" +   echo "g     Print the GPL license notification." +   echo "h     Print this Help." +   echo "v     Verbose mode." +   echo "V     Print software version and exit." +   echo +} + +################################################################################ +################################################################################ +# Main program                                                                 # +################################################################################ +################################################################################ + +Help +echo "Hello world!" +``` + +The options described in this Help function are typical for the programs I write, although none are in the code yet. Run the program to test it: + + +``` +[student@testvm1 ~]$ ./hello +Add description of the script functions here. + +Syntax: scriptTemplate [-g|h|v|V] +options: +g     Print the GPL license notification. +h     Print this Help. +v     Verbose mode. +V     Print software version and exit. + +Hello world! +[student@testvm1 ~]$ +``` + +Because you have not added any logic to display Help only when you need it, the program will always display the Help. Since the function is working correctly, read on to add some logic to display the Help only when the **-h** option is used when you invoke the program at the command line.  + +### Handling options + +A Bash script's ability to handle command-line options such as **-h** gives some powerful capabilities to direct the program and modify what it does. In the case of the **-h** option, you want the program to print the Help text to the terminal session and then quit without running the rest of the program. The ability to process options entered at the command line can be added to the Bash script using the **while** command (see [_How to program with Bash: Loops_][4] to learn more about **while**) in conjunction with the **getops** and **case** commands. + +The **getops** command reads any and all options specified at the command line and creates a list of those options. In the code below, the **while** command loops through the list of options by setting the variable **$options** for each. The **case** statement is used to evaluate each option in turn and execute the statements in the corresponding stanza. The **while** statement will continue to evaluate the list of options until they have all been processed or it encounters an exit statement, which terminates the program. + +Be sure to delete the Help function call just before the **echo "Hello world!"** statement so that the main body of the program now looks like this: + + +``` +################################################################################ +################################################################################ +# Main program                                                                 # +################################################################################ +################################################################################ +################################################################################ +# Process the input options. Add options as needed.                            # +################################################################################ +# Get the options +while getopts ":h" option; do +   case $option in +      h) # display Help +         Help +         exit;; +   esac +done + +echo "Hello world!" +``` + +Notice the double semicolon at the end of the exit statement in the case option for **-h**. This is required for each option added to this case statement to delineate the end of each option. + +### Testing + +Testing is now a little more complex. You need to test your program with a number of different options—and no options—to see how it responds. First, test with no options to ensure that it prints "Hello world!" as it should: + + +``` +[student@testvm1 ~]$ ./hello +Hello world! +``` + +That works, so now test the logic that displays the Help text: + + +``` +[student@testvm1 ~]$ ./hello -h +Add description of the script functions here. + +Syntax: scriptTemplate [-g|h|t|v|V] +options: +g     Print the GPL license notification. +h     Print this Help. +v     Verbose mode. +V     Print software version and exit. +``` + +That works as expected, so try some testing to see what happens when you enter some unexpected options: + + +``` +[student@testvm1 ~]$ ./hello -x +Hello world! +[student@testvm1 ~]$ ./hello -q +Hello world! +[student@testvm1 ~]$ ./hello -lkjsahdf +Add description of the script functions here. + +Syntax: scriptTemplate [-g|h|t|v|V] +options: +g     Print the GPL license notification. +h     Print this Help. +v     Verbose mode. +V     Print software version and exit. + +[student@testvm1 ~]$ +``` + +The program just ignores any options without specific responses without generating any errors. But notice the last entry (with **-lkjsahdf** for options): because there is an **h** in the list of options, the program recognizes it and prints the Help text. This testing has shown that the program doesn't have the ability to handle incorrect input and terminate the program if any is detected. + +You can add another case stanza to the case statement to match any option that doesn't have an explicit match. This general case will match anything you have not provided a specific match for. The case statement now looks like this, with the catch-all match of **\?** as the last case. Any additional specific cases must precede this final one: + + +``` +while getopts ":h" option; do +   case $option in +      h) # display Help +         Help +         exit;; +     \?) # incorrect option +         echo "Error: Invalid option" +         exit;; +   esac +done +``` + +Test the program again using the same options as before and see how it works now. + +### Where you are + +You have accomplished a good amount in this article by adding the capability to process command-line options and a Help procedure. Your Bash script now looks like this: + + +``` +#!/usr/bin/bash +################################################################################ +#                              scriptTemplate                                  # +#                                                                              # +# Use this template as the beginning of a new program. Place a short           # +# description of the script here.                                              # +#                                                                              # +# Change History                                                               # +# 11/11/2019  David Both    Original code. This is a template for creating     # +#                           new Bash shell scripts.                            # +#                           Add new history entries as needed.                 # +#                                                                              # +#                                                                              # +################################################################################ +################################################################################ +################################################################################ +#                                                                              # +#  Copyright (C) 2007, 2019 David Both                                         # +#  [LinuxGeek46@both.org][5]                                                        # +#                                                                              # +#  This program is free software; you can redistribute it and/or modify        # +#  it under the terms of the GNU General Public License as published by        # +#  the Free Software Foundation; either version 2 of the License, or           # +#  (at your option) any later version.                                         # +#                                                                              # +#  This program is distributed in the hope that it will be useful,             # +#  but WITHOUT ANY WARRANTY; without even the implied warranty of              # +#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # +#  GNU General Public License for more details.                                # +#                                                                              # +#  You should have received a copy of the GNU General Public License           # +#  along with this program; if not, write to the Free Software                 # +#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # +#                                                                              # +################################################################################ +################################################################################ +################################################################################ + +################################################################################ +# Help                                                                         # +################################################################################ +Help() +{ +   # Display Help +   echo "Add description of the script functions here." +   echo +   echo "Syntax: scriptTemplate [-g|h|t|v|V]" +   echo "options:" +   echo "g     Print the GPL license notification." +   echo "h     Print this Help." +   echo "v     Verbose mode." +   echo "V     Print software version and exit." +   echo +} + +################################################################################ +################################################################################ +# Main program                                                                 # +################################################################################ +################################################################################ +################################################################################ +# Process the input options. Add options as needed.                            # +################################################################################ +# Get the options +while getopts ":h" option; do +   case $option in +      h) # display Help +         Help +         exit;; +     \?) # incorrect option +         echo "Error: Invalid option" +         exit;; +   esac +done + +echo "Hello world!" +``` + +Be sure to test this version of the program very thoroughly. Use random inputs and see what happens. You should also try testing valid and invalid options without using the dash (**-**) in front. + +### Next time + +In this article, you added a Help function as well as the ability to process command-line options to display it selectively. The program is getting a little more complex, so testing is becoming more important and requires more test paths in order to be complete. + +The next article will look at initializing variables and doing a bit of sanity checking to ensure that the program will run under the correct set of conditions. + +### Resources + + * [How to program with Bash: Syntax and tools][6] + * [How to program with Bash: Logical operators and shell expansions][7] + * [How to program with Bash: Loops][4] + + + +* * * + +_This series of articles is partially based on Volume 2, Chapter 10 of David Both's three-part Linux self-study course, [Using and Administering Linux—Zero to SysAdmin][8]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/help-bash-program + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/19/12/introduction-automation-bash-scripts +[3]: https://opensource.com/article/19/12/creating-bash-script-template +[4]: https://opensource.com/article/19/10/programming-bash-loops +[5]: mailto:LinuxGeek46@both.org +[6]: https://opensource.com/article/19/10/programming-bash-syntax-tools +[7]: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions +[8]: http://www.both.org/?page_id=1183 From 13b4a9e0f1ba547724ab316ac9670d6f6152de00 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 21 Dec 2019 00:59:01 +0800 Subject: [PATCH 194/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191219=202020?= =?UTF-8?q?=20technology=20must=20haves,=20a=20guide=20to=20Kubernetes=20e?= =?UTF-8?q?tcd,=20and=20more=20industry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md --- ...bernetes etcd, and more industry trends.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md diff --git a/sources/tech/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md b/sources/tech/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md new file mode 100644 index 0000000000..198d4f8292 --- /dev/null +++ b/sources/tech/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (2020 technology must haves, a guide to Kubernetes etcd, and more industry trends) +[#]: via: (https://opensource.com/article/19/12/gartner-ectd-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +2020 technology must haves, a guide to Kubernetes etcd, and more industry trends +====== +A weekly look at open source community, market, and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [Gartner's top 10 infrastructure and operations trends for 2020][2] + +> “The vast majority of organisations that do not adopt a shared self-service platform approach will find that their DevOps initiatives simply do not scale,” said Winser. "Adopting a shared platform approach enables product teams to draw from an I&O digital toolbox of possibilities, while benefiting from high standards of governance and efficiency needed for scale." + +**The impact**: The breakneck change of technology development and adoption will not slow down next year, as the things you've been reading about for the last two years become things you have to figure out to deal with every day. + +## [A guide to Kubernetes etcd: All you need to know to set up etcd clusters][3] + +> Etcd is a distributed reliable key-value store which is simple, fast and secure. It acts like a backend service discovery and database, runs on different servers in Kubernetes clusters at the same time to monitor changes in clusters and to store state/configuration data that should to be accessed by a Kubernetes master or clusters. Additionally, etcd allows Kubernetes master to support discovery service so that deployed application can declare their availability for inclusion in service. + +**The impact**: This is actually way more than I needed to know about setting up etcd clusters, but now I have a mental model of what that could look like, and you can too. + +## [How the open source model could fuel the future of digital marketing][4] + +> In other words, the broad adoption of open source culture has the power to completely invert the traditional marketing funnel. In the future, prospective customers could be first introduced to “late funnel” materials and then buy into the broader narrative — a complete reversal of how traditional marketing approaches decision-makers today. + +**The impact**: The SEO on this cuts two ways: It can introduce uninitiated marketing people to open source and uninitiated technical people to the ways that technology actually gets adopted. Neat! + +## [Kubernetes integrates interoperability, storage, waits on sidecars][5] + +> In a [recent interview][6], Lachlan Evenson, and was also a lead on the Kubernetes 1.16 release, said sidecar containers was one of the features that team was a “little disappointed” it could not include in their release. +> +> Guinevere Saenger, software engineer at GitHub and lead for the 1.17 release team, explained that sidecar containers gained increased focus “about a month ago,” and that its implementation “changes the pod spec, so this is a change that affects a lot of areas and needs to be handled with care.” She noted that it did move closer to completion and “will again be prioritized for 1.18.” + +**The impact**: You can read between the lines to understand a lot more about the Kubernetes sausage-making process. It's got governance, tradeoffs, themes, and timeframes; all the stuff that is often invisible to consumers of a project. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/gartner-ectd-and-more-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.information-age.com/gartner-top-10-infrastructure-and-operations-trends-2020-123486509/ +[3]: https://superuser.openstack.org/articles/a-guide-to-kubernetes-etcd-all-you-need-to-know-to-set-up-etcd-clusters/ +[4]: https://www.forbes.com/sites/forbescommunicationscouncil/2019/11/19/how-the-open-source-model-could-fuel-the-future-of-digital-marketing/#71b602fb20a5 +[5]: https://www.sdxcentral.com/articles/news/kubernetes-integrates-interoperability-storage-waits-on-sidecars/2019/12/ +[6]: https://kubernetes.io/blog/2019/12/06/when-youre-in-the-release-team-youre-family-the-kubernetes-1.16-release-interview/ From 562e129053632361e2d7bb663d75e4cce8ddbb7a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 21 Dec 2019 08:46:24 +0800 Subject: [PATCH 195/676] PRF @hopefully2333 --- ...ternet security works- TLS, SSL, and CA.md | 64 +++++++++++-------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md b/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md index 6850c03e2d..4271541775 100644 --- a/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md +++ b/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md @@ -1,24 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (hopefully2333) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How internet security works: TLS, SSL, and CA) [#]: via: (https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority) [#]: author: (Bryant Son https://opensource.com/users/brson) -互联网的安全是如何保证的:TLS,SSL,和 CA +互联网的安全是如何保证的:TLS、SSL 和 CA ====== -你的浏览器里的锁的图标的后面是什么? + +> 你的浏览器里的锁的图标的后面是什么? + ![Lock][1] -每天你都会重复这件事很多次,你访问网站,这个网站需要你用用户名或者电子邮件地址,和你的密码来进行登录。银行网站,社交网站,电子邮件服务,电子商务网站,和新闻网站。这里只在使用了这种机制的网站中列举了其中一小部分。 +每天你都会重复这件事很多次,访问网站,网站需要你用你的用户名或者电子邮件地址和你的密码来进行登录。银行网站、社交网站、电子邮件服务、电子商务网站和新闻网站。这里只在使用了这种机制的网站中列举了其中一小部分。 -每次你登陆进一个这种类型的网站时,你实际上是在说:“是的,我信任这个网站,所以我愿意把我的个人信息共享给它。”这些数据可能包含你的姓名,性别,实际地址,电子邮箱地址,有时候甚至会包括你的信用卡信息。 +每次你登录进一个这种类型的网站时,你实际上是在说:“是的,我信任这个网站,所以我愿意把我的个人信息共享给它。”这些数据可能包含你的姓名、性别、实际地址、电子邮箱地址,有时候甚至会包括你的信用卡信息。 但是你怎么知道你可以信任这个网站?换个方式问,为了让你可以信任它,网站应该如何保护你的交易? -本文旨在阐述使网站变得安全的机制。我会首先论述 web 协议 http 和 https,以及传输层安全(TLS)的概念,后者是互联网协议(IP)层中的加密协议之一。然后,我会解释证书颁发机构和自签名证书,以及它们如何帮助保护一个网站。最后,我会介绍一些开源的工具,你可以使用它们来创建和管理你的证书。 +本文旨在阐述使网站变得安全的机制。我会首先论述 web 协议 http 和 https,以及传输层安全Transport Layer Security(TLS)的概念,后者是互联网协议Internet Protocol(IP)层中的加密协议之一。然后,我会解释证书颁发机构certificate authority和自签名证书,以及它们如何帮助保护一个网站。最后,我会介绍一些开源的工具,你可以使用它们来创建和管理你的证书。 ### 通过 https 保护路由 @@ -26,13 +28,13 @@ ![Certificate information][2] -默认情况下,如果一个网站使用的是 http 协议,那么它是不安全的。通过网站主机配置一个证书并添加到路由,可以把这个网站从一个不安全的 http 网站变为一个安全的 https 网站。那个锁图标通常表示这个网站是受 https 保护的。 +默认情况下,如果一个网站使用的是 http 协议,那么它是不安全的。为通过网站主机的路由添加一个配置过的证书,可以把这个网站从一个不安全的 http 网站变为一个安全的 https 网站。那个锁图标通常表示这个网站是受 https 保护的。 点击证书来查看网站的 CA,根据你的浏览器,你可能需要下载证书来查看它。 ![Certificate information][3] -点击证书来查看网站的 CA,根据你的浏览器,你可能需要下载证书来查看它。 +在这里,你可以了解有关 Opensource.com 证书的信息。例如,你可以看到 CA 是 DigiCert,并以 Opensource.com 的名称提供给 Red Hat。 这个证书信息可以让终端用户检查该网站是否可以安全访问。 @@ -42,19 +44,19 @@ ### 带有 TLS 和 SSL 的互联网协议 -TLS 是旧版安全套接字层协议(SSL)的最新版本。理解这一点的最好方法就是仔细理解 IP 的不同协议层。 +TLS 是旧版安全套接字层协议Secure Socket Layer(SSL)的最新版本。理解这一点的最好方法就是仔细理解互联网协议的不同协议层。 ![IP layers][4] -我们知道当今的互联网是由6个层面组成的:物理层,数据链路层,网络层,传输层,安全层,应用层。物理层是基础,这一层是最接近实际的硬件设备的。应用层是最抽象的一层,是最接近终端用户的一层。安全层可以被认为是应用层的一部分,TLS 和 SSL,是被设计用来在一个计算机网络中提供通信安全的加密协议,它们位于安全层中。 +我们知道当今的互联网是由 6 个层面组成的:物理层、数据链路层、网络层、传输层、安全层、应用层。物理层是基础,这一层是最接近实际的硬件设备的。应用层是最抽象的一层,是最接近终端用户的一层。安全层可以被认为是应用层的一部分,TLS 和 SSL,是被设计用来在一个计算机网络中提供通信安全的加密协议,它们位于安全层中。 这个过程可以确保终端用户使用网络服务时,通信的安全性和保密性。 ### 证书颁发机构和自签名证书 -CA 是受信任的组织,它可以颁发数字证书。 +证书颁发机构Certificate authority(CA)是受信任的组织,它可以颁发数字证书。 -TLS 和 SSL 可以使连接更安全,但是这个加密机制需要一种方式来验证它;这就是 SSL/TLS 证书。TLS 使用了一种叫做非对称加密的加密机制,这个机制有一对称为私钥和公钥的安全密钥。(这是一个非常复杂的主题,超出了本文的讨论范围,但是如果你想去了解这方面的东西,你可以阅读“密码学和公钥密码基础体系简介”)你要知道的基础内容是,证书颁发机构们,比如 GlobalSign, DigiCert,和 GoDaddy,它们是受人们信任的可以颁发证书的供应商,它们颁发的证书可以用于验证网站使用的 TLS/SSL 证书。网站使用的证书是导入到主机服务器里的,用于保护网站。 +TLS 和 SSL 可以使连接更安全,但是这个加密机制需要一种方式来验证它;这就是 SSL/TLS 证书。TLS 使用了一种叫做非对称加密的加密机制,这个机制有一对称为私钥和公钥的安全密钥。(这是一个非常复杂的主题,超出了本文的讨论范围,但是如果你想去了解这方面的东西,你可以阅读“[密码学和公钥密码基础体系简介][5]”)你要知道的基础内容是,证书颁发机构们,比如 GlobalSign、DigiCert 和 GoDaddy,它们是受人们信任的可以颁发证书的供应商,它们颁发的证书可以用于验证网站使用的 TLS/SSL 证书。网站使用的证书是导入到主机服务器里的,用于保护网站。 然而,如果你只是要测试一下正在开发中的网站或服务,CA 证书可能对你而言太昂贵或者是太复杂了。你必须有一个用于生产目的的受信任的证书,但是开发者和网站管理员需要有一种更简单的方式来测试网站,然后他们才能将其部署到生产环境中;这就是自签名证书的来源。 @@ -62,48 +64,50 @@ TLS 和 SSL 可以使连接更安全,但是这个加密机制需要一种方 ### 生成证书的开源工具 -有几种开源工具可以用来管理 TLS/SSL 证书。其中最著名的就是 openssl,这个工具包含在很多 Linux 发行版中和 macos 中。当然,你也可以使用其他开源工具。 +有几种开源工具可以用来管理 TLS/SSL 证书。其中最著名的就是 openssl,这个工具包含在很多 Linux 发行版中和 MacOS 中。当然,你也可以使用其他开源工具。 -| Tool Name | Description | License | +| 工具名 | 描述 | 许可证 | | --------- | ------------------------------------------------------------------------------ | --------------------------------- | -| OpenSSL | 实现 TLS 和加密库的最著名的开源工具 | Apache License 2.0 | -| EasyRSA | 用于构建 PKI CA 的命令行实用工具 | GPL v2 | -| CFSSL | 来自 cloudflare 的 PKI/TLS 瑞士军刀 | BSD 2-Clause "Simplified" License | -| Lemur | 来自网飞的 TLS创建工具 | Apache License 2.0 | +| [OpenSSL][7] | 实现 TLS 和加密库的最著名的开源工具 | Apache License 2.0 | +| [EasyRSA][8] | 用于构建 PKI CA 的命令行实用工具 | GPL v2 | +| [CFSSL][9] | 来自 cloudflare 的 PKI/TLS 瑞士军刀 | BSD 2-Clause "Simplified" License | +| [Lemur][10] | 来自网飞Netflix的 TLS 创建工具 | Apache License 2.0 | -如果你的目的是扩展和对用户友好,网飞的 Lemur 是一个很有趣的选择。你在网飞的技术博客上可以查看更多有关它的信息。 +如果你的目的是扩展和对用户友好,网飞的 Lemur 是一个很有趣的选择。你在[网飞的技术博客][6]上可以查看更多有关它的信息。 ### 如何创建一个 Openssl 证书 你可以靠自己来创建证书,下面这个案例就是使用 Openssl 生成一个自签名证书。 -1. 使用 openssl 命令行生成一个私钥: +1、使用 `openssl` 命令行生成一个私钥: + ``` openssl genrsa -out example.key 2048 ``` + ![](https://opensource.com/sites/default/files/uploads/4_openssl_generatekey.jpg) -2. 使用在第一步中生成的私钥来创建一个证书签名请求(CSR): +2、使用在第一步中生成的私钥来创建一个证书签名请求certificate signing request(CSR): + ``` -openssl req -new -key example.key -out example.csr \ --subj "/C=US/ST=TX/L=Dallas/O=Red Hat/OU=IT/CN=test.example.com" +openssl req -new -key example.key -out example.csr -subj "/C=US/ST=TX/L=Dallas/O=Red Hat/OU=IT/CN=test.example.com" ``` ![](https://opensource.com/sites/default/files/uploads/5_openssl_generatecsr.jpg) -3. 使用你的 CSR 和私钥创建一个证书: +3、使用你的 CSR 和私钥创建一个证书: ``` -openssl x509 -req -days 366 -in example.csr \ --signkey example.key -out example.crt +openssl x509 -req -days 366 -in example.csr -signkey example.key -out example.crt ``` ![](https://opensource.com/sites/default/files/uploads/6_openssl_generatecert.jpg) ### 了解更多关于互联网安全的知识 + 如果你想要了解更多关于互联网安全和网站安全的知识,请看我为这篇文章一起制作的 Youtube 视频。 - +- 你有什么问题?发在评论里让我们知道。 @@ -114,7 +118,7 @@ via: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate- 作者:[Bryant Son][a] 选题:[lujun9972][b] 译者:[hopefully2333](https://github.com/hopefully2333) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -126,3 +130,7 @@ via: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate- [4]: https://opensource.com/sites/default/files/uploads/3_internetprotocol.jpg [5]: https://opensource.com/article/18/5/cryptography-pki [6]: https://medium.com/netflix-techblog/introducing-lemur-ceae8830f621 +[7]: https://www.openssl.org/ +[8]: https://github.com/OpenVPN/easy-rsa +[9]: https://github.com/cloudflare/cfssl +[10]: https://github.com/Netflix/lemur From 2934b3a29ce0c55b2c1fa3847e130aff4a160b82 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 21 Dec 2019 08:47:13 +0800 Subject: [PATCH 196/676] PUB @hopefully2333 https://linux.cn/article-11699-1.html --- .../20191118 How internet security works- TLS, SSL, and CA.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191118 How internet security works- TLS, SSL, and CA.md (99%) diff --git a/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md b/published/20191118 How internet security works- TLS, SSL, and CA.md similarity index 99% rename from translated/tech/20191118 How internet security works- TLS, SSL, and CA.md rename to published/20191118 How internet security works- TLS, SSL, and CA.md index 4271541775..144fe836e8 100644 --- a/translated/tech/20191118 How internet security works- TLS, SSL, and CA.md +++ b/published/20191118 How internet security works- TLS, SSL, and CA.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (hopefully2333) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11699-1.html) [#]: subject: (How internet security works: TLS, SSL, and CA) [#]: via: (https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority) [#]: author: (Bryant Son https://opensource.com/users/brson) From af3a3a218bd8f86eed7cb213f1f4f69b20f2b8e3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 21 Dec 2019 11:23:27 +0800 Subject: [PATCH 197/676] PRF @hj24 --- ...ow to write a Python web API with Flask.md | 113 ++++++++---------- 1 file changed, 53 insertions(+), 60 deletions(-) diff --git a/translated/tech/20191127 How to write a Python web API with Flask.md b/translated/tech/20191127 How to write a Python web API with Flask.md index 763b7200dd..3db6d4c64e 100644 --- a/translated/tech/20191127 How to write a Python web API with Flask.md +++ b/translated/tech/20191127 How to write a Python web API with Flask.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (hj24) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to write a Python web API with Flask) [#]: via: (https://opensource.com/article/19/11/python-web-api-flask) [#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) -如何使用Flask编写Python Web API +如何使用 Flask 编写 Python Web API ====== -这是一个快速教程,用来展示如何通过Flask(目前发展最迅速的Python框架之一)来从服务器获取数据。 +> 这是一个快速教程,用来展示如何通过 Flask(目前发展最迅速的 Python 框架之一)来从服务器获取数据。 + ![spiderweb diagram][1] -[Python][2]是一个以语法简洁著称的高级的,面向对象的程序语言。它一直都是一个用来构建RESTful API的顶级编程语言。 +[Python][2] 是一个以语法简洁著称的高级的、面向对象的程序语言。它一直都是一个用来构建 RESTful API 的顶级编程语言。 -[Flask][3]是一个高度可定制化的Python框架,可以为开发人员提供用户访问数据方式的完全控制。Flask是一个基于Werkzeug的[WSGI][4]工具包和Jinja 2模板引擎的”微框架“。它是一个被设计来开发RESTful API的web框架。 +[Flask][3] 是一个高度可定制化的 Python 框架,可以为开发人员提供用户访问数据方式的完全控制。Flask 是一个基于 Werkzeug 的 [WSGI][4] 工具包和 Jinja 2 模板引擎的”微框架“。它是一个被设计来开发 RESTful API 的 web 框架。 -Flask是Python发展最迅速的框架之一,很多知名网站如:Netflix, Pinterest, 和LinkedIn都将Flask纳入了它们的开发技术栈。下面是一个简单的示例,展示了Flask是如何允许用户通过HTTP GET请求来从服务器获取数据的。 +Flask 是 Python 发展最迅速的框架之一,很多知名网站如:Netflix、Pinterest 和 LinkedIn 都将 Flask 纳入了它们的开发技术栈。下面是一个简单的示例,展示了 Flask 是如何允许用户通过 HTTP GET 请求来从服务器获取数据的。 -### 初始化一个Flask应用 - -首先,创建一个你的Flask项目的目录结构。你可以在你系统的任何地方来做这件事。 +### 初始化一个 Flask 应用 +首先,创建一个你的 Flask 项目的目录结构。你可以在你系统的任何地方来做这件事。 ``` $ mkdir tutorial @@ -32,17 +32,14 @@ $ python3 -m venv env $ source env/bin/activate (env) $ pip3 install flask-restful Collecting flask-restful -Downloading -Collecting Flask>=0.8 (from flask-restful) +Downloading https://files.pythonhosted.org/packages/17/44/6e49...8da4/Flask_RESTful-0.3.7-py2.py3-none-any.whl +Collecting Flask>=0.8 (from flask-restful) [...] ``` -### 导入Flask模块 - -Next, import the **flask** module and its **flask_restful** library into your **main.py** code: - -然后,在你的**main.py**代码中导入**flask**模块和它的**flask_restful**库: +### 导入 Flask 模块 +然后,在你的 `main.py` 代码中导入 `flask` 模块和它的 `flask_restful` 库: ``` from flask import Flask @@ -52,80 +49,76 @@ app = Flask(__name__) api = Api(app) class Quotes(Resource): -    def get(self): -        return { -            'William Shakespeare': { -                'quote': ['Love all,trust a few,do wrong to none', -                'Some are born great, some achieve greatness, and some greatness thrust upon them.'] -        }, -        'Linus': { -            'quote': ['Talk is cheap. Show me the code.'] -            } -        } + def get(self): + return { + 'William Shakespeare': { + 'quote': ['Love all,trust a few,do wrong to none', + 'Some are born great, some achieve greatness, and some greatness thrust upon them.'] + }, + 'Linus': { + 'quote': ['Talk is cheap. Show me the code.'] + } + } api.add_resource(Quotes, '/') if __name__ == '__main__': -    app.run(debug=True) + app.run(debug=True) ``` -### 运行app - -Flask includes a built-in HTTP server for testing. Test the simple API you built: - -Flask包含一个内建的用于测试的HTTP服务器。来测试一下这个你创建的简单的API: +### 运行 app +Flask 包含一个内建的用于测试的 HTTP 服务器。来测试一下这个你创建的简单的 API: ``` (env) $ python main.py - * Serving Flask app "main" (lazy loading) - * Environment: production -   WARNING: This is a development server. Do not use it in a production deployment. -   Use a production WSGI server instead. - * Debug mode: on - * Running on (Press CTRL+C to quit) + * Serving Flask app "main" (lazy loading) + * Environment: production + WARNING: This is a development server. Do not use it in a production deployment. + Use a production WSGI server instead. + * Debug mode: on + * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) ``` -启动开发服务器时将启动Flask应用程序,该应用程序包含一个名为 **get** 的方法来响应简单的HTTP GET请求。你可以通过 **wget**、**curl** 命令或者任意的web浏览器来测试它。 - +启动开发服务器时将启动 Flask 应用程序,该应用程序包含一个名为 `get` 的方法来响应简单的 HTTP GET 请求。你可以通过 `wget`、`curl` 命令或者任意的 web 浏览器来测试它。 ``` -$ curl +$ curl http://localhost:5000 { -    "William Shakespeare": { -        "quote": [ -            "Love all,trust a few,do wrong to none", -            "Some are born great, some achieve greatness, and some greatness thrust upon them." -        ] -    }, -    "Linus": { -        "quote": [ -            "Talk is cheap. Show me the code." -        ] -    } + "William Shakespeare": { + "quote": [ + "Love all,trust a few,do wrong to none", + "Some are born great, some achieve greatness, and some greatness thrust upon them." + ] + }, + "Linus": { + "quote": [ + "Talk is cheap. Show me the code." + ] + } } ``` -要查看使用Python和Flask的类似Web API的更复杂版本,请导航至美国国会图书馆的[Chronicling America] [5]网站,该网站可提供有关这些信息的历史报纸和数字化报纸。 +要查看使用 Python 和 Flask 的类似 Web API 的更复杂版本,请导航至美国国会图书馆的 [Chronicling America][5] 网站,该网站可提供有关这些信息的历史报纸和数字化报纸。 ### 为什么使用 Flask? -Flask有以下几个主要的优点: +Flask 有以下几个主要的优点: - 1. Python很流行并且广泛被应用,所以任何熟悉Python的人都可以使用Flask来开发。 + 1. Python 很流行并且广泛被应用,所以任何熟悉 Python 的人都可以使用 Flask 来开发。 2. 它轻巧而简约。 3. 考虑安全性而构建。 4. 出色的文档,其中包含大量清晰,有效的示例代码。 还有一些潜在的缺点: - 1. 它轻巧而简约。但如果您正在寻找具有大量捆绑库和预制组件的框架,那么这可能不是最佳选择。 - 2. 如果必须围绕Flask构建自己的框架,则你可能会发现维护自定义项的成本可能会抵消使用Flask的好处。 + 1. 它轻巧而简约。但如果你正在寻找具有大量捆绑库和预制组件的框架,那么这可能不是最佳选择。 + 2. 如果必须围绕 Flask 构建自己的框架,则你可能会发现维护自定义项的成本可能会抵消使用 Flask 的好处。 -如果您要构建Web程序或API,可以考虑选择Flask。它功能强大且健壮,并且其优秀的项目文档使入门变得容易。试用一下,评估一下,看看它是否适合您的项目。 +如果你要构建 Web 程序或 API,可以考虑选择 Flask。它功能强大且健壮,并且其优秀的项目文档使入门变得容易。试用一下,评估一下,看看它是否适合你的项目。 -在本课中了解更多信息关于Python异常处理以及如何以安全的方式进行操作。 +在本课中了解更多信息关于 Python 异常处理以及如何以安全的方式进行操作。 -------------------------------------------------------------------------------- @@ -134,7 +127,7 @@ via: https://opensource.com/article/19/11/python-web-api-flask 作者:[Rachel Waston][a] 选题:[lujun9972][b] 译者:[hj24](https://github.com/hj24) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d5160d38f4a4e3119fdeeb646dcb5cf497af0e3c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 21 Dec 2019 11:24:00 +0800 Subject: [PATCH 198/676] PUB @hj24 https://linux.cn/article-11701-1.html --- .../20191127 How to write a Python web API with Flask.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191127 How to write a Python web API with Flask.md (98%) diff --git a/translated/tech/20191127 How to write a Python web API with Flask.md b/published/20191127 How to write a Python web API with Flask.md similarity index 98% rename from translated/tech/20191127 How to write a Python web API with Flask.md rename to published/20191127 How to write a Python web API with Flask.md index 3db6d4c64e..8e28adebdf 100644 --- a/translated/tech/20191127 How to write a Python web API with Flask.md +++ b/published/20191127 How to write a Python web API with Flask.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (hj24) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11701-1.html) [#]: subject: (How to write a Python web API with Flask) [#]: via: (https://opensource.com/article/19/11/python-web-api-flask) [#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) From a0e74ad7bddc4c5f16a42605a5e051acacc196fb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 21 Dec 2019 11:40:31 +0800 Subject: [PATCH 199/676] Rename sources/tech/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md to sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md --- ...haves, a guide to Kubernetes etcd, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md (100%) diff --git a/sources/tech/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md b/sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md similarity index 100% rename from sources/tech/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md rename to sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md From 53d30126ac83e0bc678c2f5e329cd2b6ffb767a6 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sat, 21 Dec 2019 12:32:37 +0800 Subject: [PATCH 200/676] Translating --- .../tech/20191220 4 ways to volunteer this holiday season.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191220 4 ways to volunteer this holiday season.md b/sources/tech/20191220 4 ways to volunteer this holiday season.md index e425a5ef21..e90a48cebc 100644 --- a/sources/tech/20191220 4 ways to volunteer this holiday season.md +++ b/sources/tech/20191220 4 ways to volunteer this holiday season.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7d4f88b63ba99be8c077ca2f30b2dbdd5bf7a0ec Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sat, 21 Dec 2019 12:40:41 +0800 Subject: [PATCH 201/676] Translating --- ...view questions every Kubernetes job candidate should know.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md b/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md index 4b08d6f2dd..aecf855110 100644 --- a/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md +++ b/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9ccd1852506cf180a378de83e30a12b24d7b7c88 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 22 Dec 2019 00:38:59 +0800 Subject: [PATCH 202/676] PRF @HankChow --- .../20191017 How to type emoji on Linux.md | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/translated/tech/20191017 How to type emoji on Linux.md b/translated/tech/20191017 How to type emoji on Linux.md index 86dc42d4ef..8ad80a62e0 100644 --- a/translated/tech/20191017 How to type emoji on Linux.md +++ b/translated/tech/20191017 How to type emoji on Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to type emoji on Linux) @@ -9,9 +9,10 @@ 如何在 Linux 系统中输入 emoji ====== -使用 GNOME 桌面可以让你在文字中轻松加入 emoji。 -![A cat under a keyboard.][1] +> 使用 GNOME 桌面可以让你在文字中轻松加入 emoji。 + +![](https://img.linux.net.cn/data/attachment/album/201912/22/003829tsuogoonoxunn33o.jpg) emoji 是潜藏在 Unicode 字符空间里的有趣表情图,它们已经风靡于整个互联网。emoji 可以用来在社交媒体上表示自己的心情状态,也可以作为重要文件名的视觉标签,总之它们的各种用法层出不穷。在 Linux 系统中有很多种方式可以输入 Unicode 字符,但 GNOME 桌面能让你更轻松地查找和输入 emoji。 @@ -25,7 +26,6 @@ emoji 是潜藏在 Unicode 字符空间里的有趣表情图,它们已经风 例如在 Fedora 上: - ``` $ sudo dnf search emoji emoji-picker.noarch : An emoji selection tool @@ -46,35 +46,29 @@ google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emo 要开始设置,首先打开 GNOME 的设置面板。 - 1. 在左边侧栏中,选择“地区与语言Region & Language”类别 - 2. 点击“输入源Input Sources”选项下方的加号(+)打开“添加输入源Add an Input Source”面板 - +1、在左边侧栏中,选择“地区与语言Region & Language”类别。 +2、点击“输入源Input Sources”选项下方的加号(+)打开“添加输入源Add an Input Source”面板。 ![Add a new input source][5] - 3. 在“添加输入源Add an Input Source”面板中,点击底部的菜单按钮 - - +3、在“添加输入源Add an Input Source”面板中,点击底部的菜单按钮。 ![Add an Input Source panel][6] - 4. 滑动到列表底部并选择“其它Other” - 5. 在“其它Other”列表中,找到“其它Other快速输入Typing Booster)” - +4、滑动到列表底部并选择“其它Other”。 +5、在“其它Other”列表中,找到“其它Other快速输入Typing Booster)”。 ![Find Other \(Typing Booster\) in inputs][7] - 6. 点击右上角的“添加Add”按钮,将输入源添加到 GNOME 桌面 - - +6、点击右上角的“添加Add”按钮,将输入源添加到 GNOME 桌面。 以上操作完成之后,就可以关闭设置面板了。 #### 切换到快速输入 -现在 GNOME 桌面的右上角会出现一个新的图标,一般情况下是当前语言的双字母缩写(例如英语是 en,世界语是 eo,西班牙语是 es,等等)。如果你按下了超级键Super key(也就是键盘上带有 Linux 企鹅/Windows 徽标/Mac Command 标志的键)+空格键的组合键,就会切换到输入列表中的下一个输入源。在这里,我们只有两个输入源,也就是默认语言和快速输入。 +现在 GNOME 桌面的右上角会出现一个新的图标,一般情况下是当前语言的双字母缩写(例如英语是 en,世界语是 eo,西班牙语是 es,等等)。如果你按下了超级键Super key(也就是键盘上带有 Linux 企鹅/Windows 徽标/Mac Command 标志的键)+ 空格键的组合键,就会切换到输入列表中的下一个输入源。在这里,我们只有两个输入源,也就是默认语言和快速输入。 你可以尝试使用一下这个组合键,观察图标的变化。 @@ -96,7 +90,7 @@ google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emo ### 使用其它切换方式 -如果你觉得超级键+空格键这个组合用起来不顺手,你也可以换成其它键的组合。在 GNOME 设置面板中选择“设备Device”→“键盘Keyboard”。 +如果你觉得“超级键+空格键”这个组合用起来不顺手,你也可以换成其它键的组合。在 GNOME 设置面板中选择“设备Device”→“键盘Keyboard”。 在“键盘Keyboard”页面中,将“切换到下一个输入源Switch to next input source”更改为你喜欢的组合键。 @@ -106,11 +100,9 @@ google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emo 实际上,现代键盘的设计只是为了输入 26 个字母以及尽可能多的数字和符号。但 ASCII 字符的数量已经比键盘上能看到的字符多得多了,遑论上百万个 Unicode 字符。因此,如果你想要在 Linux 应用程序中输入 Unicode,但又不想使用快速输入,你可以尝试一下 Unicode 输入。 - 1. 打开任意一种支持输入 Unicode 字符的软件,但仍然使用你的默认输入语言 - 2. 使用 ctrl+shift+U 组合键进入 Unicode 输入模式 - 3. 在 Unicode 输入模式下,只需要输入某个 Unicode 字符的对应序号,就实现了对这个 Unicode 字符的输入。例如 `1F44D` 对应的是 👍,而 `2620` 则对应了 ☠。想要查看所有 Unicode 字符的对应序号,可以参考 [Unicode 规范][11]。 - - +1. 打开任意一种支持输入 Unicode 字符的软件,但仍然使用你的默认输入语言 +2. 使用 `Ctrl+Shift+U` 组合键进入 Unicode 输入模式 +3. 在 Unicode 输入模式下,只需要输入某个 Unicode 字符的对应序号,就实现了对这个 Unicode 字符的输入。例如 `1F44D` 对应的是 👍,而 `2620` 则对应了 ☠。想要查看所有 Unicode 字符的对应序号,可以参考 [Unicode 规范][11]。 ### emoji 的实用性 @@ -127,7 +119,7 @@ via: https://opensource.com/article/19/10/how-type-emoji-linux 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 550d8e26291d24251247e1efba5425b17efdc068 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 22 Dec 2019 00:40:21 +0800 Subject: [PATCH 203/676] PUB @HankChow https://linux.cn/article-11702-1.html --- .../tech => published}/20191017 How to type emoji on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191017 How to type emoji on Linux.md (99%) diff --git a/translated/tech/20191017 How to type emoji on Linux.md b/published/20191017 How to type emoji on Linux.md similarity index 99% rename from translated/tech/20191017 How to type emoji on Linux.md rename to published/20191017 How to type emoji on Linux.md index 8ad80a62e0..7c11e45b76 100644 --- a/translated/tech/20191017 How to type emoji on Linux.md +++ b/published/20191017 How to type emoji on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11702-1.html) [#]: subject: (How to type emoji on Linux) [#]: via: (https://opensource.com/article/19/10/how-type-emoji-linux) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 59f1b4e9caad014636e6989ed2a41419d82700b4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 22 Dec 2019 00:53:08 +0800 Subject: [PATCH 204/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191220=20Why=20?= =?UTF-8?q?We=20Need=20Interoperable=20Service=20Identity=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191220 Why We Need Interoperable Service Identity.md --- ... We Need Interoperable Service Identity.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/tech/20191220 Why We Need Interoperable Service Identity.md diff --git a/sources/tech/20191220 Why We Need Interoperable Service Identity.md b/sources/tech/20191220 Why We Need Interoperable Service Identity.md new file mode 100644 index 0000000000..7ca8470bf7 --- /dev/null +++ b/sources/tech/20191220 Why We Need Interoperable Service Identity.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why We Need Interoperable Service Identity?) +[#]: via: (https://www.linux.com/articles/why-we-need-interoperable-identity/) +[#]: author: (TC CURRIE https://www.linux.com/author/tc_currie/) + +Why We Need Interoperable Service Identity? +====== + +[![][1]][2] + +[![][1]][2] + +Interoperable service identity is necessary to secure communication between different cloud providers and different platforms. This presents a challenge with multi-cloud and hybrid deployments. How do you secure service to service communication across those boundaries? + +Evan Gilman, Staff Engineer at  [Scytale.io][3] and co-author of _Zero Trust Networks_, illustrates this issue: when you’re in AWS, you’ll use an AWS IAM role in order to identify which instance a certain role should or should not have access to.  But in today’s multi-platform world, you can be communicating from AWS to GCP to your on-prem infrastructure. Those systems do not understand what IAM role is because it is AWS-specific. + +This is what Scytale is trying to address.  *“*We are bringing a platform-agnostic identity, meaning, an identity that is not specific to a cloud provider or a platform, or any specific kind of technology,” he said. + +**What’s SPIFFE?** + +[Secure Production Identity Framework for Everyone (SPIFFE)][4] is a set of specifications that define interoperability across all tech platforms, such as how to format the name, the shape of the document, how you validate documents, etc.  “This SPIFFE level is like a secure dial tone,” Gilman explains. “You pick up the phone, it rings the other side, doesn’t really matter what platform it is or where it’s running or anything like that. The SPIFFE authentication occurs and you get a nice little layer of encryption and some authenticity insurances as well.” + +But at the end of the day, SPIFFE is just a set of documents. SPIRE is the software implementation of the SPIFFE specifications. + +“Think about the way the passports work,” he said.  “If you look at passports from different countries, they may be slightly different, but they have similar characteristics like SPIFFE specifications.  They’re all the same size. They all have a picture in the same spot. They have the same funny-looking barcode at the bottom, and so on. So, when you show your passport at a country border, they know how to read your passport, no matter what country that passport is from.  SPIRE is the passport agency in this analogy. Where does this passport come from? Who gives it to you? How do you get it and how do you do that in an automated fashion?” + +SPIRE implements these SPIFFE specifications and enables workloads and services to get these passports as soon as they boot in a way that is very reliable, scalable, and very highly automated. + +**Zero Trust** + +Gilman is taking the philosophy of Zero Trust — don’t trust anybody whatsoever — and applying it to network infrastructure and service-to-service communication.  “We do this by removing all the security functions from the network and making no assumptions about what should or should not be allowed based on IP address,” he said. + +“Instead, we build systems in such a way that they don’t rely on that network to deliver trustworthy information.   We use protocols for strong authentication and authorization to try to mitigate any kind of funny business that might happen on the wire.” + +**Into the New Decade** + +For Scytale, Gilman’s biggest push for 2020 is to provide documentation with detailed examples of how to solve different use cases, and how to configure the software to solve those use cases. “Very clear-cut guidance,” he states.  “We have a lot of flexibility and features built into the software, but we don’t have conceptual guidelines that can teach people how the internals are working and stuff like that. We button everything up and make the experience really easy to pick up for folks who might not necessarily want to get in the weeds with it. They just want it to work.” + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/why-we-need-interoperable-identity/ + +作者:[TC CURRIE][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/tc_currie/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2019/12/computer-2930704_1280-696x413.jpg (computer-2930704_1280) +[2]: https://www.linux.com/wp-content/uploads/2019/12/computer-2930704_1280.jpg +[3]: http://scytale.io/ +[4]: https://spiffe.io/ From f6cfd66f0d1c73efb31e7ed477026e723db49739 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 22 Dec 2019 00:53:43 +0800 Subject: [PATCH 205/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191222=20How=20?= =?UTF-8?q?to=20Update=20Grub=20on=20Ubuntu=20and=20Other=20Linux=20Distri?= =?UTF-8?q?butions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md --- ...on Ubuntu and Other Linux Distributions.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md b/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..a969c37867 --- /dev/null +++ b/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Update Grub on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/update-grub/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Update Grub on Ubuntu and Other Linux Distributions +====== + +In this tutorial, you’ll learn to update grub on Ubuntu or any other Linux distribution. You’ll also learn a thing or two about how this grub update process works. + +### How to update grub + +Ubuntu and many other Linux distributions provide a handy command line utility called update-grub. + +To update grub, all you have to do is to run this command in the terminal with sudo. + +``` +sudo update-grub +``` + +You should see an output like this: + +``` +[email protected]:~$ sudo update-grub +[sudo] password for abhishek: +Sourcing file `/etc/default/grub' +Generating grub configuration file ... +Found linux image: /boot/vmlinuz-5.0.0-37-generic +Found initrd image: /boot/initrd.img-5.0.0-37-generic +Found linux image: /boot/vmlinuz-5.0.0-36-generic +Found initrd image: /boot/initrd.img-5.0.0-36-generic +Found linux image: /boot/vmlinuz-5.0.0-31-generic +Found initrd image: /boot/initrd.img-5.0.0-31-generic +Found Ubuntu 19.10 (19.10) on /dev/sda4 +Found MX 19 patito feo (19) on /dev/sdb1 +Adding boot menu entry for EFI firmware configuration +done +``` + +You may see a similar command called update-grub2. No need to be alarmed or confused between update-grub and update-grub2. Both of these commands do the same action. + +Around ten years ago, when grub2 was just introduced, update-grub2 command was also introduced. Today, update-grub2 is just a symbolic link to update-grub and both update grub2 configuration (because grub2 is the default). + +#### Can’t find update-grub command? Here’s what to do in that case + +It’s possible that your Linux distribution might not have update-grub command available. + +What do you do in that case? How do you update grub on such a Linux distribution? + +There is no need to panic. The update-grub command is simply a stub for running ‘grub-mkconfig -o /boot/grub/grub.cfg’ to generate grub2 config file. + +Which means that you can update grub with the following command on any Linux distribution: + +``` +sudo grub-mkconfig -o /boot/grub/grub.cfg +``` + +Of course, remembering update-grub command is a lot easier than the above command and this is the reason why it was created in the first place. + +### How does update-grub work? + +When you install a Linux distribution, it (usually) asks you to install the [grub boot loader][1]. + +Part of grub is installed on the MBR/ESP partition. Rest of the grub lies in /boo/grub directory of the Linux distributions. + +As per its [man page][2], update-grub works by looking into the /boot directory. All the files starting with [vmlinuz-][3] will be treated as kernels and they will get a grub menu entry. It will also add initrd lines for [ramdisk][4] images found with the same version as kernels found. + +It also looks into all disk partitions for other operating systems with [os-prober][5]. If it finds other operating systems, it adds them to the grub menu. + +![Representational image of Grub Menu][6] + +### Why would you need to update grub? + +There could be a number of scenarios when you need to update grub. + +Suppose you changed the grub config file (/etc/default/grub) to [change the default boot order][7] or reduce the default boot time. Your changes won’t take into effect unless you update the grub. + +Another scenario is when you have multiple Linux distributions installed on the same system. + +For example, on my Intel NUC, I have two disks. The first disk had Ubuntu 19.10 and then I installed Ubuntu 18.04 on it. The second OS (Ubuntu 18.04) also installed its own grub and now the grub screen is controlled by Ubuntu 18.04 grub. + +On the second disk, I installed MX Linux but I didn’t install grub this time. I want the existing grub (controlled by Ubuntu 18.04) to handle all the OS entries. + +Now, in this scenario, the grub on Ubuntu 18.04 needs to be updated so that it can see [MX Linux][8]. + +![][9] + +As you can see in the image above, when I update the grub, it finds various Linux kernels installed on 18.04 along with Ubuntu 19.10 and MX Linux on different partition. + +If I want MX Linux to control the grub, I can install grub on MX Linux with [grub-install][10] command and then the grub on MX Linux will start controlling the grub screen. You get the gist, right? + +Using a GUI tool like [Grub Customizer][11] is a simpler way to make changes in grub. + +**In the end…** + +Initially, I had intended to keep it a short article as a quick tip. But then I thought of explaining a few things associated with it so that (relatively) new Linux users could learn more than just a simple command. + +Did you like it? Do you have some questions or suggestions? Please feel free to leave a comment. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/update-grub/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/GNU_GRUB +[2]: https://manpages.debian.org/testing/grub-legacy/update-grub.8.en.html +[3]: https://www.ibm.com/developerworks/community/blogs/mhhaque/entry/anatomy_of_the_initrd_and_vmlinuz?lang=en +[4]: https://en.wikipedia.org/wiki/Initial_ramdisk +[5]: https://packages.debian.org/sid/utils/os-prober +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/grub_screen.png?ssl=1 +[7]: https://itsfoss.com/grub-customizer-ubuntu/ +[8]: https://mxlinux.org/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/update_grub.png?ssl=1 +[10]: https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html +[11]: https://itsfoss.com/customize-grub-linux/ From 011b92d683ad4bc32b89d14c746346bb6ac1f3ff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 22 Dec 2019 00:54:29 +0800 Subject: [PATCH 206/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191221=20Custom?= =?UTF-8?q?ize=20your=20Linux=20desktop=20with=20KDE=20Plasma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md --- ...mize your Linux desktop with KDE Plasma.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md diff --git a/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md b/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md new file mode 100644 index 0000000000..0baaf4747a --- /dev/null +++ b/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Customize your Linux desktop with KDE Plasma) +[#]: via: (https://opensource.com/article/19/12/linux-kde-plasma) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Customize your Linux desktop with KDE Plasma +====== +This article is part of a special series of 24 days of Linux desktops. +If you think there's no such thing as too much opportunity to customize +your desktop, KDE Plasma may be for you. +![5 pengiuns floating on iceburg][1] + +The Plasma desktop by the KDE community is a pinnacle among open source desktops. KDE got into the Linux desktop market early, but since its foundational Qt toolkit did not have a fully open license at the time, the [GNOME][2] desktop was created. Since then, Qt has become open source, and KDE (and its derivatives, like the [Trinity desktop][3]) has thrived. + +You may find the KDE desktop in your distribution's software repository, or you can download and install a distribution that ships KDE as its default. Before you install, be aware that KDE provides a full, integrated, and robust desktop experience, so several KDE applications are installed along with it. If you're already running a different desktop, you will find yourself with redundant applications (two PDF readers, several media players, two or more file managers, and so on). If you just want to try the KDE desktop without committing to it, you can install a KDE-based distribution in a virtual machine, such as [GNOME Boxes][4], or you can try a bootable OS like [Porteus][5]. + +### KDE desktop tour + +The [KDE Plasma][6] desktop is relatively boring at first glance—but in a comforting way. It's got the industry-standard layout: pop-up application menu in the bottom-left corner, taskbar in the middle, system tray on the right. It's exactly what you'd expect from a standard household or business computer. + +![KDE Plasma desktop][7] + +What sets KDE apart, though, is that you can change nearly anything you want. The Qt toolkit can be taken apart and rearranged in some surprising ways, meaning you can essentially design your own desktop using KDE's parts as your foundation. The settings available for how your desktop behaves are vast, too. KDE can act as a standard desktop, a tiling window manager, and anything in between. You can create your own window rules by window class, role, type, title, or any combination thereof, so if you want specific applications to behave differently than everything else, you can create an exception to global settings. + +Furthermore, there's a rich collection of widgets to enable you to customize the way you interface with your desktop. There's a GNOME-like full-screen application launcher, a Unity-like dock launcher and icons-only taskbar, and a traditional taskbar. You can create and place panels on any edge of the screen you want. + +![A slightly customized KDE desktop][8] + +There's so much customization, in fact, that one of the most common critiques of KDE is that it's _too customizable_, so keep in mind that customization is optional. You can use the Plasma desktop in its default configuration, and change things gradually and only as you feel necessary. What matters most about Plasma desktop configuration options isn't their number, but that they're discoverable and intuitive, either in the System Settings application or with a right-click. + +The fact is, on KDE, there's almost never just one way to accomplish any given task, and its users see that as its greatest strength. There's no implied workflow in KDE, only a default. And all defaults can be changed, until everything you need to do with your desktop is second-nature. + +### Consistency and integration + +The KDE community prides itself on consistency and integration, made possible through great developer and community management and the KDE libraries. The developers of KDE aren't just developers of a desktop. They provide a [stunning collection of applications][9], each of them created with KDE libs that extend and standardize common Qt widgets. It's no accident that after using KDE for a few months, whether you open [DigiKam][10] for photo management or Kmail to check email or KTorrent to grab the latest ISO or Dolphin to manage files, your muscle memory takes you where you need to go in the UI before you consciously think about it. + +![KDE on Porteus][11] + +### Try KDE + +KDE has something for everyone. Use its default settings for a smooth, plain-vanilla desktop experience, or customize it to make it your own. It's a stable, attractive, and robust desktop environment that probably has everything you need for whatever you want to do on Linux. + +KDE originally stood for Kool Desktop Environment, but is now known by many as the K Desktop... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-kde-plasma + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg) +[2]: https://opensource.com/article/19/12/gnome-linux-desktop +[3]: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://opensource.com/article/19/6/linux-distros-to-try +[6]: https://kde.org/plasma-desktop +[7]: https://opensource.com/sites/default/files/uploads/advent-kde-presskit.jpg (KDE Plasma desktop) +[8]: https://opensource.com/sites/default/files/uploads/advent-kde-dock.jpg (A slightly customized KDE desktop) +[9]: https://kde.org/applications/ +[10]: https://opensource.com/life/16/5/how-use-digikam-photo-management +[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus) From e6a387edc957ae0d32f4bc5d5757cbc21e322f54 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 22 Dec 2019 00:54:59 +0800 Subject: [PATCH 207/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191221=20Elimin?= =?UTF-8?q?ating=20gender=20bias=20in=20open=20source=20software=20develop?= =?UTF-8?q?ment,=20a=20database=20of=20microbes,=20and=20more=20open=20sou?= =?UTF-8?q?rce=20news?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md --- ... of microbes, and more open source news.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md diff --git a/sources/tech/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md b/sources/tech/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md new file mode 100644 index 0000000000..3cf9d05097 --- /dev/null +++ b/sources/tech/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Eliminating gender bias in open source software development, a database of microbes, and more open source news) +[#]: via: (https://opensource.com/article/19/12/news-december-21) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Eliminating gender bias in open source software development, a database of microbes, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![Weekly news roundup with TV][1] + +In this edition of our open source news roundup, we take a look at eliminating gender bias in open source software development, an open source database of microbes, an open source index for cooperatives, and more! + +### Eliminating gender bias from open source development + +It's a sad fact that certain groups, among them women, are woefully underrepresented in open source projects. It's like a bug in the open source development process. Fortunately, there are initiatives to make that under representation a thing of the past. A study out of Oregon State University (OSU) intends to resolve the issue of the lack of women in open source development by "[finding these bugs and proposing redesigns around them][2], leading to more gender-inclusive tools used by software developers." + +The study will look at tools commonly used in open source development — including Eclipse, GitHub, and Hudson — to determine if they "significantly discourage newcomers, especially women, from joining OSS projects." According to Igor Steinmacher, one of the principal investigators of the study, the study will examine "how people use tools because the 'bugs' may be embedded in how the tool was designed, which may place people with different cognitive styles at a disadvantage." + +The developers of the tools being studied will walk through their software and answer questions based on specific personas. The researchers at OSU will suggest ways to redesign the software to eliminate gender bias and will "create a list of best practices for fixing gender-bias bugs in both products and processes." + +### Canadian university compiles open source microbial database + +What do you do when you have a vast amount of data but no way to effectively search and build upon it? You turn it into a database, of course. That's what researchers at Simon Fraser University in British Columbia, along with collaborators from around the globe, did with [information about chemical compounds created by bacteria and fungi][3]. Called the Natural Products Atlas, the database "holds information on nearly 25,000 natural compounds and serves as a knowledge base and repository for the global scientific community." + +Licensed under a Creative Commons Attribution 4.0 International License, the Natural Products Atlas "holds information on nearly 25,000 natural compounds and serves as a knowledge base and repository for the global scientific community." The [website for the Natural Products Atlas][4] hosts the database also includes a number of visualization tools and is fully searchable. + +Roger Linington, an associate professor at SFU who spearheaded the creation of the database, said that having "all the available data in one place and in a standardized format means we can now index natural compounds for anyone to freely access and learn more about." + +### Open source index for cooperatives + +Europe has long been a hotbed of both open source development and open source adoption. While European governments strongly advocate open source, non profits have been following suit. One of those is Cooperatives Europe, which is developing "[open source software to allow users to index co-op information and resources in a standardised way][5]." + +The idea behind the software, called Coop Starter, reinforces the [essential freedoms of free software][6]: it's intended to provide "education, training and information. The software may be used and repurposed by the public for their own needs and on their own infrastructure." Anyone can use it "to reference existing material on co-operative entrepreneurship" and can contribute "by sharing resources and information." + +The [code for Coop Starter][7], along with a related WordPress plugin, is available from Cooperative Europe's GitLab repository. + +#### In other news + + * [Nancy recognised as France’s top digital free and collaborative public service][8] + * [Open Source and AI: Ready for primetime in government?][9] + * [Open Software Means Kinder Science][10] + * [New Open-Source CoE to be launched by Wipro and Oman’s Ministry of Tech & Communication][11] + + + +_Thanks, as always, to Opensource.com staff members and [Correspondents][12] for their help this week._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/news-december-21 + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://techxplore.com/news/2019-12-professors-gender-biased-bugs-open-source-software.html +[3]: https://www.sfu.ca/sfunews/stories/2019/12/sfu-global-collaboration-creates-world-s-first-open-source-datab.html +[4]: https://www.npatlas.org/joomla/ +[5]: https://www.thenews.coop/144412/sector/regional-organisations/cooperatives-europe-builds-open-source-index-for-the-co-op-movement/ +[6]: https://www.gnu.org/philosophy/free-sw.en.html +[7]: https://git.happy-dev.fr/startinblox/applications/coop-starter +[8]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/territoire-numerique-libre +[9]: https://federalnewsnetwork.com/commentary/2019/12/open-source-and-ai-ready-for-primetime-in-government/ +[10]: https://blogs.scientificamerican.com/observations/open-software-means-kinder-science/ +[11]: https://www.indianweb2.com/2019/12/11/new-open-source-coe-to-be-launched-by-wipro-and-omans-ministry-of-tech-communication/ +[12]: https://opensource.com/correspondent-program From f3ab8f7fe89564930a36ca3f1c00b08894316c6e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 22 Dec 2019 00:55:41 +0800 Subject: [PATCH 208/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191221=20Testin?= =?UTF-8?q?g=20your=20Bash=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191221 Testing your Bash script.md --- .../tech/20191221 Testing your Bash script.md | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 sources/tech/20191221 Testing your Bash script.md diff --git a/sources/tech/20191221 Testing your Bash script.md b/sources/tech/20191221 Testing your Bash script.md new file mode 100644 index 0000000000..4a8504cbe9 --- /dev/null +++ b/sources/tech/20191221 Testing your Bash script.md @@ -0,0 +1,288 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Testing your Bash script) +[#]: via: (https://opensource.com/article/19/12/testing-bash-script) +[#]: author: (David Both https://opensource.com/users/dboth) + +Testing your Bash script +====== +In the fourth and final article in this series on automation with shell +scripts, learn about initializing variables and ensuring your program +runs correctly. +![Team checklist and to dos][1] + +In the [first article][2] in this series, you created your first, very small, one-line Bash script and explored the reasons for creating shell scripts. In the [second article][3], you began creating a fairly simple template that can be a starting point for other Bash programs and began testing it. In the [third article][4], you created and used a simple Help function and learned about using functions and how to handle command-line options such as **-h**. + +This fourth and final article in the series gets into variables and initializing them as well as how to do a bit of sanity testing to help ensure the program runs under the proper conditions. Remember, the objective of this series is to build working code that will be used for a template for future Bash programming projects. The idea is to make getting started on new programming projects easy by having common elements already available in the template. + +### Variables + +The Bash shell, like all programming languages, can deal with variables. A variable is a symbolic name that refers to a specific location in memory that contains a value of some sort. The value of a variable is changeable, i.e., it is variable. If you are not familiar with using variables, read my article [_How to program with Bash: Syntax and tools_][5] before you go further. + +Done? Great! Let's now look at some good practices when using variables. + +I always set initial values for every variable used in my scripts. You can find this in your template script immediately after the procedures as the first part of the main program body, before it processes the options. Initializing each variable with an appropriate value can prevent errors that might occur with uninitialized variables in comparison or math operations. Placing this list of variables in one place allows you to see all of the variables that are supposed to be in the script and their initial values. + +Your little script has only a single variable, **$option**, so far. Set it by inserting the following lines as shown: + + +``` +################################################################################ +################################################################################ +# Main program                                                                 # +################################################################################ +################################################################################ +# Initialize variables +option="" +################################################################################ +# Process the input options. Add options as needed.                            # +################################################################################ +``` + +Test this to ensure that everything works as it should and that nothing has broken as the result of this change. + +### Constants + +Constants are variables, too—at least they should be. Use variables wherever possible in command-line interface (CLI) programs instead of hard-coded values. Even if you think you will use a particular value (such as a directory name, a file name, or a text string) just once, create a variable and use it where you would have placed the hard-coded name. + +For example, the message printed as part of the main body of the program is a string literal, **echo "Hello world!"**. Change that to a variable. First, add the following statement to the variable initialization section: + + +``` +`Msg="Hello world!"` +``` + +And now change the last line of the program from: + + +``` +`echo "Hello world!"` +``` + +to: + + +``` +`echo "$Msg"` +``` + +Test the results. + +### Sanity checks + +Sanity checks are simply tests for conditions that need to be true in order for the program to work correctly, such as: the program must be run as the root user, or it must run on a particular distribution and release of that distro. Add a check for _root_ as the running user in your simple program template. + +Testing that the root user is running the program is easy because a program runs as the user that launches it. + +The **id** command can be used to determine the numeric user ID (UID) the program is running under. It provides several bits of information when it is used without any options: + + +``` +[student@testvm1 ~]$ id +uid=1001(student) gid=1001(student) groups=1001(student),5000(dev) +``` + +Using the **-u** option returns just the user's UID, which is easily usable in your Bash program: + + +``` +[student@testvm1 ~]$ id -u +1001 +[student@testvm1 ~]$ +``` + +Add the following function to the program. I added it after the Help procedure, but you can place it anywhere in the procedures section. The logic is that if the UID is not zero, which is always the root user's UID, the program exits: + + +``` +################################################################################ +# Check for root.                                                              # +################################################################################ +CheckRoot() +{ +   if [ `id -u` != 0 ] +   then +      echo "ERROR: You must be root user to run this program" +      exit +   fi   +} +``` + +Now, add a call to the **CheckRoot** procedure just before the variable's initialization. Test this, first running the program as the student user: + + +``` +[student@testvm1 ~]$ ./hello +ERROR: You must be root user to run this program +[student@testvm1 ~]$ +``` + +then as the root user: + + +``` +[root@testvm1 student]# ./hello +Hello world! +[root@testvm1 student]# +``` + +You may not always need this particular sanity test, so comment out the call to **CheckRoot** but leave all the code in place in the template. This way, all you need to do to use that code in a future program is to uncomment the call. + +### The code + +After making the changes outlined above, your code should look like this: + + +``` +#!/usr/bin/bash +################################################################################ +#                              scriptTemplate                                  # +#                                                                              # +# Use this template as the beginning of a new program. Place a short           # +# description of the script here.                                              # +#                                                                              # +# Change History                                                               # +# 11/11/2019  David Both    Original code. This is a template for creating     # +#                           new Bash shell scripts.                            # +#                           Add new history entries as needed.                 # +#                                                                              # +#                                                                              # +################################################################################ +################################################################################ +################################################################################ +#                                                                              # +#  Copyright (C) 2007, 2019 David Both                                         # +#  [LinuxGeek46@both.org][6]                                                        # +#                                                                              # +#  This program is free software; you can redistribute it and/or modify        # +#  it under the terms of the GNU General Public License as published by        # +#  the Free Software Foundation; either version 2 of the License, or           # +#  (at your option) any later version.                                         # +#                                                                              # +#  This program is distributed in the hope that it will be useful,             # +#  but WITHOUT ANY WARRANTY; without even the implied warranty of              # +#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # +#  GNU General Public License for more details.                                # +#                                                                              # +#  You should have received a copy of the GNU General Public License           # +#  along with this program; if not, write to the Free Software                 # +#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # +#                                                                              # +################################################################################ +################################################################################ +################################################################################ + +################################################################################ +# Help                                                                         # +################################################################################ +Help() +{ +   # Display Help +   echo "Add description of the script functions here." +   echo +   echo "Syntax: scriptTemplate [-g|h|v|V]" +   echo "options:" +   echo "g     Print the GPL license notification." +   echo "h     Print this Help." +   echo "v     Verbose mode." +   echo "V     Print software version and exit." +   echo +} + +################################################################################ +# Check for root.                                                              # +################################################################################ +CheckRoot() +{ +   # If we are not running as root we exit the program +   if [ `id -u` != 0 ] +   then +      echo "ERROR: You must be root user to run this program" +      exit +   fi +} + +################################################################################ +################################################################################ +# Main program                                                                 # +################################################################################ +################################################################################ + +################################################################################ +# Sanity checks                                                                # +################################################################################ +# Are we rnning as root? +# CheckRoot + +# Initialize variables +option="" +Msg="Hello world!" +################################################################################ +# Process the input options. Add options as needed.                            # +################################################################################ +# Get the options +while getopts ":h" option; do +   case $option in +      h) # display Help +         Help +         exit;; +     \?) # incorrect option +         echo "Error: Invalid option" +         exit;; +   esac +done + +echo "$Msg" +``` + +### A final exercise + +You probably noticed that the Help function in your code refers to features that are not in the code. As a final exercise, figure out how to add those functions to the code template you created. + +### Summary + +In this article, you created a couple of functions to perform a sanity test for whether your program is running as root. Your program is getting a little more complex, so testing is becoming more important and requires more test paths to be complete. + +This series looked at a very minimal Bash program and how to build a script up a bit at a time. The result is a simple template that can be the starting point for other, more useful Bash scripts and that contains useful elements that make it easy to start new scripts. + +By now, you get the idea: Compiled programs are necessary and fill a very important need. But for sysadmins, there is always a better way. Always use shell scripts to meet your job's automation needs. Shell scripts are open; their content and purpose are knowable. They can be readily modified to meet different requirements. I have never found anything that I need to do in my sysadmin role that cannot be accomplished with a shell script. + +What you have created so far in this series is just the beginning. As you write more Bash programs, you will find more bits of code that you use frequently and should be included in your program template. + +### Resources + + * [How to program with Bash: Syntax and tools][5] + * [How to program with Bash: Logical operators and shell expansions][7] + * [How to program with Bash: Loops][8] + + + +* * * + +_This series of articles is partially based on Volume 2, Chapter 10 of David Both's three-part Linux self-study course, [Using and Administering Linux—Zero to SysAdmin][9]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/testing-bash-script + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/todo_checklist_team_metrics_report.png?itok=oB5uQbzf (Team checklist and to dos) +[2]: https://opensource.com/article/19/12/introduction-automation-bash-scripts +[3]: https://opensource.com/article/19/12/creating-bash-script-template +[4]: https://opensource.com/article/19/12/give-your-bash-program-some-help +[5]: https://opensource.com/article/19/10/programming-bash-syntax-tools +[6]: mailto:LinuxGeek46@both.org +[7]: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions +[8]: https://opensource.com/article/19/10/programming-bash-loops +[9]: http://www.both.org/?page_id=1183 From f806cb316fd19aa6c811c80ceec8252e2558048d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 22 Dec 2019 07:01:39 +0800 Subject: [PATCH 209/676] Rename sources/tech/20191220 Why We Need Interoperable Service Identity.md to sources/talk/20191220 Why We Need Interoperable Service Identity.md --- .../20191220 Why We Need Interoperable Service Identity.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191220 Why We Need Interoperable Service Identity.md (100%) diff --git a/sources/tech/20191220 Why We Need Interoperable Service Identity.md b/sources/talk/20191220 Why We Need Interoperable Service Identity.md similarity index 100% rename from sources/tech/20191220 Why We Need Interoperable Service Identity.md rename to sources/talk/20191220 Why We Need Interoperable Service Identity.md From 3c2cfc611c292e7846cd686e2b17b7b867219279 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 22 Dec 2019 07:39:02 +0800 Subject: [PATCH 210/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @mayunmeiyouming 恭喜您,完成了第一篇翻译贡献! --- ... fans love about the Mate Linux desktop.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md b/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md index 505c16110e..46bf53162b 100644 --- a/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md +++ b/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md @@ -1,38 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (mayunmeiyouming) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What GNOME 2 fans love about the Mate Linux desktop) [#]: via: (https://opensource.com/article/19/12/mate-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -GNOME 2粉丝喜欢Mate Linux桌面的什么 +GNOME 2 粉丝喜欢 Mate Linux 桌面的什么? ====== -本文是24天Linux桌面特别系列的一部分。如果您还记得GNOME 2,那么Mate Linux桌面将满足您的怀旧的情怀。 -![Linux keys on the keyboard for a desktop computer][1] -如果你以前听过这个:当GNOME3第一次发布时,很多GNOME用户还没有准备好放弃GNOME2。[Mate] [2](以yerba mate_ plant命名)项目的开始是为了延续GNOME 2桌面,刚开始时使用GTK 2(GNOME 2所基于的工具包),然后又合并了GTK 3。由于Linux Mint的简单易用,使得桌面变得非常流行,并且从那时起,它已经普遍用于Fedora、Ubuntu、Slackware、Arch和许多其他Linux发行版上。今天,Mate继续提供一个传统的桌面环境,它的外观和感觉与GNOME 2完全一样,使用GTK 3工具包。 +> 本文是 24 天 Linux 桌面特别系列的一部分。如果你还在怀念 GNOME 2,那么 Mate Linux 桌面将满足你的怀旧情怀。 -您可以在Linux发行版的软件仓库中找到Mate,也可以下载并[安装][3]把Mate作为默认桌面的发行版。不过,在你这样做之前,请注意它是为了提供完整的桌面体验,所以许多Mate应用程序都是随桌面一起安装的。如果您运行的是不同的桌面,您可能会发现自己有多余的应用程序(两个PDF阅读器、两个媒体播放器、两个文件管理器,等等)。如果您只想尝试Mate桌面,可以在虚拟机中安装基于Mate的发行版,例如[GNOME box][4]。 +![](https://img.linux.net.cn/data/attachment/album/201912/22/073751ugrt47kye0begk3k.jpg) -### Mate桌面之旅 +如果你以前听过这个传闻:当 GNOME3 第一次发布时,很多 GNOME 用户还没有准备好放弃 GNOME 2。[Mate][2](以马黛茶yerba mate植物命名)项目的开始是为了延续 GNOME 2 桌面,刚开始时它使用 GTK 2(GNOME 2 所基于的工具包),然后又合并了 GTK 3。由于 Linux Mint 的简单易用,使得该桌面变得非常流行,并且从那时起,它已经普遍用于 Fedora、Ubuntu、Slackware、Arch 和许多其他 Linux 发行版上。今天,Mate 继续提供一个传统的桌面环境,它的外观和感觉与 GNOME 2 完全一样,使用 GTK 3 工具包。 -Mate项目不仅仅唤起了GNOME 2;它是gnome2。如果你是00年代中期Linux桌面的粉丝,至少,你会发现Mate的怀旧情怀。我不是GNOME2的粉丝,我倾向于使用KDE,但是有一个地方我无法想象没有GNOME2:[OpenSolaris][5]。OpenSolaris项目并没有持续太久,当Ian Murdock在被Oracle并入Sun Microsystems之前加入Sun Microsystems时,它变得非常突出,但我当时是一个低级的Solaris管理员,并使用OpenSolaris来教自己更多关于Unix的那种风格。这是我使用GNOME2的唯一平台(因为我一开始不知道如何更改桌面,后来才习惯),而今天的[OpenIndiana project][6]是OpenSolaris的社区延续,它通过Mate桌面使用GNOME2。 +你可以在你的 Linux 发行版的软件仓库中找到 Mate,也可以下载并[安装][3]一个把 Mate 作为默认桌面的发行版。不过,在你这样做之前,请注意为了提供完整的桌面体验,所以许多 Mate 应用程序都是随该桌面一起安装的。如果你运行的是不同的桌面,你可能会发现自己有多余的应用程序(两个 PDF 阅读器、两个媒体播放器、两个文件管理器,等等)。所以如果你只想尝试 Mate 桌面,可以在虚拟机(例如 [GNOME box][4])中安装基于 Mate 的发行版。 + +### Mate 桌面之旅 + +Mate 项目不仅仅可以让你想起来 GNOME 2;它就是 GNOME 2。如果你是 00 年代中期 Linux 桌面的粉丝,至少,你会从中感受到 Mate 的怀旧情怀。我不是 GNOME 2 的粉丝,我更倾向于使用 KDE,但是有一个地方我无法想象没有 GNOME 2:[OpenSolaris][5]。OpenSolaris 项目并没有持续太久,在 Sun Microsystems 被并入 Oracle 之前,Ian Murdock 加入 Sun 时它就显得非常突出,我当时是一个初级的 Solaris 管理员,使用 OpenSolaris 来让自己更多学会那种 Unix 风格。这是我使用过 GNOME 2 的唯一平台(因为我一开始不知道如何更改桌面,后来习惯了它),而今天的 [OpenIndiana project][6] 是 OpenSolaris 的社区延续,它通过 Mate 桌面使用 GNOME 2。 ![Mate on OpenIndiana][7] -Mate的布局由左上角的三个菜单组成:应用程序、位置和系统。应用程序菜单提供对系统上安装的所有的应用程序的启动程序的快速访问。Places菜单提供对常用位置(如主目录、网络文件夹等)的快速访问。系统菜单包含全局选项,如关级和睡眠。右上角是一个系统托盘,屏幕底部有一个任务栏和一个虚拟桌面切换栏。 +Mate 的布局由左上角的三个菜单组成:应用程序、位置和系统。应用程序菜单提供对系统上安装的所有的应用程序启动器的快速访问。位置菜单提供对常用位置(如家目录、网络文件夹等)的快速访问。系统菜单包含全局选项,如关机和睡眠。右上角是一个系统托盘,屏幕底部有一个任务栏和一个虚拟桌面切换栏。 -就桌面设计而言,它是一种稍微有点奇怪的配置。它从早期的Linux桌面、MacFinder和Windows中借用了相同的部分,但是又创建了一个独特的配置,这种配置很直观,而且很熟悉。Mate故意抵制与这个模型的偏差,这正是它的用户喜欢的地方。 +就桌面设计而言,这是一种稍微有点奇怪的配置。它从早期的 Linux 桌面、MacFinder 和 Windows 中借用了一些相同的部分,但是又创建了一个独特的配置,这种配置很直观而有些熟悉。Mate 执意保持这个模型,而这正是它的用户喜欢的地方。 -### Mate和开源 +### Mate 和开源 -Mate是一个最直接的例子,展示了开源如何使开发人员能够对抗项目生命的终结。从理论上讲,GNOME2会被GNOME3所取代,但它依然存在,因为一个开发人员建立代码的一个分支并继续进行下去。势头越来越大,更多的开发人员加入进来,并且用户喜爱的桌面比以往任何时候都更好。并不是所有的软件都有第二次机会,但是开源永远是一个机会,否则就永远没有机会。 +Mate 是一个最直接的例子,展示了开源如何使开发人员能够对抗项目生命的终结。从理论上讲,GNOME 2 会被 GNOME 3 所取代,但它依然存在,因为一个开发人员建立了该代码的一个分支并继续发展了下去。它的发展势头越来越庞大,更多的开发人员加入进来,并且这个让用户喜爱的桌面比以往任何时候都要更好。并不是所有的软件都有第二次机会,但是开源永远是一个机会,否则就永远没有机会。 -使用和支持开源意味着支持用户和开发人员的自由。而且Mate桌面是它们的努力的有力证明。 - -探索不同的桌面是一件好事。我最近将开始使用为GNOME 3 +使用和支持开源意味着支持用户和开发人员的自由。而且 Mate 桌面是他们的努力的有力证明。 -------------------------------------------------------------------------------- @@ -41,7 +41,7 @@ via: https://opensource.com/article/19/12/mate-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[mayunmeiyouming](https://github.com/mayunmeiyouming) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2bf87800293d6118337ec2948b9590a96391dd70 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 22 Dec 2019 07:40:21 +0800 Subject: [PATCH 211/676] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @mayunmeiyouming 本文首发地址: https://linux.cn/article-11703-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/mayunmeiyouming 请注册以领取 LCCN: https://lctt.linux.cn/ --- ...213 What GNOME 2 fans love about the Mate Linux desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191213 What GNOME 2 fans love about the Mate Linux desktop.md (98%) diff --git a/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md b/published/20191213 What GNOME 2 fans love about the Mate Linux desktop.md similarity index 98% rename from translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md rename to published/20191213 What GNOME 2 fans love about the Mate Linux desktop.md index 46bf53162b..61f485fc27 100644 --- a/translated/tech/20191213 What GNOME 2 fans love about the Mate Linux desktop.md +++ b/published/20191213 What GNOME 2 fans love about the Mate Linux desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (mayunmeiyouming) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11703-1.html) [#]: subject: (What GNOME 2 fans love about the Mate Linux desktop) [#]: via: (https://opensource.com/article/19/12/mate-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From bde0dddb67f244206c534fa33bba161234365a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Sun, 22 Dec 2019 08:59:58 +0800 Subject: [PATCH 212/676] Translated --- ...d 8.1 Oreo on Linux To Run Apps - Games.md | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) rename {sources => translated}/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md (55%) diff --git a/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md b/translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md similarity index 55% rename from sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md rename to translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md index f20d24e5cf..c8263bd9e0 100644 --- a/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md +++ b/translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md @@ -7,144 +7,144 @@ [#]: via: (https://fosspost.org/tutorials/install-android-8-1-oreo-on-linux) [#]: author: (Python Programmer;Open Source Software Enthusiast. Worked On Developing A Lot Of Free Software. The Founder Of Foss Post;Foss Project. Computer Science Major. ) -Install Android 8.1 Oreo on Linux To Run Apps & Games +在 Linux 上安装 Android 8.1 Oreo 来运行应用程序和游戏 ====== ![](https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/android-8.1-oreo-x86-on-linux.png?resize=1237%2C527&ssl=1) -[android x86][1] is a free and an open source project to port the android system made by Google from the ARM architecture to the x86 architecture, which allow users to run the android system on their desktop machines to enjoy all android functionalities + Apps & games. +[android x86][1] 是一个自由开放源码的项目,将谷歌制作的android系统从 ARM 架构移植到 x86 架构, 运行用户在他们的桌面机器上运行 android 系统来享受所有的 android 功能和应用程序及游戏。 -The android x86 project finished porting the android 8.1 Oreo system to the x86 architecture few weeks ago. In this post, we’ll explain how to install it on your Linux system so that you can use your android apps and games any time you want. +几周前,android x86 项目完成 android 8.1 Oreo 系统到 x86 架构的移植。在这篇文章中,我们将解释如何在你的 Linux 系统上安装它,以便你能够随时使用你的 android 应用程序和游戏。 -### Installing Android x86 8.1 Oreo on Linux +### 在 Linux 上安装 Android x86 8.1 Oreo -#### Preparing the Environment +#### 准备环境 -First, let’s download the android x86 8.1 Oreo system image. You can download it from [this page][2], just click on the “View” button under the android-x86_64-8.1-r1.iso file. +首先,让我们下载 android x86 8.1 Oreo 系统镜像。你可以从[这个页面][2]下载它,只需单击 android-x86_64-8.1-r1.iso 文件下 “View” 按钮。 -We are going to use QEMU to run android x86 on our Linux system. QEMU is a very good emulator software, which is also free and open source, and is available in all the major Linux distributions repositories. +我们将在我们的 Linux 系统上使用 QEMU 来运行 android x86 。QEMU 是一个非常好的模拟器软件,它也是自由和开放源码的,并且在所有主要的 Linux 发行版存储库中都是可用的。 -To install QEMU on Ubuntu/Linux Mint/Debian: +在 Ubuntu/Linux Mint/Debian 上安装 QEMU: ``` sudo apt-get install qemu qemu-kvm libvirt-bin ``` -To install QEMU on Fedora: +在 Fedora 上安装 QEMU: ``` sudo dnf install qemu qemu-kvm ``` -For other distributions, just search for the qemu and qemu-kvm packages and install them. +对于其它发行版,只需要搜索 qemu 和 qemu-kvm 软件包,并安装它们。 -After you have installed QEMU, we’ll need to run the following command to create the android.img file, which will be like some sort of an allocated disk space just for the android system. All android files and system will be inside that image file: +在你安装 QEMU 后,我们将需要运行下面的命令来创建 android.img 文件,它就像某种分配给 android 系统的磁盘空间。所有 android 文件和系统都将位于该镜像文件中: ``` qemu-img create -f qcow2 android.img 15G ``` -Here we are saying that we want to allocate a maximum of 15GB for android, but you can change it to any size you want (make sure it’s at least bigger than 5GB). +我们在这里说,我们想为 android 分配一个最大 15GB 的磁盘空间,但是,你可以更改它到你想要的任意大小(确保它至少大于5GB)。 -Now, to start running the android system for the first time, run: +现在,首次启动运行 android 系统,运行: ``` sudo qemu-system-x86_64 -m 2048 -boot d -enable-kvm -smp 3 -net nic -net user -hda android.img -cdrom /home/mhsabbagh/android-x86_64-8.1-r1.iso ``` -Replace /home/mhsabbagh/android-x86_64-8.1-r1.iso with the path of the file that you downloaded from the android x86 website. For explaination of other options we are using here, you may refer to [this article][3]. +将 /home/mhsabbagh/android-x86_64-8.1-r1.iso 替换为你从 android x86 网站下载的文件的路径。我们在这里正在使用的其它选项的解释,你可以参考[这篇文章][3]。 -After you run the above command, the android system will start: +在你运行上面的命令后,android 系统将启动: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 39 android 8.1 oreo on linux][4] -#### Installing the System +#### 安装系统 -From this window, choose “Advanced options”, which should lead to the following menu, from which you should choose “Auto_installation” as follows: +从这个窗口中,选择 “Advanced options”, 它将引导到下面的菜单,你应如下在其中选择 “Auto_installation” : ![Install Android 8.1 Oreo on Linux To Run Apps & Games 41 android 8.1 oreo on linux][5] -After that, the installer will just tell you about whether you want to continue or not, choose Yes: +在这以后,安装器将告知你是否想要继续,选择 Yes : ![Install Android 8.1 Oreo on Linux To Run Apps & Games 43 android 8.1 oreo on linux][6] -And the installation will carry on without any further instructions from you: +接下来,安装器将无需你的指示而继续进行: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 45 android 8.1 oreo on linux][7] -Finally you’ll receive this message, which indicates that you have successfully installed android 8.1: +最后,你将收到这个信息,它表示你已经成功安装 android 8.1 : ![Install Android 8.1 Oreo on Linux To Run Apps & Games 47 android 8.1 oreo on linux][8] -For now, just close the QEMU window completely. +现在,完全关闭 QEMU 窗口。 -#### Booting and Using Android 8.1 Oreo +#### 启动和使用 Android 8.1 Oreo -Now that the android system is fully installed in your android.img file, you should use the following QEMU command to start it instead of the previous one: +现在,android 系统已经完全安装在你的 android.img 文件中,你应该使用下面的 QEMU 命令来启动它,而不是前面的命令: ``` sudo qemu-system-x86_64 -m 2048 -boot d -enable-kvm -smp 3 -net nic -net user -hda android.img ``` -Notice that all we did was that we just removed the -cdrom option and its argument. This is to tell QEMU that we no longer want to boot from the ISO file that we downloaded, but from the installed android system. +注意,我们所做的只是移除 -cdrom 选项和它的参数。这是告诉 QEMU ,我们不再想从我们下载的 ISO 文件启动,相反,从安装的 android 系统启动。 -You should see the android booting menu now: +你现在能够看到 android 启动菜单: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 49 android 8.1 oreo on linux][9] -Then you’ll be taken to the first preparation wizard, choose your language and continue: +然后,你将带去第一个准备向导,选择你的语言并继续: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 51 android 8.1 oreo on linux][10] -From here, choose the “Set up as new” option: +从这里,选择 “Set up as new” 选项: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 53 android 8.1 oreo on linux][11] -Then android will ask you about if you want to login to your current Google account. This step is optional, but important so that you can use the Play Store later: +然后,android 将询问你是否想登陆到你当前的谷歌账号。这步骤是可选的,但是这很重要,以便你随后可以使用 Play Store : ![Install Android 8.1 Oreo on Linux To Run Apps & Games 55 android 8.1 oreo on linux][12] -Then you’ll need to accept the terms and conditions: +然后,你将需要接受条款: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 57 android 8.1 oreo on linux][13] -Now you can choose your current timezone: +现在,你可以选择你当前的时区: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 59 android 8.1 oreo on linux][14] -The system will ask you now if you want to enable any data collection features. If I were you, I’d simply turn them all off like that: +系统将询问你是否想启动一些数据收集功能。如果我是你的话,我将简单地关闭它们,像这样: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 61 android 8.1 oreo on linux][15] -Finally, you’ll have 2 launcher types to choose from, I recommend that you choose the Launcher3 option and make it the default: +最后,你将有两种启动类型可供选择,我建议你选择 Launcher3 选项,并使其成为默认项: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 63 android 8.1 oreo on linux][16] -Then you’ll see your fully-working android system home screen: +然后,你将看到完整工作的 android 系统主屏幕: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 65 android 8.1 oreo on linux][17] -From here now, you can do all the tasks you want; You can use the built-in android apps, or you may browse the settings of your system to adjust it however you like. You may change look and feeling of your system, or you can run Chrome for example: +从现在起,你可以做你想做的任何事情;你可以使用内置的 android 应用程序,或者你可以浏览你是系统设置来根据你的喜好进行调整。你可以更改你的系统的外观和体验,或者你可以像示例一样运行 Chrome : ![Install Android 8.1 Oreo on Linux To Run Apps & Games 67 android 8.1 oreo on linux][18] -You may start installing some apps like WhatsApp and others from the Google Play store for your own use: +你可以从 Google Play store 开始安装一些应用程序程序,像 WhatsApp 和其它的应用程序,以供你自己使用: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 69 android 8.1 oreo on linux][19] -You can now do whatever you want with your system. Congratulations! +你现在可以用你的系统做任何你想做的事。恭喜! -### How to Easily Run Android 8.1 Oreo Later +### 以后如何轻松地运行 Android 8.1 Oreo -We don’t want to always have to open the terminal window and write that long QEMU command to run the android system, but we want to run it in just 1 click whenever we need that. +我们不想总是不得不打开终端窗口,并写那些长长的 QEMU 命令来运行 android 系统,相反,我们想在我们需要时一次单击就运行它。 -To do this, we’ll create a new file under /usr/share/applications called android.desktop with the following command: +为此,我们将使用下面的命令在 /usr/share/applications 下创建一个名为 android.desktop 的新文件: ``` sudo nano /usr/share/applications/android.desktop ``` -And paste the following contents inside it (Right click and then paste): +并在其中粘贴下面的内容(右键单击然后粘贴): ``` [Desktop Entry] @@ -158,19 +158,19 @@ StartupNotify=true Categories=GTK; ``` -Again, you have to replace /home/mhsabbagh/android.img with the path to the local image on your system. Then save the file (Ctrl + X, then press Y, then Enter). +再强调一次,你必需使用你系统上的本地镜像路径来替换 /home/mhsabbagh/android.img 。然后保存文件 (Ctrl + X ,然后按 Y ,然后按 Enter)。 -Notice that we needed to use “pkexec” to run QEMU with root privileges because starting from newer versions, accessing to the KVM technology via libvirt is not allowed for normal users; That’s why it will ask you for the root password each time. +注意,我们需要使用 “pkexec” 来使用 root 权限运行 QEMU ,因为从较新的版本开始,普通用户不允许通过 libvirt 访问 KVM 技术;这就是为什么它将每次要求你输入 root 密码的原因。 -Now, you’ll see the android icon in the applications menu all the time, you can simply click it any time you want to use android and the QEMU program will start: +现在,你将在应用程序菜单中看到 android 图标,你可以在你想使用 android 的任何时间来简单地单击图标,QEMU 程序将启动: ![Install Android 8.1 Oreo on Linux To Run Apps & Games 71 android 8.1 oreo on linux][20] -### Conclusion +### 总结 -We showed you how install and run android 8.1 Oreo on your Linux system. From now on, it should be much easier on you to do your android-based tasks without some other software like Blutsticks and similar methods. Here, you have a fully-working and functional android system that you can manipulate however you like, and if anything goes wrong, you can simply nuke the image file and run the installation all over again any time you want. +我们向你展示如何你的 Linux 系统上安装和运行 android 8.1 Oreo 。从现在起,在没有其它一些软件的(像 Blutsticks 和类似的方法)的情况下,你应该更容易地完成基于 android 的任务。在这里,你有一个完整工作和功能的 android 系统,你可以随心所欲地操作它,如果一些东西出差,你可以简单地核弹攻击镜像文件,然后随时再一次重新运行安装程序。 -Have you tried android x86 before? How was your experience with it? +你之前尝试过 android x86 吗?你的经验如何? -------------------------------------------------------------------------------- @@ -179,7 +179,7 @@ via: https://fosspost.org/tutorials/install-android-8-1-oreo-on-linux 作者:[Python Programmer;Open Source Software Enthusiast. Worked On Developing A Lot Of Free Software. The Founder Of Foss Post;Foss Project. Computer Science Major.][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[robsean](https://github.com/robsean) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d8fd8662c3c0a363f44ccf10f34edb1fc7d5cb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Sun, 22 Dec 2019 09:24:53 +0800 Subject: [PATCH 213/676] Translating --- ...ow to Update Grub on Ubuntu and Other Linux Distributions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md b/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md index a969c37867..870ec17f6b 100644 --- a/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md +++ b/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2f1bd3e4930ba5f8704dbae50a399f5cd3c9f1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Sun, 22 Dec 2019 09:28:15 +0800 Subject: [PATCH 214/676] Translating --- ...to create an e-book chapter template in LibreOffice Writer.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md index 8c6a5c8072..0d8bfed9ce 100644 --- a/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md +++ b/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md @@ -1,3 +1,4 @@ +Translating by robsean How to create an e-book chapter template in LibreOffice Writer ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_colorbooks.png?itok=vNhsYYyC) From c27980860e02ca99ae0af14516efa27ffaa4601b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 22 Dec 2019 23:41:28 +0800 Subject: [PATCH 215/676] Rename sources/tech/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md to sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md --- ...elopment, a database of microbes, and more open source news.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md (100%) diff --git a/sources/tech/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md b/sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md similarity index 100% rename from sources/tech/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md rename to sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md From 2aa7619083b4faabc9a878a11cff8d58b959c8b4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 23 Dec 2019 00:52:40 +0800 Subject: [PATCH 216/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191222=20Create?= =?UTF-8?q?=20a=20unique=20Linux=20experience=20with=20the=20Unix=20Deskto?= =?UTF-8?q?p=20Environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191222 Create a unique Linux experience with the Unix Desktop Environment.md --- ...ience with the Unix Desktop Environment.md | 179 ++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 sources/tech/20191222 Create a unique Linux experience with the Unix Desktop Environment.md diff --git a/sources/tech/20191222 Create a unique Linux experience with the Unix Desktop Environment.md b/sources/tech/20191222 Create a unique Linux experience with the Unix Desktop Environment.md new file mode 100644 index 0000000000..bf82680c8b --- /dev/null +++ b/sources/tech/20191222 Create a unique Linux experience with the Unix Desktop Environment.md @@ -0,0 +1,179 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create a unique Linux experience with the Unix Desktop Environment) +[#]: via: (https://opensource.com/article/19/12/linux-unix-desktop-environment-ude) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Create a unique Linux experience with the Unix Desktop Environment +====== +This article is part of a special series of 24 days of Linux desktops. +If you're in the mood for something completely unique, then UDE is the +desktop you need to try. +![Penguins][1] + +When the UDE project started in 1996, the developers took on a bold name—[Unix Desktop Environment (UDE)][2]—and held high hopes of reinventing what a desktop could be. They weren't just trying to redefine Unix desktops; they were trying to change the way users interacted with applications on their system. Windows 95 had just come out, so the idea of managing a make-believe "desktop" filled with "folders" and "windows" meant to mimic a real-world desktop had not won all computer users' mindshare (it still hasn't, but it does at least seem to be a reliably stable option now). There was still room for experimentation in computer user interfaces (UIs), and the UDE project introduced some truly innovative ideas. + +One of UDE's most intriguing concepts is that its windows have no title bars or handles. All window control is performed with a hex menu that appears when a window border is clicked. Windows are moved with a middle-click and resized with a right-click. + +![Unix Desktop Environment][3] + +If you're in the mood for something completely unique, then UDE is the desktop you need to try. + +### Installing UDE + +Your distribution probably doesn't have UDE in its software repository, but it's relatively easy to compile for someone who's used to building software from raw source code. + +I installed UDE on Slackware 14.2, but it doesn't rely on any libraries other than standard Xlibs, so it should work on any Linux or BSD system. The compile process requires build tools, which ship by default on Slackware but are often omitted on other distributions to save space on the initial download. The names of the packages you must install to build from source code vary depending on your distro, so refer to the documentation for specifics. For example, on Debian-based distributions, you can learn about build requirements in [Debian's BuildingTutorial][4] doc, and on Fedora-based distributions, refer to [Fedora's Installing software from source][5] doc. Once you have the build tools installed, you can build UDE the standard [GNU Automake][6] way: + + +``` +$ ./configure +$ make -j2 +$ sudo make install +``` + +The default location for installation is **/usr/local**, but you can adjust the paths during the configuration step. + +### Xinitrc and UDE + +The easiest way to get up and running with UDE is to let Xorg do the bulk of the work. First, you must create a **$HOME/.xinitrc** file. I adapted this from scripts bundled in Slackware: + + +``` +#!/bin/sh +# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $ + +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +sysresources=/etc/X11/xinit/.Xresources +sysmodmap=/etc/X11/xinit/.Xmodmap + +# merge in defaults and keymaps + +if [ -f $sysresources ]; then +    xrdb -merge $sysresources +fi + +if [ -f $sysmodmap ]; then +    xmodmap $sysmodmap +fi + +if [ -f $userresources ]; then +    xrdb -merge $userresources +fi + +if [ -f $usermodmap ]; then +    xmodmap $usermodmap +fi + +# window manager +exec /usr/local/bin/uwm +``` + +According to this file, the default action for the **startx** command is to launch the **uwm** window manager (which houses UDE). However, your distribution may have other ideas about what happens when your graphic server is launched (or killed to be restarted), so this file may do you little good. On many distributions, you can add a **.desktop** file to **/usr/share/xsessions** to have it listed in the GDM or KDM menu, so create a file called **uwm.desktop** and enter this text: + + +``` +[Desktop Entry] +Name=UDE +Comment=UNIX Desktop Environment +Exec=/usr/local/bin/uwm +Type=Application +``` + +Log out from your desktop session and log back into UDE. By default, your session manager (KDM, GDM, or LightDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +With GDM: + +![][7] + +With SDDM: + +![][8] + +#### Launching with brute force + +If UDE fails to start, try installing XDM, a lightweight session manager that doesn't look at **/usr/share/xsessions** and instead just does whatever the authenticated user's **.xinitrc** prescribes. + +### Desktop tour + +When UDE first launches, you may find yourself staring at a black screen. That's the default primary desktop for UDE, and it's blank because no background wallpaper has been set. You can set one for yourself with the **feh** command (you may need to install it from your repository). This command has a few options for setting the background, including **\--bg-fill** to fill the screen with your wallpaper of choice, **\--bg-scale** to scale it to fit, and so on. + + +``` +`$ feh --bg-fill ~/Pictures/wallpapers/mybackground.jpg` +``` + +### Interacting with the desktop + +The next task is to launch an application. UDE provides an application menu, which you can bring up at your mouse pointer's position with a right-click on the desktop. Because you haven't customized the menu yet, your best bet is to launch an **xterm** window so that you can issue arbitrary commands. + +Once you have an xterm window open, you might notice that there's no window decoration. This is the central idea behind UDE: windows are manipulated primarily with a "honeycomb" or hex menu that appears when you left-click on the border of any window. + +![UDE honeycomb menu][9] + +Clockwise from the top hex, the options are: + + * Close + * Kill (confirm by selecting the pop-up hex that appears upon mouseover) + * Make sticky or send to a different desktop + * Maximize + * Send behind other windows + * Minimize + + + +Most of them are self-explanatory, but the minimize option can be confusing because there's no place for windows to be minimized _to_ because there's no taskbar, no docklet, and no desktop icons. To retrieve a minimized window, middle-click on the desktop. + +![UDE middle-click menu][10] + +This presents a menu of virtual desktops, one of which is your current desktop and therefore contains even your minimized applications. Select the minimized application to restore it to your screen. + +### Menus and configuration + +There are example and default config files in **/usr/local/share/uwm/config**, including one for the right-click application menu configuration. The syntax for the menu is simple and well-documented at the top of the file. This code sample changes the browser option from Netscape to Firefox: + + +``` +LINE; +% ITEM "Netscape":"netscape"; +ITEM "Firefox":"firefox"; +LINE; +``` + +To see your changes, restart UDE from the left-click menu. The **uwmrc** configuration files dictate the layout of UDE, including the size of window borders, fonts, and other stylistic choices. They are + +also well-documented in comments, so look through them and make changes to experiment and find what works best for you. + +### Old innovations, new again + +UDE's interface is strange and new and—if you're intrigued by UI design—very exciting. UDE's design exemplifies the advantages and disadvantages of creating standards in computing. On the one hand, something like UDE is so alien to most users that it's bound to get in the way, yet on the other hand, it's fresh and different and forces users to re-evaluate their workflows, which may result in several unexpected improvements. The reaction you probably have when trying UDE is the same one you're likely to see when you introduce a friend to Linux: What's an old, familiar GNOME or KDE desktop to you is a puzzle to them. But deep down, most of us know the potential benefits of changing the way we look at something we take for granted. + +That said, UDE is unquestionably an experiment, not a finished project. It probably isn't going to be your primary desktop, but it's well worth exploring. This is innovation. It's sometimes messy, sometimes slow, sometimes tumultuous. But it's important, bold, and a heck of a lot of fun. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-unix-desktop-environment-ude + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ (Penguins) +[2]: http://udeproject.sourceforge.net/ +[3]: https://opensource.com/sites/default/files/uploads/advent-ude.jpg (Unix Desktop Environment) +[4]: https://wiki.debian.org/BuildingTutorial +[5]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html +[6]: https://opensource.com/article/19/7/introduction-gnu-autotools +[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg +[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg +[9]: https://opensource.com/sites/default/files/uploads/advent-ude-hex.jpg (UDE honeycomb menu) +[10]: https://opensource.com/sites/default/files/uploads/advent-ude-middle.jpg (UDE middle-click menu) From 3f75faa782a35c7f7bb450a65b110e2619326081 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 23 Dec 2019 00:53:08 +0800 Subject: [PATCH 217/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191222=20Why=20?= =?UTF-8?q?your=20Python=20code=20needs=20to=20be=20beautiful=20and=20expl?= =?UTF-8?q?icit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md --- ...code needs to be beautiful and explicit.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md diff --git a/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md b/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md new file mode 100644 index 0000000000..00417f38ef --- /dev/null +++ b/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why your Python code needs to be beautiful and explicit) +[#]: via: (https://opensource.com/article/19/12/zen-python-beauty-clarity) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Why your Python code needs to be beautiful and explicit +====== +Welcome to Pythonukkah, a special series about the Zen of Python. On the +first day, we celebrate the first two principles: beauty and +explicitness. +![Searching for code][1] + +Python contributor Tim Peters introduced us to the [Zen of Python][2] in 1999. Twenty years later, its 19 guiding principles continue to be relevant within the community. We start our Pythonukkah celebration—like Hanukkah, a festival of lights—with the first two principles in the Zen of Python: on beauty and explicitness. + +> "Hanukkah is the Festival of Lights, +> Instead of one day of presents, we get eight crazy nights." +> —Adam Sandler, [_The Hanukkah Song_][3] + +### Beautiful is better than ugly. + +It was in _[Structure and Interpretation of Computer Programs][4]_ (_SICP_) that the point was made: "Programs must be written for people to read and only incidentally for machines to execute." Machines do not care about beauty, but people do. + +A beautiful program is one that is enjoyable to read. This means first that it is consistent. Tools like [Black][5], [flake8][6], and [Pylint][7] are great for making sure things are reasonable on a surface layer. + +But even more important, only humans can judge what humans find beautiful. Code reviews and a collaborative approach to writing code are the only realistic way to build beautiful code. Listening to other people is an important skill in software development. + +Finally, all the tools and processes are moot if the _will_ is not there. Without an appreciation for the importance of beauty, there will never be an emphasis on writing beautiful code. + +This is why this is the first principle: it is a way of making "beauty" a value in the Python community. It immediately answers: "Do we _really_ care about beauty?" We do. + +### Explicit is better than implicit. + +We humans celebrate light and fear the dark. Light helps us make sense of vague images. In the same way, programming with more explicitness helps us make sense of abstract ideas. It is often tempting to make things implicit. + +"Why is **self** explicitly there as the first parameter of methods?" + +There are many technical explanations, but all of them are wrong. It is almost a Python programmer's rite of passage to write a metaclass that makes explicitly listing **self** unnecessary. (If you have never done this before, do so; it makes a great metaclass learning exercise!) + +The reason **self** is explicit is not because the Python core developers did not want to make a metaclass like that the "default" metaclass. The reason it is explicit is because there is one less special case to teach: the first argument is _explicit_. + +Even when Python does allow non-explicit things, such as context variables, we must always ask: Are we sure we need them? Could we not just pass arguments explicitly? Sometimes, for many reasons, this is not feasible. But prioritizing explicitness means, at the least, asking the question and estimating the effort. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-beauty-clarity + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://www.python.org/dev/peps/pep-0020/ +[3]: https://en.wikipedia.org/wiki/The_Chanukah_Song +[4]: https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs +[5]: https://opensource.com/article/19/5/python-black +[6]: https://opensource.com/article/19/5/python-flake8 +[7]: https://opensource.com/article/19/10/python-pylint-introduction From a206cbd5b233c902089fb2fa8e2ebe0883545bc0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Dec 2019 06:24:44 +0800 Subject: [PATCH 218/676] PRF @Valoniakim --- ... to overcome cultural communication challenges.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/translated/talk/20181018 Think global- How to overcome cultural communication challenges.md b/translated/talk/20181018 Think global- How to overcome cultural communication challenges.md index 2e6ef612b5..5b214ec331 100644 --- a/translated/talk/20181018 Think global- How to overcome cultural communication challenges.md +++ b/translated/talk/20181018 Think global- How to overcome cultural communication challenges.md @@ -1,11 +1,13 @@ 全球化思考:怎样克服交流中的文化差异 ====== -这有一些建议帮助你的全球化开发团队能够更好地理解你们的讨论并能参与其中。 + +> 这有一些建议帮助你的全球化开发团队能够更好地理解你们的讨论并能参与其中。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/people_remote_teams_world.png?itok=_9DCHEel) 几周前,我见证了两位同事之间一次有趣的互动,他们分别是 Jason,我们的一位美国员工,和 Raj,一位来自印度的访问工作人员。 -Raj 在印度时,他一般会通过电话参加美国中部时间上午 9 点的每日立会,现在他到美国工作了,就可以和组员们坐在同一间会议室里开会了。Jason 拦下了 Raj,说:“ Raj 你要去哪?你不是一直和我们开电话会议吗?你突然出现在会议室里我还不太适应。” Raj 听了说,“是这样吗?没问题。”就回到自己工位前准备和以前一样参加电话会议了。 +Raj 在印度时,他一般会通过电话参加美国中部时间上午 9 点的每日立会,现在他到美国工作了,就可以和组员们坐在同一间会议室里开会了。Jason 拦下了 Raj,说:“Raj 你要去哪?你不是一直和我们开电话会议吗?你突然出现在会议室里我还不太适应。” Raj 听了说,“是这样吗?没问题。”就回到自己工位前准备和以前一样参加电话会议了。 我去找 Raj,问他为什么不去参加每日立会,Raj 说 Jason 让自己给组员们打电话参会,而与此同时,Jason 也在会议室等着 Raj 来参加立会。 @@ -19,7 +21,7 @@ Jason 明显是在开玩笑,但 Raj 把它当真了。这就是在两人互相 现在是全球化时代,我们的同事很可能不跟我们面对面接触,甚至不在同一座城市,来自不同的国家。越来越多的技术公司拥有全球化的工作场所,和来自世界各地的员工,他们有着不同的背景和经历。这种多样性使得技术公司能够在这个快速发展的科技大环境下拥有更强的竞争力。 -但是这种地域的多样性也会给团队带来挑战。管理和维持团高性能的团队发展对于同地协作的团队来说就有着很大难度,对于有着多样背景成员的全球化团队来说,无疑更加困难。成员之间的交流会发生延迟,误解时有发生,成员之间甚至会互相怀疑,这些都会影响着公司的成功。 +但是这种地域的多样性也会给团队带来挑战。管理和维持高性能的团队发展对于同地协作的团队来说就有着很大难度,对于有着多样背景成员的全球化团队来说,无疑更加困难。成员之间的交流会发生延迟,误解时有发生,成员之间甚至会互相怀疑,这些都会影响着公司的成功。 到底是什么因素让全球化交流间发生误解呢?我们可以参照 Erin Meyer 的书《[文化地图][2]》,她在书中将全球文化分为八个类型,其中美国文化被分为低语境文化,与之相对的,日本为高语境文化。 @@ -71,7 +73,7 @@ Jason 明显是在开玩笑,但 Raj 把它当真了。这就是在两人互相 保持长久关系最好的方法是和你的组员们单独见面。如果你的公司可以报销这些费用,那么努力去和组员们见面吧。和一起工作了很长时间的组员们见面能够使你们的关系更加坚固。我所在的公司就有着周期性交换员工的传统,每隔一段时间,世界各地的员工就会来到美国工作,美国员工再到其他分部工作。 -另一种聚齐组员们的机会的研讨会。研讨会创造的不仅是学习和培训的机会,你还可以挤出一些时间和组员们培养感情。 +另一种聚齐组员们的机会是研讨会。研讨会创造的不仅是学习和培训的机会,你还可以挤出一些时间和组员们培养感情。 在如今,全球化经济不断发展,拥有来自不同国家和地区的员工对维持一个公司的竞争力来说越来越重要。即使组员们来自世界各地,团队中会出现一些交流问题,但拥有一支国际化的高绩效团队不是问题。如果你在工作中有什么促进团队交流的小窍门,请在评论中告诉我们吧。 @@ -83,7 +85,7 @@ via: https://opensource.com/article/18/10/think-global-communication-challenges 作者:[Avindra Fernando][a] 选题:[lujun9972][b] 译者:[Valoniakim](https://github.com/Valoniakim) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e86057173a0c0ecd1944b2218c182ac9763f6172 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Dec 2019 06:25:17 +0800 Subject: [PATCH 219/676] PUB @Valoniakim https://linux.cn/article-11705-1.html --- ...k global- How to overcome cultural communication challenges.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20181018 Think global- How to overcome cultural communication challenges.md (100%) diff --git a/translated/talk/20181018 Think global- How to overcome cultural communication challenges.md b/published/20181018 Think global- How to overcome cultural communication challenges.md similarity index 100% rename from translated/talk/20181018 Think global- How to overcome cultural communication challenges.md rename to published/20181018 Think global- How to overcome cultural communication challenges.md From e8d5c030448e19454e928d6c518cf5b8417324f8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Dec 2019 07:07:35 +0800 Subject: [PATCH 220/676] PRF @geekpi --- ...rted with Lumina for your Linux desktop.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/translated/tech/20191214 Get started with Lumina for your Linux desktop.md b/translated/tech/20191214 Get started with Lumina for your Linux desktop.md index d1520e3b5c..f43acfac03 100644 --- a/translated/tech/20191214 Get started with Lumina for your Linux desktop.md +++ b/translated/tech/20191214 Get started with Lumina for your Linux desktop.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Lumina for your Linux desktop) @@ -9,12 +9,14 @@ 在 Linux 桌面中开始使用 Lumina ====== -本文是 24 天 Linux 桌面特别系列的一部分。Lumina 是快速、合理的基于 Fluxbox 的快捷方式桌面,它具有你无法缺少的所有功能。 -![Lightbulb][1] -多年来,有一个基于 FreeBSD 的桌面操作系统(OS),称为 PC-BSD。它旨在作为一般使用的系统,因此值得注意,因为 BSD 主要用于服务器。大多数时候,PC-BSD 默认带 KDE 桌面,但是 KDE 越来越依赖于 Linux 特定的技术,因此有越来越多的 PC-BSD 从中迁移出来。PC-BSD 变成了 [Trident][2],它的默认桌面是 [Lumina][3],它是一组小部件,它们使用与 KDE 相同的基于 Qt 的工具箱,运行在 Fluxbox 窗口管理器中。 +> 本文是 24 天 Linux 桌面特别系列的一部分。Lumina 桌面是让你使用快速、合理的基于 Fluxbox 桌面的捷径,它具有你无法缺少的所有功能。 -你可以在 Linux 发行版的软件仓库或 BSD 的 port 树中找到 Lumina 桌面。如果你安装了 Lumina 并且已经在运行另一个桌面,那么你可能会发现有冗余的应用(两个 PDF 阅读器、两个文件管理器,等等),因为 Lumina 包含一些集成的应用。如果你只想尝试 Lumina 桌面,那么可以在虚拟机如 [GNOME Boxes][4] 中安装基于 Lumina 的 BSD 发行版。 +![](https://img.linux.net.cn/data/attachment/album/201912/23/070658vtgg3wkrpg5g36rs.jpg) + +多年来,有一个名为 PC-BSD 的基于 FreeBSD 的桌面操作系统(OS)。它旨在作为一个常规使用的系统,因此值得注意,因为 BSD 主要用于服务器。大多数时候,PC-BSD 默认带 KDE 桌面,但是 KDE 越来越依赖于 Linux 特定的技术,因此 PC-BSD 越来越从 KDE 迁离。PC-BSD 变成了 [Trident][2],它的默认桌面是 [Lumina][3],它是一组小部件,它们使用与 KDE 相同的基于 Qt 的工具包,运行在 Fluxbox 窗口管理器上。 + +你可以在 Linux 发行版的软件仓库或 BSD 的 ports 树中找到 Lumina 桌面。如果你安装了 Lumina 并且已经在运行另一个桌面,那么你可能会发现有冗余的应用(两个 PDF 阅读器、两个文件管理器,等等),因为 Lumina 包含一些集成的应用。如果你只想尝试 Lumina 桌面,那么可以在虚拟机如 [GNOME Boxes][4] 中安装基于 Lumina 的 BSD 发行版。 如果在当前的操作系统上安装 Lumina,那么必须注销当前的桌面会话,才能登录到新的会话。默认情况下,会话管理器(SDDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 @@ -34,13 +36,13 @@ Lumina 提供了一个简单而轻巧的桌面环境。屏幕底部有一个面 ![Lumina desktop running on Project Trident][7] -Lumina 与几个 Linux 轻量级桌面非常相似,尤其是 LXQT,不同之处在于 Lumina 完全不依赖于基于 Linux 的桌面框架,例如 ConsoleKit、PolicyKit、D-Bus 或 systemd。对于你而言,这是否具有优势取决于所运行的操作系统。毕竟,如果你运行的是可以访问这些功能的 Linux,那么使用不使用这些特性的桌面可能就没有多大意义,还会减少功能。如果你运行的是 BSD,那么在 Fluxbox 中运行 Lumina 部件意味着你不必从 port 安装 Linux 兼容库。 +Lumina 与几个 Linux 轻量级桌面非常相似,尤其是 LXQT,不同之处在于 Lumina 完全不依赖于基于 Linux 的桌面框架(例如 ConsoleKit、PolicyKit、D-Bus 或 systemd)。对于你而言,这是否具有优势取决于所运行的操作系统。毕竟,如果你运行的是可以访问这些功能的 Linux,那么使用不使用这些特性的桌面可能就没有多大意义,还会减少功能。如果你运行的是 BSD,那么在 Fluxbox 中运行 Lumina 部件意味着你不必从 ports 安装 Linux 兼容库。 ### 为什么要使用 Lumina -Lumina 设计简单,没有很多功能,你无法通过安装 Fluxbox 以及自己喜欢的组件来实现([PCManFM][8] 用于文件管理、各种 [LXQt 应用][9 ]、[Tint2][10] 面板等)。但它是开源的,开源用户喜欢寻找避免重复发明轮子的方法(几乎与我们喜欢重新发明轮子一样多)。 +Lumina 设计简单,它没有很多功能,但是你可以安装 Fluxbox 你喜欢的组件(用于文件管理的 [PCManFM][8]、各种 [LXQt 应用][9]、[Tint2][10] 面板等)。在开源中,开源用户喜欢寻找不要重复发明轮子的方法(几乎与我们喜欢重新发明轮子一样多)。 -Lumina 桌面是快速而合理的基于 Fluxbox 的桌面快捷方式,它具有你无法缺少的所有功能,并且你很少需要调整细节。试一试 Lumina 桌面,看看它是否适合你。 +Lumina 桌面是让你使用快速、合理的基于 Fluxbox 桌面的捷径,它具有你无法缺少的所有功能,并且你很少需要调整细节。试一试 Lumina 桌面,看看它是否适合你。 -------------------------------------------------------------------------------- @@ -49,7 +51,7 @@ via: https://opensource.com/article/19/12/linux-lumina-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1c58ef8e95498ab5b3c0c5cde4dce724ceb610f4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Dec 2019 07:09:09 +0800 Subject: [PATCH 221/676] PUB @geekpi https://linux.cn/article-11706-1.html --- ...20191214 Get started with Lumina for your Linux desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191214 Get started with Lumina for your Linux desktop.md (98%) diff --git a/translated/tech/20191214 Get started with Lumina for your Linux desktop.md b/published/20191214 Get started with Lumina for your Linux desktop.md similarity index 98% rename from translated/tech/20191214 Get started with Lumina for your Linux desktop.md rename to published/20191214 Get started with Lumina for your Linux desktop.md index f43acfac03..213e4eff5b 100644 --- a/translated/tech/20191214 Get started with Lumina for your Linux desktop.md +++ b/published/20191214 Get started with Lumina for your Linux desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11706-1.html) [#]: subject: (Get started with Lumina for your Linux desktop) [#]: via: (https://opensource.com/article/19/12/linux-lumina-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From e9ce568296f6a1b430e2c137ee092baeb919f807 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 23 Dec 2019 08:55:00 +0800 Subject: [PATCH 222/676] translated --- ... Customize your Linux desktop with FVWM.md | 78 ------------------- ... Customize your Linux desktop with FVWM.md | 75 ++++++++++++++++++ 2 files changed, 75 insertions(+), 78 deletions(-) delete mode 100644 sources/tech/20191210 Customize your Linux desktop with FVWM.md create mode 100644 translated/tech/20191210 Customize your Linux desktop with FVWM.md diff --git a/sources/tech/20191210 Customize your Linux desktop with FVWM.md b/sources/tech/20191210 Customize your Linux desktop with FVWM.md deleted file mode 100644 index f238fdc121..0000000000 --- a/sources/tech/20191210 Customize your Linux desktop with FVWM.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Customize your Linux desktop with FVWM) -[#]: via: (https://opensource.com/article/19/12/fvwm-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Customize your Linux desktop with FVWM -====== -This article is part of a special series of 24 days of Linux desktops. -If you're looking for a lightweight, fast, and simple Linux window -manager, FVWM qualifies. But if you're looking for something to dig -into, explore, and hack, then FVWM is a must. -![Coding on a computer][1] - -The [FVWM][2] window manager started out as modifications to [TWM][3], back in 1993. After several years of iteration, what emerged is an extremely customizable environment where any behavior, action, or event is configurable. It has support for custom key bindings, mouse gestures, theming, scripting, and much more. - -While FVWM is usable immediately after installation, its default distribution provides only the absolute minimum configuration. It's a great foundation to start your own custom desktop environment, but if you just want to use it as a desktop, then you probably want to install a full configuration distributed by another user. There are a few different distributions of FVWM, including FVWM95, which mimics Windows 95 (at least in appearance and layout). I tried [FVWM-Crystal][4], a modern-looking theme with some common Linux desktop conventions. - -Install the FVWM distribution you want to try from your Linux distribution's software repository. If you can't find a specific FVWM distribution, it's safe to install the base FVWM2 package and then go to [Box-Look.org][5] to download a theme package manually. It's a little more work that way, but not nearly as much as building your own workspace from scratch. - -After installing, log out of your current desktop session so you can log into FVWM. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -To do so with GDM: - -![Select your desktop session in GDM][6] - -And with KDM: - -![Select your desktop session with KDM][7] - -### FVWM desktop - -Regardless of what theme and configuration you're using, FVWM, at minimum, provides a menu when you left-click on the desktop. The contents of this menu vary depending on what you've installed. The menu in the FVWM-Crystal distribution contains quick access to common preferences, such as screen resolution, wallpaper settings, window decorations, and so on. - -As with pretty much everything in FVWM, the menu can be edited to include whatever you want, but FVWM-Crystal favors the application menu bar. The application menu is located at the top-left of the screen, and each icon contains a menu of related application launchers. For example, the GIMP icon reveals image editors, the KDevelop icon reveals integrated development environments (IDEs), the GNU icon reveals text editors, and so on, depending on what you have installed on your system. - -![FVWM-crystal running on Slackware 14.2][8] - -FVWM-Crystal also provides virtual desktops, a taskbar, a clock, and an application bar. - -For your background, you can use the wallpapers bundled with FVWM-Crystal or set your own with the **feh** command (you may need to install it from your repository). This command has a few options for setting the background, including **\--bg-scale** to fill the screen with a scaled version of your wallpaper of choice, **\--bg-fill** to fill the screen without adjusting the size of the image, and so on. - - -``` -`$ feh --bg-scale ~/Pictures/wallpapers/mybackground.jpg` -``` - -Most configuration files are contained in **$HOME/.fvwm-crystal**, with some systemwide defaults located in **/usr/share/fvwm-crystal**. - -### Do it yourself - -FVWM is as much a desktop-building platform as it is a window manager. It doesn't do anything for you, and it expects you to configure anything—and possibly everything. -If you're looking for a lightweight, fast, and simple window manager, FVWM qualifies. But if you're looking for something to dig into, explore, and hack, then FVWM is a must. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/fvwm-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) -[2]: http://www.fvwm.org/ -[3]: https://en.wikipedia.org/wiki/Twm -[4]: https://www.box-look.org/p/1018270/ -[5]: http://box-look.org -[6]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) -[7]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) -[8]: https://opensource.com/sites/default/files/advent-fvwm-crystal.jpg (FVWM-crystal running on Slackware 14.2) diff --git a/translated/tech/20191210 Customize your Linux desktop with FVWM.md b/translated/tech/20191210 Customize your Linux desktop with FVWM.md new file mode 100644 index 0000000000..90d2fa7604 --- /dev/null +++ b/translated/tech/20191210 Customize your Linux desktop with FVWM.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Customize your Linux desktop with FVWM) +[#]: via: (https://opensource.com/article/19/12/fvwm-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 FVWM 自定义 Linux 桌面 +====== +本文是 24 天 Linux 桌面特别系列的一部分。如果你正在寻找轻巧,快速且简单的 Linux 窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入,探索和破解,那么 FVWM 是必须的。 +![Coding on a computer][1] + +[FVWM][2] 窗口管理器最早是对早在 1993 年的 [TWM][3] 的修改。经过几年的迭代,出现了一个可高度自定义的环境,它可以配置任何行为、动作或事件。它支持自定义键绑定、鼠标手势、主题、脚本等。 + +尽管 FVWM 在安装后即可使用,但默认发行版仅提供最小的配置。这是开始自定义桌面环境的良好基础,但是,如果你只想将其用作桌面,那么可能要安装另一个用户发布的完整配置。FVWM 有几种不同的发行版,包括模仿 Windows 95 的 FVWM95(至少在外观和布局上)。我尝试了 [FVWM-Crystal][4],这是一个具有一些现代 Linux 桌面约定的现代主题。 + +从 Linux 发行版的软件仓库中安装要尝试的 FVWM 发行版。如果找不到特定的 FVWM 发行版,那么可以安装基础的 FVWM2 包,然后进入 [Box-Look.org][5] 手动下载主题包。这样就需要更多的工作,但比从头开始构建要少。 + +安装后,请注销当前的桌面会话,以便你可以登录 FVWM。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 + +对于 GDM: + +![Select your desktop session in GDM][6] + +对于 KDM: + +![Select your desktop session with KDM][7] + +### FVWM 桌面 + +无论你使用什么主题和配置,当你在桌面上单击鼠标左键时,FVWM 至少会显示一个菜单。菜单的内容取决于你所安装的。FVWM-Crystal 分发中的菜单包含对常用首选项的快速访问,例如屏幕分辨率、壁纸设置、窗口装饰等。 + +与 FVWM 中的几乎所有东西一样,你可以在菜单中编辑你要想的内容,但 FVWM-Crystal 倾向应用菜单栏。应用菜单位于屏幕的左上角,每个图标都包含相关应用启动器的菜单。例如,GIMP 图标表示图像编辑器,KDevelop 图标表示集成开发环境(IDE),GNU 图标表示文本编辑器,等等,具体取决于你在系统上安装的程序。 + +![FVWM-crystal running on Slackware 14.2][8] + +FVWM-Crystal 还提供虚拟桌面、任务栏、时钟和应用栏。 + +关于背景,你可以使用与 FVWM-Crystal 捆绑在一起的壁纸,也可以使用 **feh** 命令设置自己的壁纸(你可能需要从仓库中安装它)。此命令有一些设置背景的选项,包括 **\-bg-scale** 使用缩放填充屏幕,**\-bg-fill** 直接填充而不缩放图片,等等。 + + +``` +`$ feh --bg-scale ~/Pictures/wallpapers/mybackground.jpg` +``` + +大多数配置文件都包含在 **$HOME/.fvwm-crystal** 中,某些系统范围的默认文件位于 **/usr/share/fvwm-crystal**。 + +### 自己尝试一下 + +FVWM 是桌面构建平台,也是窗口管理器。它不会为你做什么事情,它期望你来配置尽可能的一切。 +如果你正在寻找轻巧,快速且简单的窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入,探索和破解,那么 FVWM 是必须的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/fvwm-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: http://www.fvwm.org/ +[3]: https://en.wikipedia.org/wiki/Twm +[4]: https://www.box-look.org/p/1018270/ +[5]: http://box-look.org +[6]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) +[7]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) +[8]: https://opensource.com/sites/default/files/advent-fvwm-crystal.jpg (FVWM-crystal running on Slackware 14.2) From 8f0ad60a4842ff8d38642eafe24e0c110b8f862b Mon Sep 17 00:00:00 2001 From: runningwater Date: Mon, 23 Dec 2019 09:08:16 +0800 Subject: [PATCH 223/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20191007 Using the Java Persistence API.md | 273 ------------------ ...20191007 Using the Java Persistence API.md | 272 +++++++++++++++++ 2 files changed, 272 insertions(+), 273 deletions(-) delete mode 100644 sources/tech/20191007 Using the Java Persistence API.md create mode 100644 translated/tech/20191007 Using the Java Persistence API.md diff --git a/sources/tech/20191007 Using the Java Persistence API.md b/sources/tech/20191007 Using the Java Persistence API.md deleted file mode 100644 index 6b16213fc1..0000000000 --- a/sources/tech/20191007 Using the Java Persistence API.md +++ /dev/null @@ -1,273 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (runningwater) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using the Java Persistence API) -[#]: via: (https://opensource.com/article/19/10/using-java-persistence-api) -[#]: author: (Stephon Brown https://opensource.com/users/stephb) - -Using the Java Persistence API -====== -Learn how to use the JPA by building an example app for a bike store. -![Coffee beans][1] - -The Java Persistence API (JPA) is an important Java functionality for application developers to understand. It translates exactly how Java developers turn method calls on objects into accessing, persisting, and managing data stored in NoSQL and relational databases. - -This article examines the JPA in detail through a tutorial example of building a bicycle loaning service. This example will create a create, read, update, and delete (CRUD) layer for a larger application using the Spring Boot framework, the MongoDB database (which is [no longer open source][2]), and the Maven package manager. I also use NetBeans 11 as my IDE of choice. - -This tutorial focuses on the open source angle of the Java Persistence API, rather than the tools, to show how it works. This is all about learning the pattern of programming applications, but it's still smart to understand the software. You can access the full code in my [GitHub repository][3]. - -### Java: More than 'beans' - -Java is an object-oriented language that has gone through many changes since the Java Development Kit (JDK) was released in 1996. Understanding the language's various pathways and its virtual machine is a history lesson in itself; in brief, the language has forked in many directions, similar to the Linux kernel, since its release. There are standard editions that are free to the community, enterprise editions for business, and an open source alternatives contributed to by multiple vendors. Major versions are released at six-month intervals; since there are often major differences in features, you may want to do some research before choosing a version. - -All and all, Java is steeped in history. This tutorial focuses on [JDK 11][4], which is the open source implementation of Java 11, because it is one of the long-term-support versions that is still active. - - * **Spring Boot: **Spring Boot is a module from the larger Spring framework developed by Pivotal. Spring is a very popular framework for working with Java. It allows for a variety of architectures and configurations. Spring also offers support for web applications and security. Spring Boot offers basic configurations for bootstrapping various types of Java projects quickly. This tutorial uses Spring Boot to quickly write a console application and test functionality against the database. - * **Maven:** Maven is a project/package manager developed by Apache. Maven allows for the management of packages and various dependencies within its POM.xml file. If you have used NPM, you may be familiar with how package managers function. Maven also manages build and reporting functionality. - * **Lombok:** Lombok is a library that allows the creation of object getters/setters through annotation within the object file. This is already present in languages like C#, and Lombok introduces this functionality into Java. - * **NetBeans: **NetBeans is a popular open source IDE that focuses specifically on Java development. Many of its tools provide an implementation for the latest Java SE and EE updates. - - - -This group of tools will be used to create a simple application for a fictional bike store. It will implement functionality for inserting collections for "Customer" and "Bike" objects. - -### Brewed to perfection - -Navigate to the [Spring Initializr][5]. This website enables you to generate basic project needs for Spring Boot and the dependencies you will need for the project. Select the following options: - - 1. **Project:** Maven Project - 2. **Language:** Java - 3. **Spring Boot:** 2.1.8 (or the most stable release) - 4. **Project Metadata:** Whatever your naming conventions are (e.g., **com.stephb**) - * You can keep Artifact as "Demo" - 5. **Dependencies:** Add: - * Spring Data MongoDB - * Lombok - - - -Click **Download** and open the new project in your chosen IDE (e.g., NetBeans). - -#### Model outline - -The models represent information collected about specific objects in the program that will be persisted in your database. Focus on two objects: **Customer** and **Bike**. First, create a **dto** folder within the **src** folder. Then, create the two Java class objects named **Customer.java** and **Bike.java**. They will be structured in the program as follows: - -**Customer. Java** - - -``` - 1 package com.stephb.JavaMongo.dto; - 2  - 3 import lombok.Getter; - 4 import lombok.Setter; - 5 import org.springframework.data.annotation.Id; - 6  - 7 /** - 8  * - 9  * @author stephon -10  */ -11 @Getter @Setter -12 public class Customer { -13  -14         private @Id [String][6] id; -15         private [String][6] emailAddress; -16         private [String][6] firstName; -17         private [String][6] lastName; -18         private [String][6] address; -19          -20 } -``` - -**Bike.java** - - -``` - 1 package com.stephb.JavaMongo.dto; - 2  - 3 import lombok.Getter; - 4 import lombok.Setter; - 5 import org.springframework.data.annotation.Id; - 6  - 7 /** - 8  * - 9  * @author stephon -10  */ -11 @Getter @Setter -12 public class Bike { -13         private @Id [String][6] id; -14         private [String][6] modelNumber; -15         private [String][6] color; -16         private [String][6] description; -17  -18         @Override -19         public [String][6] toString() { -20                 return "This bike model is " + this.modelNumber + " is the color " + this.color + " and is " + description; -21         } -22 } -``` - -As you can see, Lombok annotation is used within the object to generate the getters/setters for the properties/attributes. Properties can specifically receive the annotations if you do not want all of the attributes to have getters/setters within that class. These two classes will form the container carrying your data to wherever you want to display information. - -#### Set up a database - -I used a [Mongo Docker][7] container for testing. If you have MongoDB installed on your system, you do not have to run an instance in Docker. You can install MongoDB from its website by selecting your system information and following the installation instructions. - -After installing, you can interact with your new MongoDB server through the command line, a GUI such as MongoDB Compass, or IDE drivers for connecting to data sources. Now you can define your data layer to pull, transform, and persist your data. To set your database access properties, navigate to the **applications.properties** file in your application and provide the following: - - -``` - 1 spring.data.mongodb.host=localhost - 2 spring.data.mongodb.port=27017 - 3 spring.data.mongodb.database=BikeStore -``` - -#### Define the data access object/data access layer - -The data access objects (DAO) in the data access layer (DAL) will define how you will interact with data in the database. The awesome thing about using a **spring-boot-starter** is that most of the work for querying the database is already done. - -Start with the **Customer** DAO. Create an interface in a new **dao** folder within the **src** folder, then create another Java class name called **CustomerRepository.java**. The class should look like: - - -``` - 1 package com.stephb.JavaMongo.dao; - 2  - 3 import com.stephb.JavaMongo.dto.Customer; - 4 import java.util.List; - 5 import org.springframework.data.mongodb.repository.MongoRepository; - 6  - 7 /** - 8  * - 9  * @author stephon -10  */ -11 public interface CustomerRepository extends MongoRepository<Customer, String>{ -12         @Override -13         public List<Customer> findAll(); -14         public List<Customer> findByFirstName([String][6] firstName); -15         public List<Customer> findByLastName([String][6] lastName); -16 } -``` - -This class is an interface that extends or inherits from the **MongoRepository** class with your DTO (**Customer.java**) and a string because they will be used for querying with your custom functions. Because you have inherited from this class, you have access to many functions that allow persistence and querying of your object without having to implement or reference your own functions. For example, after you instantiate the **CustomerRepository** object, you can use the **Save** function immediately. You can also override these functions if you need more extended functionality. I created a few custom queries to search my collection, given specific elements of my object. - -The **Bike** object also has a repository for interacting with the database. Implement it very similarly to the **CustomerRepository**. It should look like: - - -``` - 1 package com.stephb.JavaMongo.dao; - 2  - 3 import com.stephb.JavaMongo.dto.Bike; - 4 import java.util.List; - 5 import org.springframework.data.mongodb.repository.MongoRepository; - 6  - 7 /** - 8  * - 9  * @author stephon -10  */ -11 public interface BikeRepository extends MongoRepository<Bike,String>{ -12         public Bike findByModelNumber([String][6] modelNumber); -13         @Override -14         public List<Bike> findAll(); -15         public List<Bike> findByColor([String][6] color); -16 } -``` - -#### Run your program - -Now that you have a way to structure your data and a way to pull, transform, and persist it, run your program! - -Navigate to your **Application.java** file (it may have a different name, depending on what you named your application, but it should include "application"). Where the class is defined, include an **implements CommandLineRunner** afterward. This will allow you to implement a **run** method to create a command-line application. Override the **run** method provided by the **CommandLineRunner** interface and include the following to test the **BikeRepository**: - - -``` - 1 package com.stephb.JavaMongo; - 2  - 3 import com.stephb.JavaMongo.dao.BikeRepository; - 4 import com.stephb.JavaMongo.dao.CustomerRepository; - 5 import com.stephb.JavaMongo.dto.Bike; - 6 import java.util.Scanner; - 7 import org.springframework.beans.factory.annotation.Autowired; - 8 import org.springframework.boot.CommandLineRunner; - 9 import org.springframework.boot.SpringApplication; -10 import org.springframework.boot.autoconfigure.SpringBootApplication; -11  -12  -13 @SpringBootApplication -14 public class JavaMongoApplication implements CommandLineRunner { -15                 @Autowired -16                 private BikeRepository bikeRepo; -17                 private CustomerRepository custRepo; -18                  -19     public static void main([String][6][] args) { -20                         SpringApplication.run(JavaMongoApplication.class, args); -21     } -22         @Override -23         public void run([String][6]... args) throws [Exception][8] { -24                 Scanner scan = new Scanner([System][9].in); -25                 [String][6] response = ""; -26                 boolean running = true; -27                 while(running){ -28                         [System][9].out.println("What would you like to create? \n C: The Customer \n B: Bike? \n X:Close"); -29                         response = scan.nextLine(); -30                         if ("B".equals(response.toUpperCase())) { -31                                 [String][6][] bikeInformation = new [String][6][3]; -32                                 [System][9].out.println("Enter the information for the Bike"); -33                                 [System][9].out.println("Model Number"); -34                                 bikeInformation[0] = scan.nextLine(); -35                                 [System][9].out.println("Color"); -36                                 bikeInformation[1] = scan.nextLine(); -37                                 [System][9].out.println("Description"); -38                                 bikeInformation[2] = scan.nextLine(); -39  -40                                 Bike bike = new Bike(); -41                                 bike.setModelNumber(bikeInformation[0]); -42                                 bike.setColor(bikeInformation[1]); -43                                 bike.setDescription(bikeInformation[2]); -44  -45                                 bike = bikeRepo.save(bike); -46                                 [System][9].out.println(bike.toString()); -47  -48  -49                         } else if ("X".equals(response.toUpperCase())) { -50                                 [System][9].out.println("Bye"); -51                                 running = false; -52                         } else { -53                                 [System][9].out.println("Sorry nothing else works right now!"); -54                         } -55                 } -56                  -57         } -58 } -``` - -The **@Autowired** annotation allows automatic dependency injection of the **BikeRepository** and **CustomerRepository** beans. You will use these classes to persist and gather data from the database. - -There you have it! You have created a command-line application that connects to a database and is able to perform CRUD operations with minimal code on your part. - -### Conclusion - -Translating from programming language concepts like objects and classes into calls to store, retrieve, or change data in a database is essential to building an application. The Java Persistence API (JPA) is an important tool in the Java developer's toolkit to solve that challenge. What databases are you exploring in Java? Please share in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/using-java-persistence-api - -作者:[Stephon Brown][a] -选题:[lujun9972][b] -译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/stephb -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) -[2]: https://www.techrepublic.com/article/mongodb-ceo-tells-hard-truths-about-commercial-open-source/ -[3]: https://github.com/StephonBrown/SpringMongoJava -[4]: https://openjdk.java.net/projects/jdk/11/ -[5]: https://start.spring.io/ -[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string -[7]: https://hub.docker.com/_/mongo -[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+exception -[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system diff --git a/translated/tech/20191007 Using the Java Persistence API.md b/translated/tech/20191007 Using the Java Persistence API.md new file mode 100644 index 0000000000..6c44f50290 --- /dev/null +++ b/translated/tech/20191007 Using the Java Persistence API.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: (runningwater) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using the Java Persistence API) +[#]: via: (https://opensource.com/article/19/10/using-java-persistence-api) +[#]: author: (Stephon Brown https://opensource.com/users/stephb) + +使用 Java 持久化 API +====== +我们通过为自行车商店构建示例应用程序来学习如何使用 JPA。 +![Coffee beans][1] + +对应用开发者来说,Java 持久化 API (JPA)是一项重要的技能,需要透彻理解。它为 Java 开发人员定义了如何将对象的方法调用转换为访问、持久化及管理 NoSQL 和关系型数据库数据存储的问题的方案。 + +本文通过构建自行车借贷服务的教程示例来详细研究 JPA。此示例会使用 Spring Boot 框架、MongoDB 数据库([已经不开源][2])和 Maven 包管理来构建一个大型应用程序,并且创建一个创建、读取、更新和删除(CRUD) 层。这儿我选择 NetBeans 11 作为我的 IDE。 + +此教程仅从开源的角度来介绍 Java 持久化的工作原理,不涉及其作为工具的使用说明。这全是关于编写应用程序模式的学习,但对于理解具体的软件实现也很益处。可以从我的[ GitHub 源仓库][3] 来获取相关代码。 + +### Java: 不仅仅是 'beans' + +Java 是一门面向对象的编程语言,自 1996 年发布第一版 Java 开发工具(JDK)起,已经变化了很多很多。要了解其特性和其虚拟机本身就是个很长的历史。简而言之,和 Linux 内核很相似,自发布以来,该语言已经向多个方向分支发展。有对社区免费的标准版本、有针对企业的企业版本及由多家供应商提供的开源替代品。主要版本每六个月发布一次,其功能往往差异很大,所以确认选用版本前得先做些研究。 + +总而言之,Java 的历史很悠久。本教程重点介绍 Java 11 的开源实现 [JDK 11][4]。因其是扔然有效的长期支持版本之一。 + + * **Spring Boot: ** Spring Boot 是由 Pivotal 公司开发大型 Spring 框架的一个模块。Spring 是 Java 开发中一个非常流行的框架。它支持各种框架和配置,也支持 WEB 应用程序及提供了应用安全保障功能。Spring Boot 为快速启动项目集成了基本的配置。本教程使用 Spring Boot 来快速编写控制台应用程序并针对数据库编写测试用例。 + * **Maven:** Maven 是由 Apache 开发的项目/包管理工具。Maven 通过 `POM.xml` 文件来管理包及其依赖项。如果你们使用过 NPM 的话,可能会非常熟悉包管理器的功能。此外 Maven 也用来进行项目构建及生成功能报告。 + * **Lombok:** Lombok 是一个库,它通过在对象文件里面添加注解来自动创建 getters/setters 方法。像 C# 这些语言已经实现了此功能,Lombok 只是把此功能引入 Java 语言而已。 + * **NetBeans: ** NetBeans 是一款很流行的开源 IDE,专门用于 Java 开发。它的许多工具都随着 Java SE 和 EE 的版本更新而更新。 + + + +我们会这组工具来创建一个简单的虚构自行车商店应用程序。会实现对 "Customer" 和 "Bike" 对象集合的的插入操作。 + +### 酿造完美 + +导航到 [Spring Initializr][5] 页面。该网站可以生成基于 Spring Boot 和其依赖项的基本项目。选择以下选项: + + 1. **项目:** Maven 工程 + 2. **语言:** Java + 3. **Spring Boot:** 2.1.8 (或最稳定版本) + 4. **项目元数据:** 无论你使用什么名字,其命名约定都是像 **com.stephb** 这样的。 + * 你可以保留 Artifact 名字为 “Demo”。 + 5. **依赖项:** 添加: + * Spring Data MongoDB + * Lombok + + + +点击 **下载**,然后用你的 IDE(例如 NetBeans) 打开此新项目。 + +#### 模型层(Model)概要 + +项目里面,模型代表从数据库里取出的信息的具体对象。我们关注两个对象:**Customer** 和 **Bike**。首先,在 **src** 目录创建 **dto** 目录;然后,创建两个名为 **Customer.java** 和 **Bike.java** 的 Java 类对象文件。其结构如下示: + +**Customer.Java** + + +``` + 1 package com.stephb.JavaMongo.dto; + 2  + 3 import lombok.Getter; + 4 import lombok.Setter; + 5 import org.springframework.data.annotation.Id; + 6  + 7 /** + 8  * + 9  * @author stephon +10  */ +11 @Getter @Setter +12 public class Customer { +13  +14         private @Id String id; +15         private String emailAddress; +16         private String firstName; +17         private String lastName; +18         private String address; +19          +20 } +``` + +**Bike.java** + + +```Java + 1 package com.stephb.JavaMongo.dto; + 2  + 3 import lombok.Getter; + 4 import lombok.Setter; + 5 import org.springframework.data.annotation.Id; + 6  + 7 /** + 8  * + 9  * @author stephon +10  */ +11 @Getter @Setter +12 public class Bike { +13         private @Id String id; +14         private String modelNumber; +15         private String color; +16         private String description; +17  +18         @Override +19         public String toString() { +20                 return "This bike model is " + this.modelNumber + " is the color " + this.color + " and is " + description; +21         } +22 } +``` + +如你所见,对象中使用 Lombok 注解来为定义的属性(特性)生成 getters/setters 方法。如果你不想对所有属于都生成 getters/setters 方法,可以在属性上定义这些注解。这两个类会变成容器,里面携带有数据,无论在何处想显示信息都可以使用。 + +#### 配置数据库 + +我使用 [Mongo Docker][7] 容器来进行此次测试。如果你的系统上已经安装了 MongoDB,则不必运行 Docker 实例。你也可以登陆其官网,然后按照安装说明,选择系统信息来安装 MongoDB。 + +安装后,就可以使用命令行、GUI(例如 MongoDB Compass)或用于连接数据源的 IDE 驱动程序来与新的 MongoDB 服务进行交互。到目前为止,可以开始定义数据层了,用来拉取、转换和持久化数据。需要设置数据库访问属性,请导航到程序中的 **applications.properties** 文件,然后添加如下内容: + + +``` + 1 spring.data.mongodb.host=localhost + 2 spring.data.mongodb.port=27017 + 3 spring.data.mongodb.database=BikeStore +``` + +#### 定义数据访问对象(数据)层 + +数据访问层(DAL)中的数据访问对象(DAO)定义了与数据库中的数据的交互过程。令人惊叹的就是在使用 **spring-boot-starter** 后,查询数据库的大部分工作已经完成。 + +让我们从 **Customer** DAO 开始。在 **src** 下的新目录 **dao** 中创建一个接口文件,然后再创建一个名为 **CustomerRepository.java** 的 Java 类文件,其内容如下示: + + +``` + 1 package com.stephb.JavaMongo.dao; + 2  + 3 import com.stephb.JavaMongo.dto.Customer; + 4 import java.util.List; + 5 import org.springframework.data.mongodb.repository.MongoRepository; + 6  + 7 /** + 8  * + 9  * @author stephon +10  */ +11 public interface CustomerRepository extends MongoRepository{ +12         @Override +13         public ListStringCustomer> findAll(); +14         public List findByFirstName(String firstName); +15         public List findByLastName(String lastName); +16 } +``` + +这个类是一个接口,扩展或继承于 **MongoRepository** 类,而 MongoRepository 类依赖于 DTO (**Customer.java**)和一个字符串,它们用来实现自定义函数查询功能。因为您已继承自此类,所以您可以访问许多方法函数,这些函数允许持久化和查询对象,而无需实现或引用自己定义的方法函数。例如,在实例化 **CustomerRepository** 对象后,你就可以直接使用 **Save** 功能。如果你需要扩展更多的功能,也可以重写这些方法。我创建了一些自定义查询来搜索我的集合,这些集合对象是我自定义的元素。 + +**Bike** 对象也有一个存储源负责与数据库交互。与 **CustomerRepository** 的实现非常类似。其实现如下所示: + +``` + 1 package com.stephb.JavaMongo.dao; + 2  + 3 import com.stephb.JavaMongo.dto.Bike; + 4 import java.util.List; + 5 import org.springframework.data.mongodb.repository.MongoRepository; + 6  + 7 /** + 8  * + 9  * @author stephon +10  */ +11 public interface BikeRepository extends MongoRepository{ +12         public Bike findByModelNumber(String modelNumber); +13         @Override +14         public List findAll(); +15         public List findByColor(String color); +16 } +``` + +#### 运行程序 + +现在,你已经有了一种结构化数据的方式,可以对数据进行提取、转换和持久化,然后运行这个程序。 + +找到 **Application.java** 文件(有可能不是此名称,具体取决于你的应用程序名称,但都会包含有 “application” )。在定义此类的地方,在后面加上 **CommandLineRunner 的实现**。这将允许你实现 **run** 方法来创建命令行应用程序。重写 **CommandLineRunner** 接口提供的 **run** 方法,并包含如下内容用来测试 **BikeRepository** : + + +``` + 1 package com.stephb.JavaMongo; + 2  + 3 import com.stephb.JavaMongo.dao.BikeRepository; + 4 import com.stephb.JavaMongo.dao.CustomerRepository; + 5 import com.stephb.JavaMongo.dto.Bike; + 6 import java.util.Scanner; + 7 import org.springframework.beans.factory.annotation.Autowired; + 8 import org.springframework.boot.CommandLineRunner; + 9 import org.springframework.boot.SpringApplication; +10 import org.springframework.boot.autoconfigure.SpringBootApplication; +11  +12  +13 @SpringBootApplication +14 public class JavaMongoApplication implements CommandLineRunner { +15                 @Autowired +16                 private BikeRepository bikeRepo; +17                 private CustomerRepository custRepo; +18                  +19     public static void main(String[] args) { +20                         SpringApplication.run(JavaMongoApplication.class, args); +21     } +22         @Override +23         public void run(String... args) throws [Exception] { +24                 Scanner scan = new Scanner(System.in); +25                 String response = ""; +26                 boolean running = true; +27                 while(running){ +28                         System.out.println("What would you like to create? \n C: The Customer \n B: Bike? \n X:Close"); +29                         response = scan.nextLine(); +30                         if ("B".equals(response.toUpperCase())) { +31                                 String[] bikeInformation = new String; +32                                 System.out.println("Enter the information for the Bike"); +33                                 System.out.println("Model Number"); +34                                 bikeInformation[0] = scan.nextLine(); +35                                 System.out.println("Color"); +36                                 bikeInformation[1] = scan.nextLine(); +37                                 System.out.println("Description"); +38                                 bikeInformation[2] = scan.nextLine(); +39  +40                                 Bike bike = new Bike(); +41                                 bike.setModelNumber(bikeInformation[0]); +42                                 bike.setColor(bikeInformation[1]); +43                                 bike.setDescription(bikeInformation[2]); +44  +45                                 bike = bikeRepo.save(bike); +46                                 System.out.println(bike.toString()); +47  +48  +49                         } else if ("X".equals(response.toUpperCase())) { +50                                 System.out.println("Bye"); +51                                 running = false; +52                         } else { +53                                 System.out.println("Sorry nothing else works right now!"); +54                         } +55                 } +56                  +57         } +58 } +``` + +其中的 **@Autowired** 注解会自动依赖注入 **BikeRepository** 和 **CustomerRepository** Bean。我们将使用这些类来从数据库持久化和采集数据。 + +已经好了。你已经创建了一个命令行应用程序。该应用程序连接到数据库,并且能够以最少的代码执行 CRUD 操作 + +### 结论 + +从诸如对象和类之类的编程语言概念转换为用于在数据库中存储、检索或更改数据的调用对于构建应用程序至关重要。Java 持久化 API (JPA)正是为 Java 开发人员解决这一难题的重要工具。 你正在使用 Java 操纵哪些数据库呢? 请在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/using-java-persistence-api + +作者:[Stephon Brown][a] +选题:[lujun9972][b] +译者:[runningwater](https://github.com/runningwater) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stephb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://www.techrepublic.com/article/mongodb-ceo-tells-hard-truths-about-commercial-open-source/ +[3]: https://github.com/StephonBrown/SpringMongoJava +[4]: https://openjdk.java.net/projects/jdk/11/ +[5]: https://start.spring.io/ +[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[7]: https://hub.docker.com/_/mongo +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+exception +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system From 8551f20e1b00d2e62ff57e609bd08629fcac067e Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 23 Dec 2019 09:56:05 +0800 Subject: [PATCH 224/676] translating --- ... Restart Services in Ubuntu and Other Linux Distributions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md b/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md index 7026071748..ab88f9198d 100644 --- a/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md +++ b/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 015b65037a85312c5b144c489ec311f719be2a74 Mon Sep 17 00:00:00 2001 From: Hank Chow <280630620@qq.com> Date: Mon, 23 Dec 2019 11:20:09 +0800 Subject: [PATCH 225/676] hankchow translating --- ...2 Why your Python code needs to be beautiful and explicit.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md b/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md index 00417f38ef..10fecd9694 100644 --- a/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md +++ b/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0435c78fdd0d7cf26b3117c6209546ad21fa6464 Mon Sep 17 00:00:00 2001 From: chen ni Date: Mon, 23 Dec 2019 22:46:40 +0800 Subject: [PATCH 226/676] =?UTF-8?q?=E7=94=B3=E9=A2=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20191218 How tracking pixels work.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191218 How tracking pixels work.md b/sources/tech/20191218 How tracking pixels work.md index 596d007175..11ac17be73 100644 --- a/sources/tech/20191218 How tracking pixels work.md +++ b/sources/tech/20191218 How tracking pixels work.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chen-ni) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -106,7 +106,7 @@ via: https://jvns.ca/blog/how-tracking-pixels-work/ 作者:[Julia Evans][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/chen-ni) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ccc461c71c1c445cece7650b81a85a9aef621db5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Dec 2019 22:48:53 +0800 Subject: [PATCH 227/676] PRF @robsean --- .../tech/20190225 Netboot a Fedora Live CD.md | 143 +++++++++--------- 1 file changed, 69 insertions(+), 74 deletions(-) diff --git a/translated/tech/20190225 Netboot a Fedora Live CD.md b/translated/tech/20190225 Netboot a Fedora Live CD.md index 6cae3ce9d4..ffd4e51bfc 100644 --- a/translated/tech/20190225 Netboot a Fedora Live CD.md +++ b/translated/tech/20190225 Netboot a Fedora Live CD.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Netboot a Fedora Live CD) @@ -12,40 +12,38 @@ ![](https://fedoramagazine.org/wp-content/uploads/2019/02/netboot-livecd-816x345.jpg) -[Live CD][1] 对于很多任务是很有用的,例如: +[Live CD][1] 对于很多任务是很有用的,例如: - * 将操作系统安装到一个硬盘驱动器 - * 修复一个启动加载程序或执行其它救援模式操作 - * 为网络浏览提供一个相适应的最小环境 - * …以及[更多的东西][2]。 +* 将操作系统安装到一个硬盘驱动器 +* 修复一个启动加载程序或执行其它救援模式操作 +* 为 Web 浏览提供一个相适应的最小环境 +* …以及[更多的东西][2]。 - - -因为使用 DVD 和 USB 驱动器来存储你的 Live CD 镜像是一个替代方案,你可以上传它们到一个不太可能丢失或损坏的 [iSCSI][3] 服务器中。这个指南向你展示如何加载你的 Live CD 镜像到一个 ISCSI 服务器上,并使用 [iPXE][4] 启动加载程序来访问它们。 +作为使用 DVD 和 USB 驱动器来存储你的 Live CD 镜像是一个替代方案,你可以上传它们到一个不太可能丢失或损坏的 [iSCSI][3] 服务器中。这个指南向你展示如何加载你的 Live CD 镜像到一个 ISCSI 服务器上,并使用 [iPXE][4] 启动加载程序来访问它们。 ### 下载一个 Live CD 镜像 ``` $ MY_RLSE=27 $ MY_LIVE=$(wget -q -O - https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/$MY_RLSE/Workstation/x86_64/iso | perl -ne '/(Fedora[^ ]*?-Live-[^ ]*?\.iso)(?{print $^N})/;') -$ MY_NAME=fc$MY_RLSE +$ MY_NAME=fc$MY_RLSE $ wget -O $MY_NAME.iso https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/$MY_RLSE/Workstation/x86_64/iso/$MY_LIVE ``` -上面的命令下载 Fedora-Workstation-Live-x86_64-27-1.6.iso Fedora Live 镜像,并保存为 fc27.iso 。更改 MY_RLSE 的值来下载其它档案版本。或者,你可以浏览 来下载最新的 Fedora live 镜像。在21之前的版本使用不同的命名约定,必需[在这里手动下载][5]。如果你手动下载一个 Live CD 镜像,设置 MY_NAME 变量为不带有扩展名的文件的基本名称。用此方法,下面部分中命令将引用正确的文件。 +上面的命令下载 `Fedora-Workstation-Live-x86_64-27-1.6.iso` Fedora Live 镜像,并保存为 `fc27.iso`。更改 `MY_RLSE` 的值来下载其它档案版本。或者,你可以浏览 来下载最新的 Fedora live 镜像。在 21 之前的版本使用不同的命名约定,必需[在这里手动下载][5]。如果你手动下载一个 Live CD 镜像,设置 `MY_NAME` 变量为不带有扩展名的文件的基本名称。用此方法,下面部分中命令将引用正确的文件。 ### 转换 Live CD 镜像 -使用 livecd-iso-to-disk 工具来转换 ISO 文件为一个磁盘镜像,并添加 netroot 参数到嵌入的内核命令行: +使用 `livecd-iso-to-disk` 工具来转换 ISO 文件为一个磁盘镜像,并添加 `netroot` 参数到嵌入的内核命令行: ``` $ sudo dnf install -y livecd-tools $ MY_SIZE=$(du -ms $MY_NAME.iso | cut -f 1) -$ dd if=/dev/zero of=$MY_NAME.img bs=1MiB count=0 seek=$(($MY_SIZE+512)) -$ MY_SRVR=server-01.example.edu -$ MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) -$ MY_LOOP=$(sudo losetup --show --nooverlap --find $MY_NAME.img) -$ sudo livecd-iso-to-disk --format --extra-kernel-args netroot=iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME $MY_NAME.iso $MY_LOOP +$ dd if=/dev/zero of=$MY_NAME.img bs=1MiB count=0 seek=$(($MY_SIZE+512)) +$ MY_SRVR=server-01.example.edu +$ MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) +$ MY_LOOP=$(sudo losetup --show --nooverlap --find $MY_NAME.img) +$ sudo livecd-iso-to-disk --format --extra-kernel-args netroot=iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME $MY_NAME.iso $MY_LOOP $ sudo losetup -d $MY_LOOP ``` @@ -53,21 +51,21 @@ $ sudo losetup -d $MY_LOOP 在你的 ISCSI 服务器上创建一个目录来存储你的 live 镜像,随后上传你修改的镜像到其中。 -**对于 21 及更高发布版本:** +对于 21 及更高发布版本: ``` -$ MY_FLDR=/images +$ MY_FLDR=/images $ scp $MY_NAME.img $MY_SRVR:$MY_FLDR/ ``` -**对于 21 以前发布版本:** +对于 21 以前发布版本: ``` -$ MY_FLDR=/images -$ MY_LOOP=$(sudo losetup --show --nooverlap --find --partscan $MY_NAME.img) -$ sudo tune2fs -O ^has_journal ${MY_LOOP}p1 -$ sudo e2fsck ${MY_LOOP}p1 -$ sudo dd status=none if=${MY_LOOP}p1 | ssh $MY_SRVR "dd of=$MY_FLDR/$MY_NAME.img" +$ MY_FLDR=/images +$ MY_LOOP=$(sudo losetup --show --nooverlap --find --partscan $MY_NAME.img) +$ sudo tune2fs -O ^has_journal ${MY_LOOP}p1 +$ sudo e2fsck ${MY_LOOP}p1 +$ sudo dd status=none if=${MY_LOOP}p1 | ssh $MY_SRVR "dd of=$MY_FLDR/$MY_NAME.img" $ sudo losetup -d $MY_LOOP ``` @@ -76,89 +74,86 @@ $ sudo losetup -d $MY_LOOP 在你的 iSCSI 服务器上运行下面的命令: ``` -$ sudo -i -# MY_NAME=fc27 -# MY_FLDR=/images -# MY_SRVR=`hostname` -# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) -# cat << END > /etc/tgt/conf.d/$MY_NAME.conf +$ sudo -i +# MY_NAME=fc27 +# MY_FLDR=/images +# MY_SRVR=`hostname` +# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) +# cat << END > /etc/tgt/conf.d/$MY_NAME.conf - backing-store $MY_FLDR/$MY_NAME.img - readonly 1 - allow-in-use yes - -END + backing-store $MY_FLDR/$MY_NAME.img + readonly 1 + allow-in-use yes + +END # tgt-admin --update ALL ``` ### 创建一个可启动 USB 驱动器 -[iPXE][4] 启动加载程序有一个 [sanboot][6] 命令,你可以使用它来连接,并启动你 ISCSI 服务器上运行的live 镜像。它可以用很多不同的[格式][7]编译。最好的工作格式依赖于你正在运行的硬件。例如,下面的说明向你展示如何在一个 USB 驱动器上从 [syslinux][9] 中 [链式加载][8] iPXE。 +[iPXE][4] 启动加载程序有一个 [sanboot][6] 命令,你可以使用它来连接并启动托管于你 ISCSI 服务器上运行的 live 镜像。它可以以很多不同的[格式][7]编译。最好的工作格式依赖于你正在运行的硬件。例如,下面的说明向你展示如何在一个 USB 驱动器上从 [syslinux][9] 中 [链式加载][8] iPXE。 -首先,下载 iPXE ,并以它的 lkrn 格式构建。这应该作为一个工作站上的普通用户完成: +首先,下载 iPXE,并以它的 lkrn 格式构建。这应该作为一个工作站上的普通用户完成: ``` -$ sudo dnf install -y git -$ git clone http://git.ipxe.org/ipxe.git $HOME/ipxe +$ sudo dnf install -y git +$ git clone http://git.ipxe.org/ipxe.git $HOME/ipxe $ sudo dnf groupinstall -y "C Development Tools and Libraries" -$ cd $HOME/ipxe/src -$ make clean -$ make bin/ipxe.lkrn +$ cd $HOME/ipxe/src +$ make clean +$ make bin/ipxe.lkrn $ cp bin/ipxe.lkrn /tmp ``` 接下来,准备一个带有一个 MSDOS 分区表和一个 FAT32 文件系统的 USB 驱动器。下面的命令假设你已经连接将要格式化的 USB 驱动器。**注意:你要格式正确的驱动器!** ``` -$ sudo -i -# dnf install -y parted util-linux dosfstools +$ sudo -i +# dnf install -y parted util-linux dosfstools # echo; find /dev/disk/by-id ! -regex '.*-part.*' -name 'usb-*' -exec readlink -f {} \; | xargs -i bash -c "parted -s {} unit MiB print | perl -0 -ne '/^Model: ([^(]*).*\n.*?([0-9]*MiB)/i && print \"Found: {} = \$2 \$1\n\"'"; echo; read -e -i "$(find /dev/disk/by-id ! -regex '.*-part.*' -name 'usb-*' -exec readlink -f {} \; -quit)" -p "Drive to format: " MY_USB -# umount $MY_USB? -# wipefs -a $MY_USB -# parted -s $MY_USB mklabel msdos mkpart primary fat32 1MiB 100% set 1 boot on +# umount $MY_USB? +# wipefs -a $MY_USB +# parted -s $MY_USB mklabel msdos mkpart primary fat32 1MiB 100% set 1 boot on # mkfs -t vfat -F 32 ${MY_USB}1 ``` -最后,在 USB 驱动器上安装并配置 syslinux ,来链式加载 iPXE : +最后,在 USB 驱动器上安装并配置 syslinux ,来链式加载 iPXE: ``` -# dnf install -y syslinux-nonlinux -# syslinux -i ${MY_USB}1 -# dd if=/usr/share/syslinux/mbr.bin of=${MY_USB} -# MY_MNT=$(mktemp -d) -# mount ${MY_USB}1 $MY_MNT -# MY_NAME=fc27 -# MY_SRVR=server-01.example.edu -# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) +# dnf install -y syslinux-nonlinux +# syslinux -i ${MY_USB}1 +# dd if=/usr/share/syslinux/mbr.bin of=${MY_USB} +# MY_MNT=$(mktemp -d) +# mount ${MY_USB}1 $MY_MNT +# MY_NAME=fc27 +# MY_SRVR=server-01.example.edu +# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) # cat << END > $MY_MNT/syslinux.cfg ui menu.c32 default $MY_NAME timeout 100 menu title SYSLINUX label $MY_NAME - menu label ${MY_NAME^^} - kernel ipxe.lkrn - append dhcp && sanboot iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME -END -# cp /usr/share/syslinux/menu.c32 $MY_MNT -# cp /usr/share/syslinux/libutil.c32 $MY_MNT -# cp /tmp/ipxe.lkrn $MY_MNT + menu label ${MY_NAME^^} + kernel ipxe.lkrn + append dhcp && sanboot iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME +END +# cp /usr/share/syslinux/menu.c32 $MY_MNT +# cp /usr/share/syslinux/libutil.c32 $MY_MNT +# cp /tmp/ipxe.lkrn $MY_MNT # umount ${MY_USB}1 ``` -通过简单地编辑 syslinux.cfg 文件,并添加附加的菜单入口,你应该能够使用这同一个 USB 驱动器来网络启动附加的 ISCSI 目标。 +通过简单地编辑 `syslinux.cfg` 文件,并添加附加的菜单项,你应该能够使用这同一个 USB 驱动器来网络启动附加的 ISCSI 目标。 -这仅是加载 IPXE 的一种方法。你可以直接在你的工作站上安装 syslinux 。再一种选项是编译 iPXE 为一个 EFI 可执行文件,并直接放置它到你的 [ESP][10]中。又一种选项是编译 iPXE 为一个 PXE 加载器,并放置它到你的能够被 DHCP 引用的 TFTP 服务器。最佳的选项依赖于的环境 +这仅是加载 IPXE 的一种方法。你可以直接在你的工作站上安装 syslinux 。再一种选项是编译 iPXE 为一个 EFI 可执行文件,并直接放置它到你的 [ESP][10] 中。又一种选项是编译 iPXE 为一个 PXE 加载器,并放置它到你的能够被 DHCP 引用的 TFTP 服务器。最佳的选项依赖于的环境 ### 最后说明 - * 如果你以 IPXE 的 EFI 格式编译 IPXE ,你可能想添加 –filename \EFI\BOOT\grubx64.efi 参数到 sanboot 命令。 - * 能够创建自定义 live 镜像。更多信息参考[创建和使用 live CD][11] 。 - * 有可能添加 –overlay-size-mb 和 –home-size-mb 参数到 livecd-iso-to-disk 命令来创建永久存储的 live 镜像。然而,如果你有多个并发用户,你将需要设置你的 ISCSI 服务器来管理独立的每个用户可写覆盖。这与 “[如何构建一个网络启动服务器,部分 4][12]” 一文所示类似。 - * Live 镜像在它们的内核命令行中支持一个 persistenthome 选项(例如, persistenthome=LABEL=HOME)。与经过 CHAP 身份验证的 iSCSI 目标一起使用,对于集权控制主目录,persistenthome 选项为 NFS 提供一个有趣的替代方案。 - - - +* 如果你以 IPXE 的 EFI 格式编译 IPXE ,你可能想添加 `–filename \EFI\BOOT\grubx64.efi` 参数到 `sanboot` 命令。 +* 能够创建自定义 live 镜像。更多信息参考[创建和使用 live CD][11]。 +* 可以添加 `–overlay-size-mb` 和 `–home-size-mb` 参数到 `livecd-iso-to-disk` 命令来创建永久存储的 live 镜像。然而,如果你有多个并发用户,你将需要设置你的 ISCSI 服务器来管理独立的每个用户的可写覆盖。这与 “[如何构建一个网络启动服务器,部分 4][12]” 一文所示类似。 +* Live 镜像在它们的内核命令行中支持一个 `persistenthome` 选项(例如, `persistenthome=LABEL=HOME`)。与经过 CHAP 身份验证的 iSCSI 目标一起使用,对于中心控制主目录,`persistenthome` 选项为 NFS 提供一个有趣的替代方案。 -------------------------------------------------------------------------------- @@ -167,7 +162,7 @@ via: https://fedoramagazine.org/netboot-a-fedora-live-cd/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6f2aa0a9d70955b659ed2b5d96bd1435339bffc8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Dec 2019 22:49:16 +0800 Subject: [PATCH 228/676] PUB @robsean https://linux.cn/article-11708-1.html --- .../tech => published}/20190225 Netboot a Fedora Live CD.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190225 Netboot a Fedora Live CD.md (99%) diff --git a/translated/tech/20190225 Netboot a Fedora Live CD.md b/published/20190225 Netboot a Fedora Live CD.md similarity index 99% rename from translated/tech/20190225 Netboot a Fedora Live CD.md rename to published/20190225 Netboot a Fedora Live CD.md index ffd4e51bfc..928f1eeed8 100644 --- a/translated/tech/20190225 Netboot a Fedora Live CD.md +++ b/published/20190225 Netboot a Fedora Live CD.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11708-1.html) [#]: subject: (Netboot a Fedora Live CD) [#]: via: (https://fedoramagazine.org/netboot-a-fedora-live-cd/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) From e51900f9d7d230bf67b9042e82624a036eeea716 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Dec 2019 23:19:22 +0800 Subject: [PATCH 229/676] PRF @lxbwolf --- ...How To Set Password Complexity On Linux.md | 69 +++++++++---------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/translated/tech/20190513 How To Set Password Complexity On Linux.md b/translated/tech/20190513 How To Set Password Complexity On Linux.md index 9e70171824..8fe167bbac 100644 --- a/translated/tech/20190513 How To Set Password Complexity On Linux.md +++ b/translated/tech/20190513 How To Set Password Complexity On Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Set Password Complexity On Linux?) @@ -12,13 +12,12 @@ Linux 如何设置密码复杂度? 对于 Linux 系统管理员来说,用户管理是最重要的事之一。这涉及到很多因素,实现强密码策略是用户管理的其中一个方面。移步后面的 URL 查看如何 [在 Linux 上生成一个强密码][1]。它会限制系统未授权的用户的访问。 -所有人都知道 Linux 的默认策略很安全,然而我们还是要做一些微调,这样才更安全。弱密码有安全隐患,因此,请特别注意。移步后面的 URL 查看生成的强密码的 [密码长度和分值][2]。本文将教你在 Linux 中如何实现最安全的策略。 +所有人都知道 Linux 的默认策略很安全,然而我们还是要做一些微调,这样才更安全。弱密码有安全隐患,因此,请特别注意。移步后面的 URL 查看生成的强密码的[密码长度和分值][2]。本文将教你在 Linux 中如何实现最安全的策略。 -在大多数 Linux 系统中,我们可以用 PAM(pluggable authentication module,译注:可插拔认证模块)来加强密码策略。在下面的路径可以找到这个文件。 +在大多数 Linux 系统中,我们可以用 PAM(可插拔认证模块pluggable authentication module)来加强密码策略。在下面的路径可以找到这个文件。 -在红帽系列的系统中,路径:`/etc/pam.d/system-auth`。 - -Debian 系列的系统中,路径:`/etc/pam.d/common-password`。 +- 在红帽系列的系统中,路径:`/etc/pam.d/system-auth`。 +- Debian 系列的系统中,路径:`/etc/pam.d/common-password`。 关于默认的密码过期时间,可以在 `/etc/login.defs` 文件中查看详细信息。 @@ -33,32 +32,30 @@ PASS_MIN_LEN 5 PASS_WARN_AGE 7 ``` -**详细解释:** - - * **`PASS_MAX_DAYS:`**` ` 一个密码可使用的最大天数。 - * **`PASS_MIN_DAYS:`**` ` 两次密码修改之间最小的间隔天数。 - * **`PASS_MIN_LEN:`**` ` 密码最小长度。 - * **`PASS_WARN_AGE:`**` ` 密码过期前给出警告的天数。 - +详细解释: +* `PASS_MAX_DAYS`:一个密码可使用的最大天数。 +* `PASS_MIN_DAYS`:两次密码修改之间最小的间隔天数。 +* `PASS_MIN_LEN`:密码最小长度。 +* `PASS_WARN_AGE`:密码过期前给出警告的天数。 我们将会展示在 Linux 中如何实现下面的 11 个密码策略。 - * 一个密码可使用的最大天数 - * 两次密码修改之间最小的间隔天数 - * 密码过期前给出警告的天数 - * 密码历史记录/拒绝重复使用密码 - * 密码最小长度 - * 最少的大写字母个数 - * 最少的小写字母个数 - * 最少的数字个数 - * 最少的其他字符(符号)个数 - * 账号锁定 — 重试 - * 账号解锁时间 +* 一个密码可使用的最大天数 +* 两次密码修改之间最小的间隔天数 +* 密码过期前给出警告的天数 +* 密码历史记录/拒绝重复使用密码 +* 密码最小长度 +* 最少的大写字母个数 +* 最少的小写字母个数 +* 最少的数字个数 +* 最少的其他字符(符号)个数 +* 账号锁定 — 重试 +* 账号解锁时间 ### 密码可使用的最大天数是什么? -这一参数限制一个密码可使用的最大天数。它强制用户在过期前修改他/她的密码。如果他们忘记修改,那么他们会登录不了系统。他们需要联系管理员才能正常登录。这个参数可以在 `/etc/login.defs` 文件中设置。我把这个参数设置为 `90 天`。 +这一参数限制一个密码可使用的最大天数。它强制用户在过期前修改他/她的密码。如果他们忘记修改,那么他们会登录不了系统。他们需要联系管理员才能正常登录。这个参数可以在 `/etc/login.defs` 文件中设置。我把这个参数设置为 90 天。 ``` # vi /etc/login.defs @@ -68,7 +65,7 @@ PASS_MAX_DAYS 90 ### 密码最小天数是什么? -这个参数限制两次修改之间的最少天数。举例来说,如果这个参数被设置为 15 天,用户今天修改了密码,那么在 15 天之内他都不能修改密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 `15 天`。 +这个参数限制两次修改之间的最少天数。举例来说,如果这个参数被设置为 15 天,用户今天修改了密码,那么在 15 天之内他都不能修改密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 15 天。 ``` # vi /etc/login.defs @@ -78,7 +75,7 @@ PASS_MIN_DAYS 15 ### 密码警告天数是什么? -这个参数控制密码警告的前置天数,在密码即将过期时会给用户警告提示。在警告天数结束前,用户会收到日常警告提示。这可以提醒用户在密码过期前修改他们的密码,否则我们就需要联系管理员来解锁密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 `10 天`。 +这个参数控制密码警告的前置天数,在密码即将过期时会给用户警告提示。在警告天数结束前,用户会收到日常警告提示。这可以提醒用户在密码过期前修改他们的密码,否则我们就需要联系管理员来解锁密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 10 天。 ``` # vi /etc/login.defs @@ -90,7 +87,7 @@ PASS_WARN_AGE 10 ### 密码历史或拒绝重复使用密码是什么? -这个参数控制密码历史。它记录曾经使用过的密码(禁止使用的曾用密码的个数)。当用户设置新的密码时,它会检查密码历史,如果他们要设置的密码是一个曾经使用过的旧密码,将会发出警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码历史为 `5`。 +这个参数控制密码历史。它记录曾经使用过的密码(禁止使用的曾用密码的个数)。当用户设置新的密码时,它会检查密码历史,如果他们要设置的密码是一个曾经使用过的旧密码,将会发出警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码历史为 5。 ``` # vi /etc/pam.d/system-auth @@ -100,7 +97,7 @@ password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok r ### 密码最小长度是什么? -这个参数表示密码的最小长度。当用户设置新密码时,系统会检查这个参数,如果新设的密码长度小于这个参数设置的值,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置最小密码长度为 `12`。 +这个参数表示密码的最小长度。当用户设置新密码时,系统会检查这个参数,如果新设的密码长度小于这个参数设置的值,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置最小密码长度为 12。 ``` # vi /etc/pam.d/system-auth @@ -108,11 +105,11 @@ password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok r password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 ``` -**try_first_pass retry=3** : 在密码设置交互界面,用户有 3 次机会重设密码。 +`try_first_pass retry=3`:在密码设置交互界面,用户有 3 次机会重设密码。 ### 设置最少的大写字母个数? -这个参数表示密码中至少需要的大写字母的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有大写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码(中大写字母)的最小长度为 `1` 个字母。 +这个参数表示密码中至少需要的大写字母的个数。这些是密码强度参数,可以让密码更健壮。当用户设置新密码时,系统会检查这个参数,如果密码中没有大写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码(中的大写字母)的最小长度为 1 个字母。 ``` # vi /etc/pam.d/system-auth @@ -122,7 +119,7 @@ password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 ucredit= ### 设置最少的小写字母个数? -这个参数表示密码中至少需要的小写字母的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有小写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1` 个字母。 +这个参数表示密码中至少需要的小写字母的个数。这些是密码强度参数,可以让密码更健壮。当用户设置新密码时,系统会检查这个参数,如果密码中没有小写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 1 个字母。 ``` # vi /etc/pam.d/system-auth @@ -132,7 +129,7 @@ password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 lcred ### 设置密码中最少的数字个数? -这个参数表示密码中至少需要的数字的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有数字,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1`。 +这个参数表示密码中至少需要的数字的个数。这些是密码强度参数,可以让密码更健壮。当用户设置新密码时,系统会检查这个参数,如果密码中没有数字,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 1 个数字。 ``` # vi /etc/pam.d/system-auth @@ -142,7 +139,7 @@ password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 dcred ### 设置密码中最少的其他字符(符号)个数? -这个参数表示密码中至少需要的特殊符号的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有特殊符号,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1` 个字符。 +这个参数表示密码中至少需要的特殊符号的个数。这些是密码强度参数,可以让密码更健壮。当用户设置新密码时,系统会检查这个参数,如果密码中没有特殊符号,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 1 个字符。 ``` # vi /etc/pam.d/system-auth @@ -163,7 +160,7 @@ account required pam_tally2.so ### 设定账号解锁时间? -这个参数表示用户解锁时间。如果一个用户账号在连续认证失败后被锁定了,当过了设定的解锁时间后,就会解锁。设置被锁定中的账号的解锁时间(900 秒 = 15分钟)。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。 +这个参数表示用户解锁时间。如果一个用户账号在连续认证失败后被锁定了,当过了设定的解锁时间后,才会解锁。设置被锁定中的账号的解锁时间(900 秒 = 15分钟)。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。 ``` # vi /etc/pam.d/system-auth @@ -179,7 +176,7 @@ via: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8bed80c54082f46d47fbde3c013044fad2e3ec72 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 23 Dec 2019 23:19:50 +0800 Subject: [PATCH 230/676] PUB @lxbwolf https://linux.cn/article-11709-1.html --- .../20190513 How To Set Password Complexity On Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190513 How To Set Password Complexity On Linux.md (99%) diff --git a/translated/tech/20190513 How To Set Password Complexity On Linux.md b/published/20190513 How To Set Password Complexity On Linux.md similarity index 99% rename from translated/tech/20190513 How To Set Password Complexity On Linux.md rename to published/20190513 How To Set Password Complexity On Linux.md index 8fe167bbac..f9dfca1e8e 100644 --- a/translated/tech/20190513 How To Set Password Complexity On Linux.md +++ b/published/20190513 How To Set Password Complexity On Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11709-1.html) [#]: subject: (How To Set Password Complexity On Linux?) [#]: via: (https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From c47d3a6ba6cc0d7afebb9225825576b51ce77a89 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Dec 2019 00:55:43 +0800 Subject: [PATCH 231/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191223=20Best?= =?UTF-8?q?=20of=202019:=20Fedora=20for=20system=20administrators?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191223 Best of 2019- Fedora for system administrators.md --- ... 2019- Fedora for system administrators.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20191223 Best of 2019- Fedora for system administrators.md diff --git a/sources/tech/20191223 Best of 2019- Fedora for system administrators.md b/sources/tech/20191223 Best of 2019- Fedora for system administrators.md new file mode 100644 index 0000000000..5e57ff2912 --- /dev/null +++ b/sources/tech/20191223 Best of 2019- Fedora for system administrators.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best of 2019: Fedora for system administrators) +[#]: via: (https://fedoramagazine.org/best-of-2019-fedora-for-system-administrators/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +Best of 2019: Fedora for system administrators +====== + +![][1] + +The end of the year is a perfect time to look back on some of the Magazine’s most popular articles of 2019. One of the Fedora operating systems’s many strong points is its wide array of tools for system administrators. As your skills progress, you’ll find that the Fedora OS has even more to offer. And because Linux is the sysadmin’s best friend, you’ll always be in good company. In 2019, there were quite a few articles about sysadmin tools our readers enjoyed. Here’s a sampling. + +### Introducing Fedora CoreOS + +If you follow modern IT topics, you know that containers are a hot topic — and [containers mean Linux][2]. This summer brought the first preview release of [Fedora CoreOS][3]. This new edition of Fedora can run containerized workloads. You can use it to deploy apps and services in a modern way. + +> [Introducing Fedora CoreOS][4] + +### InitRAMFS, dracut and the dracut emergency shell + +To be a good sysadmin, you need to understand system startup and the boot process. From time to time, you’ll encounter software errors, configuration problems, or other issues that keep your system from starting normally. With the information in the article below, you can do some life-saving surgery on your system, and restore it to working order. + +> [InitRAMFS, Dracut, and the Dracut Emergency Shell][5] + +### How to reset your root password + +Although this article was published a few years ago, it continues to be one of the most popular. Apparently, we’re not the only people who sometimes get locked out of our own system! If this happens to you, and you need to reset the root password, the article below should do the trick. + +> [How to reset a root password on Fedora][6] + +### Systemd: unit dependencies and order + +This article is part of [an entire series][7] on systemd, the modern system and process manager in Fedora and other distributions. As you may know, systemd has sophisticated but easy to use methods to start up or shut own services in the right order. This article shows you how they work. That way you can apply the right options to unit files you create for systemd. + +> [systemd: Unit dependencies and order][8] + +### Setting kernel command line arguments + +Fedora 30 introduced new ways to change the boot options for your kernel. This article from Laura Abbott on the Fedora kernel team explains the new Bootloader Spec (BLS). It also tells you how to use it to set options on your kernel for boot time. + +> [Setting kernel command line arguments with Fedora 30][9] + +Stay tuned to the Magazine for other upcoming “Best of 2019” categories. All of us at the Magazine hope you have a great end of year and holiday season. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/best-of-2019-fedora-for-system-administrators/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/12/2019top-sysadmins.png-816x345.jpg +[2]: https://www.redhat.com/en/blog/containers-are-linux +[3]: https://getfedora.org/coreos/ +[4]: https://fedoramagazine.org/introducing-fedora-coreos/ +[5]: https://fedoramagazine.org/initramfs-dracut-and-the-dracut-emergency-shell/ +[6]: https://fedoramagazine.org/reset-root-password-fedora/ +[7]: https://fedoramagazine.org/series/systemd-series/ +[8]: https://fedoramagazine.org/systemd-unit-dependencies-and-order/ +[9]: https://fedoramagazine.org/setting-kernel-command-line-arguments-with-fedora-30/ From 5c1d712ac48e50f9f49eddd6e7e744eb91de5a2d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Dec 2019 00:56:30 +0800 Subject: [PATCH 232/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191224=20App=20?= =?UTF-8?q?Highlight:=20Falkon=20Open=20Source=20Web=20Browser=20from=20KD?= =?UTF-8?q?E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md --- ...Falkon Open Source Web Browser from KDE.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md diff --git a/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md new file mode 100644 index 0000000000..42439f33c1 --- /dev/null +++ b/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) +[#]: via: (https://itsfoss.com/falkon-browser/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +App Highlight: Falkon Open Source Web Browser from KDE +====== + +_**Formerly known as Qupzilla, Falkon is a web browser based on QtWebEngine. In this week’s App Highlight, we take a look at this open source software.**_ + +### Falkon: Open Source Web Browser for Linux (and Windows) + +![][1] + +First thing first, [Falkon][2] is not a new web browser. It has been in development since 2010 but it was known as Qupzilla. + +In 2017, QupZilla moved under KDE umbrella and changed its name to Falkon. Being under KDE umbrella means that project is actively maintained following KDE standards. + +It uses the [QtWebEngine][3] rendering engine – which is a striped down version of Chromium core. + +In this article, I shall take a closer look at what it offers and how it’s different than other dominant web browsers on Linux out there. + +### Features of Falkon Browser + +Thought it may not be a popular browser, I did find it capable enough to browse modern web services. + +Let me highlight the key features of Falkon and if you find it interesting enough, give it a try. + +#### Simple User Interface + +![][4] + +I know it’s not exactly a “feature” but the user experience (UX) matters a lot. Despite being a lightweight browser, you have a decent looking interface here. You won’t feel like you are using a browser from the early 2000’s. + +#### AdBlock Extension + +![][5] + +It comes packed in with the AdBlock extension that works pretty well if you want to get rid of the advertisements while browsing a website. You can also customize the behavior of the AdBlock extension. + +#### DuckDuckGo Default Search Engine + +It’s a good thing to have one of the [privacy-oriented search engines][6] as the default search engine if you do not like using Google. + +#### Session Manager + +![][7] + +Falkon includes a useful session manager from the available options in the browser menu. You can restore a specific recent session using this – which should come in handy. + +#### Extension Support + +![][8] + +It does support adding extensions but you cannot add extensions from Chrome/Firefox add-on marketplace. You have a limited set of extensions to choose from. + +#### Theme Support + +Falkon also lets you customize the appearance to some extent. You can try them out if you want to change the appearance of the browser. + +![][9] + +#### Other Essential Settings + +![][10] + +I also explored other settings/functionalities like adding a bookmark or being able to manage the passwords. + +Or, maybe manage the notification access of a webpage. + +Oh, I also tried using YouTube – with no problems whatsoever. + +Of course, this isn’t an extensive review – but yes, Falkon does have all the essential options that you will need in a browser (unless you have a specific requirements). + +### Installing Falkon Browser + +You can easily find Falkon browser available in your Software Center. + +In case you don’t, you can find Flatpak/Snap packages available from its [official download page][11]. You’ll also find Windows installer files on the download page. + +[Download Falkon Browser][11] + +**Wrapping Up** + +As a KDE product, Falkon is tailored for KDE desktop environment. Some KDE distributions like OpenMandriva use Falkon as the default web browser. + +Falkon browser is for the ones looking for a lightweight and feature-rich web browser. An alternative worth taking a look is [Midori][12]. + +In my opinion, it is a good alternative browser – unless you need tons of extensions, cross-platform synchronization and require to access some browser-specific websites. + +What do you think about the Falkon browser? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/falkon-browser/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-screenshot.jpg?ssl=1 +[2]: https://www.falkon.org/ +[3]: https://wiki.qt.io/QtWebEngine +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-adblock.jpg?ssl=1 +[6]: https://itsfoss.com/privacy-search-engines/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/session-manager-falkon.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-extensions.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-theme.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-preference.png?ssl=1 +[11]: https://www.falkon.org/download/ +[12]: https://itsfoss.com/midori-browser/ From cd1ad3ba2be103e6daf335499289cb8ba1d0223c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Dec 2019 00:57:02 +0800 Subject: [PATCH 233/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191223=20Get=20?= =?UTF-8?q?back=20to=20basics=20with=20the=20TWM=20Linux=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191223 Get back to basics with the TWM Linux desktop.md --- ...ck to basics with the TWM Linux desktop.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20191223 Get back to basics with the TWM Linux desktop.md diff --git a/sources/tech/20191223 Get back to basics with the TWM Linux desktop.md b/sources/tech/20191223 Get back to basics with the TWM Linux desktop.md new file mode 100644 index 0000000000..19b16daf6f --- /dev/null +++ b/sources/tech/20191223 Get back to basics with the TWM Linux desktop.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get back to basics with the TWM Linux desktop) +[#]: via: (https://opensource.com/article/19/12/twm-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Get back to basics with the TWM Linux desktop +====== +This article is part of a special series of 24 days of Linux desktops. +TWM may be bare-bones by default, but it's a great foundation for a +customized Linux desktop that has all your favorite bits and pieces. +![Penguin driving a car with a yellow background][1] + +The most humble of window managers, TWM, is a little akin to those sample photographs you get when you buy a picture frame. It's basic, almost a bare-minimum proof of concept that Xorg ships with the [X11][2] Windows System to demonstrate that a desktop can indeed be created for a graphical user interface (GUI). + +Some distributions treat it as a fallback window manager that can be launched in a pinch if you break your usual desktop and need a terminal just long enough for repairs. Now that Xorg is basically bulletproof and moving aside for [Wayland][3], sometimes TWM isn't even included at all. And yet, amazingly, TWM, short for either _Timeless Window Manager_ or _Tabbed Window Manager_, depending on who you ask, has some fun features and configuration options. + +![TWM][4] + +Your distribution (XQuartz on Mac OS included) may discreetly include TWM as a fallback window manager. Otherwise, you are likely to find it in your software repository, and you can also get it from the [Freedesktop][5] GitHub repository. If you're already running a different desktop, it's safe to install TWM on the same system because it doesn't include any bundled applications aside from a few configuration panels. + +After installing, log out of your current desktop session so you can log into TWM. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging into your new one. + +With GDM: + +![Selecting your desktop in GDM][6] + +With SDDM: + +![Selecting your desktop in KDM][7] + +### Desktop tour + +TWM's basic configuration is usually unspectacular. Here's TWM on my Slackware system: + +![TWM by default][8] + +You can get a pop-up menu with a left-click on the desktop. By default, it has one application listed: xterm. When you launch xterm, the outline of a window appears until you click to place it on the desktop. + +More actions are available with a right-click or a middle-click on the desktop or a window's title bar. For instance, to resize a window, you can middle-click the title bar and select **Resize**; this places you into resize mode so you can drag your mouse across the edge of the window you want to make smaller or larger. Click again to confirm the new size. + +When you right-click the icon in the upper-left corner of any window, that window is minimized into a desktop icon (a precursor to the OS X dock). You can drag this icon anywhere on your desktop and right-click on it to restore it back to a full-sized window. + +These are all old Unix conventions; tricks of the visual interface that long-time Unix users will remember fondly but are utterly baffling at first to new users. You can learn to love them by using TWM, but if you do that, you'll no doubt want something a little prettier and more tailored to your daily workflow. + +### TWM configuration + +One of my favorite sites is [Linux Questions][9], a tried-and-true Linux support forum. I stumbled across a post there about TWM, where user **rkfb** was, apparently in all seriousness, praising TWM as his favorite lightweight window manager. What's more, **rkfb** had [the config file to prove it][10]. + +I downloaded the sample **.twmrc** file and discovered that there are a surprising number of options and features in TWM. Like other "building-block" window managers, such as [FVWM][11] or [MLVWM][12], it takes a lot of work to customize it and bring it up to modern expectations. You can also add the usual laundry list of applications to TWM. For instance, you could run [Tint2][13] or [Xfce-panel][14] to provide a traditional taskbar and other applets, or [stalonetray][15] for a system tray, and [vdesk][16] to provide virtual desktops, but then again, TWM isn't meant to be a _modern_ window manager, but a _timeless_ window manager. You may not want to make it too modern. + +There are _lots_ of options and definitions in the config file for TWM. Two of my favorites are **RandomPlacement** (an option to activate random placement of windows, so you don't have to manually click to set the location of each window you launch) and **ShowIconManager** (which displays a vertical taskbar). + +The syntax to define the contents of the menus is pretty easy to understand: + + +``` +menu "Shells" { +   "Shells"     f.title +   "rxvt"               f.exec "urxvt -fg cyan -bg black -cr white &" +   "Konsole"    f.exec "konsole &" +} +``` + +Color themes are similarly intuitive from the sample file. + +You can set a background using the **feh** command (you probably need to install it first): + + +``` +`$ feh --bg-fill ~/christopher-burns_unsplash.jpg` +``` + +### Old TWM is new TWM + +TWM looks and feels like an artifact of a bygone era, when desktops were simpler in design but complex in configuration. It's probably not the best or the most flexible window manager available, but it's surprisingly configurable. You can use it as the foundation of a customized desktop consisting of all your favorite desktop bits and pieces. You can spend the time to make TWM something you enjoy using, and you'll learn a lot about interface design, Unix history, and pixmap bit depth along the way. Give TWM another look, and make that look beautiful. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/twm-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://en.wikipedia.org/wiki/X_Window_System +[3]: https://wayland.freedesktop.org/ +[4]: https://opensource.com/sites/default/files/uploads/advent-twm.jpg (TWM) +[5]: https://github.com/freedesktop/twm +[6]: https://opensource.com/sites/default/files/uploads/advent-gdm_3.jpg (Selecting your desktop in GDM) +[7]: https://opensource.com/sites/default/files/uploads/advent-kdm_2.jpg (Selecting your desktop in KDM) +[8]: https://opensource.com/sites/default/files/uploads/advent-twm-basic.jpg (TWM by default) +[9]: http://linuxquestions.org +[10]: https://www.linuxquestions.org/questions/linux-desktop-74/share-your-configuration-file-of-twm-best-x-windows-manager-4175585974 +[11]: https://opensource.com/article/19/12/fvwm-linux-desktop +[12]: https://opensource.com/article/19/12/linux-mlvwm-desktop +[13]: https://opensource.com/article/19/1/productivity-tool-tint2 +[14]: https://opensource.com/article/19/12/xfce-linux-desktop +[15]: http://stalonetray.sourceforge.net/ +[16]: https://offog.org/code/vdesk From f69ba8c0361123a8902f76a66a6e02bd7d87c4eb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Dec 2019 00:57:37 +0800 Subject: [PATCH 234/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191223=2010=20a?= =?UTF-8?q?rticles=20to=20learn=20Linux=20your=20way?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191223 10 articles to learn Linux your way.md --- ...223 10 articles to learn Linux your way.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/tech/20191223 10 articles to learn Linux your way.md diff --git a/sources/tech/20191223 10 articles to learn Linux your way.md b/sources/tech/20191223 10 articles to learn Linux your way.md new file mode 100644 index 0000000000..0ef668ad28 --- /dev/null +++ b/sources/tech/20191223 10 articles to learn Linux your way.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 articles to learn Linux your way) +[#]: via: (https://opensource.com/article/19/12/learn-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +10 articles to learn Linux your way +====== +It's been a good year for Linux, so take a look back at the top 10 Linux +articles on Opensource.com from 2019. +![Penguins gathered together in the Artic][1] + +The year 2019 has been good for Linux with Opensource.com readers. Obviously, the term "Linux" itself is weighted: Does it refer to the kernel or the desktop or the ecosystem? In this look back at the top Linux articles of the year, I've intentionally taken a broad view in defining the top 10 Linux articles (for some definition of "top" and some definition of "Linux"). Here they are, offered in no particular order. + +### A beginner's guide to Linux permissions + +[_A beginner's guide to Linux permissions_][2] by Bryant Son introduces new users to the concept of file permissions with graphics and charts to illustrate each point. It can be hard to come up with visuals for concepts that are, at their core, purely text-based, and this article is friendly for the visual learners out there. I also like how Bryant stays focused. Any discussion of file permissions can lead to several related topics (like ownership and access control lists and so on), but this article is dedicated to explaining one thing and explaining it well. + +### Why I made the switch from Mac to Linux + +Matthew Broberg offers an insightful and honest look at his migration to Linux from MacOS in [_Why I made the switch from Mac to Linux_][3]. Changing platforms is always tough, and it's important to record what's behind the decision to switch. Matt's article, I think, serves several purposes, but the two most important for me: it's an invitation for the Linux community to support him by answering questions and offering potential solutions, and it's a good data point for others who are considering Linux adoption. + +### Troubleshooting slow WiFi on Linux + +In [_Troubleshooting slow WiFi on Linux_][4], David Clinton provides a useful analysis of a problem everyone has on every platform—and has tips on how to solve it. It's a good example of an "incidentally Linux" tip that not only helps everyday people with everyday problems but also shows non-Linux users how approachable troubleshooting (on any platform) is. + +### How GNOME uses Git + +[_How GNOME uses Git_][5] by Molly de Blanc takes a look behind the scenes, revealing how one of the paragons of open source software (the GNOME desktop) uses one of the other paragons of open source (Git) for development. It's always heartening to me to hear about an open source project that defaults to an open source solution for whatever needs to be done. Believe it or not, this isn't always the case, but for GNOME, it's an important and welcoming part of the project's identity. + +### Virtual filesystems in Linux: Why we need them and how they work + +Alison Chaiken masterfully explains what is considered incomprehensible to many users in [_Virtual filesystems in Linux: Why we need them and how they work_][6]. Understanding what a filesystem is and what it does is one thing, but _virtual_ ones aren't even, by definition, real. And yet Linux delivers them in a way that even casual users can benefit from, and Alison's article explains it in a way that anyone can understand. As a bonus, Alison goes even deeper in the second half of the article and demonstrates how to use bcc scripts to monitor everything she just taught you. + +### Understanding file paths and how to use them + +I thought [_Understanding file paths and how to use them_][7] was important to write about because it's a concept most users (on any platform) don't seem to be taught. It's a strange phenomenon, because now, more than ever, the _file path_ is something people see literally on a daily basis: Nearly all internet URLs contain a file path telling you exactly where within the domain you are. I often wonder why computer education doesn't start with the internet, the most familiar app of all and arguably the most heavily used supercomputer in existence, and use it to explain the appliances we interface with each day. (I guess it would help if those appliances were running Linux, but we're working on that.) + +### Inter-process communication in Linux + +[_Inter-process communication in Linux: Shared storage_][8] by Marty Kalin delves into the developer side of Linux, explaining IPC and how to interact with it in your code. I'm cheating by including this article because it's actually a three-part series, but it's the best explanation of its kind. There is very little documentation that manages to explain how Linux handles IPC, much less what IPC is, why it's important, or how to take advantage of it when programming. It's normally a topic you work your way up to in university. Now you can read all about it here instead. + +### Understanding system calls on Linux with strace + +[_Understanding system calls on Linux with strace_][9] by Gaurav Kamathe is highly technical in ways I wish that every conference talk I've ever seen about **strace** was. This is a clear and helpful demonstration of a complex but amazingly useful command. To my surprise, the command I've found myself using since this article isn't the titular command, but **ltrace** (to see which functions are called by a command). Obviously, this article's packed with information and is a handy reference for developers and QA testers. + +### How the Linux desktop has grown + +[_How the Linux desktop has grown_][10] by Jim Hall is a visual journey through the history of the Linux desktop. It starts with [TWM][11] and passes by [FVWM][12], [GNOME][13], [KDE][14], and others. If you're new to Linux, this is a fascinating history lesson from someone who was there (and has the screenshots to prove it). If you've been with Linux for many years, then this will definitely bring back memories. In the end, though, one thing is certain: Anyone who can still locate screenshots from 20 years ago is a superhuman data archivist. + +### Create your own video streaming server with Linux + +[_Create your own video streaming server with Linux_][15] by Aaron J. Prisk breaks down more than just a few preconceptions most of us have about the services we take for granted. Because services like YouTube and Twitch exist, many people assume that those are the only gateways to broadcasting video to the world. Of course, people used to think that Windows and Mac were the only gateways into computing, and that, thankfully, turned out to be a gross miscalculation. In this article, Aaron sets up a video-streaming server and even manages to find space to talk about [OBS][16] in so you can create videos to stream. Is it a fun weekend project or the start of a new career? You decide. + +### 10 moments that shaped Linux history + +[_10 moments that shaped Linux history_][17] by Alan Formy-Duval attempts the formidable task of choosing just 10 things to highlight in the history of Linux. It's an exercise in futility, of course, because there have been so many important moments, so I love how Alan filters it through his own experience. For example, when was it obvious that Linux was going to last? When Alan realized that all the systems he maintained at work were running Linux. There's a beauty to interpreting history this way because the moments of importance will differ for each person. There's no definitive list for Linux, or articles about Linux, or for open source. You make your own list, and you make yourself a part of it. + +### What do you want to learn? + +What else do you want to know about Linux? Please tell us about it in the comments, or [write an article][18] for Opensource.com about your experience with Linux. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/learn-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png?itok=p7cWyQv9 (Penguins gathered together in the Artic) +[2]: https://opensource.com/article/19/6/understanding-linux-permissions +[3]: https://opensource.com/article/19/10/why-switch-mac-linux +[4]: http://opensource.com/article/19/4/troubleshooting-wifi-linux +[5]: https://opensource.com/article/19/10/how-gnome-uses-git +[6]: https://opensource.com/article/19/3/virtual-filesystems-linux +[7]: https://opensource.com/article/19/8/understanding-file-paths-linux +[8]: https://opensource.com/article/19/4/interprocess-communication-linux-storage +[9]: https://opensource.com/article/19/2/linux-backup-solutions +[10]: https://opensource.com/article/19/8/how-linux-desktop-grown +[11]: https://github.com/freedesktop/twm +[12]: http://www.fvwm.org/ +[13]: http://gnome.org +[14]: http://kde.org +[15]: https://opensource.com/article/19/1/basic-live-video-streaming-server +[16]: https://opensource.com/life/15/12/real-time-linux-video-editing-with-obs-studio +[17]: https://opensource.com/article/19/4/top-moments-linux-history +[18]: https://opensource.com/how-submit-article From e25b656c7351bedf64a60486bcf90acf68455c00 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Dec 2019 00:58:03 +0800 Subject: [PATCH 235/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191223=2010=20r?= =?UTF-8?q?esources=20to=20become=20a=20better=20Bash=20user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191223 10 resources to become a better Bash user.md --- ... resources to become a better Bash user.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20191223 10 resources to become a better Bash user.md diff --git a/sources/tech/20191223 10 resources to become a better Bash user.md b/sources/tech/20191223 10 resources to become a better Bash user.md new file mode 100644 index 0000000000..b00f359d4d --- /dev/null +++ b/sources/tech/20191223 10 resources to become a better Bash user.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 resources to become a better Bash user) +[#]: via: (https://opensource.com/article/19/12/bash-resources) +[#]: author: (David Both https://opensource.com/users/dboth) + +10 resources to become a better Bash user +====== +Take a look through our top 10 Bash articles from 2019. +![bash logo on green background][1] + +As another great year wraps up at Opensource.com, my fascination with all things [Bash][2] has me looking back at the top 10 Bash articles we published in 2019. These articles include basic how-to articles, tools, shortcuts, and even a way to build your own command-line game with Bash. + +I didn't select these articles based solely on the number of hits they had but rather on a number of criteria. In the true spirit of top 10 countdowns, the top Bash article from 2019 is at the end for the final reveal. + + 10. [_Bash vs. Python: Which language should you use?_][3] by Archit Modi looks at the strengths and weaknesses of these popular languages. Although both have many good points, the bottom line—as with most things Linux—is, "it depends." + + + 9. [_How to program with Bash: Logical operators and shell expansions_][4] is the second in a three-part series I wrote about Bash programming. This article lists all of the Bash logical operators and provides some easy examples for using them. It also discusses five of the seven types of shell expansions and includes easy-to-understand examples that help to clarify how these expansions work. + + + 8. Abhishek Tamrakar shows us how to _[Hone advanced Bash skills by building Minesweeper][5]._ This is an interesting, fun, and informative way to improve the Bash skills you already have. When finished, you have a working command-line game of Minesweeper and some serious skills. This article is one of my favorites because it not only stretches our skills, but it illustrates the power of Bash as a programming language. + + + 7. [_How to program with Bash: Syntax and tools_][6] is the first article in my Bash programming series. In addition to introducing Bash as a programming language, it looks at the basic syntax of Bash programming, the use of variables, and flow control. + + + 6. Matthew Broberg's [_The birth of the Bash shell_][7] delves into the history of the Bash shell with a look at how it all started with Unix and the original (Ken) Thompson shell. As someone who appreciates the historical roots of Linux and many of its components, I gained some new insights from this article. + + + 5. Seth Kenlon contributed _[How to write a loop in Bash][8],_ which explores the _for_ loop in some detail. A _for_ loop is a recipe detailing what actions you want your computer to take for each data object (such as a file) you specify. This article has some excellent examples to get you started and shows the power that loops can bring to Bash scripts. + + + 4. _[7 Bash history shortcuts you will actually use][9]_ shows how to save time on the command line by using Bash shortcuts. Ian Miell describes time-saving tools that go far beyond just simple command-line recall. These are very cool, and I especially like the easy method for reissuing the previous command while reordering the arguments. + + + 3. Seth Kenlon also shows some [_Bash aliases you can't live without_][10] that will save even more time. This article takes us through one of the ways that we "lazy sysadmins" can become even more efficient than we already are. This is all about less typing while getting more results. + + + 2. I always recommend testing scripts to ensure that they do what they are intended to—and that they don't create any other problems while doing so. Darin London introduces us to _[Testing Bash with BATS][11],_ the Bash Automated Testing System, a TAP-compliant testing framework for Bash. The [Test Anything Protocol][12] is also used for testing many other Unix languages. This article is loaded with examples and recommendations for structuring Bash programs so that they can be tested easily with this tool. + + + 1. Our number 1 spot for 2019 is—drum-roll—Seth Kenlon with [_3 command line games for learning Bash the fun way_][13]. Learning is work, but it can be fun. If you are into games (and it seems that we sysadmins like to have fun), this article looks at three tools for learning more about Bash for everyone from noobs to gurus. Everything you do in the game of Bashcrawl, for example, is a valid Bash command that you can use later in real life, and playing the game provides Bash practice because the "game" is made out of actual directories and files on your computer. + + + +These articles can help you learn Bash and some of its many powerful features. I have certainly learned a lot from them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/bash-resources + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/downloads/bash-cheat-sheet +[3]: https://opensource.com/article/19/4/bash-vs-python +[4]: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions +[5]: https://opensource.com/article/19/9/advanced-bash-building-minesweeper +[6]: https://opensource.com/article/19/10/programming-bash-syntax-tools +[7]: https://opensource.com/19/9/command-line-heroes-bash +[8]: https://opensource.com/article/19/6/how-write-loop-bash +[9]: https://opensource.com/article/19/10/bash-history-shortcuts +[10]: https://opensource.com/article/19/7/bash-aliases +[11]: https://opensource.com/article/19/2/testing-bash-bats +[12]: https://testanything.org/producers.html +[13]: https://opensource.com/article/19/10/learn-bash-command-line-games From 9333f151d3e9a6513649b0e5e396d449b90ea924 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 24 Dec 2019 00:58:25 +0800 Subject: [PATCH 236/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191223=20Priori?= =?UTF-8?q?tizing=20simplicity=20in=20your=20Python=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191223 Prioritizing simplicity in your Python code.md --- ...ritizing simplicity in your Python code.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/tech/20191223 Prioritizing simplicity in your Python code.md diff --git a/sources/tech/20191223 Prioritizing simplicity in your Python code.md b/sources/tech/20191223 Prioritizing simplicity in your Python code.md new file mode 100644 index 0000000000..53662a8f1c --- /dev/null +++ b/sources/tech/20191223 Prioritizing simplicity in your Python code.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Prioritizing simplicity in your Python code) +[#]: via: (https://opensource.com/article/19/12/zen-python-simplicity-complexity) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Prioritizing simplicity in your Python code +====== +This is the second part of a special series about the Zen of Python +focusing on the third and fourth principles: simplicity and complexity. +![Person reading a book and digital copy][1] + +> "Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y plus rien à retrancher." +> +> "It seems that perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away." +> —Antoine de Saint-Exupéry, _[Terre des Hommes][2]_, 1939 + +A common concern in programming is the struggle with complexity. It is easy for any programmer to make a program so complicated no expert can debug it or modify it. The [Zen of Python][3] would not be complete if it did not touch on this. + +### Simple is better than complex. + +When it is possible to choose at all, choose the simple solution. Python is rarely in the business of _disallowing_ things. This means it is possible, and even straightforward, to design baroque programs to solve straightforward problems. + +It is worthwhile to remember at each point that simplicity is one of the easiest things to lose and the hardest to regain when writing code. + +This can mean choosing to write something as a function, rather than introducing an extraneous class. This can mean avoiding a robust third-party library in favor of writing a two-line function that is perfect for the immediate use-case. Most often, it means avoiding predicting the future in favor of solving the problem at hand. + +It is much easier to change the program later, especially if simplicity and beauty were among its guiding principles than to load the code down with all possible future variations. + +### Complex is better than complicated. + +This is possibly the most misunderstood principle because understanding the precise meanings of the words is crucial. Something is _complex_ when it is composed of multiple parts. Something is _complicated_ when it has a lot of different, often hard to predict, behaviors. + +When solving a hard problem, it is often the case that no simple solution will do. In that case, the most Pythonic strategy is to go "bottom-up." Build simple tools and combine them to solve the problem. + +This is where techniques like _object composition_ shine. Instead of having a complicated inheritance hierarchy, have objects that forward some method calls to a separate object. Each of those can be tested and developed separately and then finally put together. + +Another example of "building up" is using [singledispatch][4], so that instead of one complicated object, we have a simple, mostly behavior-less object and separate behaviors. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-simplicity-complexity + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://en.wikipedia.org/wiki/Wind,_Sand_and_Stars +[3]: https://www.python.org/dev/peps/pep-0020/ +[4]: https://opensource.com/article/19/5/python-singledispatch From f799306115690661058b3d43bb8a0d1561ca7093 Mon Sep 17 00:00:00 2001 From: XLCYun Date: Tue, 24 Dec 2019 01:06:47 +0800 Subject: [PATCH 237/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190711 DevOps for introverted people.md | 73 ------------------- .../20190711 DevOps for introverted people.md | 72 ++++++++++++++++++ 2 files changed, 72 insertions(+), 73 deletions(-) delete mode 100644 sources/tech/20190711 DevOps for introverted people.md create mode 100644 translated/tech/20190711 DevOps for introverted people.md diff --git a/sources/tech/20190711 DevOps for introverted people.md b/sources/tech/20190711 DevOps for introverted people.md deleted file mode 100644 index da1778573c..0000000000 --- a/sources/tech/20190711 DevOps for introverted people.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( XLCYun ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (DevOps for introverted people) -[#]: via: (https://opensource.com/article/19/7/devops-introverted-people) -[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo) - -DevOps for introverted people -====== -We asked the Opensource.com DevOps team to talk about their experience -as DevOps introverts and to give DevOps extroverts some advice. Here are -their answers. -![Q and A letters][1] - -We asked members of our [DevOps team][2] to talk about their experience as introverts and to give extroverts some advice. Before we get into their responses, though, let’s first define the term. - -### What does being introverted mean? - -Being an introvert is commonly defined as someone who finds it more energy depleting, as opposed to energizing, to be around people. It can be a helpful term when we think about how we recharge: introverted people may require more alone time to recharge, especially after spending a lot of time around groups of people. A big myth about introverts is that they are necessarily shy, but [science suggests][3] that is a separate personality trait. - -Introversion and extraversion were popularized by the [Myers Briggs Type Indicators][4] and are now more commonly referred to as two ends of the same [spectrum][5]. Even though it may seem that there are more extroverted people in the world than introverts, psychologists tend to believe that a majority of us fall along the spectrum closer to [ambiverts or introverts][6]. - -Now, on to the questions and answers. - -### What are some techniques DevOps leaders can use to make sure introverts feel like part of the team and increase their willingness to share ideas? - -"Everyone is a little different, so it’s important to be observant. Someone from GitLab once told me their philosophy is that if you aren’t offering your opinion, then they’re being exclusionary. If someone isn’t offering an opinion in a meeting, then find ways to include them. **When I know an introvert is interested in a topic we’re meeting about, I’ll ask in advance for written input. A lot of meetings can be avoided by moving the discussion to slack or GitLab where introverts are more willing to engage.** In stand-up, everyone gives an update, and introverts seem to do fine in this context. So we sometimes do the same thing in other meetings just to make sure everyone has time to speak. I also encourage introverts to speak in front of small groups either at work or in the community in order to build those skills." —Dan Barker - -"**I think the best thing that anyone ever did for me was to make sure I had the skills necessary to answer the big questions when they came.** As a very young enlisted Air Force member I was giving status briefings to my units’ senior leadership. That required that I have a number of data points available at any given moment as well as the why behind any delays or deviations on the way towards established objectives. That propelled me from a behind the scenes person into being willing to share my opinion and thoughts with others." —Chris Short - -"**Lead through culture. Design and try out a ritual for your co-workers.** You can design a smaller weekly ritual for groups or teams or a bigger yearly event for your department or organization. The point is to try something and observe your leadership role in it. Identify gaps or tensions in your culture. Look back at the beliefs and behaviors of teams. Where do you observe tension? What’s missing from your culture? Start with a simple statement 'I see a tension between X and Y'. Or 'My team is missing Z'. Next, flip the gap or tension into a question: write down 3 'How might we’s (HMWs)'." —Catherine Louis - -"Introverts are not a different class of people, they are either people who think or wait too much before they share their mind or people who have no idea what's going on. I was one among the first category, I thought too much and sometimes worried about what if my opinion is laughed upon or not entertained or thought otherwise. It was hard coming up of that kind of mindset but it was also eating my chances of learning better things. Once, we were discussing in the team about an implementation issue. My then manager asked me one on one, why I am not participating as I am one of the more experienced people on the team, and I opened up (after I gathered all the power in the universe to say something) saying everything I wanted to say was already shared. He suggested 'I could use a repetition sometimes, as there are many things going on, it would be helpful if you just repeat your thought even if it is discussed'. Well, that was not a very persuasive way but that gave me a bit of confidence that someone at-least wants to hear me. - -"Now, the way I used to make people speak in my team, is **I often ask the introvert person for help, even if I know the resolution, and appreciate them in team meetings and discussions to boost up their confidence encouraging them to share more knowledge with the team, by slowly giving them time to come out of their reserved nature**. They may still remain a bit isolated in the outer world but within a team, some emerge a player we can count on." —Abhishek Tamrakar - -"My advice to introverts when participating in conferences is to find friends/colleagues who are also attending so you have people to talk to comfortably, reach out prior to the event to schedule some smaller meetings/meals with other attendees (friends, industry contacts, former colleagues, etc.), **be mindful of your exhaustion level and take care of yourself**: skip the social/evening events if you need to recharge, write about your experience in a post-event retrospective." —Elizabeth Joseph - -### What are some tips for increasing productivity when working with a teammate who tends to be more of an introvert? - -"Productivity is increasingly challenging to really qualify. In many cases, a break from work or a casual conversation can be the spark needed in our creative endeavors. Again, I find slack and GitLab to be very helpful mediums for exchanging ideas and interacting with others when you have introverts on your team. **I also find pair programming to be very useful for most introverts as one on one interactions aren’t usually as taxing but the product quality and efficiency gains are substantial.** However, when an introvert is working alone, everyone on the team should be discouraged from interrupting them. It’s best to send them an email or some non-intrusive medium." —Dan Barker - -"Give them great tools for doing and documenting their work. **Enable them to be the best they can be at their job.** Check in with them frequently enough to make sure they’re on the right track but also be mindful it’s a bigger distraction to them than it is more extroverted people." —Chris Short - -"**Don’t interrupt me when I am heads down.** Really, don’t. It could take me 2 hours minimally to get my brain back to where I was when I was knee deep in something. It feels painful. Really. Instead, email me and ask me to come to a place where there is a whiteboard. Share the problem from the customer's point of view—draw it—not from your point of view. I may have dozens of customer issues niggling in the back of my brain. If your issues sound like 'make me look good to my upper management', it will get less attention from me than the true customer's issues I already have. Draw a picture. Give me time to think. Make sure there is more than one marker in case I am ready to share. Be prepared that your hypothesis about the problem is completely wrong." —Catherine Louis - -"Appreciation and encouragement is the way out, appreciation may not be an appraisal, but an appreciation that encourages people to feel comfortable in presence of more than one living entities, **so that everyone feels heard and not laughed or underrated**." —Abhishek Tamrakar - -### Final thoughts - -The biggest takeaway from our conversations on introverted DevOps enthusiasts is one of equity: Treat people as they need to be treated, and ask people to treat you as you want to be treated. Whether you are extroverted or introverted, we all need to respect the fact that we do not all experience the world in the same way. Our colleagues deserve the space they need to get the work done, and knowing how to support them starts with a discussion on their needs. Our differences are what make our communities so special and it makes our work more useful for more people. The most effective way to communicate with others is to communicate in a style that works well for both of you. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/devops-introverted-people - -作者:[Matthew Broberg][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_QandAorange_520x292_0311LL.png?itok=qa3hHSou (Q and A letters) -[2]: https://opensource.com/devops-team -[3]: https://www.inc.com/melanie-curtin/are-you-shy-or-introverted-science-says-this-is-1-primary-difference.html -[4]: https://www.myersbriggs.org/my-mbti-personality-type/mbti-basics/extraversion-or-introversion.htm?bhcp=1 -[5]: https://lifehacker.com/lets-quit-it-with-the-introvert-extrovert-nonsense-1713772952 -[6]: https://www.psychologytoday.com/us/blog/the-gen-y-guide/201710/the-majority-people-are-not-introverts-or-extroverts diff --git a/translated/tech/20190711 DevOps for introverted people.md b/translated/tech/20190711 DevOps for introverted people.md new file mode 100644 index 0000000000..78ab1667b4 --- /dev/null +++ b/translated/tech/20190711 DevOps for introverted people.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (XLCYun) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevOps for introverted people) +[#]: via: (https://opensource.com/article/19/7/devops-introverted-people) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo) + +内向者的 DevOps +====== +我们请求 Opensource.com 的 DevOps 团队,希望他们能够谈一谈作为 DevOps 内向者的休验,同时给 DevOps 外向者一些建议。下面是他们的回答。 + +![问答][1] + +我们请求我们的 [DevOps 团队][2] 谈一谈他们作为一个内向者的体验,并给外向者们一些建议。但是在我们开始了解他们的回答之前,让我们先来定义一下这些词汇。 + +### “内向者”是什么意思? + +内向者通常指的是一部分人群,当他们和别人相处的时候,会使他们的能量耗尽,而不是激发他们更多的能量。当我们思考我们是如何恢复能量时,这是一个非常有用的词汇:内向者通常需要更多的独处时间来恢复能量,特别是和一群人在一起很长时间后。关于内向者的一个非常大的误解就是他们一定是“害羞的”,但是科学表明,那不过是另一种不同的性格特征。 + +内向性与外向性是通过 [Myers Briggs 类型指标][4] 而为人所知的,现在也常常被称作一个 [光谱][5] 的两端。虽然这个世界看起来好像外向者比内向者要多,但是心理学者则倾向于认为大部分人在光谱上的位置是落在 [中间性格或偏内向性格的][6]。 + +现在,我们来看看问答。 + +### DevOps 技术主管可以通过哪些方式来让内向者感觉他们是团队的一部分并且愿意分享他们的想法? + +“每个人都会不大一样,所以观察敏锐就很重要了。从 GitLab 过来的一个人告诉我,他们的哲学就是如果他们没有提供任何意见,那么他们就是被排除在外的。如果有人在一个会议上没有提供任何的意见,那就想办法让他们加入进来。**当我知道一个内向者对我们将要讨论的会议论题感兴趣的时候,我会提前请他写一些书面文本。有非常多的会议其实是可以避免的,只要通过把讨论放到 Slack 或者 GitLab 上就行了,内向者会更愿意参与进来**。在站立会议中,每个人都会交代最新的进展,在这个环境下,内向者表现得很好。有时候我们在其实会议上会重复做一些事情,仅仅是为了保证每个人都有时间发言。我同时也会鼓励内向者在工作小组或者社区小组面前发言,以此来锻炼他们的这些技能。—— 丹·巴克 + +“**我觉得别人对我做的最好的事情,就是他们保证了当重大问题来临的时候,我拥有必要的技能去回答它**。彼时,我作为一名非常年轻的入伍空军的一员,我需要给我们部队的高级领导做状态简报的汇报。我必须在任何时候都有一些可用的数据点,以及在实现我们确立的目标的过程中,产生延误以及偏差的背后的原因。那样的经历推动着我从一个“幕后人员”逐渐变得更加愿意和别人分享自己的观点和想法。 + +“**通过文化去领导。为你的同僚一起设计和尝试仪式。**你可以为给你的小组或团队设计一个小的每周仪式,甚至给你的部门或组织设计一个年度的大仪式。它的意义在于去尝试一些事物,并观察你在其中的领导角色。去找到你们文化当中的代沟以及对立。回顾团队的信仰和行为。你能从哪里观察到对立?你们的文化中缺失了什么?从一个小陈述开始‘我从 X 和 Y 之间看到了对立’,或者‘我的团队缺少了 Z’。接着,将代沟与对立转换为问题:写下三个‘我们如何能……(How might we's, HMWs)’。”——凯瑟琳·路易斯 + +“内向者不是一个不同的群体,他们要么是在分享他们的想法之前想得太多或等得太久的一些人,要么就是一些根本不知道发生了什么的人。我就是第一种,我想太多了,有时候还担心我的意见会被其他人嘲笑,或者没有什么意思,或者想偏了。形成那样的思维方式很难,但它同时也在吞噬着我学习更好事物的机会。有一次,我们团队在讨论一个实现问题。我当时的老大一次又一次地问我,为什么我没有作为团队中更具经验的人参与进来,然后我就(集齐了全宇宙的力量之后)开口说我想说的大家都已经说过了。他说,有时候我可以重复说一次,事情纷繁,如果你能够重复一遍你的想法,即使它已经被讨论过了,也会大有裨益。好吧,虽然它不是一种特别信服的方式,但是我知道了至少有人想听听我怎么说,它给了我一点信心。 + +“现在,我所使用的让团队中的人发言的方法是**我经常向内向的人求助,即使我知道解决方法,并且在团队会议和讨论中感谢他们来建立他们的自信心,通过给他们时间让他们一点一点的从他们寡言的本性中走出来,从而跟团队分享很多的知识**。他们在外面的世界中可能仍然会有一点点孤立,但是在团队里面,有些会成为我们可以信赖的人。——阿布希什克·塔姆拉卡尔 + +“我给参加会议的内向者的建议是,找一个同样要参加会议的朋友或者同事,这样到时你就会有人可以跟你一起舒服地交谈,在会议开始之前,提前跟其他的与会者(朋友,行业联系人,前同事等等)约着见个面或者吃顿饭,**要注意你的疲劳程度,并且照顾好自己**:如果你需要重新恢复能量,就跳过那些社交或者夜晚的活动,在事后回顾中记录一下自己的感受。”——伊丽莎白·约瑟夫 + +### 和一个内向者倾向的同事一起工作时,有什么提高生产效率的小建议? + +“在保证质量时,生产效率会越来越具备挑战性。在大多数时候,工作中的一个小憩或者轻松随意的交谈,可能正是我们的创造性活动中需要的一个火花。再说一次,我发现当你的团队中有内向者时, Slack 和 Github 会是一个非常有用的用于交换想法以及和其他人互动的媒介。**我同时也发现,结对编程对于大部分的内向者也非常有用,虽然一对一的交流对于他们来说,并不像交税那么频繁,但是生产质量和效率的提升却是重大的**。但是,当一个内向者在独自工作的时间,团队中的所有人都不应该去打断他们。最好是发个邮件,或者使用没有那么强的侵入性的媒介。——丹·巴克 + +“给他们趁手的工具,让他们工作并归档他们的工作。**让他们能够在他们的工作上做到最好**。要足够经常地去检查一下,保证他们没有走偏路,但是要记住,相比外向者而言,这样做是更大的一种让人分心的困扰。 + +“**当我低着头的时候,不要打断我。真的,别打断我**!当我沉浸在某件事物中时,这样做会造成我至少需要花费两个小时,才能让我的大脑重新回到之前的状态。感觉很痛苦。真的。你可以发个邮件让我去有白板的地方。然后从客户的角度而不是你的角度——通过画图的方式——分享下有什么问题。要知道,可能同时会有十几个客户问题缠绕在我的脑海中,如果你的问题听起来就是“这样子做会让我在我的领导面前显得很好”的那一类问题,那么相比我脑袋中已经有的真正的客户问题而言,它不会得到更多的关注的。画个图,给我点时间思考。当我准备分享我的看法的时候,保证有多支马克笔可以使用。准备好接受你对问题的假设有可能完全是错误的。”——凯瑟琳·路易斯 + +“感谢和鼓励就是解决的方法,感谢可能不是一份工作评估,但是感谢能让人舒服地感受到自己并不仅仅是一个活着的独立实体,**因而每个人都能够感觉到自己是被倾听的,而不是被嘲笑或者低估的**。”——阿布希什克·塔姆拉卡尔 + +### 结语 + +在与内向的 DevOps 爱好者的这次交谈中,我们最大的启迪就是平等:其他人需要被怎样对待,就怎样对待他们,同时你想被怎样对待,就去要求别人怎样对待你。无论你是内向还是外向,我们都需要承认我们并非全以相同的一种方式体验这个世界。我们的同事应当被给予足够的空间以完成他们的工作,通过讨论他们的需求作为了解如何支持他们的开始。我们的差异正是我们的社区如此特别的原因,它让我们的工作对更多的人更加的有用。与别人沟通最有效的方式,就是对于你们两者而言都可行的方式。 + +-------------------------------------------------------------------------------- + +转载自: https://opensource.com/article/19/7/devops-introverted-people + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[XLCYun](https://github.com/XLCYun) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_QandAorange_520x292_0311LL.png?itok=qa3hHSou (Q and A letters) +[2]: https://opensource.com/devops-team +[3]: https://www.inc.com/melanie-curtin/are-you-shy-or-introverted-science-says-this-is-1-primary-difference.html +[4]: https://www.myersbriggs.org/my-mbti-personality-type/mbti-basics/extraversion-or-introversion.htm?bhcp=1 +[5]: https://lifehacker.com/lets-quit-it-with-the-introvert-extrovert-nonsense-1713772952 +[6]: https://www.psychologytoday.com/us/blog/the-gen-y-guide/201710/the-majority-people-are-not-introverts-or-extroverts From 37730c659bf00ccedb52cce84909fb5bdf83c9a1 Mon Sep 17 00:00:00 2001 From: XLCYun Date: Tue, 24 Dec 2019 01:07:26 +0800 Subject: [PATCH 238/676] Update 20190711 DevOps for introverted people.md --- translated/tech/20190711 DevOps for introverted people.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190711 DevOps for introverted people.md b/translated/tech/20190711 DevOps for introverted people.md index 78ab1667b4..8422b1fb87 100644 --- a/translated/tech/20190711 DevOps for introverted people.md +++ b/translated/tech/20190711 DevOps for introverted people.md @@ -9,7 +9,7 @@ 内向者的 DevOps ====== -我们请求 Opensource.com 的 DevOps 团队,希望他们能够谈一谈作为 DevOps 内向者的休验,同时给 DevOps 外向者一些建议。下面是他们的回答。 +我们邀请 Opensource.com 的 DevOps 团队,希望他们能够谈一谈作为 DevOps 内向者的休验,同时给 DevOps 外向者一些建议。下面是他们的回答。 ![问答][1] From 5c6f3915ce8c8d2cf6a7b90e694e3758164d2173 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 24 Dec 2019 08:49:52 +0800 Subject: [PATCH 239/676] translated --- ...etro Apple desktop with the Linux MLVWM.md | 220 ------------------ ...etro Apple desktop with the Linux MLVWM.md | 218 +++++++++++++++++ 2 files changed, 218 insertions(+), 220 deletions(-) delete mode 100644 sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md create mode 100644 translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md diff --git a/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md b/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md deleted file mode 100644 index 4090744fb8..0000000000 --- a/sources/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md +++ /dev/null @@ -1,220 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Build a retro Apple desktop with the Linux MLVWM) -[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Build a retro Apple desktop with the Linux MLVWM -====== -This article is part of a special series of 24 days of Linux desktops. -What if old-school Apple computers were built around open source POSIX? -You can find out by building the Macintosh-like Virtual Window Manager. -![Person typing on a 1980's computer][1] - -Imagine traveling into an alternate history where the Apple II GS and MacOS 7 were built upon open source [POSIX][2], using all the same conventions as modern Linux, like plain-text configuration files and modular system design. What would such an OS have enabled for its users? You can answer these questions (and more!) with the [Macintosh-like Virtual Window Manager (MLVWM)][3]. - -![MLVWM running on Slackware 14.2][4] - -### Installing MLVWM - -MLVWM is not an easy installation, and it's probably not in your distribution's software repository. If you have the time to decipher a poorly translated README file, edit some configuration files, gather and resize some old **.xpm** images, and edit an Xorg preference or two, then you can experience MLVWM. Otherwise, this is a novelty window manager with its latest release back in 2000. - -To compile MLVWM, you must have **imake** installed, which provides the **xmkmf** command. You can install imake from your distribution's software repository, or get it directly from [Freedesktop.org][5]. Assuming you have the **xmkmf** command, change into the directory containing the MLVWM source code, and run these commands to build it: - - -``` -$ xmkmf -a -$ make -``` - -After building, the compiled **mlvwm** binary is located in the **mlvwm** directory. Move it to any location [in your path][6] to install it: - - -``` -`$ mv mlvwm/mlvwm /usr/local/bin/` -``` - -#### Editing the config files - -MLVWM is now installed, but it won't launch correctly without adjusting several configuration files and carefully arranging required image files. Sample config files are located in the **sample_rc** directory of the source code you downloaded. Copy the files **Mlvwm-Netscape** and **Mlvwm-Xterm** to your home directory: - - -``` -`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME` -``` - -Move the **Mlvwmrc** file to **$HOME/.mlvwmrc** (yes, you must use a lower-case "m" even though the sample file deceptively begins with a capital letter): - - -``` -`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc` -``` - -Open **.mlwmrc** and find lines 54–55, which define the path (the "IconPath") for the pixmap images that MLVWM uses in its menus and UI: - - -``` -# Set icon search path. It needs before "Style". -IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap -``` - -Adjust the path to match a directory you will fill with your own images (I suggest using **$HOME/.local/share/pixmaps**). MLVWM doesn't provide pixmaps, so it's up to you to provide pixmap icons for the desktop you're building. - -Do this even if you have pixmaps located elsewhere on your system (such as **/usr/share/pixmaps**), because you're going to have to adjust the size of the pixmaps, and you probably don't want to do that on a system-wide level. - - -``` -# Set icon search path. It needs before "Style". -IconPath /home/seth/.local/share/pixmaps -``` - -#### Choosing the pixmaps - -You've defined the **.local/share/pixmaps** directory as the source of pixmaps, but neither the directory nor the images exist yet. Create the directory: - - -``` -`$ mkdir -p $HOME/.local/share/pixmaps` -``` - -Right now, the config file assigns images to menu entries and UI elements, but none of those images exist on your system. To fix this, read through the configuration file and locate every **.xpm** image. For each image listed in the config, add an image with the same file name (or change the file name in the config file) to your IconPath directory. - -The **.mlvwmrc** file is well commented, so you can get a general idea of what you're editing. This is just a first pass, anyway. You can always come back and change the look of your desktop later. - -Here are some examples. - -This code block sets the icon in the upper-left corner of the screen: - - -``` -# Register the menu -Menu Apple, Icon label1.xpm, Stick -``` - -The **label1.xpm** image is actually provided in the source code download's **pixmap** directory, but I prefer to use **Penguin.xpm** from **/usr/share/pixmaps** (on Slackware). Whatever you use, you must place your custom pixmap in **~/.local/share/pixmaps** and either change the pixmap's name in the configuration or rename the pixmap file to match what's currently in the config file. - -This code block defines the applications listed in the left menu: - - -``` -"About this Workstation..." NonSelect, Gray, Action About -"" NonSelect -"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls -"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm -"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm -END -``` - -By following the same syntax as what you see in the configuration file, you can customize the pixmaps and add your own applications to the menu (for instance, I changed **mule** to **emacs**). This is your gateway to your applications in the MLVWM GUI, so list everything you want quick access to. You may also wish to include a shortcut to your **/usr/share/applications** folder. - - -``` -`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications` -``` - -Once you're finished editing the configuration file and adding your own images to your IconPath directory, your pixmaps must all be resized to roughly 16x16 pixels. (MLVWM isn't consistent in its defaults, so there's room for variation.) You can do this as a bulk action using ImageMagick: - - -``` -`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done` -``` - -### Starting MLVWM - -The easiest way to get up and running with MLVWM is to let Xorg do the bulk of the work. First, you must create a **$HOME/.xinitrc** file. I borrowed this one from Slackware, which borrowed it from Xorg: - - -``` -#!/bin/sh -# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $ - -userresources=$HOME/.Xresources -usermodmap=$HOME/.Xmodmap -sysresources=/etc/X11/xinit/.Xresources -sysmodmap=/etc/X11/xinit/.Xmodmap - -# merge in defaults and keymaps - -if [ -f $sysresources ]; then -    xrdb -merge $sysresources -fi - -if [ -f $sysmodmap ]; then -    xmodmap $sysmodmap -fi - -if [ -f $userresources ]; then -    xrdb -merge $userresources -fi - -if [ -f $usermodmap ]; then -    xmodmap $usermodmap -fi - -# Start the window manager: -if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then -  exec ck-launch-session /usr/local/bin/mlvwm -else -  exec /usr/local/bin/mlvwm -fi -``` - -According to this file, the default action for the **startx** command is to launch MLVWM. However, your distribution may have other ideas about what happens when your graphic server launches (or is killed to be restarted), so this file may do you little good. On many distributions, you can add a **.desktop** file to **/usr/share/xsessions** to have it listed in the GDM or KDM menu, so create a file called **mlvwm.desktop** and enter this text: - - -``` -[Desktop Entry] -Name=Mlvwm -Comment=Macintosh-like virtual window manager -Exec=/usr/local/bin/mlvwm -TryExec=ck-launch-session /usr/local/bin/mlvwm -Type=Application -``` - -Log out from your desktop session and log back into MLVWM. By default, your session manager (KDM, GDM, or LightDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -With GDM: - -![][7] - -With SDDM: - -![][8] - -#### Launching with brute force - -If MLVWM fails to start, try installing XDM, a lightweight session manager that doesn't look at **/usr/share/xsessions** and instead just does whatever the authenticated user's **.xinitrc** proscribes. - -![MLVWM][9] - -### Build your own retro Apple - -The MLVWM desktop is unpolished, imperfect, accurate, and loads of fun. Many of the menu options you see are unimplemented, but you can make them active and meaningful. - -This is your chance to step back in time, change history, and make the old-school Apple line of computers a bastion of open source. Be a revisionist, design your own retro Apple desktop, and, most importantly, have fun. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/linux-mlvwm-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) -[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains -[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html -[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2) -[5]: http://cgit.freedesktop.org/xorg/util/imake -[6]: https://opensource.com/article/17/6/set-path-linux -[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg -[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg -[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM) diff --git a/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md b/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md new file mode 100644 index 0000000000..6b43924213 --- /dev/null +++ b/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md @@ -0,0 +1,218 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a retro Apple desktop with the Linux MLVWM) +[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Linux MLVWM 打造复古苹果桌面 +====== +本文是 24 天 Linux 桌面特别系列的一部分。如果老式的苹果电脑用开源 POSIX 构建如何?你可以通过构建类 Macintosh 虚拟窗口管理器来实现。 +![Person typing on a 1980's computer][1] + +想象一下进入另外一个历史,Apple II GS 和 MacOS 7 是基于开源 [POSIX][2] 构建的,它使用了与现代 Linux 相同的所有约定,例如纯文本配置文件和模块化系统设计。这样的操作系统将为其用户带来什么?你可以使用[类 Macintosh 虚拟窗口管理器(MLVWM)][3]来回答这些问题(甚至更多!)。 + +![MLVWM running on Slackware 14.2][4] + +### 安装 MLVWM + +MLVWM 安装并不容易,并且可能不在发行版的软件仓库中。如果你有时间理解翻译不佳的 README 文件,编辑一些配置文件,收集并调整一些旧的 **.xpm**图像,编辑一两个 Xorg 选项,那么你就可以体验 MLVWM。否则,这是一个新奇的窗口管理器,其最新版本可以追溯到 2000 年。 + + +要编译 MLVWM,你必须安装 **imake**,它提供 **xmkmf** 命令。你可以从发行版的软件仓库中安装 imake,也可以直接从 [Freedesktop.org][5] 获得。假设你已经有 **xmkmf**命令,请进入包含 MLVWM 源码的目录,然后运行以下命令进行构建: + + +``` +$ xmkmf -a +$ make +``` + +构建后,编译后的 **mlvwm** 二进制文件位于 **mlvwm** 目录中。将其移动到[你的 PATH ][6]的任何位置: + + +``` +`$ mv mlvwm/mlvwm /usr/local/bin/` +``` + +#### 编辑配置文件 + +现在已经安装 MLVWM,但是如果不调整几个配置文件并仔细排列所需的图像文件,它将无法正确启动。示例配置文件位于你下载的源代码的 **sample_rc** 目录中。将文件 **Mlvwm-Netscape** 和 **Mlvwm-Xterm** 复制到你的主目录: + + +``` +`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME` +``` + +将 **Mlvwmrc** 移动到 **$HOME/.mlvwmrc**(是的,即使示例文件的名称看似是大写字母,但你也必须使用小写的 “m”): + + +``` +`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc` +``` + +打开 **.mlwmrc** 并找到第 54-55 行,它们定义了 MLVWM 在菜单和 UI 中使用的像素图的路径(“IconPath”): + + +``` +# Set icon search path. It needs before "Style". +IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap +``` + +调整路径以匹配你填充图像的路径(我建议使用 **$HOME/.local/share/pixmaps**)。MLVWM 不提供像素图,因此需要你提供构建桌面所需图标。 + +即使你有位于系统其他位置的像素图(例如 **/usr/share/pixmaps**)),也要这样做,因为你需要调整像素图的大小,你可能也不想在系统范围内执行此操作。 + + +``` +# Set icon search path. It needs before "Style". +IconPath /home/seth/.local/share/pixmaps +``` + +#### 选择像素图 + +你已将 **.local/share/pixmaps** 目录定义为像素图源路径,但是该目录和图像均不存在。创建目录: + + +``` +`$ mkdir -p $HOME/.local/share/pixmaps` +``` + +现在,配置文件将图像分配给菜单项和 UI 元素,但是系统中不存在这些图像。要解决此问题,请通读配置文件并找到每个 **.xpm** 图像。对于配置中列出的每个图像,将具有相同文件名的图像(或更改配置文件中的文件名)添加到你的 IconPath 目录。 + +**.mlvwmrc** 文件的注释很好,因此你可以大致了解要编辑的内容。无论如何,这只是第一步。你可以随时回来更改桌面外观。 + +这有些例子 + +此代码块设置屏幕左上角的图标: + +``` +# Register the menu +Menu Apple, Icon label1.xpm, Stick +``` + +**label1.xpm** 图像实际上在源代码的 **pixmap**目录中,但我更喜欢使用来自 **/usr/share/pixmaps** 的 **Penguin.xpm**(在 Slackware 上)。无论使用什么,都必须将自定义像素图放在 **~/.local/share/pixmaps** 中,并在配置中更改像素图的名称,或者重命名像素图以匹配配置文件中当前的名称。 + +此代码块定义了左侧菜单中列出的应用: + + +``` +"About this Workstation..." NonSelect, Gray, Action About +"" NonSelect +"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls +"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm +"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm +END +``` + +通过遵循与配置文件中相同的语法,你可以自定义像素图并将自己的应用添加到菜单中(例如,我将 **mule** 更改为 **emacs**)。 这是你在 MLVWM GUI 中打开应用的入口,因此请列出你要快速访问的所有内容。你可能还希望包括指向 **/usr/share/applications** 文件夹的快捷方式。 + + +``` +`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications` +``` + +完成编辑配置文件并将自己的图像添加到 IconPath 目录后,必须将所有像素图的大小都调整为大约 16x16 像素。(MLVWM 的默认设置不一致,因此存在变化空间。)你可以使用 ImageMagick 进行批量操作: + + +``` +`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done` +``` + +### 启动 MLVWM + +最简单的运行 MLVWM 的方式是让 Xorg 完成大部分工作。首先,你必须创建一个 **$HOME/.xinitrc** 文件。我从 Slackware 复制了这个,它也是从 Xorg 来的: + + +``` +#!/bin/sh +# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $ + +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +sysresources=/etc/X11/xinit/.Xresources +sysmodmap=/etc/X11/xinit/.Xmodmap + +# merge in defaults and keymaps + +if [ -f $sysresources ]; then +    xrdb -merge $sysresources +fi + +if [ -f $sysmodmap ]; then +    xmodmap $sysmodmap +fi + +if [ -f $userresources ]; then +    xrdb -merge $userresources +fi + +if [ -f $usermodmap ]; then +    xmodmap $usermodmap +fi + +# Start the window manager: +if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then +  exec ck-launch-session /usr/local/bin/mlvwm +else +  exec /usr/local/bin/mlvwm +fi +``` + +根据此文件,**startx** 命令的默认操作是启动 MLVWM。但是,你的发行版可能对于图形服务器启动(或被终止重新启动)时会发生的情况有其他做法,因此此文件可能对你没有什么帮助。在许多发行版上,你可以添加 **.desktop** 文件到 **/usr/share/xsessions** 中,以将其列在 GDM 或 KDM 菜单中,因此创建名为 **mlvwm.desktop** 的文件并输入: + + +``` +[Desktop Entry] +Name=Mlvwm +Comment=Macintosh-like virtual window manager +Exec=/usr/local/bin/mlvwm +TryExec=ck-launch-session /usr/local/bin/mlvwm +Type=Application +``` + +从桌面会话注销并重新登录到 MLVWM。默认情况下,会话管理器(KDM、GDM 或 LightDM,具体取决于你的设置)将继续登录到以前的桌面,因此在登录之前必须覆盖它。 + +对于 GDM: + +![][7] + +对于 SDDM: + +![][8] + +#### 强制启动 + +如果 MLVWM 无法启动,请尝试安装 XDM,这是一个轻量级会话管理器,它不会查询 **/usr/share/xsessions** 的内容,而是执行经过身份验证用户的所有 **.xinitrc** 操作。 + +![MLVWM][9] + +### 打造自己的复古苹果 + +MLVWM 桌面未经打磨、不完美、准确且充满乐趣。你看到的许多菜单项都是未实现的,但你可以使它们变得活跃且有意义。 + +这是一次让你时光倒流,改变历史,让老式苹果系列电脑成为开源堡垒的机会。成为一名修正主义者,设计你自己的复古苹果桌面,最重要的是,它有乐趣。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-mlvwm-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html +[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2) +[5]: http://cgit.freedesktop.org/xorg/util/imake +[6]: https://opensource.com/article/17/6/set-path-linux +[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg +[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg +[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM) From 2ca34652033b536aeff239cc7de84b452ad41686 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 24 Dec 2019 08:55:03 +0800 Subject: [PATCH 240/676] translating --- ...0 Why Vim fans love the Herbstluftwm Linux window manager.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md index 94f7ecc281..47218849e3 100644 --- a/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md +++ b/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5080ddb0f1c6b80b8b1bc90dfba8eac67864b8a0 Mon Sep 17 00:00:00 2001 From: runningwater Date: Tue, 24 Dec 2019 14:23:26 +0800 Subject: [PATCH 241/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E7=94=B3=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Create and manage MacOS LaunchAgents using Go.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sources/tech/20180130 Create and manage MacOS LaunchAgents using Go.md b/sources/tech/20180130 Create and manage MacOS LaunchAgents using Go.md index 8bd6b8bf64..b9a477824c 100644 --- a/sources/tech/20180130 Create and manage MacOS LaunchAgents using Go.md +++ b/sources/tech/20180130 Create and manage MacOS LaunchAgents using Go.md @@ -1,3 +1,12 @@ +[#]: collector: (lujun9972) +[#]: translator: (runningwater) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create and manage MacOS LaunchAgents using Go) +[#]: via: (https://ieftimov.com/post/create-manage-macos-launchd-agents-golang/) +[#]: author: (https://ieftimov.com/about) + Create and manage MacOS LaunchAgents using Go ============================================================ @@ -287,7 +296,7 @@ This is where I write about software development, programming languages and ever via: https://ieftimov.com/create-manage-macos-launchd-agents-golang 作者:[Ilija Eftimov ][a] -译者:[译者ID](https://github.com/译者ID) +译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -302,4 +311,4 @@ via: https://ieftimov.com/create-manage-macos-launchd-agents-golang [7]:https://golang.org/x/sys [8]:https://docs.google.com/document/d/1QXzI9I1pOfZPujQzxhyRy6EeHYTQitKKjHfpq0zpxZs/edit [9]:https://golang.org/x/sys -[10]:https://github.com/jteeuwen/go-bindata \ No newline at end of file +[10]:https://github.com/jteeuwen/go-bindata From 37f47e3b9e3885b2fe549d2ea20674b9ae656efc Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 24 Dec 2019 16:58:04 +0800 Subject: [PATCH 242/676] translating --- .../20191221 Customize your Linux desktop with KDE Plasma.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md b/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md index 0baaf4747a..0fe21db27b 100644 --- a/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md +++ b/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 708e13d6d7052ecf43d395a3bb359f94f2cb3197 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 24 Dec 2019 23:32:39 +0800 Subject: [PATCH 243/676] PRF @robsean --- ...d 8.1 Oreo on Linux To Run Apps - Games.md | 111 +++++++++--------- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md b/translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md index c8263bd9e0..e9b05a8757 100644 --- a/translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md +++ b/translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Install Android 8.1 Oreo on Linux To Run Apps & Games) [#]: via: (https://fosspost.org/tutorials/install-android-8-1-oreo-on-linux) [#]: author: (Python Programmer;Open Source Software Enthusiast. Worked On Developing A Lot Of Free Software. The Founder Of Foss Post;Foss Project. Computer Science Major. ) -在 Linux 上安装 Android 8.1 Oreo 来运行应用程序和游戏 +在 Linux 上安装安卓 8.1 Oreo 来运行应用程序和游戏 ====== ![](https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/android-8.1-oreo-x86-on-linux.png?resize=1237%2C527&ssl=1) -[android x86][1] 是一个自由开放源码的项目,将谷歌制作的android系统从 ARM 架构移植到 x86 架构, 运行用户在他们的桌面机器上运行 android 系统来享受所有的 android 功能和应用程序及游戏。 +[android x86][1] 是一个自由而开源的项目,将谷歌制作的安卓系统从 ARM 架构移植到了 x86 架构,可以让用户在他们的桌面电脑上运行安卓系统来享受所有的安卓功能和应用程序及游戏。 -几周前,android x86 项目完成 android 8.1 Oreo 系统到 x86 架构的移植。在这篇文章中,我们将解释如何在你的 Linux 系统上安装它,以便你能够随时使用你的 android 应用程序和游戏。 +在前一段时间,android x86 项目完成了安卓 8.1 Oreo 系统的 x86 架构移植。在这篇文章中,我们将解释如何在你的 Linux 系统上安装它,以便你能够随时使用你的安卓 用程序和游戏。 -### 在 Linux 上安装 Android x86 8.1 Oreo +### 在 Linux 上安装安卓 x86 8.1 Oreo #### 准备环境 -首先,让我们下载 android x86 8.1 Oreo 系统镜像。你可以从[这个页面][2]下载它,只需单击 android-x86_64-8.1-r1.iso 文件下 “View” 按钮。 +首先,让我们下载 android x86 8.1 Oreo 系统镜像。你可以从[这个页面][2]下载它,只需单击 “android-x86_64-8.1-r1.iso” 文件下的 “View” 按钮。 -我们将在我们的 Linux 系统上使用 QEMU 来运行 android x86 。QEMU 是一个非常好的模拟器软件,它也是自由和开放源码的,并且在所有主要的 Linux 发行版存储库中都是可用的。 +我们将在我们的 Linux 系统上使用 QEMU 来运行 android x86。QEMU 是一个非常好的模拟器软件,它也是自由而开源的,并且在所有主要的 Linux 发行版存储库中都是可用的。 在 Ubuntu/Linux Mint/Debian 上安装 QEMU: @@ -36,115 +36,115 @@ sudo apt-get install qemu qemu-kvm libvirt-bin sudo dnf install qemu qemu-kvm ``` -对于其它发行版,只需要搜索 qemu 和 qemu-kvm 软件包,并安装它们。 +对于其它发行版,只需要搜索 “qemu” 和 “qemu-kvm” 软件包,并安装它们。 -在你安装 QEMU 后,我们将需要运行下面的命令来创建 android.img 文件,它就像某种分配给 android 系统的磁盘空间。所有 android 文件和系统都将位于该镜像文件中: +在你安装 QEMU 后,我们将需要运行下面的命令来创建 `android.img` 文件,它就像某种分配给安卓系统的磁盘空间。所有安卓文件和系统都将位于该镜像文件中: ``` qemu-img create -f qcow2 android.img 15G ``` -我们在这里说,我们想为 android 分配一个最大 15GB 的磁盘空间,但是,你可以更改它到你想要的任意大小(确保它至少大于5GB)。 +我们在这里的意思是,我们想为该安卓系统分配一个最大 15GB 的磁盘空间,但是,你可以更改它到你想要的任意大小(确保它至少大于 5GB)。 -现在,首次启动运行 android 系统,运行: +现在,首次启动运行该安卓系统,运行: ``` sudo qemu-system-x86_64 -m 2048 -boot d -enable-kvm -smp 3 -net nic -net user -hda android.img -cdrom /home/mhsabbagh/android-x86_64-8.1-r1.iso ``` -将 /home/mhsabbagh/android-x86_64-8.1-r1.iso 替换为你从 android x86 网站下载的文件的路径。我们在这里正在使用的其它选项的解释,你可以参考[这篇文章][3]。 +将 `/home/mhsabbagh/android-x86_64-8.1-r1.iso` 替换为你从 android x86 网站下载的文件的路径。关于我们在这里正在使用的其它选项的解释,你可以参考[这篇文章][3]。 -在你运行上面的命令后,android 系统将启动: +在你运行上面的命令后,该安卓系统将启动: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 39 android 8.1 oreo on linux][4] +![][4] #### 安装系统 从这个窗口中,选择 “Advanced options”, 它将引导到下面的菜单,你应如下在其中选择 “Auto_installation” : -![Install Android 8.1 Oreo on Linux To Run Apps & Games 41 android 8.1 oreo on linux][5] +![][5] -在这以后,安装器将告知你是否想要继续,选择 Yes : +在这以后,安装器将告知你是否想要继续,选择 “Yes”: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 43 android 8.1 oreo on linux][6] +![][6] 接下来,安装器将无需你的指示而继续进行: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 45 android 8.1 oreo on linux][7] +![][7] -最后,你将收到这个信息,它表示你已经成功安装 android 8.1 : +最后,你将收到这个信息,它表示你已经成功安装安卓 8.1 : -![Install Android 8.1 Oreo on Linux To Run Apps & Games 47 android 8.1 oreo on linux][8] +![][8] -现在,完全关闭 QEMU 窗口。 +现在,关闭 QEMU 窗口即可。 -#### 启动和使用 Android 8.1 Oreo +#### 启动和使用 安卓 8.1 Oreo -现在,android 系统已经完全安装在你的 android.img 文件中,你应该使用下面的 QEMU 命令来启动它,而不是前面的命令: +现在,安卓系统已经完全安装在你的 `android.img` 文件中,你应该使用下面的 QEMU 命令来启动它,而不是前面的命令: ``` sudo qemu-system-x86_64 -m 2048 -boot d -enable-kvm -smp 3 -net nic -net user -hda android.img ``` -注意,我们所做的只是移除 -cdrom 选项和它的参数。这是告诉 QEMU ,我们不再想从我们下载的 ISO 文件启动,相反,从安装的 android 系统启动。 +注意,我们所做的只是移除 `-cdrom` 选项及其参数。这是告诉 QEMU,我们不再想从我们下载的 ISO 文件启动,相反,从这个安装的安卓系统启动。 -你现在能够看到 android 启动菜单: +你现在能够看到安卓的启动菜单: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 49 android 8.1 oreo on linux][9] +![][9] -然后,你将带去第一个准备向导,选择你的语言并继续: +然后,你将进入第一个准备向导,选择你的语言并继续: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 51 android 8.1 oreo on linux][10] +![][10] 从这里,选择 “Set up as new” 选项: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 53 android 8.1 oreo on linux][11] +![][11] -然后,android 将询问你是否想登陆到你当前的谷歌账号。这步骤是可选的,但是这很重要,以便你随后可以使用 Play Store : +然后,安卓将询问你是否想登录到你当前的谷歌账号。这步骤是可选的,但是这很重要,以便你随后可以使用谷歌 Play 商店: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 55 android 8.1 oreo on linux][12] +![][12] 然后,你将需要接受条款: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 57 android 8.1 oreo on linux][13] +![][13] 现在,你可以选择你当前的时区: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 59 android 8.1 oreo on linux][14] +![][14] -系统将询问你是否想启动一些数据收集功能。如果我是你的话,我将简单地关闭它们,像这样: +系统将询问你是否想启动一些数据收集功能。如果我是你的话,我将简单地全部关闭它们,像这样: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 61 android 8.1 oreo on linux][15] +![][15] 最后,你将有两种启动类型可供选择,我建议你选择 Launcher3 选项,并使其成为默认项: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 63 android 8.1 oreo on linux][16] +![][16] -然后,你将看到完整工作的 android 系统主屏幕: +然后,你将看到完整工作的安卓系统主屏幕: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 65 android 8.1 oreo on linux][17] +![][17] -从现在起,你可以做你想做的任何事情;你可以使用内置的 android 应用程序,或者你可以浏览你是系统设置来根据你的喜好进行调整。你可以更改你的系统的外观和体验,或者你可以像示例一样运行 Chrome : +从现在起,你可以做你想做的任何事情;你可以使用内置的安卓应用程序,或者你可以浏览你的系统设置来根据你的喜好进行调整。你可以更改你的系统的外观和体验,或者你可以像示例一样运行 Chrome : -![Install Android 8.1 Oreo on Linux To Run Apps & Games 67 android 8.1 oreo on linux][18] +![][18] -你可以从 Google Play store 开始安装一些应用程序程序,像 WhatsApp 和其它的应用程序,以供你自己使用: +你可以开始从谷歌 Play 商店安装一些应用程序程序,像 WhatsApp 和其它的应用程序,以供你自己使用: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 69 android 8.1 oreo on linux][19] +![][19] 你现在可以用你的系统做任何你想做的事。恭喜! -### 以后如何轻松地运行 Android 8.1 Oreo +### 以后如何轻松地运行安卓 8.1 Oreo -我们不想总是不得不打开终端窗口,并写那些长长的 QEMU 命令来运行 android 系统,相反,我们想在我们需要时一次单击就运行它。 +我们不想总是不得不打开终端窗口,并写那些长长的 QEMU 命令来运行安卓系统,相反,我们想在我们需要时一次单击就运行它。 -为此,我们将使用下面的命令在 /usr/share/applications 下创建一个名为 android.desktop 的新文件: +为此,我们将使用下面的命令在 `/usr/share/applications` 下创建一个名为 `android.desktop` 的新文件: ``` sudo nano /usr/share/applications/android.desktop ``` -并在其中粘贴下面的内容(右键单击然后粘贴): +并在其中粘贴下面的内容(右键单击然后粘贴): ``` [Desktop Entry] @@ -158,33 +158,32 @@ StartupNotify=true Categories=GTK; ``` -再强调一次,你必需使用你系统上的本地镜像路径来替换 /home/mhsabbagh/android.img 。然后保存文件 (Ctrl + X ,然后按 Y ,然后按 Enter)。 +再强调一次,你必需使用你系统上的本地镜像路径来替换 `/home/mhsabbagh/android.img` 。然后保存文件(`Ctrl+X`,然后按 `Y`,然后按回车)。 -注意,我们需要使用 “pkexec” 来使用 root 权限运行 QEMU ,因为从较新的版本开始,普通用户不允许通过 libvirt 访问 KVM 技术;这就是为什么它将每次要求你输入 root 密码的原因。 +注意,我们需要使用 `pkexec` 来使用 root 权限运行 QEMU ,因为从较新的版本开始,普通用户不允许通过 libvirt 访问 KVM 技术;这就是为什么它将每次要求你输入 root 密码的原因。 -现在,你将在应用程序菜单中看到 android 图标,你可以在你想使用 android 的任何时间来简单地单击图标,QEMU 程序将启动: +现在,你将在应用程序菜单中看到安卓图标,你可以在你想使用安卓的任何时间来简单地单击该图标,QEMU 程序将启动: -![Install Android 8.1 Oreo on Linux To Run Apps & Games 71 android 8.1 oreo on linux][20] +![][20] ### 总结 -我们向你展示如何你的 Linux 系统上安装和运行 android 8.1 Oreo 。从现在起,在没有其它一些软件的(像 Blutsticks 和类似的方法)的情况下,你应该更容易地完成基于 android 的任务。在这里,你有一个完整工作和功能的 android 系统,你可以随心所欲地操作它,如果一些东西出差,你可以简单地核弹攻击镜像文件,然后随时再一次重新运行安装程序。 - -你之前尝试过 android x86 吗?你的经验如何? +我们向你展示如何在你的 Linux 系统上安装和运行安卓 8.1 Oreo 。从现在起,在没有其它一些软件的(像 Blutsticks 和类似的方法)的情况下,你可以更容易地完成基于安卓的任务。在这里,你有一个完整工作和功能的安卓系统,你可以随心所欲地操作它,如果一些东西出错,你可以简单地干掉该镜像文件,然后随时再一次重新运行安装程序。 +你之前尝试过 android x86 吗?你的体验如何? -------------------------------------------------------------------------------- via: https://fosspost.org/tutorials/install-android-8-1-oreo-on-linux -作者:[Python Programmer;Open Source Software Enthusiast. Worked On Developing A Lot Of Free Software. The Founder Of Foss Post;Foss Project. Computer Science Major.][a] +作者:[M.Hanny Sabbagh][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]: +[a]: https://fosspost.org/author/mhsabbagh [b]: https://github.com/lujun9972 [1]: http://www.android-x86.org/ [2]: http://www.android-x86.org/download From 765cafa8409fd89236054e6c64da8561693bb50d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 24 Dec 2019 23:35:24 +0800 Subject: [PATCH 244/676] PUB @robsean https://linux.cn/article-11711-1.html --- ...7 Install Android 8.1 Oreo on Linux To Run Apps - Games.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md (99%) diff --git a/translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md b/published/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md similarity index 99% rename from translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md rename to published/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md index e9b05a8757..3babf263f3 100644 --- a/translated/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md +++ b/published/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11711-1.html) [#]: subject: (Install Android 8.1 Oreo on Linux To Run Apps & Games) [#]: via: (https://fosspost.org/tutorials/install-android-8-1-oreo-on-linux) [#]: author: (Python Programmer;Open Source Software Enthusiast. Worked On Developing A Lot Of Free Software. The Founder Of Foss Post;Foss Project. Computer Science Major. ) From b7c8eb327e45917e999d9063a15d6f51a0530f1f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 25 Dec 2019 00:52:26 +0800 Subject: [PATCH 245/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191225=208=20Co?= =?UTF-8?q?mmands=20to=20Check=20Memory=20Usage=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191225 8 Commands to Check Memory Usage on Linux.md --- ...Commands to Check Memory Usage on Linux.md | 416 ++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 sources/tech/20191225 8 Commands to Check Memory Usage on Linux.md diff --git a/sources/tech/20191225 8 Commands to Check Memory Usage on Linux.md b/sources/tech/20191225 8 Commands to Check Memory Usage on Linux.md new file mode 100644 index 0000000000..89108b5ded --- /dev/null +++ b/sources/tech/20191225 8 Commands to Check Memory Usage on Linux.md @@ -0,0 +1,416 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 Commands to Check Memory Usage on Linux) +[#]: via: (https://www.2daygeek.com/linux-commands-check-memory-usage/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +8 Commands to Check Memory Usage on Linux +====== + +Linux is not like Windows and you will not get a GUI always, especially in a server environment. + +As a Linux administrator, it is important to know how to check your available and used resources, such as memory, CPU, disk space, etc. + +If there are any applications that use too much resources on the system to run your system at the optimum level you need to find and fix. + +If you want to **[find out the top 10 memory (RAM) consumption processes in Linux][1]**, go to the following article. + +In Linux, there are commands for everything, so use the corresponding commands. + +In this tutorial, we will show you eight powerful commands to check memory usage on a Linux system, including RAM and swap. + +**[Creating swap space on a Linux system][2]** is very important. + +The following commands can help you check memory usage in Linux in different ways. + + * free Command + * /proc/meminfo File + * vmstat Command + * ps_mem Command + * smem Command + * top Command + * htop Command + * glances Command + + + +### 1) How to Check Memory Usage on Linux Using the free Command + +**[Free command][3]** is the most powerful command widely used by the Linux administrator. But it provides very little information compared to the “/proc/meminfo” file. + +Free command displays the total amount of free and used physical and swap memory on the system, as well as buffers and caches used by the kernel. + +These information is gathered from the “/proc/meminfo” file. + +``` +# free -m + total used free shared buff/cache available +Mem: 15867 9199 1702 3315 4965 3039 +Swap: 17454 666 16788 +``` + + * **total:** Total installed memory + * **used:** Memory is currently in use by running processes (used= total – free – buff/cache) + * **free:** Unused memory (free= total – used – buff/cache) + * **shared:** Memory shared between two or more processes (multiple processes) + * **buffers:** Memory reserved by the kernel to hold a process queue request. + * **cache:** Size of the page cache that holds recently used files in RAM + * **buff/cache:** Buffers + Cache + * **available:** Estimation of how much memory is available for starting new applications, without swapping. + + + +### 2) How to Check Memory Usage on Linux Using the /proc/meminfo File + +The “/proc/meminfo” file is a virtual file that contains various real-time information about memory usage. + +It shows memory stats in kilobytes, most of which are somewhat difficult to understand. + +However it contains useful information about memory usage. + +``` +# cat /proc/meminfo + +MemTotal: 16248572 kB +MemFree: 1764576 kB +MemAvailable: 3136604 kB +Buffers: 234132 kB +Cached: 4731288 kB +SwapCached: 28516 kB +Active: 9004412 kB +Inactive: 3552416 kB +Active(anon): 8094128 kB +Inactive(anon): 2896064 kB +Active(file): 910284 kB +Inactive(file): 656352 kB +Unevictable: 80 kB +Mlocked: 80 kB +SwapTotal: 17873388 kB +SwapFree: 17191328 kB +Dirty: 252 kB +Writeback: 0 kB +AnonPages: 7566736 kB +Mapped: 3692368 kB +Shmem: 3398784 kB +Slab: 278976 kB +SReclaimable: 125480 kB +SUnreclaim: 153496 kB +KernelStack: 23936 kB +PageTables: 73880 kB +NFS_Unstable: 0 kB +Bounce: 0 kB +WritebackTmp: 0 kB +CommitLimit: 25997672 kB +Committed_AS: 24816804 kB +VmallocTotal: 34359738367 kB +VmallocUsed: 0 kB +VmallocChunk: 0 kB +Percpu: 3392 kB +HardwareCorrupted: 0 kB +AnonHugePages: 0 kB +ShmemHugePages: 0 kB +ShmemPmdMapped: 0 kB +HugePages_Total: 0 +HugePages_Free: 0 +HugePages_Rsvd: 0 +HugePages_Surp: 0 +Hugepagesize: 2048 kB +Hugetlb: 0 kB +DirectMap4k: 1059088 kB +DirectMap2M: 14493696 kB +DirectMap1G: 2097152 kB +``` + +### 3) How to Check Memory Usage on Linux Using the vmstat Command + +The **[vmstat command][4]** is another useful tool for reporting virtual memory statistics. + +vmstat reports information about processes, memory, paging, block IO, traps, disks, and cpu functionality. + +vmstat does not require special permissions, and it can help identify system bottlenecks. + +``` +# vmstat + +procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- + r b swpd free buff cache si so bi bo in cs us sy id wa st + 1 0 682060 1769324 234188 4853500 0 3 25 91 31 16 34 13 52 0 0 +``` + +If you want to understand this in detail, read the field description below. + +**Procs** + + * **r:** The number of runnable processes (running or waiting for run time). + * **b:** The number of processes in uninterruptible sleep. + + + +**Memory** + + * **swpd:** the amount of virtual memory used. + * **free:** the amount of idle memory. + * **buff:** the amount of memory used as buffers. + * **cache:** the amount of memory used as cache. + * **inact:** the amount of inactive memory. (-a option) + * **active:** the amount of active memory. (-a option) + + + +**Swap** + + * **si:** Amount of memory swapped in from disk (/s). + * **so:** Amount of memory swapped to disk (/s). + + + +**IO** + + * **bi:** Blocks received from a block device (blocks/s). + * **bo:** Blocks sent to a block device (blocks/s). + + + +**System** + + * **in:** The number of interrupts per second, including the clock. + * **cs:** The number of context switches per second. + + + +**CPU : These are percentages of total CPU time.** + + * **us:** Time spent running non-kernel code. (user time, including nice time) + * **sy:** Time spent running kernel code. (system time) + * **id:** Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time. + * **wa:** Time spent waiting for IO. Prior to Linux 2.5.41, included in idle. + * **st:** Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown. + + + +Run the following command for detailed information. + +``` +# vmstat -s + + 16248580 K total memory + 2210256 K used memory + 2311820 K active memory + 2153352 K inactive memory + 11368812 K free memory + 107584 K buffer memory + 2561928 K swap cache + 17873388 K total swap + 0 K used swap + 17873388 K free swap + 44309 non-nice user cpu ticks + 164 nice user cpu ticks + 14332 system cpu ticks + 382418 idle cpu ticks + 1248 IO-wait cpu ticks + 1407 IRQ cpu ticks + 2147 softirq cpu ticks + 0 stolen cpu ticks + 1022437 pages paged in + 260296 pages paged out + 0 pages swapped in + 0 pages swapped out + 1424838 interrupts + 4979524 CPU context switches + 1577163147 boot time + 3318 forks +``` + +### 4) How to Check Memory Usage on Linux Using the ps_mem Command + +**[ps_mem][5]** is a simple Python script that allows you to get core memory usage accurately for a program in Linux. + +This can determine how much RAM is used per program (not per process). + +It calculates the total amount of memory used per program, total = sum (private RAM for program processes) + sum (shared RAM for program processes). + +The shared RAM is problematic to calculate, and the tool automatically selects the most accurate method available for the running kernel. + +``` +# ps_mem + + Private + Shared = RAM used Program +180.0 KiB + 30.0 KiB = 210.0 KiB xf86-video-intel-backlight-helper (2) +192.0 KiB + 66.0 KiB = 258.0 KiB cat (2) +312.0 KiB + 38.5 KiB = 350.5 KiB lvmetad +380.0 KiB + 25.5 KiB = 405.5 KiB crond +392.0 KiB + 32.5 KiB = 424.5 KiB rtkit-daemon +852.0 KiB + 117.0 KiB = 969.0 KiB gnome-session-ctl (2) +928.0 KiB + 56.5 KiB = 984.5 KiB gvfs-mtp-volume-monitor + 1.0 MiB + 42.5 KiB = 1.0 MiB dconf-service + 1.0 MiB + 106.5 KiB = 1.1 MiB gvfs-goa-volume-monitor + 1.0 MiB + 180.5 KiB = 1.2 MiB gvfsd +. +. + 5.3 MiB + 3.0 MiB = 8.3 MiB evolution-addressbook-factory + 8.5 MiB + 1.2 MiB = 9.7 MiB gnome-session-binary (4) + 7.5 MiB + 3.1 MiB = 10.5 MiB polkitd + 7.4 MiB + 3.3 MiB = 10.7 MiB pulseaudio (2) + 7.0 MiB + 7.0 MiB = 14.0 MiB msm_notifier + 12.7 MiB + 2.3 MiB = 15.0 MiB evolution-source-registry + 13.3 MiB + 2.5 MiB = 15.8 MiB gnome-terminal-server + 15.8 MiB + 1.0 MiB = 16.8 MiB tracker-miner-fs + 18.7 MiB + 1.8 MiB = 20.5 MiB python3.7 + 16.6 MiB + 4.0 MiB = 20.5 MiB evolution-calendar-factory + 22.3 MiB + 753.0 KiB = 23.0 MiB gsd-keyboard (2) + 22.4 MiB + 832.0 KiB = 23.2 MiB gsd-wacom (2) + 20.8 MiB + 2.5 MiB = 23.3 MiB blueman-tray + 22.0 MiB + 1.8 MiB = 23.8 MiB blueman-applet + 23.1 MiB + 934.0 KiB = 24.0 MiB gsd-xsettings (2) + 23.7 MiB + 1.2 MiB = 24.9 MiB gsd-media-keys (2) + 23.4 MiB + 1.6 MiB = 25.0 MiB gsd-color (2) + 23.9 MiB + 1.2 MiB = 25.1 MiB gsd-power (2) + 16.5 MiB + 8.9 MiB = 25.4 MiB evolution-alarm-notify + 27.2 MiB + 2.0 MiB = 29.2 MiB systemd-journald + 28.7 MiB + 2.8 MiB = 31.5 MiB c + 29.6 MiB + 2.2 MiB = 31.8 MiB chrome-gnome-sh (2) + 43.9 MiB + 6.8 MiB = 50.7 MiB WebExtensions + 46.7 MiB + 6.7 MiB = 53.5 MiB goa-daemon + 86.5 MiB + 55.2 MiB = 141.7 MiB Xorg (2) +191.4 MiB + 24.1 MiB = 215.4 MiB notepadqq-bin +306.7 MiB + 29.0 MiB = 335.7 MiB gnome-shell (2) +601.6 MiB + 77.7 MiB = 679.2 MiB firefox + 1.0 GiB + 109.7 MiB = 1.1 GiB chrome (15) + 2.3 GiB + 123.1 MiB = 2.5 GiB Web Content (8) +---------------------------------- + 5.6 GiB +================================== +``` + +### 5) How to Check Memory Usage on Linux Using the smem Command + +**[smem][6]** is a tool that can provide numerous reports of memory usage on Linux systems. Unlike existing tools, smem can report Proportional Set Size (PSS), Unique Set Size (USS) and Resident Set Size (RSS). + +Proportional Set Size (PSS): refers to the amount of memory used by libraries and applications in the virtual memory system. + +Unique Set Size (USS) : Unshared memory is reported as USS (Unique Set Size). + +Resident Set Size (RSS) : The standard measure of physical memory (it typically shared among multiple applications) usage known as resident set size (RSS) will significantly overestimate memory usage. + +``` +# smem -tk + + PID User Command Swap USS PSS RSS +3383 daygeek cat 0 92.0K 123.0K 1.7M +3384 daygeek cat 0 100.0K 129.0K 1.7M +1177 daygeek /usr/lib/gnome-session-ctl 0 436.0K 476.0K 4.6M +1171 daygeek /usr/bin/dbus-daemon --conf 0 524.0K 629.0K 3.8M +1238 daygeek /usr/lib/xdg-permission-sto 0 592.0K 681.0K 5.9M +1350 daygeek /usr/lib/gsd-screensaver-pr 0 652.0K 701.0K 5.8M +1135 daygeek /usr/lib/gdm-x-session --ru 0 648.0K 723.0K 6.0M +. +. +1391 daygeek /usr/lib/evolution-data-ser 0 16.5M 25.2M 63.3M +1416 daygeek caffeine-ng 0 28.7M 31.4M 66.2M +4855 daygeek /opt/google/chrome/chrome - 0 38.3M 46.3M 120.6M +2174 daygeek /usr/lib/firefox/firefox -c 0 44.0M 50.7M 120.3M +1254 daygeek /usr/lib/goa-daemon 0 46.7M 53.3M 80.4M +3416 daygeek /opt/google/chrome/chrome - 0 44.7M 54.2M 103.3M +4782 daygeek /opt/google/chrome/chrome - 0 57.2M 65.8M 142.3M +1137 daygeek /usr/lib/Xorg vt2 -displayf 0 77.2M 129.6M 192.3M +3376 daygeek /opt/google/chrome/chrome 0 117.8M 131.0M 210.9M +4448 daygeek /usr/lib/firefox/firefox -c 0 124.4M 133.8M 224.1M +3558 daygeek /opt/google/chrome/chrome - 0 157.3M 165.7M 242.2M +2310 daygeek /usr/lib/firefox/firefox -c 0 159.6M 169.4M 259.6M +4331 daygeek /usr/lib/firefox/firefox -c 0 176.8M 186.2M 276.8M +4034 daygeek /opt/google/chrome/chrome - 0 179.3M 187.9M 264.6M +3911 daygeek /opt/google/chrome/chrome - 0 183.1M 191.8M 269.4M +3861 daygeek /opt/google/chrome/chrome - 0 199.8M 208.2M 285.2M +2746 daygeek /usr/bin/../lib/notepadqq/n 0 193.5M 217.5M 261.5M +1194 daygeek /usr/bin/gnome-shell 0 203.7M 219.0M 285.1M +2945 daygeek /usr/lib/firefox/firefox -c 0 294.5M 308.0M 410.2M +2786 daygeek /usr/lib/firefox/firefox -c 0 341.2M 354.3M 459.1M +4193 daygeek /usr/lib/firefox/firefox -c 0 417.4M 427.6M 519.3M +2651 daygeek /usr/lib/firefox/firefox -c 0 417.0M 430.1M 535.6M +2114 daygeek /usr/lib/firefox/firefox -c 0 430.6M 473.9M 610.9M +2039 daygeek /usr/lib/firefox/firefox -- 0 601.3M 677.5M 840.6M +------------------------------------------------------------------------------- + 90 1 0 4.8G 5.2G 8.0G +``` + +### 6) How to Check Memory Usage on Linux Using the top Command + +**[top command][7]** is one of the most frequently used commands by Linux administrators to understand and view the resource usage for a process on a Linux system. + +It displays the total memory of the system, current memory usage, free memory and total memory used by the buffers. + +In addition, it displays total swap memory, current swap usage, free swap memory, and total cached memory by the system. + +``` +# top -b | head -10 + +top - 11:04:39 up 40 min, 1 user, load average: 1.59, 1.42, 1.28 +Tasks: 288 total, 2 running, 286 sleeping, 0 stopped, 0 zombie +%Cpu(s): 13.3 us, 1.5 sy, 0.0 ni, 84.4 id, 0.0 wa, 0.3 hi, 0.5 si, 0.0 st +KiB Mem : 16248572 total, 7755928 free, 4657736 used, 3834908 buff/cache +KiB Swap: 17873388 total, 17873388 free, 0 used. 9179772 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 2114 daygeek 20 3182736 616624 328228 R 83.3 3.8 7:09.72 Web Content + 2039 daygeek 20 4437952 849616 261364 S 13.3 5.2 7:58.54 firefox + 1194 daygeek 20 4046856 291288 165460 S 4.2 1.8 1:57.68 gnome-shell + 4034 daygeek 20 808556 273244 88676 S 4.2 1.7 1:44.72 chrome + 2945 daygeek 20 3309832 416572 150112 S 3.3 2.6 4:04.60 Web Content + 1137 daygeek 20 564316 197292 183380 S 2.5 1.2 2:55.76 Xorg + 2651 daygeek 20 3098420 547260 275700 S 1.7 3.4 2:15.96 Web Content + 2786 daygeek 20 2957112 463912 240744 S 1.7 2.9 3:22.29 Web Content + 1 root 20 182756 10208 7760 S 0.8 0.1 0:04.51 systemd + 442 root -51 S 0.8 0:05.02 irq/141-iw+ + 1426 daygeek 20 373660 48948 29820 S 0.8 0.3 0:03.55 python3 + 2174 daygeek 20 2466680 122196 78604 S 0.8 0.8 0:17.75 WebExtensi+ +``` + +### 7) How to Check Memory Usage on Linux Using the htop Command + +The **[htop command][8]** is an interactive process viewer for Linux/Unix systems. It is a text-mode application and requires the ncurses library, it was developed by Hisham. + +It is designed as an alternative to the top command. + +This is similar to the top command, but allows you to scroll vertically and horizontally to see all the processes running the system. + +htop comes with Visual Colors, which have added benefits and are very evident when it comes to tracking system performance. + +You are free to carry out any tasks related to processes, such as process killing and renicing without entering their PIDs. + +[![][9]][10] + +### 8) How to Check Memory Usage on Linux Using the glances Command + +**[Glances][11]** is a cross-platform system monitoring tool written in Python. + +You can see all information in one place such as CPU usage, Memory usage, running process, Network interface, Disk I/O, Raid, Sensors, Filesystem info, Docker, System info, Uptime, etc,. + +![][9] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-commands-check-memory-usage/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/ +[2]: https://www.2daygeek.com/add-extend-increase-swap-space-memory-file-partition-linux/ +[3]: https://www.2daygeek.com/free-command-to-check-memory-usage-statistics-in-linux/ +[4]: https://www.2daygeek.com/linux-vmstat-command-examples-tool-report-virtual-memory-statistics/ +[5]: https://www.2daygeek.com/ps_mem-report-core-memory-usage-accurately-in-linux/ +[6]: https://www.2daygeek.com/smem-linux-memory-usage-statistics-reporting-tool/ +[7]: https://www.2daygeek.com/linux-top-command-linux-system-performance-monitoring-tool/ +[8]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/ +[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[10]: https://www.2daygeek.com/wp-content/uploads/2019/12/linux-commands-check-memory-usage-2.jpg +[11]: https://www.2daygeek.com/linux-glances-advanced-real-time-linux-system-performance-monitoring-tool/ From 4cf6327947196a1075cca14f39d9e2f0f2deebd2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 25 Dec 2019 00:57:09 +0800 Subject: [PATCH 246/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191225=20Khadas?= =?UTF-8?q?=20VIM3L:=20An=20Open=20Source=20HTPC=20Device?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191225 Khadas VIM3L- An Open Source HTPC Device.md --- ...hadas VIM3L- An Open Source HTPC Device.md | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 sources/tech/20191225 Khadas VIM3L- An Open Source HTPC Device.md diff --git a/sources/tech/20191225 Khadas VIM3L- An Open Source HTPC Device.md b/sources/tech/20191225 Khadas VIM3L- An Open Source HTPC Device.md new file mode 100644 index 0000000000..9d25522d26 --- /dev/null +++ b/sources/tech/20191225 Khadas VIM3L- An Open Source HTPC Device.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Khadas VIM3L: An Open Source HTPC Device) +[#]: via: (https://itsfoss.com/vim3l/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +Khadas VIM3L: An Open Source HTPC Device +====== + +If you’ve read our list of [Raspberry Pi alternatives][1], you might have come across VIM by Khadas. + +China-based [Khadas][2] is becoming increasingly popular for its single board computers (SCB). Apart from the generic do-it-yourself (DIY) VIM series, Khadas also has [Tone boards][3] that can be utilized for DJing and [Edge][4] boards for AI and other related projects. + +As discussed in [Raspberry Pi projects][5], one of the most popular use of a single board computer is to use it as a media center. You can turn your TV in more than just a smart TV (without being monitored) and play local music, videos, pictures and even games on your TV. You can also watch streaming services through these media center. + +You can always configure VIm (or any other SCB) as a media center. It’s a good DIY exercise but not everyone would like it. + +This is why Khadas has introduced [VIM3L][6] which is a ready to use media center device based on VIM 3. In this article, we’ll have a look at this device and see how to set it up. + +### VIM 3L specifications + +One of the strong point of Khadas is its emphasis on open source. All their source code, including [U-Boot][7], mainline Linux and Android is available on [their GitHub repository][8]. + +VIM3L comes with [CoreELEC][9] operating system. CoreELEC is a custom Linux distribution that comes with software like [Kodi][10] and its add-ons to give you a complete HTPC (home theatre PC) experience. + +![][11] + +You are not restricted to CoreELEC though. You can get the barebon version of VIM 3L and use Android or install your a Linux distribution of your choice. + + * Amlogic S905D3 SoC with quad-core Cortex-A55 CPU clocked at 1.9GHz + * 16GB eMMC + * 2GB RAM + * 2x WiFi antennas + * PCIe 2.0 and M.2 NVMe SSD support + * HDMI port + * Dolby Audio + + + +The HTPC version costs slightly more than the bare board but it consists of some additional hardware along with CoreELEC operating system: + + * Transparent DIY case + * Metal DIY case + * Heatsink + * IR Remote + + + +![VIM3L HTPC Kit][12] + +VIM3L is capable of running 4K video at 75 fps. It also includes TrustZone based security for DRM video streaming. Both Android and CoreELEC are capable of [OTA updates][13]. + +[VIM3L HTPC version costs $89.99][14] and the bare board (with Android) costs $69.99. It’s FOSS readers can _**get $6 off with itsfossfuns coupon code**_ that can be used at the checkout page of Khadas shop. + +[Khadas VIM3 Series][15] + +You may opt for the free shipping option but it will take 2-3 weeks for the device to reach you from China. You can pay $20 extra for an express DHL shipping. The shipping options are available at checkout. I think you might have to pay custom tax depending on your country’s rules so ordering one from Amazon would be better in such a case but you won’t get the It’s FOSS special discount on Amazon. + +Now that you are aware of the specifications, let me show you how to set it up and how was my experience with it. + +_The amazon links in this article are affiliate links. Please read our [affiliate policy][16]._ + +### Setting up VIM3L and using it as home theatre PC + +Initially, when you start VIM3L, a window appears on the screen which consists of a series of questions and options. Everything you choose determines the initial state of its operation. In each case, however, you can modify your options from the settings menu. Better not to rush through the settings, since the multitude of options you have at startup seem to turn the VIM3L into a superpower device. + +![Setting up proxy network][17] + +The addition of the proxy connectivity in the internet settings is a welcome option. As a enthusiast of user privacy, I enabled it to connect through the [Tor network][18]. The choice is of course yours. + +![Peripheral devices][19] + +You can modify how many and which peripheral devices you have on that device. For example, in addition to the handheld control, you can mount a keyboard or even a console controller. Correct! A console controller that will allow you to play games. + +![Option to save logs][20] + +An important addition is the log storage option. With this, the users can consult the logs in case of an event of an error or malfunction. This could help in troubleshooting the issue. + +![Plenty of add-ons][21] + +On the left, a user can see options such as music, videos, radio, photos, games and many other options that we would like to take some time to cover. + +Add-ons further extends the capabilities of your HTPC. Here, you can find music libraries, documentaries, games, open-source software and more. The software includes various graphics, audio, and video editors, simulators etc. + +You have the freedom to choose whether you want to download them through 3rd party repositories, or from the environment of the accessory. Also, if you try to install software, you will most likely notice that along with the program, appropriate libraries and software are also installed. As you can see, this is not an accessory from scratch, but an accessory that is ready to cope with its users’ choices. + +VIM3L has different configuration profile consisting of a standard, intermediate, expert profile. As you climb into difficulty, your choices are multiplied, giving you total freedom. + +### Thoughts on VIM3L + +![][22] + +I liked VIM3L for what it offers. This is not to say that it is a perfect device. + +I found that some point, the controller is not fully accurate in signal transmission. As a result, after pressing a button twice, the signal is sent later and there is a quick change of screen. Maybe the controller I received was faulty. + +In conclusion, I would like to say that it’s not an expensive device and the feature it offers are good enough to provide you with entertainment, fun, productivity, and creativity. Most importantly, the software it offers are free and open source. + +If you like what you see here, you can either order it from [its own shop that ships from China][6] or get it from [Amazon][23]. + +Preview | Product | Price | +---|---|---|--- +![Khadas Amlogic S905D3 VIM3L HTPC Kit][24] ![Khadas Amlogic S905D3 VIM3L HTPC Kit][24] | [Khadas Amlogic S905D3 VIM3L HTPC Kit][25] | $89.99[][26] | [Buy on Amazon][27] + +Have you used VIM3L or any other pre-built media center device? Or do you prefer making your own HTPC? Do share your views. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/vim3l/ + +作者:[Community][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/raspberry-pi-alternatives/ +[2]: https://www.khadas.com/ +[3]: https://www.amazon.com/dp/B07K6GQNH3?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Tone boards) +[4]: https://www.khadas.com/edge +[5]: https://itsfoss.com/raspberry-pi-projects/ +[6]: https://www.khadas.com/vim3l +[7]: https://www.denx.de/wiki/U-Boot +[8]: https://github.com/khadas +[9]: https://coreelec.org/ +[10]: https://itsfoss.com/install-kodi-ubuntu/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/VIM3L_OS_Freedom_graphic.jpg?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/VIM3L-Htpc-Kit.jpg?ssl=1 +[13]: https://source.android.com/devices/tech/ota +[14]: https://www.amazon.com/dp/B081H66D7Q?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (VIM3L HTPC version costs $89.99) +[15]: https://www.khadas.com/shop-vim3 +[16]: https://itsfoss.com/affiliate-policy/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/khadas_vim3l_3.jpg?ssl=1 +[18]: https://itsfoss.com/tor-guide/ +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/khadas_vim3l_2.jpg?ssl=1 +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/khadas_vim3l_4.jpg?ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/khadas_vim3l_1.jpg?ssl=1 +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/VIM3L.jpg?ssl=1 +[23]: https://www.amazon.com/dp/B081H66D7Q?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Amazon) +[24]: https://i0.wp.com/m.media-amazon.com/images/I/41YC-mlA2PL._SL160_.jpg?ssl=1 +[25]: https://www.amazon.com/dp/B081H66D7Q?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Khadas Amlogic S905D3 VIM3L HTPC Kit) +[26]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) +[27]: https://www.amazon.com/dp/B081H66D7Q?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon) From e7a2ac3753e4da8249b95ee7a53688abe14c7f46 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 25 Dec 2019 00:57:48 +0800 Subject: [PATCH 247/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191224=20Chill?= =?UTF-8?q?=20out=20with=20the=20Linux=20Equinox=20Desktop=20Environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md --- ...h the Linux Equinox Desktop Environment.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md diff --git a/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md new file mode 100644 index 0000000000..3d207d33cb --- /dev/null +++ b/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Chill out with the Linux Equinox Desktop Environment) +[#]: via: (https://opensource.com/article/19/12/ede-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Chill out with the Linux Equinox Desktop Environment +====== +This article is part of a special series of 24 days of Linux desktops. +EDE is not the most glamorous, minimal, nor efficient desktop. But its +soft, muted tones are calming, its familiarity soothing, and its icon +theme fun. +![Linux penguin at the north pole beside an igloo][1] + +I haven't used the Fast Light Toolkit ([FLTK][2]) for anything serious yet, but I'm a fan of the C++ GUI toolkit that's pretty simple to learn and (in my experience) reliable even across updates. When I found out that there was a desktop environment built with FLTK, I was eager to try it—and I was quickly glad I did. The [Equinox Desktop Environment (EDE)][3] is a fast and simple desktop written in C++ and FLTK for Unix desktops. It uses common desktop conventions, so it looks and feels familiar right away, and after only a few days of using it, I found its simplicity provides a minimal elegance that I enjoy. + +![EDE desktop][4] + +### Installing EDE + +You are likely to find EDE included in your distribution's software repository, but you can also find it in its [SourceForge repository][5]. If you're already running a different desktop, it's safe to install EDE on the same system because it brings along just a few extra applications, which are specific to EDE so they won't get in your way on other desktops. + +EDE is only the desktop, and it uses the [Pekwm][6] window manager to handle layout. + +After installing EDE, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. + +With GDM: + +![][7] + +With SDDM: + +![][8] + +When EDE first boots, you might be prompted to confirm some startup tasks. On my Slackware workstation, KDE had marked some services as startup tasks (such as the HPLIP print monitor and a Bluetooth daemon), and EDE imported them with just one confirmation box. + +![Importing desktop services in EDE][9] + +After setting it up once, you won't need to do it again. + +### EDE desktop tour + +EDE's layout is exactly what most people expect from a desktop: application menu on the left, taskbar in the middle, system tray on the right. It's the standard off-the-shelf layout that confuses nobody; this is a desktop that's safe to install on a Linux computer and hand over, with confidence, to someone who's never used Linux in their life. They'll fall right into this desktop with a soft and gentle landing. + +You can bring up a small desktop menu with a right-click. This allows you to make an application launcher on the desktop, create a folder, and set some theme options. + +The panel at the bottom of the screen is retractable, so you can work full-screen if you prefer. Click the clock in the bottom-right of the screen to bring up a calendar and time-zone settings. + +EDE has a small Configuration Place application that provides access to a few simple preferences: + + * Background and icon settings + * Screensaver settings + * Time and clock + * System bell + * Keyboard + * Preferred applications + + + +![EDE Configuration Place][10] + +There's not much more to EDE. There's no file manager, no text editor, or paint program, or game of solitaire. You must bring anything you want to run on your desktop. That means you get to pick and choose from the wide array of Linux applications and use whatever you love the most. + +### EDE as a statement + +I found the simplicity of EDE oddly comforting, at least as a kind of "holiday" desktop; it's a nice place to visit. It's not the most glamorous desktop available, nor the most minimal, nor the most efficient. But its soft, muted tones are calming, its familiarity soothing, and its icon theme fun and exuberant. EDE is a desktop that's proud of its slow and steady pace. + +If you're in the mood to put your feet up and enjoy a clean and pleasant interface, try EDE. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ede-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/penguin.igloo_.png?itok=K92O7H6b (Linux penguin at the north pole beside an igloo) +[2]: https://www.fltk.org/ +[3]: https://sourceforge.net/projects/ede/ +[4]: https://opensource.com/sites/default/files/uploads/advent-ede.jpg (EDE desktop) +[5]: http://ede.sf.net +[6]: https://opensource.com/article/19/12/pekwm-linux-desktop +[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg +[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg +[9]: https://opensource.com/sites/default/files/uploads/advent-ede-init.jpg (Importing desktop services in EDE) +[10]: https://opensource.com/sites/default/files/uploads/advent-ede-conf.jpg (EDE Configuration Place) From ea8a1122d71eeea59066100e1bb2129f8ffab394 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 25 Dec 2019 00:58:07 +0800 Subject: [PATCH 248/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191224=20Top=20?= =?UTF-8?q?articles=20for=20learning=20Python=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191224 Top articles for learning Python in 2020.md --- ...op articles for learning Python in 2020.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20191224 Top articles for learning Python in 2020.md diff --git a/sources/tech/20191224 Top articles for learning Python in 2020.md b/sources/tech/20191224 Top articles for learning Python in 2020.md new file mode 100644 index 0000000000..3b0ba8b166 --- /dev/null +++ b/sources/tech/20191224 Top articles for learning Python in 2020.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top articles for learning Python in 2020) +[#]: via: (https://opensource.com/article/19/12/learn-python) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Top articles for learning Python in 2020 +====== +No matter where you are in your Python programming journey, +Opensource.com's top Python articles from 2019 will help you along the +way. +![Hands on a keyboard with a Python book ][1] + +Python had a big year in 2019. According to popular resources like [GitHub][2] and [Stack Overflow][3], it's trending as the second most popular language in the world. + +> "Python, the fastest-growing major programming language, has risen in the ranks of programming languages in our survey yet again, edging out Java this year and standing as the second most loved language (behind Rust)." +> — [Stack Overflow Insights][3] + +Similarly, Python grew in readership on Opensource.com by leaps and bounds. Here are the top Python articles from 2019, grouped by topic, for your perusal. + +### Why choose Python? + +There are many languages out there, so what makes Python such a destination? If the most-read articles tell us anything, it's that people enjoy its flexibility. There are [multiple paradigms][4] that are accessible to Python developers, as Jigyasa Grover explains, including the popular [object-oriented programming][5] Seth Kenlon's tutorial shows. + +If you're a long-time user and looking for advanced examples of why Python is a perfect language, Moshe Zadka covers his [top 5 reasons for loving Python][6]. If that's not enough, you can also use it play around with powerful tools without a lot of code, like in Parul Pandey's tutorial on [image manipulation][7]. + +### Configuring Python + +As Python's popularity continues to rise, more people are starting with the language than ever before. Many of those first-timers are doing so on the Mac operating system and are using a [guide to setting up Python 3][8] that Moshe and I wrote. + +After installing Python, decisions on where to write your code come next. There are many options when it comes to text editors and integrated development environments (IDEs), but readers appear to favor graphical options, as Stephan Avenwedde's article about [Pythonic][9] and my article on [JupyterLab][10] were the most read articles on that topic in 2019. + +On the path to getting confident with the language, developers will have to face the multitude of options available for how to manage versions of the language and project dependencies. Luckily, László Kiss Kollár's article makes [managing Python packages][11] a bit simpler. + +When you're ready to configure an IDE with all of the features you'll want to make the most of the language, be sure to give the [opinionated linter Black][12] a try, as Moshe explains, to keep your code clean. + +### Wrapping up + +No matter where you are in your path to enjoying Python programming, the top Python articles from 2019 are here to help you along the way. I can't wrap this up without at least one acknowledgment of the importance of testing, and Moshe offers another well-read article [on tox][13] for that purpose. + +Thank you to all the authors who wrote for Opensource.com in 2019! If you're just learning to program in Python, let us know in the comments what you want to know. And, if you're a seasoned veteran, consider sharing your tips and tricks with us by [writing an article][14] about your favorite Python topic. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/learn-python + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://octoverse.github.com/#top-languages +[3]: https://insights.stackoverflow.com/survey/2019 +[4]: https://opensource.com/article/19/10/python-programming-paradigms +[5]: https://opensource.com/article/19/7/get-modular-python-classes +[6]: https://opensource.com/article/19/10/why-love-python +[7]: https://opensource.com/article/19/3/python-image-manipulation-tools +[8]: https://opensource.com/article/19/5/python-3-default-mac +[9]: https://opensource.com/article/19/5/graphically-programming-pythonic +[10]: https://opensource.com/article/19/5/jupyterlab-python-developers-magic +[11]: https://opensource.com/article/19/4/managing-python-packages +[12]: https://opensource.com/article/19/5/python-black +[13]: https://opensource.com/article/19/5/python-tox +[14]: https://opensource.com/how-submit-article From 70cbf86ec9f7401665b7c54ade52ad0eaf53f200 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 25 Dec 2019 00:58:40 +0800 Subject: [PATCH 249/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191224=20Why=20?= =?UTF-8?q?your=20Python=20code=20should=20be=20flat=20and=20sparse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191224 Why your Python code should be flat and sparse.md --- ...r Python code should be flat and sparse.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20191224 Why your Python code should be flat and sparse.md diff --git a/sources/tech/20191224 Why your Python code should be flat and sparse.md b/sources/tech/20191224 Why your Python code should be flat and sparse.md new file mode 100644 index 0000000000..0e447c5d8e --- /dev/null +++ b/sources/tech/20191224 Why your Python code should be flat and sparse.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why your Python code should be flat and sparse) +[#]: via: (https://opensource.com/article/19/12/zen-python-flat-sparse) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Why your Python code should be flat and sparse +====== +This is part of a special series about the Zen of Python focusing on the +fifth and sixth principles: flatness and sparseness. +![Digital creative of a browser on the internet][1] + +The [Zen of Python][2] is called that for a reason. It was never supposed to provide easy-to-follow guidelines for programming. The rules are specified tersely and are designed to engage the reader in deep thought. + +In order to properly appreciate the Zen of Python, you must read it and then meditate upon the meanings. If the Zen was designed to be a set of clear rules, it would be a fault that it has rules that contradict each other. However, as a tool to help you meditate on the best solution, contradictions are powerful. + +### Flat is better than nested. + +Nowhere is the pressure to be "flat" more obvious than in Python's strong insistence on indentation. Other languages will often introduce an implementation that "cheats" on the nested structure by reducing indentation requirements. To appreciate this point, let's take a look at JavaScript. + +JavaScript is natively async, which means that programmers write code in JavaScript using a lot of callbacks. + + +``` +a(function(resultsFromA) { +  b(resultsFromA, function(resultsfromB) { +    c(resultsFromC, function(resultsFromC) { +      console.log(resultsFromC) +   } +  } +} +``` + +Ignoring the code, observe the pattern and the way indentation leads to a right-most point. This distinctive "arrow" shape is tough on the eye to quickly walk through the code, so it's seen as undesirable and even nicknamed "callback hell." However, in JavaScript, it is possible to "cheat" and not have indentation reflect nesting. + + +``` +a(function(resultsFromA) { +b(resultsFromA, +  function(resultsfromB) { +c(resultsFromC, +  function(resultsFromC) { +    console.log(resultsFromC) +}}} +``` + +Python affords no such options to cheat: every nesting level in the program must be reflected in the indentation level. So deep nesting in Python _looks_ deeply nested. That makes "callback hell" was a worse problem in Python than in JavaScript: nesting callbacks mean indenting with no options to "cheat" with braces. + +This challenge, in combination with the Zen principle, has led to an elegant solution by a library I worked on. In the [Twisted][3] framework, we came up with the _deferred_ abstraction, which would later inspire the popular JavaScript _promise_ abstraction. In this way, Python's unwavering commitment to clear code forces Python developers to discover new, powerful abstractions. + + +``` +future_value = future_result() +future_value.addCallback(a) +future_value.addCallback(b) +future_value.addCallback(c) +``` + +(This might look familiar to modern JavaScript programmers: Promises were heavily influenced by Twisted's deferreds.) + +### Sparse is better than dense. + +The easiest way to make something less dense is to introduce nesting. This habit is why the principle of sparseness follows the previous one: after we have reduced nesting as much as possible, we are often left with _dense_ code or data structures. Density, in this sense, is jamming too much information into a small amount of code, making it difficult to decipher when something goes wrong. + +Reducing that denseness requires creative thinking, and there are no simple solutions. The Zen of Python does not offer simple solutions. All it offers are ways to find what can be improved in the code, without always giving guidance for "how." + +Take a walk. Take a shower. Smell the flowers. Sit in a lotus position and think hard, until finally, inspiration strikes. When you are finally enlightened, it is time to write the code. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-flat-sparse + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://www.python.org/dev/peps/pep-0020/ +[3]: https://twistedmatrix.com/trac/ From ca3dd31f745900cf7297e5ccc1a3fe1704e6529b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 25 Dec 2019 00:59:50 +0800 Subject: [PATCH 250/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191224=20Unix?= =?UTF-8?q?=20is=20turning=2050.=20What=20does=20that=20mean=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191224 Unix is turning 50. What does that mean.md --- ...Unix is turning 50. What does that mean.md | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sources/tech/20191224 Unix is turning 50. What does that mean.md diff --git a/sources/tech/20191224 Unix is turning 50. What does that mean.md b/sources/tech/20191224 Unix is turning 50. What does that mean.md new file mode 100644 index 0000000000..c01821ea28 --- /dev/null +++ b/sources/tech/20191224 Unix is turning 50. What does that mean.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Unix is turning 50. What does that mean?) +[#]: via: (https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Unix is turning 50. What does that mean? +====== +Unix time, also known as 'epoch time,' is the number of seconds that have passed since Jan 1, 1970. As Unix turns 50, let's take a look at what worries kernel developers. +[cbaquiran][1] [(CC0)][2] + +2020 is a significant year for Unix. At the very start of the year, Unix turns 50. + +While some of the early development of Unix predates the official start of its "epoch," Jan 1, 1970 remains the zero-point in POSIX time and the recognized beginning of all things Unix. Jan 1, 2020 will mark 50 years since that moment. + +### Unix time vs human time + +In terms of human time, 50 years is a big deal. In terms of Unix time, there's nothing particularly special about 50 years. 48.7 years would be no less significant. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Unix (including Linux) systems store date/time values as the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC in 32 bits. To determine how many seconds have passed since that time and, thus, what right now looks like as a Unix time value, you can issue a command like this: + +``` +$ date +%s +1576883876 +``` + +The **%s** argument tells the date command to display the current date/time as the number of seconds since the start of 1970-01-01. + +### How much time can Unix systems manage? + +To understand how much time Unix systems can accommodate, we need to look at the capacity of a 32-bit field. It can be calculated like this: + +``` +$ echo '2^32' | bc +4294967296 +``` + +However, since Unix needs to accommodate negative numbers, it reserves one bit for a number's sign, thus reducing this to: + +``` +$ echo '2^31' | bc +2147483648 +``` + +And, since Unix numbering begins with 0, that means we have 2,147,483,648 values, but the largest possible value is 2,147,483,647. Unix date/time values cannot exceed that number – just like the odometer on your car probably can't exceed 999,999 miles. Add 1 and the value turns to 0. + +### How long is a year in seconds? + +The number of seconds in most years can be calculated like this – hours/day multiplied by minutes/hour multiplied by seconds/minute multiplied by the number of days in a year: + +``` +$ expr 24 \* 60 \* 60 \* 365 +31536000 +``` + +In leap years, we just add another day: + +``` +$ expr 24 \* 60 \* 60 \* 366 +31622400 +``` + +### **How will Unix see its 50 year birthday?** + +12:00 AM on Jan 1, 2020 will be **1577836800** in epoch time. The calculation is a little tricky, but mostly because we have to accommodate leap years. Since the start of the epoch, we've had 12 leap years, starting in 1972, the last in 2016. And, when we reach 2020, we will have had 38 regular years. + +Here’s a calculation using the **expr** command to count the seconds in these 50 years: + +``` +$ expr 24 \* 60 \* 60 \* 365 \* 38 + 24 \* 60 \* 60 \* 366 \* 12 +1577836800 +``` + +The first half of that is calculating the seconds in the 38 non-leap years. We then add a similar calculation for leap years with their 366 days. Conversely, you could use the seconds per year figures presented earlier and just do this: + +``` +$ expr 31536000 \* 38 + 31622400 \* 12 +1577836800 +``` + +This way of tracking dates and times made Unix systems fairly impervious to the Y2K scare that had people in late 1999 worried that moving into the year 2000 would wreak havoc on computer systems. Far fewer problems were experienced than people feared. In fact, only applications which stored years in a two-digit format would see the year going to 00 as a sign that time jumping backwards. Still, lots of application developers had some tedious extra work piled onto their plates to ensure that their systems wouldn’t run into serious problems when 2000 hit. + +### When Unix time will run into problems + +Unix systems won’t run into a **Y2K** type of problem until **2038** when dates stored as described above will overrun their 32-bit space allotments. But that’s 18 years from now, and kernel developers are already working on how they will avert disaster. It’s a bit too early to start panicking. + +The year 2038 problem is sometimes referred to as the **Y2K38** problem. We have until Tuesday, January 19, 2038 to address it. If the problem isn’t resolved, systems after that date may think it’s 1901. One way to address the problem would be to switch to 64-bit representations of date/time information. Some people believe that even that will be a lot more complex than it sounds. In any case, it’s probably still too early to panic. And, in the meantime, maybe after singing "Auld Lang Syne" this New Year’s Eve, you can sing "Happy Birthday" to Unix. It’s turning 50, and that’s still a very big deal. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/en/birthday-cake-cake-birthday-380178/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 5275d21971ecdc630d6e5c44ce8c6744e835316d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 25 Dec 2019 06:28:39 +0800 Subject: [PATCH 251/676] PRF --- ... Customize your Linux desktop with FVWM.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/translated/tech/20191210 Customize your Linux desktop with FVWM.md b/translated/tech/20191210 Customize your Linux desktop with FVWM.md index 90d2fa7604..013ec7ad06 100644 --- a/translated/tech/20191210 Customize your Linux desktop with FVWM.md +++ b/translated/tech/20191210 Customize your Linux desktop with FVWM.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Customize your Linux desktop with FVWM) @@ -9,14 +9,16 @@ 使用 FVWM 自定义 Linux 桌面 ====== -本文是 24 天 Linux 桌面特别系列的一部分。如果你正在寻找轻巧,快速且简单的 Linux 窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入,探索和破解,那么 FVWM 是必须的。 -![Coding on a computer][1] -[FVWM][2] 窗口管理器最早是对早在 1993 年的 [TWM][3] 的修改。经过几年的迭代,出现了一个可高度自定义的环境,它可以配置任何行为、动作或事件。它支持自定义键绑定、鼠标手势、主题、脚本等。 +> 本文是 24 天 Linux 桌面特别系列的一部分。如果你正在寻找轻巧、快速且简单的 Linux 窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入、探索和魔改的窗口管理器,那么 FVWM 是必须的。 -尽管 FVWM 在安装后即可使用,但默认发行版仅提供最小的配置。这是开始自定义桌面环境的良好基础,但是,如果你只想将其用作桌面,那么可能要安装另一个用户发布的完整配置。FVWM 有几种不同的发行版,包括模仿 Windows 95 的 FVWM95(至少在外观和布局上)。我尝试了 [FVWM-Crystal][4],这是一个具有一些现代 Linux 桌面约定的现代主题。 +![](https://img.linux.net.cn/data/attachment/album/201912/25/062800dwh3yhfcpx3ggjxp.jpg) -从 Linux 发行版的软件仓库中安装要尝试的 FVWM 发行版。如果找不到特定的 FVWM 发行版,那么可以安装基础的 FVWM2 包,然后进入 [Box-Look.org][5] 手动下载主题包。这样就需要更多的工作,但比从头开始构建要少。 +[FVWM][2] 窗口管理器最早脱胎于对 1993 年的 [TWM][3] 的修改。经过几年的迭代,诞生了一个可高度自定义的环境,它可以配置任何行为、动作或事件。它支持自定义键绑定、鼠标手势、主题、脚本等。 + +尽管 FVWM 在安装后即可投入使用,但默认分发版本仅提供了极其少的配置。这是开始自定义桌面环境的良好基础,但是,如果你只想将其用作桌面,那么可能要安装由其它用户发布的完整配置版本。FVWM 有几种不同的分发版,包括模仿 Windows 95 的 FVWM95(至少在外观和布局上)。我尝试了 [FVWM-Crystal][4],这是一个具有一些现代 Linux 桌面约定的现代主题。 + +可以从 Linux 发行版的软件仓库中安装要尝试的 FVWM 分发版。如果找不到特定的 FVWM 分发版,那么可以安装基础的 FVWM2 包,然后进入 [Box-Look.org][5] 手动下载主题包。这样就需要更多的工作,但比从头开始构建要少。 安装后,请注销当前的桌面会话,以便你可以登录 FVWM。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 @@ -30,27 +32,27 @@ ### FVWM 桌面 -无论你使用什么主题和配置,当你在桌面上单击鼠标左键时,FVWM 至少会显示一个菜单。菜单的内容取决于你所安装的。FVWM-Crystal 分发中的菜单包含对常用首选项的快速访问,例如屏幕分辨率、壁纸设置、窗口装饰等。 +无论你使用什么主题和配置,当你在桌面上单击鼠标左键时,FVWM 至少会显示一个菜单。菜单的内容取决于你所安装的内容。FVWM-Crystal 分发版中的菜单包含对常用首选项的快速访问,例如屏幕分辨率、壁纸设置、窗口装饰等。 -与 FVWM 中的几乎所有东西一样,你可以在菜单中编辑你要想的内容,但 FVWM-Crystal 倾向应用菜单栏。应用菜单位于屏幕的左上角,每个图标都包含相关应用启动器的菜单。例如,GIMP 图标表示图像编辑器,KDevelop 图标表示集成开发环境(IDE),GNU 图标表示文本编辑器,等等,具体取决于你在系统上安装的程序。 +同 FVWM 中的几乎所有东西一样,你可以编辑菜单中你要想的内容,但 FVWM-Crystal 的特色在于其应用菜单栏。应用菜单位于屏幕的左上角,每个图标都包含了相关的应用启动器的菜单。例如,GIMP 图标表示图像编辑器,KDevelop 图标表示集成开发环境(IDE),GNU 图标表示文本编辑器,等等,具体取决于你在系统上安装的程序。 ![FVWM-crystal running on Slackware 14.2][8] -FVWM-Crystal 还提供虚拟桌面、任务栏、时钟和应用栏。 - -关于背景,你可以使用与 FVWM-Crystal 捆绑在一起的壁纸,也可以使用 **feh** 命令设置自己的壁纸(你可能需要从仓库中安装它)。此命令有一些设置背景的选项,包括 **\-bg-scale** 使用缩放填充屏幕,**\-bg-fill** 直接填充而不缩放图片,等等。 +FVWM-Crystal 还提供了虚拟桌面、任务栏、时钟和应用栏。 +关于背景,你可以使用与 FVWM-Crystal 捆绑在一起的壁纸,也可以使用 `feh` 命令设置自己的壁纸(你可能需要从仓库中安装它)。此命令有一些设置背景的选项,包括 `--bg-scale` 使用你选择的图片缩放填充屏幕,`--bg-fill` 直接填充而不缩放图片,等等。 ``` -`$ feh --bg-scale ~/Pictures/wallpapers/mybackground.jpg` +$ feh --bg-scale ~/Pictures/wallpapers/mybackground.jpg ``` -大多数配置文件都包含在 **$HOME/.fvwm-crystal** 中,某些系统范围的默认文件位于 **/usr/share/fvwm-crystal**。 +大多数配置文件都包含在 `$HOME/.fvwm-crystal` 中,某些系统范围的默认文件位于 `/usr/share/fvwm-crystal`。 ### 自己尝试一下 -FVWM 是桌面构建平台,也是窗口管理器。它不会为你做什么事情,它期望你来配置尽可能的一切。 -如果你正在寻找轻巧,快速且简单的窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入,探索和破解,那么 FVWM 是必须的。 +FVWM 是大多作为一个桌面构建平台,它也是窗口管理器。它不会为你做到面面俱到,它期望你来配置尽可能的一切。 + +如果你正在寻找轻巧、快速且简单的窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入、探索和魔改的窗口管理器,那么 FVWM 是必须的。 -------------------------------------------------------------------------------- @@ -59,7 +61,7 @@ via: https://opensource.com/article/19/12/fvwm-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 46a554451f27c4b3d2bd7315cfe9982e2aa630d5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 25 Dec 2019 06:29:15 +0800 Subject: [PATCH 252/676] PUB @geekpi https://linux.cn/article-11712-1.html --- .../20191210 Customize your Linux desktop with FVWM.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191210 Customize your Linux desktop with FVWM.md (98%) diff --git a/translated/tech/20191210 Customize your Linux desktop with FVWM.md b/published/20191210 Customize your Linux desktop with FVWM.md similarity index 98% rename from translated/tech/20191210 Customize your Linux desktop with FVWM.md rename to published/20191210 Customize your Linux desktop with FVWM.md index 013ec7ad06..d53602de31 100644 --- a/translated/tech/20191210 Customize your Linux desktop with FVWM.md +++ b/published/20191210 Customize your Linux desktop with FVWM.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11712-1.html) [#]: subject: (Customize your Linux desktop with FVWM) [#]: via: (https://opensource.com/article/19/12/fvwm-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From fd109a9529b4d6d64cc7afc27c67e4cb466392d5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 25 Dec 2019 08:53:00 +0800 Subject: [PATCH 253/676] translated --- ...in Ubuntu and Other Linux Distributions.md | 183 ------------------ 1 file changed, 183 deletions(-) delete mode 100644 sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md b/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md deleted file mode 100644 index ab88f9198d..0000000000 --- a/sources/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md +++ /dev/null @@ -1,183 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions) -[#]: via: (https://itsfoss.com/start-stop-restart-services-linux/) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions -====== - -Services are essential background processes that are usually run while booting up and shut down with the OS. - -If you are a sysadmin, you’ll deal with the service regularly. - -If you are a normal desktop user, you may come across the need to restart a service like [setting up Barrier for sharing mouse and keyboard between computers][1]. or when you are [using ufw to setup firewall][2]. - -Today I will show you two different ways you can manage services. You’ll learn to start, stop and restart services in Ubuntu or any other Linux distribution. - -systemd vs init - -Ubuntu and many other distributions these days use systemd instead of the good old init. - -In systemd, you manage sevices with systemctl command. - -In init, you manage service with service command. - -You’ll notice that even though your Linux system uses systemd, it is still able to use the service command (intended to be used with init system). This is because service command is actually redirect to systemctl. It’s sort of backward compatibility introduced by systemd because sysadmins were habitual of using the service command. - -I’ll show both systemctl and service command in this tutorial. - -_I am Ubuntu 18.04 here, but the process (no pun intended) is the same for other versions._ - -### Method 1: Managing services in Linux with systemd - -I am starting with systemd because of the obvious reason of its widespread adoption. - -#### 1\. List all services - -In order to manage the services, you first need to know what services are available on your system. - -You can use the systemd command to list all the services on your Linux system: - -``` -systemctl list-unit-files --type service -all -``` - -![systemctl list-unit-files][3] - -This command will output the state of all services. The value of a service’s state can be enabled, disabled, masked (inactive until mask is unset), static and generated. - -Combine it with the [grep command][4] and you can **display just the running services**: - -``` -sudo systemctl | grep running -``` - -![Display running services systemctl][5] - -Now that you know how to reference all different services, you can start actively managing them. - -**Note:** ***<service-***_**name>**_ _in the commands should be replaced by the name of the service you wish to manage (e.g. network-manager, ufw etc.)._ - -#### **2\. Start a** service - -To start a service in Linux, you just need to use its name like this: - -``` -systemctl start -``` - -#### 3\. **Stop** a service - -To stop a systemd service, you can use the stop option of systemctl command: - -``` -systemctl stop -``` - -#### 4\. Re**start** a service - -To restart a service in Linux with systemd, you can use: - -``` -systemctl restart -``` - -#### 5\. Check the status of a service - -You can confirm that you have successfully executed a certain action by printing the service status: - -``` -systemctl status -``` - -This will output information in the following manner: - -![systemctl status][6] - -That was systemd. Let’s switch to init now. - -### Method 2: Managing services in Linux with init - -The commands in init are also as simple as system. - -#### 1\. List all services - -To list all the Linux services, use - -``` -service --status-all -``` - -![service –status-all][7] - -The services preceded by **[ – ]** are **disabled** and those with **[ + ]** are **enabled**. - -#### **2\. Start** a service - -To start a service in Ubuntu and other distributions, use this command: - -``` -service start -``` - -#### **3\. Stop** a service - -Stopping a service is equally easy. - -``` -service stop -``` - -#### 4\. Re**start** a service - -If you want to restart a service, the command is: - -``` -service restart -``` - -#### 5\. Check the status of a service - -Furthermore, to check if your intended result was achieved, you can output the service ****status**:** - -``` -service status -``` - -This will output information in the following manner: - -![service status][8] - -This will, most importantly, tell you if a certain service is active **(**running**)** or not. - -**Wrapping Up** - -Today I detailed two very simple methods of managing services on Ubuntu or any other Linux system. I hope this article was helpful to you. - -Which method do you prefer? Let us know in the comment section below! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/start-stop-restart-services-linux/ - -作者:[Sergiu][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/sergiu/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/keyboard-mouse-sharing-between-computers/ -[2]: https://itsfoss.com/set-up-firewall-gufw/ -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_list_services.png?ssl=1 -[4]: https://linuxhandbook.com/grep-command-examples/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_grep_running.jpg?ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_status.jpg?ssl=1 -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status_all.png?ssl=1 -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status.jpg?ssl=1 From 13b71fdd21ee33187fcceb85c10a56c987412bb3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 25 Dec 2019 08:53:12 +0800 Subject: [PATCH 254/676] translated --- ...in Ubuntu and Other Linux Distributions.md | 183 ++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md diff --git a/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md b/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..ec3367d6ef --- /dev/null +++ b/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/start-stop-restart-services-linux/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu 和其他 Linux 发行版中启动、停止和重启服务 +====== + +服务是必不可少的后台进程,它通常随系统启动,并在关机时关闭。 + +如果你是系统管理员,那么你会定期处理服务。 + +如果你是普通桌面用户,你可能会遇到需要重启服务的情况,例如[安装 Barrier 来用于在计算机之间共享鼠标和键盘][1]。或[在使用 ufw 设置防火墙][2]时。 + +今天,我将向你展示两种管理服务的方式。你将学习在 Ubuntu 或任何其他 Linux 发行版中启动、停止和重启服务。 + +systemd 与 init + +如今,Ubuntu 和许多其他发行版都使用 systemd 而不是旧的 init。 + +在 systemd 中,可以使用 systemctl 命令管理服务。 + +在 init 中,你可以使用 service 命令管理服务。 + +你会注意到,即使你的 Linux 系统使用 systemd,它仍然可以使用 service 命令(为了与 init 系统一起使用)。这是因为 service 命令实际上已重定向到 systemctl。systemd 引入了向后兼容性,因为系统管理员们习惯使用 service 命令。 + +在本教程中,我将同时展示 systemctl 和 service 命令。 + +_我的是 Ubuntu 18.04,但其他版本的过程也一样_。 + +### 方法 1:使用 systemd 在 Linux 中管理服务 + +我从 systemd 开始,因为它被广泛接受。 + +#### 1\. 列出所有服务 + +为了管理服务,你首先需要知道系统上有哪些服务可用。 + +你可以使用 systemd 命令列出 Linux 系统上的所有服务: + +``` +systemctl list-unit-files --type service -all +``` + +![systemctl list-unit-files][3] + +此命令将输出所有服务的状态。服务状态有启用、禁用、屏蔽(在取消掩码之前处于非活动状态)、静态和已生成。 + +与 [grep 命令][4] 结合,你可以**仅显示正在运行的服务**: + +``` +sudo systemctl | grep running +``` + +![Display running services systemctl][5] + +现在,你知道了如何引用所有不同的服务,你可以开始主动管理它们。 + +**注意:** 命令中的 **<service-name>** 应该用你想管理的服务名代替。(比如:network-manager、ufw 等) + +#### 2\. 启动服务 + +要在 Linux 中启动服务,你只需使用它的名字: + +``` +systemctl start +``` + +#### 3\. 停止服务 + +要停止 systemd 服务,可以使用 systemctl 命令的 stop 选项: + +``` +systemctl stop +``` + +#### 4\. 重启服务 + +要重启 systemd 服务,可以使用: + +``` +systemctl restart +``` + +#### 5\. 检查服务状态 + +你可以通过打印服务状态来确认你已经成功执行特定操作: + +``` +systemctl status +``` + +这将以以下方式输出: + +![systemctl status][6] + +这是 systemd 的内容。现在切换到 init。 + +### 方法 2:使用 init 在 Linux 中管理服务 + +init 的命令和 systemd 的一样简单。 + +#### 1\. 列出所有服务 + +要列出所有 Linux 服务,使用: + +``` +service --status-all +``` + +![service –status-all][7] + +前面的 **[ – ]** 代表**禁用**,**[ + ]** 代表**启用**。 + +#### 2\. 启动服务 + +要在 Ubuntu 和其他发行版中启动服务,使用命令: + +``` +service start +``` + +#### 3\. 停止服务 + +停止服务同样简单。 + +``` +service stop +``` + +#### 4\. 重启服务 + +如果你想重启服务,命令是: + +``` +service restart +``` + +#### 5\. 检查服务状态 + +此外,要检查是否达到了预期的结果,你可以输出服务**状态**: + +``` +service status +``` + +这将以以下方式输出: + +![service status][8] + +最重要的是,这将告诉你某项服务是否处于活跃状态(**正在运行**)。 + +**总结** + +今天,我详细介绍了两种在 Ubuntu 或任何其他 Linux 系统上管理服务的非常简单的方法。 希望本文对你有所帮助。 + +你更喜欢哪种方法? 让我在下面的评论中知道! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/start-stop-restart-services-linux/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/keyboard-mouse-sharing-between-computers/ +[2]: https://itsfoss.com/set-up-firewall-gufw/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_list_services.png?ssl=1 +[4]: https://linuxhandbook.com/grep-command-examples/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_grep_running.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_status.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status_all.png?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status.jpg?ssl=1 From b55e746027448aaa5c36e8cbeec650d11c7b8629 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 25 Dec 2019 09:34:04 +0800 Subject: [PATCH 255/676] translating --- ...24 App Highlight- Falkon Open Source Web Browser from KDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md index 42439f33c1..7f3ec34562 100644 --- a/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ b/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d0717e53ebe8c7e0628580003a7b80bac5140017 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 25 Dec 2019 15:56:40 +0800 Subject: [PATCH 256/676] APL --- .../tech/20191224 Unix is turning 50. What does that mean.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191224 Unix is turning 50. What does that mean.md b/sources/tech/20191224 Unix is turning 50. What does that mean.md index c01821ea28..259eecb964 100644 --- a/sources/tech/20191224 Unix is turning 50. What does that mean.md +++ b/sources/tech/20191224 Unix is turning 50. What does that mean.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 85605b3c5c6d58c2b6faf9fe82f090deb4b169e8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 25 Dec 2019 16:44:31 +0800 Subject: [PATCH 257/676] TSL --- ...Unix is turning 50. What does that mean.md | 119 ------------------ ...Unix is turning 50. What does that mean.md | 111 ++++++++++++++++ 2 files changed, 111 insertions(+), 119 deletions(-) delete mode 100644 sources/tech/20191224 Unix is turning 50. What does that mean.md create mode 100644 translated/tech/20191224 Unix is turning 50. What does that mean.md diff --git a/sources/tech/20191224 Unix is turning 50. What does that mean.md b/sources/tech/20191224 Unix is turning 50. What does that mean.md deleted file mode 100644 index 259eecb964..0000000000 --- a/sources/tech/20191224 Unix is turning 50. What does that mean.md +++ /dev/null @@ -1,119 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Unix is turning 50. What does that mean?) -[#]: via: (https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Unix is turning 50. What does that mean? -====== -Unix time, also known as 'epoch time,' is the number of seconds that have passed since Jan 1, 1970. As Unix turns 50, let's take a look at what worries kernel developers. -[cbaquiran][1] [(CC0)][2] - -2020 is a significant year for Unix. At the very start of the year, Unix turns 50. - -While some of the early development of Unix predates the official start of its "epoch," Jan 1, 1970 remains the zero-point in POSIX time and the recognized beginning of all things Unix. Jan 1, 2020 will mark 50 years since that moment. - -### Unix time vs human time - -In terms of human time, 50 years is a big deal. In terms of Unix time, there's nothing particularly special about 50 years. 48.7 years would be no less significant. - -[][3] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][3] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -Unix (including Linux) systems store date/time values as the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC in 32 bits. To determine how many seconds have passed since that time and, thus, what right now looks like as a Unix time value, you can issue a command like this: - -``` -$ date +%s -1576883876 -``` - -The **%s** argument tells the date command to display the current date/time as the number of seconds since the start of 1970-01-01. - -### How much time can Unix systems manage? - -To understand how much time Unix systems can accommodate, we need to look at the capacity of a 32-bit field. It can be calculated like this: - -``` -$ echo '2^32' | bc -4294967296 -``` - -However, since Unix needs to accommodate negative numbers, it reserves one bit for a number's sign, thus reducing this to: - -``` -$ echo '2^31' | bc -2147483648 -``` - -And, since Unix numbering begins with 0, that means we have 2,147,483,648 values, but the largest possible value is 2,147,483,647. Unix date/time values cannot exceed that number – just like the odometer on your car probably can't exceed 999,999 miles. Add 1 and the value turns to 0. - -### How long is a year in seconds? - -The number of seconds in most years can be calculated like this – hours/day multiplied by minutes/hour multiplied by seconds/minute multiplied by the number of days in a year: - -``` -$ expr 24 \* 60 \* 60 \* 365 -31536000 -``` - -In leap years, we just add another day: - -``` -$ expr 24 \* 60 \* 60 \* 366 -31622400 -``` - -### **How will Unix see its 50 year birthday?** - -12:00 AM on Jan 1, 2020 will be **1577836800** in epoch time. The calculation is a little tricky, but mostly because we have to accommodate leap years. Since the start of the epoch, we've had 12 leap years, starting in 1972, the last in 2016. And, when we reach 2020, we will have had 38 regular years. - -Here’s a calculation using the **expr** command to count the seconds in these 50 years: - -``` -$ expr 24 \* 60 \* 60 \* 365 \* 38 + 24 \* 60 \* 60 \* 366 \* 12 -1577836800 -``` - -The first half of that is calculating the seconds in the 38 non-leap years. We then add a similar calculation for leap years with their 366 days. Conversely, you could use the seconds per year figures presented earlier and just do this: - -``` -$ expr 31536000 \* 38 + 31622400 \* 12 -1577836800 -``` - -This way of tracking dates and times made Unix systems fairly impervious to the Y2K scare that had people in late 1999 worried that moving into the year 2000 would wreak havoc on computer systems. Far fewer problems were experienced than people feared. In fact, only applications which stored years in a two-digit format would see the year going to 00 as a sign that time jumping backwards. Still, lots of application developers had some tedious extra work piled onto their plates to ensure that their systems wouldn’t run into serious problems when 2000 hit. - -### When Unix time will run into problems - -Unix systems won’t run into a **Y2K** type of problem until **2038** when dates stored as described above will overrun their 32-bit space allotments. But that’s 18 years from now, and kernel developers are already working on how they will avert disaster. It’s a bit too early to start panicking. - -The year 2038 problem is sometimes referred to as the **Y2K38** problem. We have until Tuesday, January 19, 2038 to address it. If the problem isn’t resolved, systems after that date may think it’s 1901. One way to address the problem would be to switch to 64-bit representations of date/time information. Some people believe that even that will be a lot more complex than it sounds. In any case, it’s probably still too early to panic. And, in the meantime, maybe after singing "Auld Lang Syne" this New Year’s Eve, you can sing "Happy Birthday" to Unix. It’s turning 50, and that’s still a very big deal. - -Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://pixabay.com/en/birthday-cake-cake-birthday-380178/ -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20191224 Unix is turning 50. What does that mean.md b/translated/tech/20191224 Unix is turning 50. What does that mean.md new file mode 100644 index 0000000000..f68c48ffd6 --- /dev/null +++ b/translated/tech/20191224 Unix is turning 50. What does that mean.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Unix is turning 50. What does that mean?) +[#]: via: (https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Unix 即将迎来 50 岁 +====== + +Unix 时间(又称为“纪元时间epoch time”)是自 1970 年 1 月 1 日以来经过的秒数。当 Unix 即将 50 岁时,让我们看一下让内核开发人员担心的地方。 + +[cbaquiran][1] + +对于 Unix 而言,2020 年是重要的一年。在这一年年初,Unix 进入 50 岁。 + +尽管 Unix 的某些早期开发早于其“纪元”的正式开始,但 1970 年 1 月 1 日仍然是 POSIX 时间的零点,也是公认的 Unix 的万物之始。自那一刻算起,2020 年 1 月 1 日将是其 50 周年。 + +### Unix 时间与人类时间 + +就人类时间而言,50 年是很重要的。就 Unix 时间而言,50 年没有什么特别的。48.7 年同样重要。 + +Unix(包括 Linux)系统将日期/时间值存储为自 1970-01-01 00:00:00 UTC 以来经过的秒数(32 位二进制)。要确定自该时间以来经过了几秒钟,看看 Unix 时间值是什么样子,你可以发出如下命令: + +``` +$ date +%s +1576883876 +``` + +`%s` 参数告诉 `date` 命令将当前日期/时间显示为自 1970-01-01 开始以来的秒数。 + +### Unix 系统可以管理多少时间? + +要了解 Unix 系统可以容纳多少时间,我们需要查看 32 位字段的容量。可以这样计算: + +``` +$ echo '2^32' | bc +4294967296 +``` + +但是,由于 Unix 需要容纳负数,因此它会为数字的符号保留一位,从而将其减少为: + +``` +$ echo '2^31' | bc +2147483648 +``` + +并且,由于 Unix 计数以 0 开头,这意味着我们有 2,147,483,648 个值,但最大的可能值为 2,147,483,647 个。Unix 日期/时间值不能超过该数字——就像汽车上的里程表可能不能超过 999,999 英里一样。加 1 该值就变为了 -2147483648。(LCTT 译注:此处原文描述有误,已修改。在达到最大值之后,即 2018/1/19 03:14:07,下 1 秒导致符号位变为 1,其余 31 位为 0,即 -2147483648,时间变为 1901/12/13 20:45:52,这就是 Y2K38 问题。) + +### 一年有多少秒? + +大多数年份的秒数可以这样计算:每天的小时数乘以每小时的分钟数乘以每分钟的秒数乘以一年中的天数: + +``` +$ expr 24 \* 60 \* 60 \* 365 +31536000 +``` + +在闰年,我们再增加一天: + +``` +$ expr 24 \* 60 \* 60 \* 366 +31622400 +``` + +### Unix 将如何庆祝其 50 岁生日? + +2020 年 1 月 1 日中午 12:00 是纪元时间的 1577836800。这个计算有些棘手,但主要是因为我们必须适应闰年。自该纪元开始以来,我们经历了 12 个闰年,从 1972 年开始,到上一个闰年是 2016 年。而且,当我们达到 2020 年时,我们将有 38 个常规年份。 + +这是使用 `expr` 命令进行的计算,以计算这 50 年的秒数: + +``` +$ expr 24 \* 60 \* 60 \* 365 \* 38 + 24 \* 60 \* 60 \* 366 \* 12 +1577836800 +``` + +前半部分是计算 38 个非闰年的秒数。然后,我们加上闰年的 366 天的类似计算。或者,你可以使用前面介绍的每年秒数,然后执行以下操作: + +``` +$ expr 31536000 \* 38 + 31622400 \* 12 +1577836800 +``` + +这种跟踪日期和时间的方式使 Unix 系统完全不受 Y2K 恐慌的影响,1999 年末人们开始担心进入 2000 年会对计算机系统造成严重破坏。但是实际遇到的问题比人们担心的少得多。实际上,只有以两位数格式存储年份的应用程序才会将年份变为 00,以表示时间倒退。尽管如此,许多应用程序开发人员还是做了很多额外的繁琐工作,以确保 2000 年到来时,他们的系统不会出现严重问题。 + +### Unix 时间何时会遇到问题? + +在 2038 年之前,Unix 系统不会遇到 Y2K 类型的问题,直到如上所述存储的日期将超过其 32 位空间分配。但这距离现在已经只有 18 年了,内核开发人员已经在研究如何避免灾难。但现在开始恐慌还为时过早。 + +2038 年的问题有时称为 Y2K38 问题。我们必须在 2038 年 1 月 19 日星期二之前解决这个问题。如果问题到时候仍未解决,则该日期之后的系统可能会认为是 1901 年。解决该问题的一种方法是切换为日期/时间信息的 64 位表示形式。有些人认为,即使那样,也会有比听起来更复杂的问题。无论如何,恐慌还为时过早。并且,与此同时,也许在新年前夜演唱了《Auld Lang Syne》之后,你可以向 Unix 唱《生日快乐》歌了。Unix 50 岁了,这仍然是大事。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2017/10/birthday-cake-candles-100739452-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From e329b96dcb28b3e3a666893ba519ecd5d030fb45 Mon Sep 17 00:00:00 2001 From: chen ni Date: Wed, 25 Dec 2019 19:04:11 +0800 Subject: [PATCH 258/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20191218 How tracking pixels work.md | 94 +++++++++---------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/sources/tech/20191218 How tracking pixels work.md b/sources/tech/20191218 How tracking pixels work.md index 11ac17be73..851652c129 100644 --- a/sources/tech/20191218 How tracking pixels work.md +++ b/sources/tech/20191218 How tracking pixels work.md @@ -7,98 +7,90 @@ [#]: via: (https://jvns.ca/blog/how-tracking-pixels-work/) [#]: author: (Julia Evans https://jvns.ca/) -How tracking pixels work +追踪像素是如何工作的? ====== -I spent some time talking to a reporter yesterday about how advertisers track people on the internet. We had a really fun time looking at Firefox’s developer tools together (I’m not an internet privacy expert, but I do know how to use the network tab in developer tools!) and I learned a few things about how tracking pixels actually work in practice! +昨天,我和一名记者谈到了一个问题:广告商是如何在互联网上对人们进行追踪的?我们津津有味地查看了 Firefox 的开发者工具(虽然我不是一个互联网隐私专家,但至少还会使用开发者工具中的“network”标签页),从中我终于弄明白追踪像素在实际中是如何工作的了。 -### the question: how does Facebook know that you went to Old Navy? +### 问题:Facebook 怎么知道你逛了 Old Navy? -I often hear about this slightly creepy internet experience: you’re looking at a product online, and a day later see an ad for the same boots or whatever that you were looking at. This is called “retargeting”, but how does it actually work exactly in practice? +我时常听人们说起这种有些诡异的上网经历:你在线上浏览了一个商品,一天之后,竟然看到了同一款靴子(或者是别的什么你当时浏览的商品)的广告。这就是所谓的“再营销”,但它到底是如何实现的呢? -In this post we’ll experiment a bit and see exactly how Facebook can know what products you’ve looked at online! I’m using Facebook as an example in this blog post just because it’s easy to find websites with Facebook tracking pixels on them but of course almost every internet advertising company does this kind of tracking. +在本文中,我们来进行一个小实验,看看 Facebook 究竟是怎么知道你在线上浏览了什么商品的。这里使用 Facebook 作为示例,只是因为很容易找到投放了 Facebook 追踪像素的网站;其实,几乎所有互联网广告公司都会使用类似的追踪技术。 -### the setup: allow third party trackers, turn off my adblocker +### 准备:允许第三方追踪器,同时关闭广告拦截器 -I use Firefox, and by default Firefox blocks a lot of this kind of tracking. So I needed to modify my Firefox privacy settings to get this tracking to work. +我使用的浏览器是 Firefox,但是 Firefox 默认拦截了很多这种类型的追踪,所以需要修改 Firefox 的隐私设置,才能让这种追踪生效。 -I changed my privacy settings from the default ([screenshot][1]) to a custom setting that allows third-party trackers ([screenshot][2]). I also disabled some privacy extensions I usually have running. +首先,我将隐私设置从默认设置([截图][1])修改为允许第三方追踪器的个性化设置([截图][2]),然后禁用了一些平时运行的隐私保护扩展。 -### tracking pixels: it’s not the gif, it’s the query parameters +### 追踪像素:关键不在于 gif,而在于请求参数 -A tracking pixel is a 1x1 gif that sites use to track you. By itself, obviously a tiny 1x1 gif doesn’t do too much. So how do tracking pixels track you? 2 ways: +追踪像素是网站用来追踪你的一个 1x1 大小的 gif。就其本身而言,一个小小的 1x1 gif 显然起不到什么作用。那么,追踪像素到底是如何进行追踪的?其中涉及两个方面: - 1. Sites use the **query parameters** in the tracking pixel to add extra information like the URL of the page you’re visiting. So instead of just requesting `https://www.facebook.com/tr/` (which is a 44-byte 1x1 gif), it’ll request `https://www.facebook.com/tr/?the_website_you're_on`. (email marketers use similar tricks to figure out if you’ve opened an email, by giving the tracking pixel a unique URL) - 2. Sites send **cookies** with the tracking pixel so that they can tell that the person who visited oldnavy.com is the same as the person who’s using Facebook on the same computer. + 1. 通过使用追踪像素上的**请求参数**,网站可以添加额外的信息,比如你正在访问的页面。这样一来,请求的就不是 `https://www.facebook.com/tr/`(这个链接是一个 44 字节大小的 1x1 gif),而是 `https://www.facebook.com/tr/?the_website_you're_on`。(邮件营销人员会使用类似的技巧,通过为追踪像素指定一个独特的 URL,弄清楚你是否打开了某一封邮件。) + 2. 在发送该请求的同时,还发送了相应的 cookie。这样一来广告商就可以知道,访问 oldnavy.com 的这个人和在同一台电脑上使用 Facebook 的是同一个人。 +### Old Navy 网站上的 Facebook 追踪像素 +为了对此进行验证,我在 Old Navy(GAP 旗下的一个服装品牌)网站上浏览了一个商品,相应的URL是 [https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1][3](这是一件“男款短绒格子花呢大衣”)。 -### the Facebook tracking pixel on Old Navy’s website - -To test this out, I went to look at a product on the Old Navy site with the URL [https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1][3] (a “Soft-Brushed Plaid Topcoat for Men”). - -When I did that, the Javascript running on that page (presumably [this code][4]) sent a request to facebook.com that looks like this in Developer tools: (I censored most of the cookie values because some of them are my login cookies :) ) +在我浏览这个商品的同时,页面上运行的 Javascript(用的应该是[这段代码][4])向 facebook.com 发送了一个请求。在开发者工具中,该请求看上去是这样的:(我屏蔽了大部分 cookie 值,因为其中有一些是我的登录 cookie) ![][5] -Let’s break down what’s happening: +下面对其进行拆解分析: - 1. My browser sends a request to ` https://www.facebook.com/tr/?id=937725046402747&ev=PageView&dl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fproduct.do%3Fpid%3D504753002%26cid%3D1125694%26pcid%3Dxxxxxx0%26vid%3D1%26grid%3Dpds_0_109_1%23pdp-page-content&rl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fcategory.do%3Fcid%3D1135640%26mlink%3D5155%2Cm_mts_a&if=false&ts=1576684838096&sw=1920&sh=1080&v=2.9.15&r=stable&a=tmtealium&ec=0&o=30&fbp=fb.1.1576684798512.1946041422&it=15xxxxxxxxxx4&coo=false&rqm=GET` - 2. With that request, it sends a cookie called `fr` which is set to `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.` (which I guess is my Facebook ad tracking ID) + 1. 我的浏览器向 ` https://www.facebook.com/tr/?id=937725046402747&ev=PageView&dl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fproduct.do%3Fpid%3D504753002%26cid%3D1125694%26pcid%3Dxxxxxx0%26vid%3D1%26grid%3Dpds_0_109_1%23pdp-page-content&rl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fcategory.do%3Fcid%3D1135640%26mlink%3D5155%2Cm_mts_a&if=false&ts=1576684838096&sw=1920&sh=1080&v=2.9.15&r=stable&a=tmtealium&ec=0&o=30&fbp=fb.1.1576684798512.1946041422&it=15xxxxxxxxxx4&coo=false&rqm=GET` 发送了一个请求; + 2. 与该请求同时发送的,还有一个名为 `fr` 的 cookie,取值为 `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.`(估计是我的 Facebook 广告追踪 ID) +在所发送的追踪像素查询字符串里,有三个值得注意的地方: + * 我当前访问的页面:[https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1#pdp-page-content][6] + * 引导我来到当前页面的上一级页面:[https://oldnavy.gap.com/browse/category.do?cid=1135640&mlink=5155,m_mts_a][7]; + * 作为我的身份标识的 cookie:`10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.` -So the three most notable things that are being sent in the tracking pixel query string are: +### 下面来逛逛 Facebook! - * the page I visited: [https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1#pdp-page-content][6] - * the page that referred me to that page: [https://oldnavy.gap.com/browse/category.do?cid=1135640&mlink=5155,m_mts_a][7] - * an identifier cookie for me: `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.` +下面来逛逛 Facebook 吧。我之前已经登入了 Facebook,猜猜看,我的浏览器发送给 Facebook 的 cookie 是什么? +不出所料,正是之前见过的 `fr` cookie:`10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.`。Facebook 现在一定知道我(Julia Evans,这个 Facebook 账号所关联的人)在几分钟之前访问了 Old Navy 网站,并且浏览了“男款短绒格子花呢大衣”,因为他们可以使用这个 cookie 将数据串联起来。 +### 这里涉及到的是第三方 cookie -### now let’s visit Facebook! +Facebook 用来追踪我访问了哪些网站的 cookie,属于所谓的“第三方 cookie”,因为 Old Navy 的网站使用它为一个第三方(即 facebook.com)确认我的身份。这和用来维持登录状态的“第一方 cookie”有所不同。 -Next, let’s visit Facebook, where I’m logged in. What cookies is my browser sending Facebook? +Safari 和 Firefox 默认都会拦截许多第三方 cookie(所以需要更改 Firefox 的隐私设置,才能够进行这个实验),而 Chrome 目前并不进行拦截(很可能是因为 Chrome 的所有者正是一个广告公司)。 -Unsurprisingly, it’s the same `fr` cookie from before: `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.`. So Facebook now definitely knows that I (Julia Evans, the person with this Facebook account) visited the Old Navy website a couple of minutes ago and looked at a “Soft-Brushed Plaid Topcoat for Men”, because they can use that identifier to match up the data. +### 网站上有很多追踪像素 -### these cookies are third-party cookies +如我所料,网站上有 **很多** 追踪像素。比如,wrangler.com 在我的浏览器里加载了来自不同域的 19 个不同的追踪像素。wrangler.com 上的追踪像素分别来自:`ct.pinterest.com`、`af.monetate.net`、`csm.va.us.criteo.net`、`google-analytics.com`、`dpm.demdex.net`、`google.ca`、`a.tribalfusion.com`、`data.photorank.me`、`stats.g.doubleclick.net`、`vfcorp.dl.sc.omtrdc.net`、`ib.adnxs.com`、`idsync.rlcdn.com`、`p.brsrvr.com`,以及`adservice.google.com`。 -The `fr` cookie that Facebook is using to track what websites I go to is called a “third party cookie”, because Old Navy’s website is using it to identify me to a third party (facebook.com). This is different from first-party cookies, which are used to keep you logged in. - -Safari and Firefox both block many third-party cookies by default (which is why I had to change Firefox’s privacy settings to get this experiment to work), and as of today Chrome doesn’t (presumably because Chrome is owned by an ad company). - -### sites have lots of tracking pixels - -Like I expected, sites have **lots** of tracking pixels. For example, wrangler.com loaded 19 different tracking pixels in my browser from a bunch of different domains. The tracking pixels on wrangler.com came from: `ct.pinterest.com`, `af.monetate.net`, `csm.va.us.criteo.net`, `google-analytics.com`, `dpm.demdex.net`, `google.ca`, `a.tribalfusion.com`, `data.photorank.me`, `stats.g.doubleclick.net`, `vfcorp.dl.sc.omtrdc.net`, `ib.adnxs.com`, `idsync.rlcdn.com`, `p.brsrvr.com`, and `adservice.google.com`. - -For most of these trackers, Firefox helpfully pointed out that it would have blocked them if I was using the standard Firefox privacy settings: +Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的大部分追踪器都会被拦截: ![][8] -### why browsers matter +### 浏览器的重要性 -The reason browsers matter so much is that your browser has the final word on what information it sends about you to which websites. The Javascript on the Old Navy’s website can ask your browser to send tracking information about you to Facebook, but your browser doesn’t have to do it! It can decide “oh yeah, I know that facebook.com/tr/ is a tracking pixel, I don’t want my users to be tracked, I’m just not going to send that request”. +浏览器之所以如此重要,是因为你的浏览器最终决定了发送你的什么信息、发送到哪些网站。Old Navy 网站上的 Javascript 可以请求你的浏览器向 Facebook 发送关于你的追踪信息,但浏览器可以拒绝执行。浏览器的决定可以是:“哈,我知道 facebook.com/tr/ 是一个追踪像素,我不想让我的用户被追踪,所以我不会发送这个请求”。 -And it can make that behaviour configurable by changing browser settings or installing browser extensions, which is why there are lots of privacy extensions. +浏览器还可以允许用户对上述行为进行配置,方法包括更改浏览器设置,以及安装浏览器扩展(所以才会有如此多的隐私保护扩展)。 -### it’s fun to see how this works! +### 摸清其中原理,实为一件趣事 -I think it’s fun to see how cookies / tracking pixels are used to track you in practice, even if it’s kinda creepy! I sort of knew how this worked before but I’d never actually looked at the cookies on a tracking pixel myself or what kind of information it was sending in its query parameters exactly. +在我看来,弄清楚 cookie / 追踪像素是怎么用于对你进行追踪的,实在是一件趣事(尽管显得有点阴险)。我之前大概明白其中的道理,但是并没有亲自查看过追踪像素上的 cookie,也没有看过发送的查询参数上究竟包含什么样的信息。 -And if you know how it works, it’s a easier to figure out how to be tracked less! +当然,明白了其中的原理,也就更容易降低被追踪的概率了。 -### what can you do? +### 可以采取的措施 -I do a few small things to get tracked on the internet a little less: +为了尽量避免在互联网上被追踪,我采取了几种简单的措施: - * install an adblocker (like ublock origin or something), which will block a lot of tracker domains - * use Firefox/Safari instead of Chrome (which have stronger default privacy settings right now) - * use the [Facebook Container][9] Firefox extension, which takes extra steps to specifically prevent Facebook from tracking you + * 安装一个广告拦截器(比如 ublock origin 之类)。广告拦截器可以对许多追踪器的域进行拦截。 + * 使用目前默认隐私保护强度更高的 Firefox/Safari,而不是 Chrome。 + * 使用 [Facebook Container][9] 这个 Firefox 扩展。该扩展针对 Facebook 进一步采取了防止追踪的措施。 - - -There are still lots of other ways to be tracked on the internet (especially when using mobile apps where you don’t have the same kind of control as with your browser), but I like understanding how this one method of tracking works and think it’s nice to be tracked a little bit less. +虽然在互联网上被追踪的方式还有很多(尤其是在使用手机应用的时候,因为在这种情况下,你没有和像对浏览器一样的控制程度),但是能够理解这种追踪方法的工作原理,稍微减少一些被追踪的可能性,也总归是一件好事。 -------------------------------------------------------------------------------- From e788516a3e5d7d166b8f5f0384756bd297f1e199 Mon Sep 17 00:00:00 2001 From: chen ni Date: Wed, 25 Dec 2019 19:11:03 +0800 Subject: [PATCH 259/676] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20191218 How tracking pixels work.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sources/tech/20191218 How tracking pixels work.md b/sources/tech/20191218 How tracking pixels work.md index 851652c129..9be6ed4049 100644 --- a/sources/tech/20191218 How tracking pixels work.md +++ b/sources/tech/20191218 How tracking pixels work.md @@ -62,9 +62,9 @@ Facebook 用来追踪我访问了哪些网站的 cookie,属于所谓的“第 Safari 和 Firefox 默认都会拦截许多第三方 cookie(所以需要更改 Firefox 的隐私设置,才能够进行这个实验),而 Chrome 目前并不进行拦截(很可能是因为 Chrome 的所有者正是一个广告公司)。 -### 网站上有很多追踪像素 +### 网站上的追踪像素有很多 -如我所料,网站上有 **很多** 追踪像素。比如,wrangler.com 在我的浏览器里加载了来自不同域的 19 个不同的追踪像素。wrangler.com 上的追踪像素分别来自:`ct.pinterest.com`、`af.monetate.net`、`csm.va.us.criteo.net`、`google-analytics.com`、`dpm.demdex.net`、`google.ca`、`a.tribalfusion.com`、`data.photorank.me`、`stats.g.doubleclick.net`、`vfcorp.dl.sc.omtrdc.net`、`ib.adnxs.com`、`idsync.rlcdn.com`、`p.brsrvr.com`,以及`adservice.google.com`。 +如我所料,网站上的追踪像素有 **很多**。比如,wrangler.com 在我的浏览器里加载了来自不同域的 19 个不同的追踪像素。wrangler.com 上的追踪像素分别来自:`ct.pinterest.com`、`af.monetate.net`、`csm.va.us.criteo.net`、`google-analytics.com`、`dpm.demdex.net`、`google.ca`、`a.tribalfusion.com`、`data.photorank.me`、`stats.g.doubleclick.net`、`vfcorp.dl.sc.omtrdc.net`、`ib.adnxs.com`、`idsync.rlcdn.com`、`p.brsrvr.com`,以及`adservice.google.com`。 Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的大部分追踪器都会被拦截: @@ -86,7 +86,7 @@ Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的 为了尽量避免在互联网上被追踪,我采取了几种简单的措施: - * 安装一个广告拦截器(比如 ublock origin 之类)。广告拦截器可以对许多追踪器的域进行拦截。 + * 安装一个广告拦截器(比如 ublock origin 之类)。广告拦截器可以针对许多追踪器的域进行拦截。 * 使用目前默认隐私保护强度更高的 Firefox/Safari,而不是 Chrome。 * 使用 [Facebook Container][9] 这个 Firefox 扩展。该扩展针对 Facebook 进一步采取了防止追踪的措施。 From df0e39e61fdbbb1361179f65fa58274834e64e21 Mon Sep 17 00:00:00 2001 From: chen ni Date: Wed, 25 Dec 2019 19:14:13 +0800 Subject: [PATCH 260/676] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {sources => translated}/tech/20191218 How tracking pixels work.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191218 How tracking pixels work.md (100%) diff --git a/sources/tech/20191218 How tracking pixels work.md b/translated/tech/20191218 How tracking pixels work.md similarity index 100% rename from sources/tech/20191218 How tracking pixels work.md rename to translated/tech/20191218 How tracking pixels work.md From 0c9a9661430d5e6f7322a0177feeea39ff151ebb Mon Sep 17 00:00:00 2001 From: Hank Chow <280630620@qq.com> Date: Wed, 25 Dec 2019 21:02:12 +0800 Subject: [PATCH 261/676] hankchow translated --- ...code needs to be beautiful and explicit.md | 66 ------------------- ...code needs to be beautiful and explicit.md | 65 ++++++++++++++++++ 2 files changed, 65 insertions(+), 66 deletions(-) delete mode 100644 sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md create mode 100644 translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md diff --git a/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md b/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md deleted file mode 100644 index 10fecd9694..0000000000 --- a/sources/tech/20191222 Why your Python code needs to be beautiful and explicit.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why your Python code needs to be beautiful and explicit) -[#]: via: (https://opensource.com/article/19/12/zen-python-beauty-clarity) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -Why your Python code needs to be beautiful and explicit -====== -Welcome to Pythonukkah, a special series about the Zen of Python. On the -first day, we celebrate the first two principles: beauty and -explicitness. -![Searching for code][1] - -Python contributor Tim Peters introduced us to the [Zen of Python][2] in 1999. Twenty years later, its 19 guiding principles continue to be relevant within the community. We start our Pythonukkah celebration—like Hanukkah, a festival of lights—with the first two principles in the Zen of Python: on beauty and explicitness. - -> "Hanukkah is the Festival of Lights, -> Instead of one day of presents, we get eight crazy nights." -> —Adam Sandler, [_The Hanukkah Song_][3] - -### Beautiful is better than ugly. - -It was in _[Structure and Interpretation of Computer Programs][4]_ (_SICP_) that the point was made: "Programs must be written for people to read and only incidentally for machines to execute." Machines do not care about beauty, but people do. - -A beautiful program is one that is enjoyable to read. This means first that it is consistent. Tools like [Black][5], [flake8][6], and [Pylint][7] are great for making sure things are reasonable on a surface layer. - -But even more important, only humans can judge what humans find beautiful. Code reviews and a collaborative approach to writing code are the only realistic way to build beautiful code. Listening to other people is an important skill in software development. - -Finally, all the tools and processes are moot if the _will_ is not there. Without an appreciation for the importance of beauty, there will never be an emphasis on writing beautiful code. - -This is why this is the first principle: it is a way of making "beauty" a value in the Python community. It immediately answers: "Do we _really_ care about beauty?" We do. - -### Explicit is better than implicit. - -We humans celebrate light and fear the dark. Light helps us make sense of vague images. In the same way, programming with more explicitness helps us make sense of abstract ideas. It is often tempting to make things implicit. - -"Why is **self** explicitly there as the first parameter of methods?" - -There are many technical explanations, but all of them are wrong. It is almost a Python programmer's rite of passage to write a metaclass that makes explicitly listing **self** unnecessary. (If you have never done this before, do so; it makes a great metaclass learning exercise!) - -The reason **self** is explicit is not because the Python core developers did not want to make a metaclass like that the "default" metaclass. The reason it is explicit is because there is one less special case to teach: the first argument is _explicit_. - -Even when Python does allow non-explicit things, such as context variables, we must always ask: Are we sure we need them? Could we not just pass arguments explicitly? Sometimes, for many reasons, this is not feasible. But prioritizing explicitness means, at the least, asking the question and estimating the effort. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/zen-python-beauty-clarity - -作者:[Moshe Zadka][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) -[2]: https://www.python.org/dev/peps/pep-0020/ -[3]: https://en.wikipedia.org/wiki/The_Chanukah_Song -[4]: https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs -[5]: https://opensource.com/article/19/5/python-black -[6]: https://opensource.com/article/19/5/python-flake8 -[7]: https://opensource.com/article/19/10/python-pylint-introduction diff --git a/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md b/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md new file mode 100644 index 0000000000..ae5568bd13 --- /dev/null +++ b/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why your Python code needs to be beautiful and explicit) +[#]: via: (https://opensource.com/article/19/12/zen-python-beauty-clarity) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +为什么 Python 代码要写得美观而明确 +====== +欢迎阅读“Python 光明节(Pythonukkah)”系列文章,这个系列文章将会讨论《Python 之禅》。我们首先来看《Python 之禅》里的前两个原则:美观与明确。 +![Searching for code][1] + +早在 1999 年,Python 的贡献者之一,Tim Peters 就提出了《[Python 之禅][2]》,直到二十年后的今天,《Python 之禅》中的 19 条原则仍然对整个社区都产生着深远的影响。为此,我们举行了这一次的“Python 光明节”。首先,我们会讨论《Python 之禅》中的前两个原则:美观和明确。 + +> "Hanukkah is the Festival of Lights, +> Instead of one day of presents, we get eight crazy nights." +> —亚当·桑德勒, [光明节之歌][3] + +### 美观胜于丑陋 + +著名的《[计算机程序的构造和解释Structure and Interpretation of Computer Programs][4]》中有这么一句话:代码是写给人看的,只是恰好能让机器运行(Programs must be written for people to read and only incidentally for machines to execute.)。毕竟机器并不在乎代码的美观性,但人类在乎。 + +阅读美观的代码对人们来说是一种享受,这就要求在整套代码中保持一致的风格。使用诸如 [Black][5]、[flake8][6]、[Pylint][7] 这一类工具能够有效地接近这一个目标。 + +但实际上,只有人类自己才知道什么才是真正的美观。因此,代码审查和协同开发是其中的不二法门,同时,在开发过程中倾听别人的意见也是必不可少的。 + +最后,个人的主观能动性也很重要,否则一切工具和流程都会变得毫无意义。只有意识到美观的重要性,才能主动编写出美观的代码。 + +这就是为什么美观在众多原则当中排到了首位,它让“美”成为了 Python 社区的一种价值。如果有人要问,”我们真的在乎美吗?“社区会以代码给出肯定的答案。 + +### 明确胜于隐晦 + +人类会欢庆光明、惧怕黑暗,那是因为光能够让我们看到难以看清的事物。同样地,尽管有些时候我们会不自觉地把代码写得含糊不清,但明确地编写代码确实能够让我们理解很多抽象的概念。 + +“为什么类方法中要将 `self` 显式指定为第一个参数?” + +这个问题已经是老生常谈了,但网络上很多流传已久的回答都是不准确的。在编写元类metaclass时,显式指定 `self` 参数就显得毫无意义。如果你没有编写过元类,希望你可以尝试一下,这是很多 Python 程序员的必经之路。 + +显式指定 `self` 参数的原因并不是 Python 的设计者不想将这样的元类视为“默认”元类,而是因为第一个参数必须是显式的。 + +即使 Python 中确实允许非显式的情况存在(例如上下文变量),但我们还是应该提出疑问:某个东西是不是有存在的必要呢?如果非显式地传递参数会不会出现问题呢?有些时候,由于种种原因,这是会有问题的。总之,在写代码时一旦能够优先考虑到明确性,至少意味着能对不明确的地方提出疑问并对结果作出有效的估计。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-beauty-clarity + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV "Searching for code" +[2]: https://www.python.org/dev/peps/pep-0020/ +[3]: https://en.wikipedia.org/wiki/The_Chanukah_Song +[4]: https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs +[5]: https://opensource.com/article/19/5/python-black +[6]: https://opensource.com/article/19/5/python-flake8 +[7]: https://opensource.com/article/19/10/python-pylint-introduction + From 7fb86b2226829deb1b8493a49a2b25a121776d02 Mon Sep 17 00:00:00 2001 From: chen ni Date: Wed, 25 Dec 2019 23:01:44 +0800 Subject: [PATCH 262/676] =?UTF-8?q?=E7=94=B3=E9=A2=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190724 How to make an old computer useful again.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190724 How to make an old computer useful again.md b/sources/tech/20190724 How to make an old computer useful again.md index 68748a93b6..7048848930 100644 --- a/sources/tech/20190724 How to make an old computer useful again.md +++ b/sources/tech/20190724 How to make an old computer useful again.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chen-ni) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -144,7 +144,7 @@ via: https://opensource.com/article/19/7/how-make-old-computer-useful-again 作者:[Howard Fosdick][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/chen-ni) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 997e996747bcfc77d2f98edaa6f594d9cb05bc31 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 25 Dec 2019 23:26:41 +0800 Subject: [PATCH 263/676] PRF --- ...0191023 How to program with Bash- Loops.md | 93 +++++++++---------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/translated/tech/20191023 How to program with Bash- Loops.md b/translated/tech/20191023 How to program with Bash- Loops.md index 5d051aafcd..81b8ff093a 100644 --- a/translated/tech/20191023 How to program with Bash- Loops.md +++ b/translated/tech/20191023 How to program with Bash- Loops.md @@ -7,32 +7,34 @@ [#]: via: (https://opensource.com/article/19/10/programming-bash-loops) [#]: author: (David Both https://opensource.com/users/dboth) -Bash 编程教程之循环 +怎样用 Bash 编程:循环 ====== -本文是 bash 编程系列(3 部分)的最后一篇,来学习使用循环执行迭代的操作。 + +> 本文是 Bash 编程系列三篇中的最后一篇,来学习使用循环执行迭代的操作。 + ![arrows cycle symbol for failing faster][1] -Bash 是一种强大的用于命令行和 shell 脚本里的编程语言。本系列的三部分都是基于我的 [Linux 自学课程三卷][2] 写的,探索怎么用 CLI(command-line interface)进行 bash 编程。本系列的 [第一篇文章][3] 讨论了 bash 编程的一些简单命令行操作,如使用变量和控制操作符。[第二篇文章][4] 探讨了文件、字符串、数字等类型和各种各样在执行流中提供控制逻辑的的逻辑运算符,还有 bash 中不同种类的扩展。本文是第三篇(也是最后一篇),意在考察在各种迭代的操作中使用循环以及怎么合理控制循环。 +Bash 是一种强大的用于命令行和 shell 脚本的编程语言。本系列的三部分都是基于我的三集 [Linux 自学课程][2] 写的,探索怎么用 CLI 进行 bash 编程。 + +本系列的 [第一篇文章][3] 讨论了 bash 编程的一些简单命令行操作,如使用变量和控制操作符。[第二篇文章][4] 探讨了文件、字符串、数字等类型和各种各样在执行流中提供控制逻辑的的逻辑运算符,还有 bash 中不同种类的扩展。本文是第三篇(也是最后一篇),意在考察在各种迭代的操作中使用循环以及怎么合理控制循环。 ### 循环 -我使用过的所有编程语言都有很多种循环结构来用来执行重复的操作。我经常使用 for 循环,然而我发现 while 和 until 循环也很有用处。 +我使用过的所有编程语言都至少有两种循环结构来用来执行重复的操作。我经常使用 `for` 循环,然而我发现 `while` 和 `until` 循环也很有用处。 #### for 循环 -我的理解是,**for** 命令在 bash 中的实现比大部分语言灵活,因为它可以处理非数字的值;与之形成对比的是,诸如标准 C 语言的 **for** 循环只能处理数字类型的值。 - -Bash 版的 **for** 命令基本的结构很简单: +我的理解是,在 bash 中实现的 `for` 命令比大部分语言灵活,因为它可以处理非数字的值;与之形成对比的是,诸如标准 C 语言的 `for` 循环只能处理数字类型的值。 +Bash 版的 `for` 命令基本的结构很简单: ``` -`for Var in list1 ; do list2 ; done` +for Var in list1 ; do list2 ; done ``` -解释一下:“对于 list1 中的每一个值,把 **$Var** 设置为那个值,使用该值执行 list2 中的程序语句;list1 中的值都执行完后,整个循环结束,退出循环。” list1 中的值可以是一个简单的显式字符串值,也可以是一个命令执行后的结果(译注:**\` \`** 包含的命令执行的结果,本系列第二篇文章中有描述)。我经常使用这种结构。 - -确认 **~/testdir** 仍然是当前的工作目录(PWD)。删除目录下所有东西,来看下这个显式写出值列表的 **for** 循环的简单的示例。这个列表中的值是字母值 — 但是不要忘了,在 bash 中所有的变量都是 string 或者可以被当成 string 来处理。 +解释一下:“对于 `list1` 中的每一个值,把 `$Var` 设置为那个值,使用该值执行 `list2` 中的程序语句;`list1` 中的值都执行完后,整个循环结束,退出循环。” `list1` 中的值可以是一个简单的显式字符串值,也可以是一个命令执行后的结果(`` 包含其内的命令执行的结果,本系列第二篇文章中有描述)。我经常使用这种结构。 +要测试它,确认 `~/testdir` 仍然是当前的工作目录(PWD)。删除目录下所有东西,来看下这个显式写出值列表的 `for` 循环的简单的示例。这个列表混合了字母和数字 — 但是不要忘了,在 bash 中所有的变量都是字符串或者可以被当成字符串来处理。 ``` [student@studentvm1 testdir]$ rm * @@ -49,7 +51,6 @@ d 给变量赋予更有意义的名字,变成前面版本的进阶版: - ``` [student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Department $Dept" ; done Department Human Resources @@ -63,7 +64,6 @@ Department Research 创建几个目录(创建时显示一些处理信息): - ``` [student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done Working on Department Human Resources @@ -84,10 +84,9 @@ drwxrwxr-x 2 student student 4096 Apr  8 15:45  Research drwxrwxr-x 2 student student 4096 Apr  8 15:45  Sales ``` -在 **mkdir** 语句中 **$Dept** 变量必须用引号包裹起来;否则名字中间有空格(如 `Information Technology`)会被当做两个独立的目录处理。我一直信奉的一条实践规则:所有的文件和目录都应该为一个单词(中间没有空格)。虽然大部分现代的操作系统可以处理名字中间有空格的情况,但是系统管理员需要花费额外的精力去确保脚本和 CLI 程序能正确处理这些特例。(尽管你因为不知道将要处理什么样的文件而烦恼,但是脚本和 CLI 应该已经把这些特例考虑在内了。) - -再次删除 **~/testdir** 下的所有东西 — 再运行一次下面的命令: +在 `mkdir` 语句中 `$Dept` 变量必须用引号包裹起来;否则名字中间有空格(如 `Information Technology`)会被当做两个独立的目录处理。我一直信奉的一条实践规则:所有的文件和目录都应该为一个单词(中间没有空格)。虽然大部分现代的操作系统可以处理名字中间有空格的情况,但是系统管理员需要花费额外的精力去确保脚本和 CLI 程序能正确处理这些特例。(即使它们很烦人,也务必考虑它们,因为你永远不知道将拥有哪些文件。) +再次删除 `~/testdir` 下的所有东西 — 再运行一次下面的命令: ``` [student@studentvm1 testdir]$ rm -rf * ; ll @@ -111,10 +110,11 @@ drwxrwxr-x 2 student student 4096 Apr  8 15:52 Research drwxrwxr-x 2 student student 4096 Apr  8 15:52 Sales ``` -假设现在有个需求,需要列出一台 Linux 机器上所有的 RPM 包并对每个包附上简短的描述。我为North Carolina 州工作的时候,曾经遇到过这种需求。由于当时州代理处不允许使用开源的工具,而且我对 Linux 不够熟悉,对技术一窍不通的老板(PHB)需要我列出我计算机上安装的所有软件,这样他们就可以“查看“计算机上有没有安装异常的软件了。 +假设现在有个需求,需要列出一台 Linux 机器上所有的 RPM 包并对每个包附上简短的描述。我为北卡罗来纳州工作的时候,曾经遇到过这种需求。由于当时开源尚未得到州政府的“批准”,而且我只在台式机上使用 Linux,对技术一窍不通的老板(PHB)需要我列出我计算机上安装的所有软件,以便他们可以“批准”一个特例。 -你怎么实现它?有一种方法是,已知 **rpm –qa** 命令提供了 RPM 包的完整描述,包括 PHB 想要的东西:软件名称和概要描述。一步步执行出最后的结果。首先,列出所有的 RPM 包: +你怎么实现它?有一种方法是,已知 `rpm –qa` 命令提供了 RPM 包的完整描述,包括了白痴老板想要的东西:软件名称和概要描述。 +让我们一步步执行出最后的结果。首先,列出所有的 RPM 包: ``` [student@studentvm1 testdir]$ rpm -qa @@ -131,7 +131,7 @@ libfontenc-1.1.3-9.fc29.x86_64 <snip> ``` -用 **sort** 和 **uniq** 命令对列表进行排序和打印去重后的结果(有些已安装的 RPM 包具有相同的名字:) +用 `sort` 和 `uniq` 命令对列表进行排序和打印去重后的结果(有些已安装的 RPM 包具有相同的名字): ``` @@ -151,13 +151,11 @@ abrt-addon-vmcore-2.11.0-1.fc29.x86_64 以上命令得到了想要的 RPM 列表,因此你可以把这个列表作为一个循环的输入信息,循环最终会打印每个 RPM 包的详细信息: - ``` [student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done ``` -这段代码产出了多余的信息。当循环结束后, 下一步就是提取出 PHB 需要的信息。因此,添加一个 **egrep** 命令用来搜索匹配 **^Name** 或 **^Summary** 的行。脱字符(^)表示行首,整个命令表示显示所有以 Name 或 Summary 开头的行。 - +这段代码产出了多余的信息。当循环结束后,下一步就是提取出白痴老板需要的信息。因此,添加一个 `egrep` 命令用来搜索匹配 `^Name` 或 `^Summary` 的行。脱字符(`^`)表示行首,整个命令表示显示所有以 Name 或 Summary 开头的行。 ``` [student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary" @@ -174,39 +172,39 @@ Summary     : Automatic bug detection and reporting tool <snip> ``` -在上面的命令中你可以试试用 **grep** 代替 **egrep** ,你会发现用 **grep** 不能得到正确的结果。你可以通过管道把命令结果用 **less** 过滤下。最终命令像这样: - +在上面的命令中你可以试试用 `grep` 代替 `egrep` ,你会发现用 `grep` 不能得到正确的结果。你也可以通过管道把命令结果用 `less` 过滤器来查看。最终命令像这样: ``` [student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary" > RPM-summary.txt ``` -这个命令行程序在同一行中用到了管道、重定向和 **for** 循环。它把你 CLI 程序的结果重定向到了一个文件,这个文件可以在邮件中使用或在其他地方作为输入使用。这个一次一步构建程序的过程让你能看到每步的结果,以此来确保整个程序以你期望的流程进行且输出你想要的结果。 +这个命令行程序用到了管道、重定向和 `for` 循环,这些全都在一行中。它把你的 CLI 程序的结果重定向到了一个文件,这个文件可以在邮件中使用或在其他地方作为输入使用。 -PHB 最终收到了超过 1900 个独立 RPM 包的清单,我严重怀疑根本就没人去读它。我给了他们想要的东西,没有从他们嘴里听到过任何关于 RPM 包的信息。 +这个一次一步构建程序的过程让你能看到每步的结果,以此来确保整个程序以你期望的流程进行且输出你想要的结果。 + +白痴老板最终收到了超过 1900 个不同的 RPM 包的清单,我严重怀疑根本就没人读过这个列表。我给了他们想要的东西,没有从他们嘴里听到过任何关于 RPM 包的信息。 ### 其他循环 -Bash 中还有两种其他类型的循环结构:**while** 和 **until** 结构,两者在语法和功能上都类似。这些循环结构的基础语法很简单: - +Bash 中还有两种其他类型的循环结构:`while` 和 `until` 结构,两者在语法和功能上都类似。这些循环结构的基础语法很简单: ``` while [ expression ] ; do list ; done ``` -逻辑解释:表达式(expression)结果为 true 时,执行程序语句 `list`。表达式结果为 false 时,退出循环。 - +逻辑解释:表达式(`expression`)结果为 true 时,执行程序语句 `list`。表达式结果为 false 时,退出循环。 ``` until [ expression ] ; do list ; done ``` -逻辑解释:直到表达式的结果为 true,执行程序语句 `list`。当表达式结果为 true 时,退出循环。 +逻辑解释:执行程序语句 `list`,直到表达式的结果为 true。当表达式结果为 true 时,退出循环。 #### While 循环 -**while** 循环用于当逻辑表达式结果为 true 时执行一系列程序语句。假设你的 PWD 仍是 **~/testdir** 。最简单的 **while** 循环会一直运行下去。下面格式的条件语句永远以 `true` 作为返回。你也可以用简单的 `1` 代替 `true` — 结果一样 — 但是这解释了 true 表达式的用法。 +`while` 循环用于当逻辑表达式结果为 true 时执行一系列程序语句。假设你的 PWD 仍是 `~/testdir`。 +最简单的 `while` 循环形式是这个会一直运行下去的循环。下面格式的条件语句永远以 `true` 作为返回。你也可以用简单的 `1` 代替 `true`,结果一样,但是这解释了 true 表达式的用法。 ``` [student@studentvm1 testdir]$ X=0 ; while [ true ] ; do echo $X ; X=$((X+1)) ; done | head @@ -223,10 +221,9 @@ until [ expression ] ; do list ; done [student@studentvm1 testdir]$ ``` -既然你已经学了 CLI 的各部分知识,那就让它变得更有用处。首先,为了防止变量 **$X** 在前面的程序或 CLI 命令执行后有遗留的值,设置 **$X** 的值为 0。然后,因为逻辑表达式 **[ true ]** 的结果永远是 1,即 true,在 **do** 和 **done** 中间的程序指令列表会一直执行 — 或者直到你按下 **Ctrl+C** 抑或发送一个 `signal 2` 给程序。那些程序指令是算法扩展,用来打印变量 **$X** 当前的值并加 1. - -[系统管理员的 Linux 哲学][5] 的信条之一是追求优雅,实现优雅的一种方式就是简化。你可以用操作符 **++** 来简化这个程序。在第一个例子中,变量当前的值被打印出来,然后变量的值增加了。可以在变量后加一个 **++** 来表示这个逻辑: +既然你已经学了 CLI 的各部分知识,那就让它变得更有用处。首先,为了防止变量 `$X` 在前面的程序或 CLI 命令执行后有遗留的值,设置 `$X` 的值为 0。然后,因为逻辑表达式 `[ true ]` 的结果永远是 1,即 true,在 `do` 和 `done` 中间的程序指令列表会一直执行 — 或者直到你按下 `Ctrl+C` 抑或发送一个 2 号信号给程序。那些程序指令是算数扩展,用来打印变量 `$X` 当前的值并加 1. +《[系统管理员的 Linux 哲学][5]》的信条之一是追求优雅,实现优雅的一种方式就是简化。你可以用操作符 `++` 来简化这个程序。在第一个例子中,变量当前的值被打印出来,然后变量的值增加了。可以在变量后加一个 `++` 来表示这个逻辑: ``` [student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((X++)) ; done | head @@ -242,8 +239,9 @@ until [ expression ] ; do list ; done 9 ``` -现在删掉程序最后的 **| head** 再运行一次。在这个版本中,变量在值被打印之前就自增了。这是通过在变量之前添加 **++** 操作符实现的。你能看出区别吗? +现在删掉程序最后的 `| head` 再运行一次。 +在下面这个版本中,变量在值被打印之前就自增了。这是通过在变量之前添加 `++` 操作符实现的。你能看出区别吗? ``` [student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((++X)) ; done | head @@ -258,8 +256,9 @@ until [ expression ] ; do list ; done 9 ``` -你已经把打印变量的值和自增简化到了一条语句。类似 **++** 操作符, 也有 **--** 操作符。你需要一个在循环到某个特定数字时终止循环的方法。把 true 表达式换成一个数字比较表达式来实现它。写一个循环到 5 终止的程序。在下面的示例代码中,你可以看到 **-le** 是 ”小于或等于“ 的数字逻辑操作符。整个语句的意思:只要 **$X** 的值小于或等于 5,循环就一直运行。当 **$X** 增加到 6时,循环终止。 +你已经把打印变量的值和自增简化到了一条语句。类似 `++` 操作符,也有 `--` 操作符。 +你需要一个在循环到某个特定数字时终止循环的方法。把 true 表达式换成一个数字比较表达式来实现它。这里有一个循环到 5 终止的程序。在下面的示例代码中,你可以看到 `-le` 是 “小于或等于” 的数字逻辑操作符。整个语句的意思:只要 `$X` 的值小于或等于 5,循环就一直运行。当 `$X` 增加到 6 时,循环终止。 ``` [student@studentvm1 ~]$ X=0 ; while [ $X -le 5 ] ; do echo $((X++)) ; done @@ -274,10 +273,7 @@ until [ expression ] ; do list ; done #### Until 循环 - - -*until** 命令非常像 **while** 命令。不同之处是,它直到逻辑表达式的值是 `true` 之前,会一直循环。看一下这种结构最简单的格式: - +`until` 命令非常像 `while` 命令。不同之处是,它直到逻辑表达式的值是 `true` 之前,会一直循环。看一下这种结构最简单的格式: ``` [student@studentvm1 ~]$ X=0 ; until false  ; do echo $((X++)) ; done | head @@ -294,8 +290,7 @@ until [ expression ] ; do list ; done [student@studentvm1 ~]$ ``` -它用一个逻辑比较表达式来数到一个特定的值: - +它用一个逻辑比较表达式来计数到一个特定的值: ``` [student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((X++)) ; done @@ -313,9 +308,13 @@ until [ expression ] ; do list ; done [student@studentvm1 ~]$ ``` -### 总结: +### 总结 -本系列探讨了构建 bash 命令行程序和 shell 脚本的很多强大的工具。但是这仅仅是你能用 Bash 做的很多有意思的事中的冰山一角,接下来就看你的了。我发现学习 Bash 编程最好的方法就是实践。找一个需要多个 Bash 命令的简单项目然后写一个 CLI 程序。系统管理员们做了很多工作让任务变成 CLI 编程,因此我确信你很容易能找到自动化的任务。很多年前,尽管我对其他的 Shell 语言和 Perl 很熟悉,但还是决定用 Bash 做所有系统管理员的自动化任务。我发现 — 有时稍微搜索一下 — 我可以用 Bash 实现我需要的所有事情。 +本系列探讨了构建 Bash 命令行程序和 shell 脚本的很多强大的工具。但是这仅仅是你能用 Bash 做的很多有意思的事中的冰山一角,接下来就看你的了。 + +我发现学习 Bash 编程最好的方法就是实践。找一个需要多个 Bash 命令的简单项目然后写一个 CLI 程序。系统管理员们要做很多适合 CLI 编程的工作,因此我确信你很容易能找到自动化的任务。 + +很多年前,尽管我对其他的 Shell 语言和 Perl 很熟悉,但还是决定用 Bash 做所有系统管理员的自动化任务。我发现,有时稍微搜索一下,我可以用 Bash 实现我需要的所有事情。 -------------------------------------------------------------------------------- @@ -332,6 +331,6 @@ via: https://opensource.com/article/19/10/programming-bash-loops [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) [2]: http://www.both.org/?page_id=1183 -[3]: https://opensource.com/article/19/10/programming-bash-part-1 -[4]: https://opensource.com/article/19/10/programming-bash-part-2 +[3]: https://linux.cn/article-11552-1.html +[4]: https://linux.cn/article-11687-1.html [5]: https://www.apress.com/us/book/9781484237298 From 9ba6322718253b6166439152d966be21a7d31157 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 26 Dec 2019 00:52:51 +0800 Subject: [PATCH 264/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191226=20Darkta?= =?UTF-8?q?ble=203=20Released=20With=20GUI=20Rework=20and=20New=20Features?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191226 Darktable 3 Released With GUI Rework and New Features.md --- ...leased With GUI Rework and New Features.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 sources/tech/20191226 Darktable 3 Released With GUI Rework and New Features.md diff --git a/sources/tech/20191226 Darktable 3 Released With GUI Rework and New Features.md b/sources/tech/20191226 Darktable 3 Released With GUI Rework and New Features.md new file mode 100644 index 0000000000..9463a07712 --- /dev/null +++ b/sources/tech/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Darktable 3 Released With GUI Rework and New Features) +[#]: via: (https://itsfoss.com/darktable-3-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Darktable 3 Released With GUI Rework and New Features +====== + +Here’s the Christmas gift for the photography enthusiasts. Darktable 3.0 has just released. + +[Darktable][1] is one of the [best applications for editing RAW images on Linux][2]. You can consider it as a [free and open source alternative to Adobe Lightroom][3]. + +Darktable 3 is a major new release with tons of feature improvements and a complete rework of the user interface. The GUI is now completely controlled by GTK+ CSS rules, which makes the whole GUI themable. There are eight themes available by default. + +With the help of over 3000 commits and 553 pull requests, the new release has fixed 66 bugs and added many new features. + +Let’s see what features this new release brings. + +### New features in Darktable 3.0 + +![Darktable 3.0 Screenshot][4] + +Here are the highlighted new features: + + * Reworked UI + * A new module for handling 3D RGB Lut transformations + * Many improvements to the ‘denoise (profiled)’ module + * A new ‘culling’ mode and timeline view added + * Many improvements to the ‘denoise (profiled)’ module + * New tone equalizer’ basic and filmic RGB modules + * Better 4K/5K display support + * Undo/redo support for more operations + * Many code optimizations for CPU and SSE paths + * Support for exporting to Google Photos + * More camera support, white balance presets, and noise profiles + * Plenty of bug fixes and feature improvements + + + +You can read about all the changes in the [release notes on GitHub][5]. + +### Installing Darktable 3.0 on Linux + +Let’s see how to get the latest Darktable release. + +#### Installing Darktable 3.0 on Ubuntu-based distributions + +Darktable is available in Ubuntu but you won’t get the latest release immediately. For the LTS version, it may take months before you have this version update. + +Worry not! Darktable provides its [own PPA][6] to install the latest release on Ubuntu-based distributions. + +Unfortuntaley, That Darktable PPA has not been updated with the new release. + +Worry not (again)! Thanks to our friend [Ji M of Ubuntu Handbook][7], we have an unofficial PPA for easily installing Darktable 3.0 on Ubuntu and other Ubuntu based distributions. + +Open a terminal and use these commands one by one: + +``` +sudo add-apt-repository ppa:ubuntuhandbook1/darktable +sudo apt update +sudo apt install darktable +``` + +#### Uninstall Darktable 3 + +To remove Darktable installed via this PPA, you can first uninstall the application: + +``` +sudo apt remove darktable +``` + +And then [remove the PPA][8] as well: + +``` +sudo add-apt-repository -r ppa:ubuntuhandbook1/darktable +``` + +#### Installing Darktable on other Linux distributions + +You may wait for your distribution to provide this new release through the software manager. + +You may also download the tarball or the entire source code from the GitHub release page (it’s at the bottom of the page). + +[Download Darktable 3.0][5] + +With Darktable 3, you can edit your holiday pictures better :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/darktable-3-release/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.darktable.org/ +[2]: https://itsfoss.com/raw-image-tools-linux/ +[3]: https://itsfoss.com/open-source-photoshop-alternatives/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/darktable_3_screenshot.jpg?ssl=1 +[5]: https://github.com/darktable-org/darktable/releases/tag/release-3.0.0 +[6]: https://launchpad.net/~pmjdebruijn/+archive/ubuntu/darktable-release +[7]: http://ubuntuhandbook.org/index.php/2019/12/install-darktable-3-0-0-ubuntu-18-04-19-10/ +[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ From 171da4ddb69c73d97d4c28c75f7a0e63b395b8f6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 26 Dec 2019 00:53:43 +0800 Subject: [PATCH 265/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191225=20How=20?= =?UTF-8?q?to=20run=20a=20business=20with=20open=20source:=20Top=20reads?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191225 How to run a business with open source- Top reads.md --- ... a business with open source- Top reads.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20191225 How to run a business with open source- Top reads.md diff --git a/sources/tech/20191225 How to run a business with open source- Top reads.md b/sources/tech/20191225 How to run a business with open source- Top reads.md new file mode 100644 index 0000000000..f857738495 --- /dev/null +++ b/sources/tech/20191225 How to run a business with open source- Top reads.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to run a business with open source: Top reads) +[#]: via: (https://opensource.com/article/19/12/business-open-source) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +How to run a business with open source: Top reads +====== +Open source software is open for business, as evidenced in the these top +5 articles from 2019. +![Open for business][1] + +Open source is ready to get to work, and in 2019, Opensource.com had many great articles about how organizations have adopted open source software or open methods to drive their business. As open source matures, we've seen open source not just replace proprietary software, but create entirely new business models. + +Check out this list of five outstanding articles from Opensource.com in 2019 about running a business with open source. + +### Get your business up and running with these open source tools + +In [_Get your business up and running with these open source tools_][2], I explain: "Yes, you really can operate a business using open source software." In this article, I review the key open source software tools that I use to run my company, including Inkscape, GIMP, LibreOffice, and Scribus. + +### What's your favorite open source BI software? + +As Lauren Maffeo explains in _[What's your favorite open source BI software?][3]_ "Open source business intelligence (BI) software helps users upload, visualize, and make decisions based on data that is pulled from several sources... BI involves turning data into insights that help your business make better decisions... Before choosing which open source BI tool to adopt, it's worth weighing the pros and cons of each tool against your business needs." The article's accompanying poll asks readers whether they prefer Pentaho, Logz.io, Cluvio, Qlikview, Sisense, or another BI application. Answer the poll to let us know which is your favorite and to see what other readers say. + +### Scrum vs. kanban: Which agile framework is better? + +Because scrum and kanban both fall under the agile framework umbrella, many people confuse them or think they're the same thing. There are differences, however. In [_Scrum vs. kanban: Which agile framework is better?_][4] Taz Brown explains the differences between scrum and kanban and helps you decide which one may be best for your team. + +### What is Small Scale Scrum? + +"Agile is fast becoming a mainstream way industries act, behave, and work as they look to improve efficiency, minimize costs, and empower staff. Most software developers naturally think, act, and work this way, and alignment towards agile software methodologies has gathered pace in recent years," write Agnieszka Gancarczyk and Leigh Griffin in [_What is Small Scale Scrum?_][5] In this article, they explain how the scrum agile methodology can help small teams work more efficiently. + +### What does DevOps mean to you? + +In *[What does DevOps mean to you?][6] *Girish Managoli offers one answer to this article's headline: "DevOps is a process of software development focusing on communication and collaboration to facilitate rapid application and product deployment." But there are a range of opinions and expectations around DevOps. To help explain DevOps and how to leverage it in organizations, Girish interviewed six experts to break down DevOps and the key practices and philosophies in making DevOps work for you. + +### Open source is open for business + +As open source plays an increasingly important role in business, there's more to learn about the topic. What do you want to know about it in 2020? Please share your ideas for articles in the comments—or even share your own experiences with running a business on open source software by [writing an article for Opensource.com][7]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/business-open-source + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_openseries.png?itok=rCtTDz5G (Open for business) +[2]: https://opensource.com/article/19/9/business-creators-open-source-tools +[3]: https://opensource.com/article/19/8/favorite-open-source-bi-software +[4]: https://opensource.com/article/19/8/scrum-vs-kanban +[5]: https://opensource.com/article/19/1/what-small-scale-scrum +[6]: https://opensource.com/article/19/1/what-does-devops-mean-you +[7]: https://opensource.com/how-submit-article From 88c6415afe8a0cfaa6cf99df8798af31f9e43978 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 26 Dec 2019 00:54:09 +0800 Subject: [PATCH 266/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191225=2012=20o?= =?UTF-8?q?pen=20source=20resources=20for=20kids=20and=20young=20adults?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191225 12 open source resources for kids and young adults.md --- ...rce resources for kids and young adults.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20191225 12 open source resources for kids and young adults.md diff --git a/sources/tech/20191225 12 open source resources for kids and young adults.md b/sources/tech/20191225 12 open source resources for kids and young adults.md new file mode 100644 index 0000000000..48ca3107a4 --- /dev/null +++ b/sources/tech/20191225 12 open source resources for kids and young adults.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (12 open source resources for kids and young adults) +[#]: via: (https://opensource.com/article/19/12/kids-students-education) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +12 open source resources for kids and young adults +====== +Explore new technologies with Opensource.com's top 12 articles from 2019 +about learning an open source technology. +![Person reading a book and digital copy][1] + +Are you looking to challenge your children (or even yourself) to learn new things about open source technologies? Whether you're in elementary school, high school, or college, or even a parent or teacher, Opensource.com has some great reading about open source technologies suitable for the younger generation. Here are our top 12 articles from 2019 on open source for students (and those who love them). + +### Hacking math education with Python + +As a student, I had difficulty with the abstraction of mathematics. Traditional classroom instruction didn't work for me. Peter Farrell has another approach for learners who are challenged by conventional mathematics instruction. His unique approach, which teaches math using Python, resonated with me when I interviewed him about how he is [_Hacking math education with Python_][2]. + +### 5 open source tools for teaching young children to read + +No doubt, you have seen how easy it is for children to master today's electronic devices—but what about traditional literacy? Are today's children getting the foundation in reading, writing, and arithmetic that they need to be successful? Laura Janusek's [_5 open source tools for teaching young children to read_][3] may help. She says, "Access to literary environments has been shown to impact literacy and attitudes towards reading. Why not strive to create a digital literacy environment for our kids by filling our devices with educational technologies, just like our shelves are filled with books?" + +### What programming language would you teach a kid first? + +Coding has become a hot area for schools and parents. Opinions abound on the best computer language to teach and when to begin teaching it. Lauren Pritchett celebrated Ada Lovelace Day 2019 by exploring [_What programming language would you teach kids first?_][4] Be sure to take the accompanying poll, too. + +### Getting started with the BBC Microbit + +Learning to code should be fun, and one of the ways to ensure a great early experience is by using an inexpensive open hardware board. In [_Getting started with the BBC Microbit_][5], I provide step-by-step directions and some code examples so your child can learn to program with MicroPython. + +### Introducing kids to computational thinking with Python + +Coding can be the key that lifts children out of poverty and empowers them to gain new skills, confidence, and the knowledge necessary to break free from socioeconomic disadvantages. In [_Introducing kids to computational thinking with Python_][6], I interviewed librarian Qumisha Goss, who is leveraging the power of Python to transform children's lives in Detroit. + +### A dozen ways to learn Python + +Do you know someone who really wants to learn to Python but is looking for the right hook to get started? Removing abstraction has been key to my best learning experiences, and I share some of the resources I've found in [_A dozen ways to learn Python_][7]. They will start you on your journey to Python proficiency and sustain your learning over the long haul. + +### 100 ways to learn Python and R for data science + +Many people want to learn data science but are drowning in the deluge of information available online, leaving them confused about where to find the best book, tutorial, or other learning resources. Where would you turn to learn the skills necessary to play a role in this rapidly growing field? Chris Englehardt, Dorris Scott, and Annu Singh share their suggestions in [_100 ways to learn Python and_ _R for data science_][8]. + +### How a trip to China inspired Endless OS and teaching kids to hack + +I've long been interested in inexpensive, Linux-based computers that help children around the world learn how to code. One of these is Endless' Hack, a low-cost laptop, and an accompanying series of video games designed to get kids coding and become creative problem solvers while they're having fun. In 2019, I got to interview Endless' founder Matt Dalio, where he shares [_How a trip to China inspired Endless OS and teaching kids to hack_][9]. + +### How to use the internet to learn IT skills + +Looking to do something meaningful in the new year? How about helping a few young people take their first steps in an IT career? You can follow the lead of David Clinton, a systems administrator, teacher, and writer, who shares [_How to use the internet to learn IT skills_][10]. Giving students access to open source tools and letting them explore and iterate creates a rich learning experience, he explains. + +### Digital divide? How the Asian Penguins share Linux at Minnesota charter school + +Stu Keroff is an educator who has turned his passion for Linux and open source into a school–community outreach program that serves a large number of immigrant families in Minnesota. He is a husband, father, teacher, speaker, and advocate for Linux in K-12 education and a winner of the [2016 Opensource.com Readers Choice Award][11]. In [_Digital divide? How the Asian Penguins share Linux at Minnesota charter school_][12], Stu shares his Linux-powered solution to expand digital literacy in his community. + +### 13 books for picking up new tech in 2019 + +If you (or someone you know) learn best by reading, my [_13 books for picking up new tech in 2019_][13] may help you discover a new skill that piques your curiosity. The list includes books on everything from Python to Linux to developing games on a Raspberry Pi. + +### 11 surprising ways you use Linux every day + +If you, like me, wonder what powers all the electronic gadgets that power our day-to-day lives today, read my article on [_11 surprising ways you use Linux every day_][14]. You might be amazed at how much we depend on open source to get us through our days. + +### A lifetime of learning + +What would you like to know to help the children in your life expand their tech knowledge and skills? Please share your ideas in the comments, or even consider sharing your own experiences with Opensource.com readers by [submitting an article][15] about your favorite open source education topic. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/kids-students-education + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://opensource.com/article/19/1/hacking-math +[3]: https://opensource.com/article/19/4/early-literacy-tools +[4]: https://opensource.com/article/19/10/first-programming-language-kids +[5]: https://opensource.com/article/19/8/getting-started-bbc-microbit +[6]: https://opensource.com/article/19/2/break-down-stereotypes-python +[7]: https://opensource.com/article/19/8/dozen-ways-learn-python +[8]: https://opensource.com/article/19/5/learn-python-r-data-science +[9]: https://opensource.com/article/19/6/endless-digital-literacy +[10]: https://opensource.com/article/19/5/it-skills-internet +[11]: https://opensource.com/community/16/2/winners-2016-community-awards +[12]: https://opensource.com/article/19/2/asian-penguins-close-digital-divide +[13]: https://opensource.com/article/19/1/tech-books-new-skils +[14]: https://opensource.com/article/19/8/everyday-tech-runs-linux +[15]: https://opensource.com/how-submit-article From 852b09ff77014a887671d07b29939148461d8d39 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 26 Dec 2019 00:54:40 +0800 Subject: [PATCH 267/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191225=20Making?= =?UTF-8?q?=20trade-offs=20when=20writing=20Python=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191225 Making trade-offs when writing Python code.md --- ...ing trade-offs when writing Python code.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20191225 Making trade-offs when writing Python code.md diff --git a/sources/tech/20191225 Making trade-offs when writing Python code.md b/sources/tech/20191225 Making trade-offs when writing Python code.md new file mode 100644 index 0000000000..47da30cb93 --- /dev/null +++ b/sources/tech/20191225 Making trade-offs when writing Python code.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Making trade-offs when writing Python code) +[#]: via: (https://opensource.com/article/19/12/zen-python-trade-offs) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Making trade-offs when writing Python code +====== +This is part of a special series about the Zen of Python focusing on the +seventh, eighth, and ninth principles: readability, special cases, and +practicality. +![Brick wall between two people, a developer and an operations manager][1] + +Software development is a discipline rife with trade-offs. For every choice, there is an equally defensible but opposite choice. Make a method private? You're encouraging copy-paste. Make a method public? You're committing prematurely to an interface. + +Software developers make hard choices every minute. While all the principles in the [Zen of Python][2] cover trade-offs to some extent, the following principles take the hardest, coldest look at some trade-offs. + +### Readability counts. + +In some sense, this middle principle is indeed the center of the entire Zen of Python. The Zen is not about writing efficient programs. It is not even about writing robust programs, for the most part. It is about writing programs that _other people can read_. + +Reading code, by its nature, happens after the code has been added to the system. Often, it happens long after. Neglecting readability is the easiest choice since it does not hurt right now. Whatever the reason for adding new code—a painful bug or a highly requested feature—it does hurt. Right now. + +In the face of immense pressure to throw readability to the side and just "solve the problem," the Zen of Python reminds us: readability counts. Writing the code so it can be read is a form of compassion for yourself and others. + +### Special cases aren't special enough to break the rules. + +There is always an excuse. This bug is particularly painful; let's not worry about simplicity. This feature is particularly urgent; let's not worry about beauty. The domain rules covering this case are particularly hairy; let's not worry about nesting levels. + +Once we allow special pleading, the dam wall breaks, and there are no more principles; things devolve into a Mad Max dystopia with every programmer for themselves, trying to find the best excuses. + +Discipline requires commitment. It is only when things are hard, when there is a strong temptation, that a software developer is tested. There is always a valid excuse to break the rules, and that's why the rules must be kept the rules. Discipline is the art of saying no to exceptions. No amount of explanation can change that. + +### Although, practicality beats purity. + +> "If you think only of hitting, springing, striking, or touching the enemy, you will not be able actually to cut him." +> — Miyamoto Musashi, _[The Book of Water][3]_ + +Ultimately, software development is a practical discipline. Its goal is to solve real problems, faced by real people. Practicality beats purity: above all else, we must _solve the problem_. If we think only about readability, simplicity, or beauty, we will not be able to actually _solve the problem_. + +As Musashi suggested, the primary goal of every code change should be to _solve a problem_. The problem must be foremost in our minds. If we waver from it and think only of the Zen of Python, we have failed the Zen of Python. This is another one of those contradictions inherent in the Zen of Python. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-trade-offs + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devops_confusion_wall_questions.png?itok=zLS7K2JG (Brick wall between two people, a developer and an operations manager) +[2]: https://www.python.org/dev/peps/pep-0020/ +[3]: https://en.wikipedia.org/wiki/The_Book_of_Five_Rings#The_Book_of_Water From e3de43d0ff5cd060eb3a11dd9c7525bba9d6fcef Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 26 Dec 2019 00:55:12 +0800 Subject: [PATCH 268/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191225=205=20se?= =?UTF-8?q?curity=20tips=20from=20Santa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191225 5 security tips from Santa.md --- .../20191225 5 security tips from Santa.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/tech/20191225 5 security tips from Santa.md diff --git a/sources/tech/20191225 5 security tips from Santa.md b/sources/tech/20191225 5 security tips from Santa.md new file mode 100644 index 0000000000..1c2f83c02a --- /dev/null +++ b/sources/tech/20191225 5 security tips from Santa.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 security tips from Santa) +[#]: via: (https://opensource.com/article/19/12/security-tips) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +5 security tips from Santa +====== +Stay off Santa's (and your employer's) naughty list by following this +list of useful security tips and practices. +![Security monster][1] + +If you're reading this in 2019, it's almost Christmas (as celebrated according to the Western Christian calendar), and, like all children and IT professionals, it's time to write your letter to Santa/St. Nick/Father Christmas. Don't forget: those who have been good get nice presents and those who haven't get coal. Coal is _not_ a clean-burning fuel, and with climate change well and truly upon us,[1][2] you don't want to be going for the latter option. + +Think back to all of the good security practices you've adopted over the past 11 or so months. And then think back to all of the bad security practices you've adopted when you should have been doing the _right_ thing. Oh, dear. It's not looking good for you, is it? + +Here's the good news, though: because Santa is a benevolent soul, there's time to make amends (unless you're reading this after Christmas[2][3]). Here's a list of useful security tips and practices that Santa follows and therefore are bound to put you on his "good" side. + +### 1\. Use a password manager + +Santa is very careful with his passwords. Here's a little secret: from time to time, rather than have his elves handcraft every little present, he sources his gifts from other parties. I'm not suggesting that he pays market rates (he's ordering in bulk, and he has a very, very good credit rating), but he uses lots of different suppliers, and he's aware that not all of them take security as seriously as he does. He doesn't want all his account logins to be leaked if one of his suppliers is hacked, so he uses separate passwords for each account. Now, Santa, being Santa, could remember all of these details if he wanted to—and even generate unique passwords that meet all the relevant complexity requirements for each site—but he uses an open source [password manager][4] for safety and for succession planning.[3][5] + +### 2\. Manage personal information properly + +You may work for a large company, organisation, or government, and you may think you have lots of customers and associated data, but consider Santa. He manages (or has managed) names, birth dates, addresses, hobbies, shoe sizes, colour preferences, and other personal data for literally every person on Earth. That's an awful lot of sensitive data, and it needs to be protected. When people grow too old for presents from Santa,[4][6] he needs to delete their data securely. In fact, Santa may well be the archetypal [GDPR][7] data controller, and he needs to be very careful who and what can access the data that he holds. Of course, he encrypts all the data and is very careful about key management. He's also very aware of the dangers associated with cold boot attacks (given the average temperature around his residence), so he ensures data is properly wiped before shutdown. + +### 3\. Measure and mitigate risk + +Santa knows all about [risk][8]. He has complex systems for ordering, fulfillment, travel planning, logistics, and delivery that are the envy of most of the world. He understands what impact failure in any part of the supply chain can have on his customers: mainly children and IT professionals. He quantifies risk, recalculating it on a regular basis to ensure that he is up to date with possible vulnerabilities and ready with mitigations. + +### 4\. Patch frequently but carefully + +Santa absolutely cannot afford for his systems to go down, particularly around his most busy period. He has established processes to ensure that the [concerns of security are balanced with the needs of the business][9].[5][10] He knows that sometimes business continuity must take priority, and on other occasions, the impact of a security breach would be so major that patches just _have_ to be applied. He tells people what he wants and listens to their views, taking them into account where he can. In other words, he embraces open management, delegating decisions where possible to the people who are best positioned to make the call, and only intervenes when asked for an executive decision or when exceptions arise. Santa is a _very_ enlightened manager. + +### 5\. Embrace diversity + +One of the useful consequences of running a global operation is that Santa values diversity. Old or young (at heart); male, female, or gender-neutral; neurotypical or neurodiverse; of any culture, sexuality, race, ability, creed, or nose colour, Santa takes into account his stakeholders and their views on what might go wrong. What a fantastic set of viewpoints Santa has available to him! And he's surprisingly hip to the opportunities for security practices that a wide and [diverse set of opinions and experiences][11] can bring[6][12] not to mention the multiple [positive impacts][13] on his organisation. + +### Summary + +Here's my advice: Be like Santa, and adopt at least some of his security practices. You'll have a much better opportunity of getting onto his good side, and that's going to go down well—not just with him, but also with your employer, who is just certain to give you a nice bonus, right? And if not, well, it's not too late to write that letter directly to Santa himself. + +* * * + + 1. If you have a problem with this statement, then either you need to find another article, or you're reading this in the far future where all our climate problems have been solved. I hope. + 2. Or you dwell in one of those cultures where Santa visits quite early in December. + 3. A high-flying goose in the face can do terrible damage to a fast-moving reindeer, and if the sleigh were to crash, what then...? + 4. Not me! + 5. Santa doesn't refer to it as a "business," but he's happy for us to call it that, so we can model our own experience on his. He's nice like that. + 6. Though Santa would never use the phrase "hip to the opportunities." He's way too cool for that. + + + +Download the free All Things Open interview series eBook Jessica McKellar is an entrepreneur,... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/security-tips + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_password_chaos_engineer_monster.png?itok=J31aRccu (Security monster) +[2]: tmp.PgLkHLx1Uz#1 +[3]: tmp.PgLkHLx1Uz#2 +[4]: https://opensource.com/article/18/4/3-password-managers-linux-command-line +[5]: tmp.PgLkHLx1Uz#3 +[6]: tmp.PgLkHLx1Uz#4 +[7]: https://opensource.com/article/18/1/being-open-about-data-privacy +[8]: http://aliceevebob.com/2019/03/12/dont-talk-security-talk-risk/ +[9]: http://aliceevebob.com/2017/10/17/stop-reading-start-patching/ +[10]: tmp.PgLkHLx1Uz#5 +[11]: http://aliceevebob.com/2017/08/08/diversity-in-it-security-not-just-a-canine-issue/ +[12]: tmp.PgLkHLx1Uz#6 +[13]: https://opensource.com/article/19/11/diversity-and-inclusion-strategies From 9debd9ea1465d8ecb63bb3af83fdc6646dd9ef75 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 26 Dec 2019 11:09:14 +0800 Subject: [PATCH 269/676] translated --- ...mize your Linux desktop with KDE Plasma.md | 72 ------------------- ...mize your Linux desktop with KDE Plasma.md | 70 ++++++++++++++++++ 2 files changed, 70 insertions(+), 72 deletions(-) delete mode 100644 sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md create mode 100644 translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md diff --git a/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md b/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md deleted file mode 100644 index 0fe21db27b..0000000000 --- a/sources/tech/20191221 Customize your Linux desktop with KDE Plasma.md +++ /dev/null @@ -1,72 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Customize your Linux desktop with KDE Plasma) -[#]: via: (https://opensource.com/article/19/12/linux-kde-plasma) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Customize your Linux desktop with KDE Plasma -====== -This article is part of a special series of 24 days of Linux desktops. -If you think there's no such thing as too much opportunity to customize -your desktop, KDE Plasma may be for you. -![5 pengiuns floating on iceburg][1] - -The Plasma desktop by the KDE community is a pinnacle among open source desktops. KDE got into the Linux desktop market early, but since its foundational Qt toolkit did not have a fully open license at the time, the [GNOME][2] desktop was created. Since then, Qt has become open source, and KDE (and its derivatives, like the [Trinity desktop][3]) has thrived. - -You may find the KDE desktop in your distribution's software repository, or you can download and install a distribution that ships KDE as its default. Before you install, be aware that KDE provides a full, integrated, and robust desktop experience, so several KDE applications are installed along with it. If you're already running a different desktop, you will find yourself with redundant applications (two PDF readers, several media players, two or more file managers, and so on). If you just want to try the KDE desktop without committing to it, you can install a KDE-based distribution in a virtual machine, such as [GNOME Boxes][4], or you can try a bootable OS like [Porteus][5]. - -### KDE desktop tour - -The [KDE Plasma][6] desktop is relatively boring at first glance—but in a comforting way. It's got the industry-standard layout: pop-up application menu in the bottom-left corner, taskbar in the middle, system tray on the right. It's exactly what you'd expect from a standard household or business computer. - -![KDE Plasma desktop][7] - -What sets KDE apart, though, is that you can change nearly anything you want. The Qt toolkit can be taken apart and rearranged in some surprising ways, meaning you can essentially design your own desktop using KDE's parts as your foundation. The settings available for how your desktop behaves are vast, too. KDE can act as a standard desktop, a tiling window manager, and anything in between. You can create your own window rules by window class, role, type, title, or any combination thereof, so if you want specific applications to behave differently than everything else, you can create an exception to global settings. - -Furthermore, there's a rich collection of widgets to enable you to customize the way you interface with your desktop. There's a GNOME-like full-screen application launcher, a Unity-like dock launcher and icons-only taskbar, and a traditional taskbar. You can create and place panels on any edge of the screen you want. - -![A slightly customized KDE desktop][8] - -There's so much customization, in fact, that one of the most common critiques of KDE is that it's _too customizable_, so keep in mind that customization is optional. You can use the Plasma desktop in its default configuration, and change things gradually and only as you feel necessary. What matters most about Plasma desktop configuration options isn't their number, but that they're discoverable and intuitive, either in the System Settings application or with a right-click. - -The fact is, on KDE, there's almost never just one way to accomplish any given task, and its users see that as its greatest strength. There's no implied workflow in KDE, only a default. And all defaults can be changed, until everything you need to do with your desktop is second-nature. - -### Consistency and integration - -The KDE community prides itself on consistency and integration, made possible through great developer and community management and the KDE libraries. The developers of KDE aren't just developers of a desktop. They provide a [stunning collection of applications][9], each of them created with KDE libs that extend and standardize common Qt widgets. It's no accident that after using KDE for a few months, whether you open [DigiKam][10] for photo management or Kmail to check email or KTorrent to grab the latest ISO or Dolphin to manage files, your muscle memory takes you where you need to go in the UI before you consciously think about it. - -![KDE on Porteus][11] - -### Try KDE - -KDE has something for everyone. Use its default settings for a smooth, plain-vanilla desktop experience, or customize it to make it your own. It's a stable, attractive, and robust desktop environment that probably has everything you need for whatever you want to do on Linux. - -KDE originally stood for Kool Desktop Environment, but is now known by many as the K Desktop... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/linux-kde-plasma - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg) -[2]: https://opensource.com/article/19/12/gnome-linux-desktop -[3]: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde -[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization -[5]: https://opensource.com/article/19/6/linux-distros-to-try -[6]: https://kde.org/plasma-desktop -[7]: https://opensource.com/sites/default/files/uploads/advent-kde-presskit.jpg (KDE Plasma desktop) -[8]: https://opensource.com/sites/default/files/uploads/advent-kde-dock.jpg (A slightly customized KDE desktop) -[9]: https://kde.org/applications/ -[10]: https://opensource.com/life/16/5/how-use-digikam-photo-management -[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus) diff --git a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md b/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md new file mode 100644 index 0000000000..402fcd0e3b --- /dev/null +++ b/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Customize your Linux desktop with KDE Plasma) +[#]: via: (https://opensource.com/article/19/12/linux-kde-plasma) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 KDE Plasma 定制 Linux 桌面 +====== +本文是 24 天 Linux 桌面特别系列的一部分。如果你认为没有太多机会进行自定义桌面,KDE Plasma 可能适合你。 +![5 pengiuns floating on iceburg][1] + +KDE 社区的 Plasma 桌面是开源桌面中的巅峰之作。KDE 很早就进入了 Linux 桌面市场,但是由于它的 基础 Qt 工具包当时没有完全开放的许可证,因此才有 [GNOME][2] 桌面。在此之后,Qt 开源了,并且 KDE(及其衍生产品,例如 [Trinity桌面][3])开始蓬勃发展。 + +你可能会在发行版的软件仓库中找到 KDE 桌面,或者可以下载并安装将 KDE 作为默认桌面的发行版。在安装之前,请注意,KDE 提供了完整、集成且强大的桌面体验,因此会同时安装几个 KDE 应用。如果你已经在运行其他桌面,那么将发现有几个冗余的应用(两个 PDF 阅读器、多个媒体播放器、两个或多个文件管理器,等等)。如果你只想尝试而不是一直使用 KDE 桌面,那么可以在虚拟机,如[GNOME Boxes][4]中安装基于 KDE 的发行版,也可以尝试使用可引导的操作系统,例如 [Porteus][5]。 + +### KDE 桌面之旅 + +乍一看,[KDE Plasma][6] 桌面相对无聊,但让人感到舒适。它有行业标准的布局:左下角弹出应用菜单,中间是任务栏,右边是系统托盘。这正是你对标准家用或商用计算机的期望。 + +![KDE Plasma desktop][7] + +但是,使 KDE 与众不同的是,你几乎可以更改任何想要的东西。Qt 工具包可以以令人惊讶的方式分割和重新排列,这意味着你实质上可以使用 KDE 的部件作为基础来设计自己的桌面。桌面行为的可用设置也很多。KDE 可以充当标准桌面,平铺窗口管理器以及两者之间的任意形式。你可以通过窗口类、角色、类型、标题或它们的任意组合来创建自己的窗口规则,因此,如果希望特定应用的行为不同于其他行为,那么可以创建全局设置的例外。 + +此外,它还有丰富的小部件集合,使你可以自定义与桌面交互的方式。它有一个类似 GNOME 的全屏应用启动器,一个类似 Unity 的 dock 启动器和仅有图标的任务栏,一个传统的任务栏。你可以在屏幕的任何边缘上创建和放置面板。 + +![A slightly customized KDE desktop][8] + +实际上,它有太多的自定义项了,因此 KDE 最常见的批评之一是它的_太过可定制化_,所以请记住,自定义项是可选的。你可以在默认配置下使用 Plasma 桌面,并仅在你认为必要时逐步进行更改。Plasma 桌面配置选项最重要的不是它们的数目,而是它们容易发现和直观,它们都在系统设置应用或者右键单击中。 + +事实是,在 KDE 上,几乎绝不会只有一种方法可以完成任何给定的任务,并且它的用户将其视为其最大的优势。KDE 中没有隐含的工作流,只有默认的。并且可以更改所有默认设置,直到你需要桌面做的成为你的习惯。 + +### 一致性和集成 + +KDE 社区以一致性和集成为荣,出色的开发人员、社区管理以及 KDE 库使其成为可能。KDE 的开发人员不只是桌面开发人员。它们提供了[惊人的应用集合][9],每个应用都使用 KDE 库创建,这些库扩展并标准化了常见的 Qt 小部件。使用 KDE 几个月后,无论是打开 [DigiKam][10] 进行照片管理,还是打开 Kmail 来检查电子邮件,还是打开 KTorrent 来获取最新的 ISO 或者使用 Dolphin 管理文件,你的肌肉记忆会在你思考之前直接带你进入对应 UI。 + +![KDE on Porteus][11] + +### 尝试 KDE + +KDE 适合所有人。使用其默认设置可获得流畅、原始的桌面体验,或对其进行自定义以使其成为自己专属。它是一个稳定、有吸引力且强大的桌面环境,可能有你想要在 Linux 完成要做的事的一切。 + +KDE 最初代表 Kool Desktop Environment,但现在被许多人称为 K Desktop。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-kde-plasma + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg) +[2]: https://opensource.com/article/19/12/gnome-linux-desktop +[3]: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://opensource.com/article/19/6/linux-distros-to-try +[6]: https://kde.org/plasma-desktop +[7]: https://opensource.com/sites/default/files/uploads/advent-kde-presskit.jpg (KDE Plasma desktop) +[8]: https://opensource.com/sites/default/files/uploads/advent-kde-dock.jpg (A slightly customized KDE desktop) +[9]: https://kde.org/applications/ +[10]: https://opensource.com/life/16/5/how-use-digikam-photo-management +[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus) \ No newline at end of file From 791cc851d7735fb0d03e18e760ebab4d345c4ae2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 26 Dec 2019 11:16:18 +0800 Subject: [PATCH 270/676] PUB @lxbwolf https://linux.cn/article-11714-1.html --- .../20191023 How to program with Bash- Loops.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191023 How to program with Bash- Loops.md (98%) diff --git a/translated/tech/20191023 How to program with Bash- Loops.md b/published/20191023 How to program with Bash- Loops.md similarity index 98% rename from translated/tech/20191023 How to program with Bash- Loops.md rename to published/20191023 How to program with Bash- Loops.md index 81b8ff093a..6a4d3ae653 100644 --- a/translated/tech/20191023 How to program with Bash- Loops.md +++ b/published/20191023 How to program with Bash- Loops.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11714-1.html) [#]: subject: (How to program with Bash: Loops) [#]: via: (https://opensource.com/article/19/10/programming-bash-loops) [#]: author: (David Both https://opensource.com/users/dboth) @@ -12,7 +12,7 @@ > 本文是 Bash 编程系列三篇中的最后一篇,来学习使用循环执行迭代的操作。 -![arrows cycle symbol for failing faster][1] +![](https://img.linux.net.cn/data/attachment/album/201912/26/111437f9pa3zqqwcc9wwg1.jpg) Bash 是一种强大的用于命令行和 shell 脚本的编程语言。本系列的三部分都是基于我的三集 [Linux 自学课程][2] 写的,探索怎么用 CLI 进行 bash 编程。 From b90b51dd6542f96656efe07ddc4ecb5fa7ad372e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 26 Dec 2019 11:39:34 +0800 Subject: [PATCH 271/676] PRF @geekpi --- ...virtual machines with Cockpit in Fedora.md | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md b/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md index ed0fd20db9..cf25b2d5b0 100644 --- a/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md +++ b/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Create virtual machines with Cockpit in Fedora) @@ -12,19 +12,19 @@ ![][1] -本文向你展示如何在 Fedora 31 上使用安装 Cockpit 所需软件来创建和管理虚拟机。Cockpit 是一个[交互式管理界面][2],可让你在任何受支持的 Web 浏览器上访问和管理系统。随着 [virt-manager 正逐渐废弃][3],用户被鼓励使用 Cockpit 来替换它。 +本文向你展示如何在 Fedora 31 上使用安装 Cockpit 所需软件来创建和管理虚拟机。Cockpit 是一个[交互式管理界面][2],可让你在任何受支持的 Web 浏览器上访问和管理系统。随着 [virt-manager 逐渐被废弃][3],鼓励用户使用 Cockpit 来替换它。 -Cockpit 是一个积极开发的项目,它有许多扩展其工作的插件。例如,其中一个是 “Machines”,它与 libvirtd 交互并允许用户创建和管理虚拟机。 +Cockpit 是一个正在活跃开发的项目,它有许多扩展其工作的插件。例如,其中一个是 “Machines”,它与 libvirtd 交互并允许用户创建和管理虚拟机。 ### 安装软件 -先决所需软件是 _libvirt _、_ cockpit_ 和 _cockpit-machines_。要将它们安装在 Fedora 31 上,请在终端[使用 sudo][4] 运行以下命令: +先决所需软件是 `libvirt`、`cockpit` 和 `cockpit-machines`。要将它们安装在 Fedora 31 上,请在终端[使用 sudo][4] 运行以下命令: ``` $ sudo dnf install libvirt cockpit cockpit-machines ``` -Cockpit 也在 “Headless Management” 软件包组中。该组对于仅通过网络访问的基于 Fedora 的服务器很有用。在这里,请使用以下命令进行安装: +Cockpit 也在 “Headless Management” 软件包组中。该软件组对于仅通过网络访问的基于 Fedora 的服务器很有用。在这里,请使用以下命令进行安装: ``` $ sudo dnf groupinstall "Headless Management" @@ -32,7 +32,7 @@ $ sudo dnf groupinstall "Headless Management" ### 设置 Cockpit 服务 -安装了必要的软件包后,就该启用服务了。 _libvirtd_ 服务运行虚拟机,而 Cockpit 有一个激活的套接字服务,可让你访问 Web GUI: +安装了必要的软件包后,就该启用服务了。`libvirtd` 服务运行虚拟机,而 Cockpit 有一个激活的套接字服务,可让你访问 Web GUI: ``` $ sudo systemctl enable libvirtd --now @@ -59,35 +59,31 @@ $ sudo systemctl status cockpit.socket 使用系统的用户名和密码登录界面。你还可以选择是否允许在此会话中将密码用于管理任务。 -选择 _Virtual Machines_,然后选择_ Create VM_ 来创建一台新的虚拟机。控制台为你提供几个选项: +选择 “Virtual Machines”,然后选择 “Create VM” 来创建一台新的虚拟机。控制台为你提供几个选项: * 使用 Cockpit 的内置库下载操作系统 * 使用系统上已下载的安装媒体 * 指向系统安装树的 URL * 通过 [PXE][5] 协议通过网络引导媒体 - - -输入所有必要的参数。然后选择 _Create_ 启动新虚拟机。 +输入所有必要的参数。然后选择 “Create” 启动新虚拟机。 此时,将出现一个图形控制台。大多数现代 Web 浏览器都允许你使用键盘和鼠标与 VM 控制台进行交互。现在,你可以完成安装并使用新的 VM,就像[过去通过 virt-manager][6] 一样。 -* * * - -_照片由 [Miguel Teixeira][7] 发布于 [Flickr][8](CC BY-SA 2.0)_ +*照片由 [Miguel Teixeira][7] 发布于 [Flickr][8](CC BY-SA 2.0)* -------------------------------------------------------------------------------- via: https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/ -作者:[Karlis KavacisPaul W. Frields][a] +作者:[Karlis Kavacis][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]: https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/ +[a]: https://fedoramagazine.org/author/karlisk/ [b]: https://github.com/lujun9972 [1]: https://fedoramagazine.org/wp-content/uploads/2019/11/create-vm-cockpit-816x345.jpg [2]: https://cockpit-project.org/ From 3c9430e10da5a196abe5ef68e0b91e60836b5d16 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 26 Dec 2019 11:40:00 +0800 Subject: [PATCH 272/676] PUB @geekpi https://linux.cn/article-11716-1.html --- ...20191127 Create virtual machines with Cockpit in Fedora.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191127 Create virtual machines with Cockpit in Fedora.md (98%) diff --git a/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md b/published/20191127 Create virtual machines with Cockpit in Fedora.md similarity index 98% rename from translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md rename to published/20191127 Create virtual machines with Cockpit in Fedora.md index cf25b2d5b0..c4de8df42f 100644 --- a/translated/tech/20191127 Create virtual machines with Cockpit in Fedora.md +++ b/published/20191127 Create virtual machines with Cockpit in Fedora.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11716-1.html) [#]: subject: (Create virtual machines with Cockpit in Fedora) [#]: via: (https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/) [#]: author: (Karlis KavacisPaul W. Frields https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/) From 8cde5f2ad52a0374be325758e01749b61c478af5 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Thu, 26 Dec 2019 19:29:35 +0800 Subject: [PATCH 273/676] Update 20180503 How the four components of a distributed tracing system work together.md --- ...r components of a distributed tracing system work together.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180503 How the four components of a distributed tracing system work together.md b/sources/tech/20180503 How the four components of a distributed tracing system work together.md index 56239fc872..68ba97e989 100644 --- a/sources/tech/20180503 How the four components of a distributed tracing system work together.md +++ b/sources/tech/20180503 How the four components of a distributed tracing system work together.md @@ -1,3 +1,4 @@ +chenmu-kk is translating. How the four components of a distributed tracing system work together ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/touch-tracing.jpg?itok=rOmsY-nU) From 606061bb51e7f3f6259cd766ddc2754acfe7956a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 26 Dec 2019 21:49:42 +0800 Subject: [PATCH 274/676] Rename sources/tech/20191226 Darktable 3 Released With GUI Rework and New Features.md to sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md --- ...91226 Darktable 3 Released With GUI Rework and New Features.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191226 Darktable 3 Released With GUI Rework and New Features.md (100%) diff --git a/sources/tech/20191226 Darktable 3 Released With GUI Rework and New Features.md b/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md similarity index 100% rename from sources/tech/20191226 Darktable 3 Released With GUI Rework and New Features.md rename to sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md From fc32328cb1559eb96804bf76045a34071b1e6902 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 26 Dec 2019 21:51:01 +0800 Subject: [PATCH 275/676] Rename sources/tech/20191225 How to run a business with open source- Top reads.md to sources/talk/20191225 How to run a business with open source- Top reads.md --- .../20191225 How to run a business with open source- Top reads.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191225 How to run a business with open source- Top reads.md (100%) diff --git a/sources/tech/20191225 How to run a business with open source- Top reads.md b/sources/talk/20191225 How to run a business with open source- Top reads.md similarity index 100% rename from sources/tech/20191225 How to run a business with open source- Top reads.md rename to sources/talk/20191225 How to run a business with open source- Top reads.md From 9efb96ed7a394fc3614ca0c29e89d47217d4ce56 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 26 Dec 2019 23:58:15 +0800 Subject: [PATCH 276/676] PRF @runningwater --- ...20191007 Using the Java Persistence API.md | 359 +++++++++--------- 1 file changed, 176 insertions(+), 183 deletions(-) diff --git a/translated/tech/20191007 Using the Java Persistence API.md b/translated/tech/20191007 Using the Java Persistence API.md index 6c44f50290..056d138caf 100644 --- a/translated/tech/20191007 Using the Java Persistence API.md +++ b/translated/tech/20191007 Using the Java Persistence API.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using the Java Persistence API) @@ -9,244 +9,237 @@ 使用 Java 持久化 API ====== -我们通过为自行车商店构建示例应用程序来学习如何使用 JPA。 + +> 我们通过为自行车商店构建示例应用程序来学习如何使用 JPA。 + ![Coffee beans][1] -对应用开发者来说,Java 持久化 API (JPA)是一项重要的技能,需要透彻理解。它为 Java 开发人员定义了如何将对象的方法调用转换为访问、持久化及管理 NoSQL 和关系型数据库数据存储的问题的方案。 +对应用开发者来说,Java 持久化 APIJava Persistence API(JPA)是一项重要的 java 功能,需要透彻理解。它为 Java 开发人员定义了如何将对象的方法调用转换为访问、持久化及管理存储在 NoSQL 和关系型数据库中的数据的方案。 -本文通过构建自行车借贷服务的教程示例来详细研究 JPA。此示例会使用 Spring Boot 框架、MongoDB 数据库([已经不开源][2])和 Maven 包管理来构建一个大型应用程序,并且创建一个创建、读取、更新和删除(CRUD) 层。这儿我选择 NetBeans 11 作为我的 IDE。 +本文通过构建自行车借贷服务的教程示例来详细研究 JPA。此示例会使用 Spring Boot 框架、MongoDB 数据库([已经不开源][2])和 Maven 包管理来构建一个大型应用程序,并且构建一个创建、读取、更新和删除(CRUD)层。这儿我选择 NetBeans 11 作为我的 IDE。 -此教程仅从开源的角度来介绍 Java 持久化的工作原理,不涉及其作为工具的使用说明。这全是关于编写应用程序模式的学习,但对于理解具体的软件实现也很益处。可以从我的[ GitHub 源仓库][3] 来获取相关代码。 +此教程仅从开源的角度来介绍 Java 持久化 API 的工作原理,不涉及其作为工具的使用说明。这全是关于编写应用程序模式的学习,但对于理解具体的软件实现也很益处。可以从我的 [GitHub 仓库][3]来获取相关代码。 -### Java: 不仅仅是 'beans' +### Java: 不仅仅是“豆子” -Java 是一门面向对象的编程语言,自 1996 年发布第一版 Java 开发工具(JDK)起,已经变化了很多很多。要了解其特性和其虚拟机本身就是个很长的历史。简而言之,和 Linux 内核很相似,自发布以来,该语言已经向多个方向分支发展。有对社区免费的标准版本、有针对企业的企业版本及由多家供应商提供的开源替代品。主要版本每六个月发布一次,其功能往往差异很大,所以确认选用版本前得先做些研究。 +Java 是一门面向对象的编程语言,自 1996 年发布第一版 Java 开发工具(JDK)起,已经变化了很多很多。要了解其各种发展及其虚拟机本身就是一堂历史课。简而言之,和 Linux 内核很相似,自发布以来,该语言已经向多个方向分支发展。有对社区免费的标准版本、有针对企业的企业版本及由多家供应商提供的开源替代品。主要版本每六个月发布一次,其功能往往差异很大,所以确认选用版本前得先做些研究。 -总而言之,Java 的历史很悠久。本教程重点介绍 Java 11 的开源实现 [JDK 11][4]。因其是扔然有效的长期支持版本之一。 +总而言之,Java 的历史很悠久。本教程重点介绍 Java 11 的开源实现 [JDK 11][4]。因其是仍然有效的长期支持版本之一。 - * **Spring Boot: ** Spring Boot 是由 Pivotal 公司开发大型 Spring 框架的一个模块。Spring 是 Java 开发中一个非常流行的框架。它支持各种框架和配置,也支持 WEB 应用程序及提供了应用安全保障功能。Spring Boot 为快速启动项目集成了基本的配置。本教程使用 Spring Boot 来快速编写控制台应用程序并针对数据库编写测试用例。 - * **Maven:** Maven 是由 Apache 开发的项目/包管理工具。Maven 通过 `POM.xml` 文件来管理包及其依赖项。如果你们使用过 NPM 的话,可能会非常熟悉包管理器的功能。此外 Maven 也用来进行项目构建及生成功能报告。 - * **Lombok:** Lombok 是一个库,它通过在对象文件里面添加注解来自动创建 getters/setters 方法。像 C# 这些语言已经实现了此功能,Lombok 只是把此功能引入 Java 语言而已。 - * **NetBeans: ** NetBeans 是一款很流行的开源 IDE,专门用于 Java 开发。它的许多工具都随着 Java SE 和 EE 的版本更新而更新。 + * **Spring Boot** 是由 Pivotal 公司开发的大型 Spring 框架的一个模块。Spring 是 Java 开发中一个非常流行的框架。它支持各种框架和配置,也为 WEB 应用程序及安全提供了保障。Spring Boot 为快速构建各种类型的 Java 项目提供了基本的配置。本教程使用 Spring Boot 来快速编写控制台应用程序并针对数据库编写测试用例。 + * **Maven** 是由 Apache 开发的项目/包管理工具。Maven 通过 `POM.xml` 文件来管理包及其依赖项。如果你使用过 NPM 的话,可能会非常熟悉包管理器的功能。此外 Maven 也用来进行项目构建及生成功能报告。 + * **Lombok** 是一个库,它通过在对象文件里面添加注解来自动创建 getters/setters 方法。像 C# 这些语言已经实现了此功能,Lombok 只是把此功能引入 Java 语言而已。 + * **NetBeans** 是一款很流行的开源 IDE,专门用于 Java 开发。它的许多工具都随着 Java SE 和 EE 的版本更新而更新。 - - -我们会这组工具来创建一个简单的虚构自行车商店应用程序。会实现对 "Customer" 和 "Bike" 对象集合的的插入操作。 +我们会用这组工具为一个虚构自行车商店创建一个简单的应用程序。会实现对 `Customer` 和 `Bike` 对象集合的的插入操作。 ### 酿造完美 导航到 [Spring Initializr][5] 页面。该网站可以生成基于 Spring Boot 和其依赖项的基本项目。选择以下选项: - 1. **项目:** Maven 工程 - 2. **语言:** Java - 3. **Spring Boot:** 2.1.8 (或最稳定版本) - 4. **项目元数据:** 无论你使用什么名字,其命名约定都是像 **com.stephb** 这样的。 + 1. **项目:** Maven 工程 + 2. **语言:** Java + 3. **Spring Boot:** 2.1.8(或最稳定版本) + 4. **项目元数据:** 无论你使用什么名字,其命名约定都是像 `com.stephb` 这样的。 * 你可以保留 Artifact 名字为 “Demo”。 - 5. **依赖项:** 添加: + 5. **依赖项:** 添加: * Spring Data MongoDB * Lombok - - 点击 **下载**,然后用你的 IDE(例如 NetBeans) 打开此新项目。 -#### 模型层(Model)概要 - -项目里面,模型代表从数据库里取出的信息的具体对象。我们关注两个对象:**Customer** 和 **Bike**。首先,在 **src** 目录创建 **dto** 目录;然后,创建两个名为 **Customer.java** 和 **Bike.java** 的 Java 类对象文件。其结构如下示: - -**Customer.Java** - - -``` - 1 package com.stephb.JavaMongo.dto; - 2  - 3 import lombok.Getter; - 4 import lombok.Setter; - 5 import org.springframework.data.annotation.Id; - 6  - 7 /** - 8  * - 9  * @author stephon -10  */ -11 @Getter @Setter -12 public class Customer { -13  -14         private @Id String id; -15         private String emailAddress; -16         private String firstName; -17         private String lastName; -18         private String address; -19          -20 } -``` - -**Bike.java** +#### 模型层概要 +在项目里面,模型model代表从数据库里取出的信息的具体对象。我们关注两个对象:`Customer` 和 `Bike`。首先,在 `src` 目录创建 `dto` 目录;然后,创建两个名为 `Customer.java` 和 `Bike.java` 的 Java 类对象文件。其结构如下示: ```Java - 1 package com.stephb.JavaMongo.dto; - 2  - 3 import lombok.Getter; - 4 import lombok.Setter; - 5 import org.springframework.data.annotation.Id; - 6  - 7 /** - 8  * - 9  * @author stephon -10  */ -11 @Getter @Setter -12 public class Bike { -13         private @Id String id; -14         private String modelNumber; -15         private String color; -16         private String description; -17  -18         @Override -19         public String toString() { -20                 return "This bike model is " + this.modelNumber + " is the color " + this.color + " and is " + description; -21         } -22 } +package com.stephb.JavaMongo.dto; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.data.annotation.Id; + +/** + * + * @author stephon + */ +@Getter @Setter +public class Customer { + + private @Id String id; + private String emailAddress; + private String firstName; + private String lastName; + private String address; + +} ``` -如你所见,对象中使用 Lombok 注解来为定义的属性(特性)生成 getters/setters 方法。如果你不想对所有属于都生成 getters/setters 方法,可以在属性上定义这些注解。这两个类会变成容器,里面携带有数据,无论在何处想显示信息都可以使用。 +*Customer.Java* + +```Java +package com.stephb.JavaMongo.dto; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.data.annotation.Id; + +/** + * + * @author stephon + */ +@Getter @Setter +public class Bike { + private @Id String id; + private String modelNumber; + private String color; + private String description; + + @Override + public String toString() { + return "This bike model is " + this.modelNumber + " is the color " + this.color + " and is " + description; + } +} +``` + +*Bike.java* + +如你所见,对象中使用 Lombok 注解来为定义的属性properties/特性attributes生成 getters/setters 方法。如果你不想对该类的所有特性都生成 getters/setters 方法,可以在属性上专门定义这些注解。这两个类会变成容器,里面携带有数据,无论在何处想显示信息都可以使用。 #### 配置数据库 -我使用 [Mongo Docker][7] 容器来进行此次测试。如果你的系统上已经安装了 MongoDB,则不必运行 Docker 实例。你也可以登陆其官网,然后按照安装说明,选择系统信息来安装 MongoDB。 - -安装后,就可以使用命令行、GUI(例如 MongoDB Compass)或用于连接数据源的 IDE 驱动程序来与新的 MongoDB 服务进行交互。到目前为止,可以开始定义数据层了,用来拉取、转换和持久化数据。需要设置数据库访问属性,请导航到程序中的 **applications.properties** 文件,然后添加如下内容: +我使用 [Mongo Docker][7] 容器来进行此次测试。如果你的系统上已经安装了 MongoDB,则不必运行 Docker 实例。你也可以登录其官网,选择系统信息,然后按照安装说明来安装 MongoDB。 +安装后,就可以使用命令行、GUI(例如 MongoDB Compass)或用于连接数据源的 IDE 驱动程序来与新的 MongoDB 服务器进行交互。到目前为止,可以开始定义数据层了,用来拉取、转换和持久化数据。需要设置数据库访问属性,请导航到程序中的 `applications.properties` 文件,然后添加如下内容: ``` - 1 spring.data.mongodb.host=localhost - 2 spring.data.mongodb.port=27017 - 3 spring.data.mongodb.database=BikeStore +spring.data.mongodb.host=localhost +spring.data.mongodb.port=27017 +spring.data.mongodb.database=BikeStore ``` -#### 定义数据访问对象(数据)层 +#### 定义数据访问对象/数据访问层 -数据访问层(DAL)中的数据访问对象(DAO)定义了与数据库中的数据的交互过程。令人惊叹的就是在使用 **spring-boot-starter** 后,查询数据库的大部分工作已经完成。 - -让我们从 **Customer** DAO 开始。在 **src** 下的新目录 **dao** 中创建一个接口文件,然后再创建一个名为 **CustomerRepository.java** 的 Java 类文件,其内容如下示: +数据访问层data access layer(DAL)中的数据访问对象data access objects(DAO)定义了与数据库中的数据的交互过程。令人惊叹的就是在使用 `spring-boot-starter` 后,查询数据库的大部分工作已经完成。 +让我们从 `Customer` DAO 开始。在 `src` 下的新目录 `dao` 中创建一个接口文件,然后再创建一个名为 `CustomerRepository.java` 的 Java 类文件,其内容如下示: ``` - 1 package com.stephb.JavaMongo.dao; - 2  - 3 import com.stephb.JavaMongo.dto.Customer; - 4 import java.util.List; - 5 import org.springframework.data.mongodb.repository.MongoRepository; - 6  - 7 /** - 8  * - 9  * @author stephon -10  */ -11 public interface CustomerRepository extends MongoRepository{ -12         @Override -13         public ListStringCustomer> findAll(); -14         public List findByFirstName(String firstName); -15         public List findByLastName(String lastName); -16 } +package com.stephb.JavaMongo.dao; + +import com.stephb.JavaMongo.dto.Customer; +import java.util.List; +import org.springframework.data.mongodb.repository.MongoRepository; + +/** + * + * @author stephon + */ +public interface CustomerRepository extends MongoRepository{ + @Override + public List findAll(); + public List findByFirstName(String firstName); + public List findByLastName(String lastName); +} ``` -这个类是一个接口,扩展或继承于 **MongoRepository** 类,而 MongoRepository 类依赖于 DTO (**Customer.java**)和一个字符串,它们用来实现自定义函数查询功能。因为您已继承自此类,所以您可以访问许多方法函数,这些函数允许持久化和查询对象,而无需实现或引用自己定义的方法函数。例如,在实例化 **CustomerRepository** 对象后,你就可以直接使用 **Save** 功能。如果你需要扩展更多的功能,也可以重写这些方法。我创建了一些自定义查询来搜索我的集合,这些集合对象是我自定义的元素。 +这个类是一个接口,扩展或继承于 `MongoRepository` 类,而 `MongoRepository` 类依赖于 DTO (`Customer.java`)和一个字符串,它们用来实现自定义函数查询功能。因为你已继承自此类,所以你可以访问许多方法函数,这些函数允许持久化和查询对象,而无需实现或引用自己定义的方法函数。例如,在实例化 `CustomerRepository` 对象后,你就可以直接使用 `Save` 函数。如果你需要扩展更多的功能,也可以重写这些函数。我创建了一些自定义查询来搜索我的集合,这些集合对象是我自定义的元素。 -**Bike** 对象也有一个存储源负责与数据库交互。与 **CustomerRepository** 的实现非常类似。其实现如下所示: +`Bike` 对象也有一个存储源负责与数据库交互。与 `CustomerRepository` 的实现非常类似。其实现如下所示: ``` - 1 package com.stephb.JavaMongo.dao; - 2  - 3 import com.stephb.JavaMongo.dto.Bike; - 4 import java.util.List; - 5 import org.springframework.data.mongodb.repository.MongoRepository; - 6  - 7 /** - 8  * - 9  * @author stephon -10  */ -11 public interface BikeRepository extends MongoRepository{ -12         public Bike findByModelNumber(String modelNumber); -13         @Override -14         public List findAll(); -15         public List findByColor(String color); -16 } +package com.stephb.JavaMongo.dao; + +import com.stephb.JavaMongo.dto.Bike; +import java.util.List; +import org.springframework.data.mongodb.repository.MongoRepository; + +/** + * + * @author stephon + */ +public interface BikeRepository extends MongoRepository{ + public Bike findByModelNumber(String modelNumber); + @Override + public List findAll(); + public List findByColor(String color); +} ``` #### 运行程序 现在,你已经有了一种结构化数据的方式,可以对数据进行提取、转换和持久化,然后运行这个程序。 -找到 **Application.java** 文件(有可能不是此名称,具体取决于你的应用程序名称,但都会包含有 “application” )。在定义此类的地方,在后面加上 **CommandLineRunner 的实现**。这将允许你实现 **run** 方法来创建命令行应用程序。重写 **CommandLineRunner** 接口提供的 **run** 方法,并包含如下内容用来测试 **BikeRepository** : - +找到 `Application.java` 文件(有可能不是此名称,具体取决于你的应用程序名称,但都会包含有 “application” )。在定义此类的地方,在后面加上 `implements CommandLineRunner`。这将允许你实现 `run` 方法来创建命令行应用程序。重写 `CommandLineRunner` 接口提供的 `run` 方法,并包含如下内容用来测试 `BikeRepository` : ``` - 1 package com.stephb.JavaMongo; - 2  - 3 import com.stephb.JavaMongo.dao.BikeRepository; - 4 import com.stephb.JavaMongo.dao.CustomerRepository; - 5 import com.stephb.JavaMongo.dto.Bike; - 6 import java.util.Scanner; - 7 import org.springframework.beans.factory.annotation.Autowired; - 8 import org.springframework.boot.CommandLineRunner; - 9 import org.springframework.boot.SpringApplication; -10 import org.springframework.boot.autoconfigure.SpringBootApplication; -11  -12  -13 @SpringBootApplication -14 public class JavaMongoApplication implements CommandLineRunner { -15                 @Autowired -16                 private BikeRepository bikeRepo; -17                 private CustomerRepository custRepo; -18                  -19     public static void main(String[] args) { -20                         SpringApplication.run(JavaMongoApplication.class, args); -21     } -22         @Override -23         public void run(String... args) throws [Exception] { -24                 Scanner scan = new Scanner(System.in); -25                 String response = ""; -26                 boolean running = true; -27                 while(running){ -28                         System.out.println("What would you like to create? \n C: The Customer \n B: Bike? \n X:Close"); -29                         response = scan.nextLine(); -30                         if ("B".equals(response.toUpperCase())) { -31                                 String[] bikeInformation = new String; -32                                 System.out.println("Enter the information for the Bike"); -33                                 System.out.println("Model Number"); -34                                 bikeInformation[0] = scan.nextLine(); -35                                 System.out.println("Color"); -36                                 bikeInformation[1] = scan.nextLine(); -37                                 System.out.println("Description"); -38                                 bikeInformation[2] = scan.nextLine(); -39  -40                                 Bike bike = new Bike(); -41                                 bike.setModelNumber(bikeInformation[0]); -42                                 bike.setColor(bikeInformation[1]); -43                                 bike.setDescription(bikeInformation[2]); -44  -45                                 bike = bikeRepo.save(bike); -46                                 System.out.println(bike.toString()); -47  -48  -49                         } else if ("X".equals(response.toUpperCase())) { -50                                 System.out.println("Bye"); -51                                 running = false; -52                         } else { -53                                 System.out.println("Sorry nothing else works right now!"); -54                         } -55                 } -56                  -57         } -58 } +package com.stephb.JavaMongo; + +import com.stephb.JavaMongo.dao.BikeRepository; +import com.stephb.JavaMongo.dao.CustomerRepository; +import com.stephb.JavaMongo.dto.Bike; +import java.util.Scanner; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +public class JavaMongoApplication implements CommandLineRunner { + @Autowired + private BikeRepository bikeRepo; + private CustomerRepository custRepo; + + public static void main(String[] args) { + SpringApplication.run(JavaMongoApplication.class, args); + } + @Override + public void run(String... args) throws Exception { + Scanner scan = new Scanner(System.in); + String response = ""; + boolean running = true; + while(running){ + System.out.println("What would you like to create? \n C: The Customer \n B: Bike? \n X:Close"); + response = scan.nextLine(); + if ("B".equals(response.toUpperCase())) { + String[] bikeInformation = new String[3]; + System.out.println("Enter the information for the Bike"); + System.out.println("Model Number"); + bikeInformation[0] = scan.nextLine(); + System.out.println("Color"); + bikeInformation[1] = scan.nextLine(); + System.out.println("Description"); + bikeInformation[2] = scan.nextLine(); + + Bike bike = new Bike(); + bike.setModelNumber(bikeInformation[0]); + bike.setColor(bikeInformation[1]); + bike.setDescription(bikeInformation[2]); + + bike = bikeRepo.save(bike); + System.out.println(bike.toString()); + + + } else if ("X".equals(response.toUpperCase())) { + System.out.println("Bye"); + running = false; + } else { + System.out.println("Sorry nothing else works right now!"); + } + } + + } +} ``` -其中的 **@Autowired** 注解会自动依赖注入 **BikeRepository** 和 **CustomerRepository** Bean。我们将使用这些类来从数据库持久化和采集数据。 +其中的 `@Autowired` 注解会自动依赖注入 `BikeRepository` 和 `CustomerRepository` Bean。我们将使用这些类来从数据库持久化和采集数据。 已经好了。你已经创建了一个命令行应用程序。该应用程序连接到数据库,并且能够以最少的代码执行 CRUD 操作 ### 结论 -从诸如对象和类之类的编程语言概念转换为用于在数据库中存储、检索或更改数据的调用对于构建应用程序至关重要。Java 持久化 API (JPA)正是为 Java 开发人员解决这一难题的重要工具。 你正在使用 Java 操纵哪些数据库呢? 请在评论中分享。 +从诸如对象和类之类的编程语言概念转换为用于在数据库中存储、检索或更改数据的调用对于构建应用程序至关重要。Java 持久化 API(JPA)正是为 Java 开发人员解决这一难题的重要工具。你正在使用 Java 操纵哪些数据库呢?请在评论中分享。 -------------------------------------------------------------------------------- @@ -255,7 +248,7 @@ via: https://opensource.com/article/19/10/using-java-persistence-api 作者:[Stephon Brown][a] 选题:[lujun9972][b] 译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5dafc97faf08ad209a99b8cd648183135fdf9164 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 27 Dec 2019 00:08:09 +0800 Subject: [PATCH 277/676] PUB @runningwater https://linux.cn/article-11717-1.html --- .../20191007 Using the Java Persistence API.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191007 Using the Java Persistence API.md (98%) diff --git a/translated/tech/20191007 Using the Java Persistence API.md b/published/20191007 Using the Java Persistence API.md similarity index 98% rename from translated/tech/20191007 Using the Java Persistence API.md rename to published/20191007 Using the Java Persistence API.md index 056d138caf..8f5c20d3cc 100644 --- a/translated/tech/20191007 Using the Java Persistence API.md +++ b/published/20191007 Using the Java Persistence API.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11717-1.html) [#]: subject: (Using the Java Persistence API) [#]: via: (https://opensource.com/article/19/10/using-java-persistence-api) [#]: author: (Stephon Brown https://opensource.com/users/stephb) @@ -12,7 +12,7 @@ > 我们通过为自行车商店构建示例应用程序来学习如何使用 JPA。 -![Coffee beans][1] +![](https://img.linux.net.cn/data/attachment/album/201912/27/000705dymv92hnba2a2322.jpg) 对应用开发者来说,Java 持久化 APIJava Persistence API(JPA)是一项重要的 java 功能,需要透彻理解。它为 Java 开发人员定义了如何将对象的方法调用转换为访问、持久化及管理存储在 NoSQL 和关系型数据库中的数据的方案。 From 54aff5668fcd18a6d005fc723cbcfd3dd21a9df1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 27 Dec 2019 00:53:08 +0800 Subject: [PATCH 278/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191227=20Explai?= =?UTF-8?q?ned!=20Why=20Your=20Distribution=20Still=20Using=20an=20?= =?UTF-8?q?=E2=80=98Outdated=E2=80=99=20Linux=20Kernel=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md --- ... Still Using an ‘Outdated- Linux Kernel.md | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md diff --git a/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md b/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md new file mode 100644 index 0000000000..224f848f2d --- /dev/null +++ b/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Explained! Why Your Distribution Still Using an ‘Outdated’ Linux Kernel?) +[#]: via: (https://itsfoss.com/why-distros-use-old-kernel/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Explained! Why Your Distribution Still Using an ‘Outdated’ Linux Kernel? +====== + +[Check your Linux kernel version][1]. Chances are that you’ll find that the kernel version your system is using has already reached end of life (EOL) as listed on Linux Kernel website. + +End of life means a software won’t get bug fixes and support anymore. + +That poses some valid questions. Why is my Linux distribution using a kernel that has reached end of life? Is this not a security risk? Is my system safe? + +Let me explain all these questions in this article. + +Summary + +The upstream kernel support and the your distribution’s kernel support are two different things. + +For example, Linux kernel 4.15 might have reached end of life (as per the official Linux kernel website) but Ubuntu 18.04 LTS release will use it and maintain it till April 2023 by backporting security patches and bug fixes. + +### Checking Linux kernel version and finding its end of life status + +Let’s first check the Linux kernel version on your system: + +``` +uname -r +``` + +I am using Ubuntu 18.04 here and it shows the Linux kernel version like this: + +``` +[email protected]:~$ uname -r +5.0.0-37-generic +``` + +Now, you may go to the official Linux kernel website and see what Linux kernels are still being supported. It’s displayed on the homepage itself. + +[Linux Kernel Official Website][2] + +You should see a status like this: + +![Linux Kernel Status][3] + +If you don’t see a kernel version listed on the homepage of kernel website, it means that specific version has reached end of life. + +As you can see, kernel 5.0 is not listed here. It indicates that this kernel version is not being supported anymore. Actually, it [reached end of life in June 2019][4]. + +The life cycle of a Linux kernel doesn’t follow a set pattern, unfortunately. It’s NOT like a regular kernel stable release will be supported for X months and a long term support(LTS) kernel will be supported for Y years. + +Based on the demand and requirements, there could be several LTS kernel versions with different EOL. You can find them along with their projected EOL on [this page][5]. + +Now comes the big question. Why is Ubuntu providing kernel 5.0 if the Linux kernel website shows that it has reached its end of life? + +### Your distribution uses an EOL Linux kernel but that’s Okay! + +![][6] + +Have you ever wondered why Ubuntu/Debian/Fedora etc are called Linux distributions? It’s because they ‘distribute’ the Linux kernel. + +They have their own modification of the Linux kernel, they add the GUI elements (desktop environment, display server etc) and software and they make it available to their users. + +In the typical workflow, a Linux distribution will choose a kernel to provide to its users. And then it will hold on to this kernel for months or years even after the kernel has reached end of life. + +How is it safe then? It’s because the _**distribution maintains the kernel by backporting all the important fixes to its kernel**_. + +In other words, your Linux distribution makes sure that your Linux kernel is patched well and has all the bug fixes and important new features backported to it. There will be thousands of changes on top of the ‘old outdated Linux kernel’. + +When the Linux kernel website says that a certain kernel version has reached EOL, it means that the core Linux kernel maintainers are not going to update/patch that kernel version anymore. + +But at the same time, the developers at Debian/Ubuntu or other distributions work to keep the same old version alive by bringing the relevant changes from the newer kernel versions (being maintained by the core kernel team) to your distribution’s old kernel. + +Bottom line is that even if it seems like your distribution is using an outdated Linux kernel, it is actually being well maintained and not really outdated. + +### Should you use the latest stable kernel version? + +![][7] + +A new stable Linux kernel version is released every 2-3 months. And this makes many users wonder who they can get their hands on that new shiny thing. + +To be frank, you should not do that unless you have a pretty good reason for it. Your distribution doesn’t provide it to you. You cannot just use ‘_sudo apt give-me-the-latest-stable-kernel_‘. + +Now, manually [installing the mainline Linux kernel version][8] could be a challenge in itself. Even if you manage to install it, it is now up to you to make sure that this kernel is updated every time there is a bug fix. And when this new kernel reaches end of life, it becomes your responsibility to upgrade to the newer kernel version. It won’t be handled with apt upgrade like regular [Ubuntu updates][9]. + +You should also keep in mind that your distribution also has drivers and patches which you may not be able to use if you switch to the mainline kernel. + +As [Greg Kroah-Hartman][10] puts it, “_**the best kernel you can use is one that someone else supports**_“. And who can be better at this job then your Linux distribution! + +I hope you have a better understanding on this topic and you won’t panic the next time you find out that the kernel version your system is using has reached end of life. + +I welcome your questions and suggestions. Please feel free to use the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/why-distros-use-old-kernel/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[2]: https://www.kernel.org/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-kernel-status.jpg?ssl=1 +[4]: http://lkml.iu.edu/hypermail/linux/kernel/1906.0/02354.html +[5]: https://www.kernel.org/category/releases.html +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/Keep_Calm_and_Trust_Your_Distribution.png?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/using_latest_kernel.png?ssl=1 +[8]: https://wiki.ubuntu.com/Kernel/MainlineBuilds +[9]: https://itsfoss.com/update-ubuntu/ +[10]: https://en.wikipedia.org/wiki/Greg_Kroah-Hartman From 692eb4ff11e1356fc480a2ec37f4ded85255070a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 27 Dec 2019 00:53:53 +0800 Subject: [PATCH 279/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191226=2010=20L?= =?UTF-8?q?inux=20command=20tutorials=20for=20beginners=20and=20experts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191226 10 Linux command tutorials for beginners and experts.md --- ...and tutorials for beginners and experts.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20191226 10 Linux command tutorials for beginners and experts.md diff --git a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md new file mode 100644 index 0000000000..3172f26ea1 --- /dev/null +++ b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Linux command tutorials for beginners and experts) +[#]: via: (https://opensource.com/article/19/12/linux-commands) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +10 Linux command tutorials for beginners and experts +====== +Learn how to make Linux do what you need it to do in Opensource.com's +top 10 articles about Linux commands from 2019. +![Penguin driving a car with a yellow background][1] + +Using Linux _well_ means understanding what commands are available and what they're capable of doing for you. We have covered a lot of them on Opensource.com during 2019, and here are 10 favorites from the bunch. + +### Using the force at the Linux command line + +The Force has a light side and a dark side. Properly understanding that is crucial to true mastery. In his article [_Using the force at the Linux command line_][2], Alan Formy-Duval explains the **-f** option (also known as **\--force**) for several popular and sometimes dangerous commands. + +### Intro to the Linux useradd command + +Sharing accounts is a bad idea. Instead, give separate accounts to different people (and even different roles) with the quintessential **useradd** command. Part of his venerable series on basic Linux administration, Alan Formy-Duval provides an [_Intro to the Linux useradd command_][3], and, as usual, he explains it in _plain English_ so that both new and experienced admins can understand it. + +### Linux commands to display your hardware information + +What's _inside_ the box? Sometimes it's useful to inspect your hardware without using a screwdriver. In [_Linux commands to display your hardware information_][4], Howard Fosdick provides both popular and obscure commands to help you dig deep into the computer you're using, the computer you're testing at the store before buying, or the computer you're trying to repair. + +### How to encrypt files with gocryptfs on Linux + +Our files hold lots of private data, from social security numbers to personal letters to loved ones. In [_How to encrypt files with gocryptfs on Linux_][5], Brian "Bex" Exelbierd explains how to keep *private *what's meant to be private. As a bonus, he demonstrates encrypting files in a way that has little to no impact on your existing workflow. This isn't a complex PGP-style puzzle of key management and background key agents; this is quick, seamless, and secure file encryption. + +### How to use advanced rsync for large Linux backups + +In the New Year, many people will resolve to be more diligent about making backups. Alan Formy-Duval must have made that resolution years ago, because in [_How to use advanced rsync for large Linux backups_][6], he displays remarkable familiarity with the file synchronization command. You might not remember all the syntax right away, but the idea is to read and process the options, construct your backup command, and then automate it. That's the smart way to use **rsync**, and it's the _only_ way to do backups reliably. + +### Using more to view text files at the Linux command line + +In Scott Nesbitt's article [_Using more to view text files at the Linux command line_][7], the good old default pager **more** finally gets the spotlight. Many people install and use **less**, because it's more flexible than **more**. However, with more and more systems being implemented in the sparsest of containers, the luxury of fancy new tools like **less** or **most** sometimes just doesn't exist. Knowing and using **more** is simple, it's a common default, and it's the production system's debugging tool of last resort. + +### What you probably didn't know about sudo + +The **sudo** command is famous to a fault. People know the **sudo** term, and most of us believe we know what it does. And we're a little bit correct, but as Peter Czanik reveals in his article [_What you probably didn't know about sudo_][8], there's a lot more to the command than just "Simon says." Like that classic childhood game, the **sudo** command is powerful and also prone to silly mistakes—only with greater potential for horrible consequences. This is one game you do not want to lose! + +### How to program with Bash: Syntax and tools + +If you're a Linux, BSD, or Mac (and lately, Windows) user, you may have used the Bash shell interactively. It's a great shell for quick, one-off commands, which is why so many Linux users love to use it as their primary user interface. However, Bash is much more than just a command prompt. It's also a programming language, and if you're already using Bash commands, then the path to automation has never been more straightforward. Learn all about it in David Both's excellent [_How to program with Bash: Syntax and tools_][9]. + +### Master the Linux ls command + +The **ls** command is one of those commands that merits a two-letter name; one-letter commands are an optimization for slow terminals where each letter causes a significant delay and also a nice bonus for lazy typists. Seth Kenlon explains how you can [_Master the Linux ls command_][10] and he does so with his usual clarity and pragmatism. Most significantly, in a system where "everything is a file," being able to list the files is crucial. + +### Getting started with the Linux cat command + +The **cat** command (short for con_cat_enate) is deceptively simple. Whether you use it to quickly see the contents of a file or to pipe the contents to another command, you may not be using **cat** to its full potential. Alan Formy-Duval's elucidating [_Getting started with the Linux cat command_][11] offers new ideas to take advantage of a command that lets you open a file without feeling like you've opened it. As a bonus, learn all about **zcat** so you can decompress files without all the trouble of decompression! It's a small and simple thing, but _this_ is what makes Linux great. + +### Continue the journey + +Don't let Opensource.com's 10 best articles about Linux commands of 2019 be the end of your journey. There's much more to discover about Linux and its versatile prompt, so stay tuned in 2020 for more insights. And, if there's a Linux command you want us to know about, please tell us about it in the comments, or share your knowledge with Opensource.com readers by [submitting an article][12] about your favorite Linux command. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-commands + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://opensource.com/article/19/5/may-the-force-linux +[3]: https://opensource.com/article/19/10/linux-useradd-command +[4]: https://opensource.com/article/19/9/linux-commands-hardware-information +[5]: https://opensource.com/article/19/8/how-encrypt-files-gocryptfs +[6]: https://opensource.com/article/19/5/advanced-rsync +[7]: https://opensource.com/article/19/1/more-text-files-linux +[8]: https://opensource.com/article/19/10/know-about-sudo +[9]: https://opensource.com/article/19/10/programming-bash-syntax-tools +[10]: https://opensource.com/article/19/7/master-ls-command +[11]: https://opensource.com/article/19/2/getting-started-cat-command +[12]: https://opensource.com/how-submit-article From be9e44f95cd8a5987439fef193ae223248dbd537 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 27 Dec 2019 00:54:22 +0800 Subject: [PATCH 280/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191226=2010=20a?= =?UTF-8?q?rticles=20to=20become=20more=20data=20science=20savvy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191226 10 articles to become more data science savvy.md --- ...icles to become more data science savvy.md | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 sources/tech/20191226 10 articles to become more data science savvy.md diff --git a/sources/tech/20191226 10 articles to become more data science savvy.md b/sources/tech/20191226 10 articles to become more data science savvy.md new file mode 100644 index 0000000000..f334c7451a --- /dev/null +++ b/sources/tech/20191226 10 articles to become more data science savvy.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 articles to become more data science savvy) +[#]: via: (https://opensource.com/article/19/12/data-science-resources) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +10 articles to become more data science savvy +====== +Boost your data science game in 2020 with Opensource.com's top 10 +most-read articles on the topic from 2019. +![Open data brain][1] + +When LinkedIn released its third annual [Emerging Jobs report][2], engineers everywhere said, "Amen." More than half the list consists of engineering roles, with new fields like robotics appearing for the first time. + +But data science had a strong showing as well. The role shows 37% annual growth, topping that aspect of the Emerging Jobs list for the third year in a row. + +Looking at the core skills a data scientist needs—including R, Python, and Apache Spark—it's easy to find overlaps with open source. So, we're not surprised that data science was one of the most popular topics at Opensource.com in 2019. + +We saw a need for knowledge about diverse data science topics. And our community of authors delivered answers. + +For your reading pleasure, we've listed the top 10 data science articles of 2019. We define "top" as the data science articles that were published in 2019 and earned the most page views, starting with the most popular. + +Whether you want to use Kubernetes for batch jobs or query 10 years' worth of GitHub data, these articles will boost your data science game in 2020. + +### Why data scientists love Kubernetes + +Kubernetes is having more than a moment. That's due in no small part to its versatility. You might already know that Kubernetes helps software developers and system operators deploy applications in Linux containers. But did you know how helpful it can be for data science as well? + +In [_Why data scientists love Kubernetes_][3], our most popular data science article in 2019, William Benton and Sophie Watson share how Kubernetes supports the data science workflow. From repeatable batch jobs to debugging ML models, this article shares several ways for data scientists to leverage Kubernetes. + +### How to use Spark SQL: A hands-on tutorial + +Wondering how to use a cloud service for big data analytics? [_How to use Spark SQL: A hands-on tutorial_][4] uses Spark DataFrames to show how to use relational databases at scale. DJ Sarkar uses a real-world dataset to walk readers through the process of using Spark SQL. + +Rich with screenshots and code, Sarkar's tutorial is the ideal sequel to [his first piece][5] on this subject. He shares several ways that you can use Spark to manage structured data obtained from flat files or databases. + +### 9 resources for data science projects + +The growth of data science in open source—from machine learning to neural networks—has left many engineers wanting to learn more. In [_9 resources for data science projects_][6], Dan Barker shares the books, tools, and online courses he thinks are a must for any engineer who wants to get started. + +Barker is especially keen on Cathy O'Neil's book [_Weapons of Math Destruction_][7], which shares how bias creeps into data and how you can stop it. He also shares a range of websites for newbies to explore. + +### Getting started with data science using Python + +Alongside the rise of data science techniques, Python has seen a meteoric rise. It's now one of the most popular programming languages. When used with libraries like pandas and Seaborn, Python is an ideal entry to data science. + +In [_Getting started with data science using Python_][8], a follow-up to his [intro to Python][9] article, Seth Kenlon shares how to create a Python virtual environment; install pandas and NumPy; create a sample dataset; and much more. This article is an especially good read if you want to learn more about data visualization. + +### How to analyze log data with Python and Apache Spark + +Like many articles in our top 10 list, [_How to analyze log data with Python and Apache Spark_][10] is a sequel to [an earlier article][11] on using Python and Apache Spark to wrangle data. Once you've learned how to put your data into a clean, structured format, DJ Sarkar offers this piece to help you analyze that data. + +Whether you want to see the top 10 error endpoints or content size statistics, Sarkar shows you how to analyze several types of log data in your [DataFrame][12]. The data that he uses isn't "big data" from a size or volume standpoint. But these techniques can scale for use with larger datasets. + +### How to wrangle log data with Python and Apache Spark + +[_How to wrangle log data with Python and Apache Spark_][11], DJ Sarkar's prequel to his piece on analyzing log data, also made our top 10 list. It's no surprise since most organizations use a range of systems and infrastructure that run constantly. Data logs are an ideal way to make sure that everything keeps working effectively. + +In this tutorial, Sarkar shows how to use Apache Spark on real-world production logs from NASA. He walks through the process of using Spark to do log analytics at scale on semi-structured log data. This ranges from setting up dependencies to data wrangling. + +### Querying 10 years of GitHub data with GHTorrent and Libraries.io + +Did you know that you can use Kibana or the Elasticsearch API to turn Amazon S3 object-storage data into a searchable Elasticsearch-type cluster? Likewise, did you know about the project that aims to build an offline version of all data available through GitHub APIs? + +In [_Querying 10 years of GitHub data with GHTorrent and Libraries.io_][13], Pete Cheslock explores how to access and query GHTorrent data. You can do it using several formats, including CSV and Google Big Query. Cheslock uses the latter to search indexed GHTorrent data to learn which software languages, licenses, and rates of growth are most popular for GitHub projects. + +### Predicting NFL play outcomes with Python and data science + +Want to increase your machine learning skills in Python? With the NFL playoff season upon us, it's a great time to read [_Predicting NFL play outcomes with Python and data science_][14], which shares some data science tips to predict plays. + +Christa Hayes shows how to spot weird values, predict downs and play types, make regression plots, and train models. Once you've read her article on [how to format data for training][15], this one is the ideal next step. + +### Analyzing the Stack Overflow Survey with Python and Pandas + +Stack Overflow's annual developer survey is a tech behemoth. Nearly 90,000 developers took this year's 20-minute survey and left a lot of data in their wake. + +To find certain results, Moshe Zadka used the pandas library to search the survey's [anonymized results][16]. If you want to filter Stack Overflow's dataset for certain details (like seeing how many developers use certain languages or contribute to open source projects), Moshe's [_Analyzing the Stack Overflow Survey with Python and Pandas_][17] tutorial shows you how. + +### 4 Python tools for getting started with astronomy + +For readers with their heads in the clouds, NumFOCUS republished some of its blog posts on Opensource.com this year. In [_4 Python tools for getting started with astronomy_][18], Dr. Gina Helfrich shares how you can get involved in astronomy. + +Intimidated? Don't be: Dr. Helfrich says Python packages are so advanced that building data-reduction scripts is much easier than ever before. If you want to play with astronomy imaging datasets, this piece will steer you in the right direction. + +### What do you want to know about data science? + +Data science is an exciting field with countless things to explore. If there's something you want to know about data science, please tell us about it in the comments so we can try to cover it in 2020. Or, if you are so inclined, please share your knowledge with Opensource.com readers by [submitting an article][19] about your favorite data science topic. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/data-science-resources + +作者:[Lauren Maffeo][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lmaffeo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opendata_0613mm.png?itok=UIjD_jhK (Open data brain) +[2]: https://business.linkedin.com/content/dam/me/business/en-us/talent-solutions/emerging-jobs-report/Emerging_Jobs_Report_U.S._FINAL.pdf +[3]: https://opensource.com/article/19/1/why-data-scientists-love-kubernetes +[4]: https://opensource.com/article/19/3/apache-spark-and-dataframes-tutorial +[5]: https://opensource.com/article/19/3/sql-scale-apache-spark-sql-and-dataframes +[6]: https://opensource.com/article/19/2/learn-data-science-ai +[7]: https://www.amazon.com/Weapons-Math-Destruction-Increases-Inequality/dp/0553418815 +[8]: https://opensource.com/article/19/9/get-started-data-science-python +[9]: https://opensource.com/article/17/10/python-101 +[10]: https://opensource.com/article/19/5/visualize-log-data-apache-spark +[11]: https://opensource.com/article/19/5/log-data-apache-spark +[12]: https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#dataframe +[13]: https://opensource.com/article/19/5/chaossearch-github-ghtorrent +[14]: https://opensource.com/article/19/10/predicting-nfl-plays-python +[15]: https://opensource.com/article/19/10/formatting-nfl-data-python +[16]: https://insights.stackoverflow.com/survey +[17]: https://opensource.com/article/19/9/stack-overflow-survey-python-pandas +[18]: https://opensource.com/article/19/10/python-astronomy-open-data +[19]: https://opensource.com/how-submit-article From 2b8c1ceb5580b22ea1b7e76760d4efd87a7e3aa3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 27 Dec 2019 00:54:53 +0800 Subject: [PATCH 281/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191226=20How=20?= =?UTF-8?q?the=20Zen=20of=20Python=20handles=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191226 How the Zen of Python handles errors.md --- ...26 How the Zen of Python handles errors.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sources/tech/20191226 How the Zen of Python handles errors.md diff --git a/sources/tech/20191226 How the Zen of Python handles errors.md b/sources/tech/20191226 How the Zen of Python handles errors.md new file mode 100644 index 0000000000..030c889db3 --- /dev/null +++ b/sources/tech/20191226 How the Zen of Python handles errors.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How the Zen of Python handles errors) +[#]: via: (https://opensource.com/article/19/12/zen-python-errors) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +How the Zen of Python handles errors +====== +This is part of a special series about the Zen of Python focusing on the +10th and 11th principles: on the silence (or not) of errors. +![a checklist for a team][1] + +Handling "exceptional conditions" is one of the most debated issues in programming. That could be because the stakes are high: mishandled error values can bring down even the largest systems. Since "exception conditions," by nature, are the least tested but occur with unpleasant frequency, correctly handling them can often distinguish a system that horror stories are told about to a system that "just works." + +From Java's **checked** exceptions through Erlang's fault isolation to Haskell's **Maybe**, different languages have remarkably different attitudes to error handling. + +The [Zen][2] offers Python's meditation on the topic. + +### Errors should never pass silently… + +Before the Zen of Python was a twinkle in Tim Peters' eye, before Wikipedia became informally known as "wiki," the first WikiWiki site, [C2][3], existed as a trove of programming guidelines. These are principles that mostly came out of a [Smalltalk][4] programming community. Smalltalk's ideas influenced many object-oriented languages, Python included. + +The C2 wiki defines the Samurai Principle: "return victorious, or not at all." In Pythonic terms, it encourages eschewing sentinel values, such as returning **None** or **-1** to indicate an inability to complete the task, in favor of raising exceptions. A **None** is silent: it looks like a value and can be put in a variable and passed around. Sometimes, it is even a _valid_ return value. + +The principle here is that if a function cannot accomplish its contract, it should "fail loudly": raise an exception. The raised exception will never look like a possible value. It will skip past the **returned_value = call_to_function(parameter)** line and go up the stack, potentially crashing the program. + +A crash is straightforward to debug: there is a stack trace indicating the problem as well as the call stack. The failure might mean that a necessary condition for the program was not met, and human intervention is needed. It might mean that the program's logic is faulty. In either case, the loud failure is better than a hidden, "missing" value, infecting the program's valid data with **None**, until it is used somewhere and an error message says "**None does not have method split**," which you probably already knew. + +### Unless explicitly silenced. + +Exceptions sometimes need to be explicitly caught. We might anticipate some of the lines in a file are misformatted and want to handle those in a special way, maybe by putting them in a "lines to be looked at by a human" file, instead of crashing the entire program. + +Python allows us to catch exceptions with **except**. This means errors can be _explicitly_ silenced. This explicitness means that the **except** line is visible in code reviews. It makes sense to question why this is the right place to silence, and potentially recover from, the exception. It makes sense to ask if we are catching too many exceptions or too few. + +Because this is all explicit, it is possible for someone to read the code and understand which exceptional conditions are recoverable. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-errors + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://www.python.org/dev/peps/pep-0020/ +[3]: https://wiki.c2.com/ +[4]: https://en.wikipedia.org/wiki/Smalltalk From ee42fcddaae55a618fb08dc32f32b22b06b79ec0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 27 Dec 2019 00:55:16 +0800 Subject: [PATCH 282/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191226=20Top=20?= =?UTF-8?q?10=20Raspberry=20Pi=20articles=20of=202019?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191226 Top 10 Raspberry Pi articles of 2019.md --- ...26 Top 10 Raspberry Pi articles of 2019.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20191226 Top 10 Raspberry Pi articles of 2019.md diff --git a/sources/tech/20191226 Top 10 Raspberry Pi articles of 2019.md b/sources/tech/20191226 Top 10 Raspberry Pi articles of 2019.md new file mode 100644 index 0000000000..e4fae2c6ca --- /dev/null +++ b/sources/tech/20191226 Top 10 Raspberry Pi articles of 2019.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 10 Raspberry Pi articles of 2019) +[#]: via: (https://opensource.com/article/19/12/raspberry-pi-2019) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +Top 10 Raspberry Pi articles of 2019 +====== +Take a look back at the year in Raspberry Pi and get excited for what's +to come in 2020. +![Raspberries with pi symbol overlay][1] + +Since its introduction, the Raspberry Pi has been one of the hottest topics on Opensource.com. This trend continued in 2019 with an impressive list of over 30 articles about various Raspberry Pi projects. The top 10 articles are covered below, but if you are a true Raspberry Pi aficionado, I encourage you to check out out our entire selection of [Raspberry Pi articles][2]. + + 1. _[Turn a Raspberry Pi 3B+ into a PriTunl VPN][3]_ by Stephen Bancroft demonstrates how to set up a PriTunl virtual private networking (VPN) on a Raspberry Pi 3B+. There are several sticky points about the process that Bancroft helpfully and clearly explains. Following his instructions, you can easily turn a Raspberry Pi into a VPN server. + + 2. In _[Let’s get physical: How to use GPIO pins on the Raspberry Pi][4]_, Anderson Silva provides a brief introduction to using the GPIO pins on a Raspberry Pi. The article is full of links to other resources, including some of Silva’s other pieces, for those who want to dig deeper into the topic. + + 3. Sam Bocetta’s article _[How to use your Raspberry Pi as a VPN server][5]_, demonstrates how to install and configure PiVPN on a Raspberry Pi to create a VPN server. The article covers every aspect of the installation and configuration process, so if the reader has followed all the instructions provided, they will end up with their own Raspberry Pi-powered VPN. + + 4. _[Program the real world using Rust on Raspberry Pi][6]_ by Rahul Thakoor explores how to use the Rust programming language on the Raspberry Pi. By adding **rust_gpiozero** to a Rust project, it is possible to write code in Rust that can interact with buttons, servos, and other hardware connected to a Raspberry Pi. This article shows you how to get started. + + 5. Ben Nuttall, Raspberry Pi community manager, proclaims _[Raspberry Pi 4 is here!][7]_ in this article covering the release of the Raspberry Pi 4. The Raspberry Pi 4 features many improvements over previous Raspberry Pi models, and Nuttall walks through them in detail. From the new hardware features to the software updates in the updated release of Raspbian, this article brings you up to speed on what the Raspberry Pi 4 brings to the Raspberry Pi ecosystem. + + 6. _[How to build a WiFi picture frame with a Raspberry Pi][8]_ by Manuel Dewald shows you how to create a WiFi-connected digital picture frame using a Raspberry Pi 3. This step-by-step tutorial provides all the instructions needed to configure the software, but if you want to make a fancy case for your digital picture frame, that part is up to you. + + 7. Anderson Silva’s _[How to boot up a new Raspberry Pi][9]_ explains what you need to do to boot an operating system on a Raspberry Pi. This article primarily provides an overview of NOOBS (New Out Of Box Software) and contains links to the official Raspberry Pi website for the most up-to-date installation instructions. + + 8. _[How to build a mobile particulate matter sensor with a Raspberry Pi][10]_ by Stephan Tetzel illustrates how to build a sensor that can monitor your air quality using a Raspberry Pi, a small LCD display, and an inexpensive sensor. The particulate matter sensor you create can be used anywhere when paired with a power bank. + + 9. _[3 popular programming languages you can learn with Raspberry Pi][11]_ by Anderson Silva looks at programming Python, Java, and JavaScript on the Raspberry Pi. The Thonny IDE for Python and the BlueJ IDE for Java are briefly covered. The article also encourages users who are interested in other programming languages with the assurance that "there’s a high likelihood that you can use your Raspberry Pi to compile or interpret any language of choice, including C, C++, PHP, and Ruby." + + 10. Take a trip down memory lane by _[Resurrecting the Amiga on the Raspberry Pi][12]_ with this guide by Sarah Thornton. Using the instructions provided, you can experience the Amiga again on a Raspberry Pi or several other devices. Thornton even provides a helpful set of links for those interested in learning more about the history of the Amiga. + + + + +I hope these articles encourage you to explore the possibilities of the Raspberry Pi. Maybe they have even inspired you to [share your own Raspberry Pi story][13] with us? Your story could end up on this list next year! + +In this month's Raspberry Pi column, Ben Nuttall introduces readers to five projects that you might... + +Owning a little cloud has a lot of benefits and can save you over $100 per month. In this step-by-... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/raspberry-pi-2019 + +作者:[Joshua Allen Holm][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) +[2]: https://opensource.com/tags/raspberry-pi +[3]: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi +[4]: https://opensource.com/article/19/3/gpio-pins-raspberry-pi +[5]: https://opensource.com/article/19/6/raspberry-pi-vpn-server +[6]: https://opensource.com/article/19/3/physical-computing-rust-raspberry-pi +[7]: https://opensource.com/article/19/6/raspberry-pi-4 +[8]: https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi +[9]: https://opensource.com/article/19/3/how-boot-new-raspberry-pi +[10]: https://opensource.com/article/19/3/mobile-particulate-matter-sensor +[11]: https://opensource.com/article/19/3/programming-languages-raspberry-pi +[12]: https://opensource.com/article/19/3/amiga-raspberry-pi +[13]: https://opensource.com/how-submit-article From f670913b2bd66a2321d0e05bdd98c450015714c9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 27 Dec 2019 08:59:20 +0800 Subject: [PATCH 283/676] translated --- ...e the Herbstluftwm Linux window manager.md | 105 ------------------ ...e the Herbstluftwm Linux window manager.md | 104 +++++++++++++++++ 2 files changed, 104 insertions(+), 105 deletions(-) delete mode 100644 sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md create mode 100644 translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md diff --git a/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md deleted file mode 100644 index 47218849e3..0000000000 --- a/sources/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md +++ /dev/null @@ -1,105 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why Vim fans love the Herbstluftwm Linux window manager) -[#]: via: (https://opensource.com/article/19/12/herbstluftwm-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Why Vim fans love the Herbstluftwm Linux window manager -====== -This article is part of a special series of 24 days of Linux desktops. -If you're a Vim fan, check out herbstluftwm, a tile-based Linux window -manager that takes the "Vim way" as inspiration. -![OpenStack source code \(Python\) in VIM][1] - -Everybody loves Vim (aside from Dvorak and Emacs users). Vim is so popular that there are entire web browsers dedicated to navigating the web with Vim keybindings, a Vim mode in the wildly popular [Zsh][2] terminal emulator, and even a text editor. There's also a window manager called [herbstluftwm][3] that models itself partly after the "Vim way." Herbstluftwm does away with windows, as such, and replaces them with tiles, or quadrants, into which applications are loaded and used. You use the keyboard (**Alt+h**, **Alt+j**, **Alt+k**, and **Alt+l**) to navigate from one tile to another. - -![Herbstluftwm][4] - -Install herbstluftwm from your distribution's software repository. After installing it, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -With GDM: - -![][5] - -With SDDM: - -![][6] - -### Herbstluftwm desktop tour - -The first time you log into herbstluftwm, you are greeted with nothing but a green screen with a darker green border around the edges. What you're seeing is the initial tile with no application loaded into it. To start the default application, xterm, press **Alt+Return**. - -The documentation emphasizes the **$HOME/.config/herbstluftwm/autostart** configuration file as a way to start important applications when you log in. For applications you don't necessarily want to start every time you log in, you can use xterm as your launch daemon. As usual, placing an ampersand (**&**) symbol after the command returns control of the shell to you. To start Emacs, for instance: - - -``` -`% emacs &` -``` - -This launches an Emacs window in a new tile and returns you to a prompt. - -![Emacs running in Herbstluftwm][7] - -#### Switching tiles - -To move from one tile to another, use the classic Vim navigation combination of **h**, **j**, **k**, or **l**, along with the **Alt** key. For example, to switch from the terminal to an application in a tile below it (i.e., at the bottom of the screen), press **Alt+j**. To navigate back up, **Alt+k**. Left and right navigations are **Alt+h** and **Alt+l**, respectively. - -#### Split screen - -You can manually split a screen vertically with **Alt+o** and horizontally with **Alt+u**. - -To remove an empty tile, navigate into it and press **Alt+r**. - -### Configuring herbstluftwm - -Aside from the **Alt** keybindings, you communicate with herbstluftwm through the **herbstclient** command. This command can be used interactively from a shell, or you can preserve your preferences in a configuration file. - -You can view all attributes available in Herbstluftwm with: - - -``` -`$ herbstclient attr` -``` - -Herbstluftwm's default behavior is defined in the default config file, which you can copy to your home directory and modify. Upon launch, herbstluftwm executes the commands contained in the config file. For instance, if you find it awkward to use keybindings centered around the **Alt** key, which is traditionally a key reserved for in-application shortcuts, you can change the key used to trigger herbstluftwm actions in the config file: - - -``` -% mkdir ~/.config/herbstluftwm -% cp /usr/xdg/herbstluftwm/autostart \ -~/.config/herbstluftwm -% sed -i 's/Mod=Mod1/Mod=Mod4/' ~/.config/herbstluftwm -% herbstclient reload -``` - -This changes the herbstluftwm modifier to the Super key (the "Windows" or "Tux" key, depending on your keyboard). - -Using the autostart file, you can set custom keybindings, create tags for applications of a specific type so you can tile applications in a consistent way, and do much more. - -### Why you need to try herbstluftwm - -Herbstluftwm is a fine example of a tiling window manager. It tiles windows by default and lets the user define exceptions to global rules. It uses Vim-like navigation but allows for quick and easy overrides. It's very likely the tiling manager you've been looking for, so try it soon. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/herbstluftwm-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM) -[2]: https://opensource.com/article/19/9/getting-started-zsh -[3]: https://herbstluftwm.org -[4]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm.png (Herbstluftwm) -[5]: https://opensource.com/sites/default/files/advent-gdm_1.jpg -[6]: https://opensource.com/sites/default/files/advent-kdm_0.jpg -[7]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm-emacs.jpg (Emacs running in Herbstluftwm) diff --git a/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md new file mode 100644 index 0000000000..cba33f5166 --- /dev/null +++ b/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why Vim fans love the Herbstluftwm Linux window manager) +[#]: via: (https://opensource.com/article/19/12/herbstluftwm-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +为什么 Vim 爱好者喜欢 Herbstluftwm Linux 窗口管理器 +====== +本文是 24 天 Linux 桌面特别系列的一部分。如果你是Vim爱好者,请试试 Herbstluftwm,这是一个受到 ”Vim 方式“启发的基于平铺的 Linux 窗口管理器。 +![OpenStack source code \(Python\) in VIM][1] + +每个人都喜欢 Vim(除了 Dvorak 和 Emacs 用户)。Vim 非常流行,以至于有整个 Web 浏览器都使用 Vim 键绑定来浏览网页,非常流行的 [Zsh][2] 终端仿真器中的 Vim 模式,甚至是文本编辑器。 还有一个名为 [herbstluftwm][3] 的窗口管理器,它部分模仿了 “Vim 方式”。Herbstluftwm 取消了窗口,在程序载入和使用时使用平铺或者象限代替。 你可以使用键盘(**Alt+h**、**Alt+j**、**Alt+k** 和 **Alt+l**)从一个平铺块移动到另一个平铺块。 + +![Herbstluftwm][4] + +从发行版软件仓库安装 Herbstluftwm。安装后,请退出当前桌面会话,以便可以登录到新会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,具体取决于你的设置)将继续登录到以前的桌面,因此在登录之前必须覆盖它。 + +在 GDM 中: + +![][5] + +在 SDDM 中: + +![][6] + +### Herbstluftwm 桌面之旅 + +第一次登录 Herbstluftwm 时,你只会看到绿屏,边缘有深绿色边框。你所看到的是初始平铺,其中没有加载任何应用程序。要启动默认应用,请按 **Alt+回车**。 + +文档中强调使用 **$HOME/.config/herbstluftwm/autostart** 作为登录时启动应用的配置文件。对于不必在每次登录时启动的应用,可以使用 xterm 作为启动守护进程。与往常一样,在命令将 shell 的控制权返回给你后加一个 **amp;** 符号。例如,要启动 Emacs: + + + +``` +`% emacs &` +``` + +这将在新平铺中启动 Emacs 窗口,然后返回命令行。 + +![Emacs running in Herbstluftwm][7] + +#### 切换平铺 + +要从一个平铺块移动到另一个平铺块,请使用经典的 **h**、**j**、**k** 或 **l** 与 **Alt** 的 Vim 导航组合键。例如,要从终端切换到其下方平铺中的应用(即屏幕底部),请按 **Alt+j**。要返回,请按 **Alt+k**。左移和右移分别为 **Alt+h** 和 **Alt+l**。 + +#### 分割屏幕 + +你可以使用 **Alt+o** 垂直分割屏幕,使用 **Alt+u** 水平分割屏幕。 + +要删除空白平铺块,请移动到该平铺块,然后按 **Alt+r**。 + +### 配置 herbstluftwm + +除了 **Alt** 键绑定外,你还可通过 **herbstclient** 命令与 Herbstluftwm 进行通信。此命令可以在 shell 中交互,或者你可在配置文件中保留你的首选项。 + +你可以查看 Herbstluftwm 中的所有可用属性: + + +``` +`$ herbstclient attr` +``` + +Herbstluftwm 的默认行为在默认配置文件中定义,你可以将其复制到家目录并进行修改。启动后,Herbstluftwm 执行配置文件中包含的命令。例如,你觉得使用以 **Alt** 为中心的键绑定很笨拙(它传统上是应用内保留快捷键),那你可以在配置文件中更改触发 Herbstluftwm 操作的键: + + +``` +% mkdir ~/.config/herbstluftwm +% cp /usr/xdg/herbstluftwm/autostart \ +~/.config/herbstluftwm +% sed -i 's/Mod=Mod1/Mod=Mod4/' ~/.config/herbstluftwm +% herbstclient reload +``` + +这将使 Herbstluftwm 的修饰键更改为 Super 键(”Windows“或 ”Tux“ 键,具体取决于你的键盘)。 + +使用自动启动文件,你可以设置自定义键绑定,为特定类型的应用创建标签,以便以一致的方式平铺应用,并执行更多操作。 + +### 为何你要尝试 herbstluftwm + +Herbstluftwm 是一个平铺窗口管理器的很好例子。它默认平铺窗口,并允许用户定义全局规则例外。它使用类似 Vim 的导航,但可以快速简单地覆盖它。你可能是你一直在寻找的平铺管理器,所以请尽快尝试一下。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/herbstluftwm-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM) +[2]: https://opensource.com/article/19/9/getting-started-zsh +[3]: https://herbstluftwm.org +[4]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm.png (Herbstluftwm) +[5]: https://opensource.com/sites/default/files/advent-gdm_1.jpg +[6]: https://opensource.com/sites/default/files/advent-kdm_0.jpg +[7]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm-emacs.jpg (Emacs running in Herbstluftwm) From a56735ab7fc615b569b1b29f8c8a01fc79f50bb7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 27 Dec 2019 09:07:03 +0800 Subject: [PATCH 284/676] translating --- ...1224 Chill out with the Linux Equinox Desktop Environment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md index 3d207d33cb..59abeb92b8 100644 --- a/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md +++ b/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 08e116279ad8ea586fd44e6564dcf06679f4cec9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 27 Dec 2019 09:17:01 +0800 Subject: [PATCH 285/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @HankChow 翻译的很好! --- ...code needs to be beautiful and explicit.md | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md b/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md index ae5568bd13..747efed262 100644 --- a/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md +++ b/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Why your Python code needs to be beautiful and explicit) @@ -9,18 +9,22 @@ 为什么 Python 代码要写得美观而明确 ====== -欢迎阅读“Python 光明节(Pythonukkah)”系列文章,这个系列文章将会讨论《Python 之禅》。我们首先来看《Python 之禅》里的前两个原则:美观与明确。 -![Searching for code][1] -早在 1999 年,Python 的贡献者之一,Tim Peters 就提出了《[Python 之禅][2]》,直到二十年后的今天,《Python 之禅》中的 19 条原则仍然对整个社区都产生着深远的影响。为此,我们举行了这一次的“Python 光明节”。首先,我们会讨论《Python 之禅》中的前两个原则:美观和明确。 +> 欢迎阅读“Python 光明节(Pythonukkah)”系列文章,这个系列文章将会讨论《Python 之禅》。我们首先来看《Python 之禅》里的前两个原则:美观与明确。 -> "Hanukkah is the Festival of Lights, -> Instead of one day of presents, we get eight crazy nights." -> —亚当·桑德勒, [光明节之歌][3] +![](https://img.linux.net.cn/data/attachment/album/201912/27/091634drq96c2fojzp6okr.png) + +早在 1999 年,Python 的贡献者之一,Tim Peters 就提出了《[Python 之禅][2]》,直到二十年后的今天,《Python 之禅》中的 19 条原则仍然对整个社区都产生着深远的影响。为此,就像庆典光明的光明节Hanukkah一样,我们举行了这一次的“Python 光明节Pythonukkah”。首先,我们会讨论《Python 之禅》中的前两个原则:美观和明确。 + +> “Hanukkah is the Festival of Lights, +> +> Instead of one day of presents, we get eight crazy nights.” +> +> —亚当·桑德勒,[光明节之歌][3] ### 美观胜于丑陋 -著名的《[计算机程序的构造和解释Structure and Interpretation of Computer Programs][4]》中有这么一句话:代码是写给人看的,只是恰好能让机器运行(Programs must be written for people to read and only incidentally for machines to execute.)。毕竟机器并不在乎代码的美观性,但人类在乎。 +著名的《[计算机程序的构造和解释Structure and Interpretation of Computer Programs][4]》中有这么一句话:代码是写给人看的,只是恰好能让机器运行。Programs must be written for people to read and only incidentally for machines to execute.机器并不在乎代码的美观性,但人类在乎。 阅读美观的代码对人们来说是一种享受,这就要求在整套代码中保持一致的风格。使用诸如 [Black][5]、[flake8][6]、[Pylint][7] 这一类工具能够有效地接近这一个目标。 @@ -28,7 +32,7 @@ 最后,个人的主观能动性也很重要,否则一切工具和流程都会变得毫无意义。只有意识到美观的重要性,才能主动编写出美观的代码。 -这就是为什么美观在众多原则当中排到了首位,它让“美”成为了 Python 社区的一种价值。如果有人要问,”我们真的在乎美吗?“社区会以代码给出肯定的答案。 +这就是为什么美观在众多原则当中排到了首位,它让“美”成为了 Python 社区的一种价值。如果有人要问,”我们*真的*在乎美吗?“社区会以代码给出肯定的答案。 ### 明确胜于隐晦 @@ -38,7 +42,7 @@ 这个问题已经是老生常谈了,但网络上很多流传已久的回答都是不准确的。在编写元类metaclass时,显式指定 `self` 参数就显得毫无意义。如果你没有编写过元类,希望你可以尝试一下,这是很多 Python 程序员的必经之路。 -显式指定 `self` 参数的原因并不是 Python 的设计者不想将这样的元类视为“默认”元类,而是因为第一个参数必须是显式的。 +显式指定 `self` 参数的原因并不是 Python 的设计者不想将这样的元类视为“默认”元类,而是因为第一个参数必须是*显式*的。 即使 Python 中确实允许非显式的情况存在(例如上下文变量),但我们还是应该提出疑问:某个东西是不是有存在的必要呢?如果非显式地传递参数会不会出现问题呢?有些时候,由于种种原因,这是会有问题的。总之,在写代码时一旦能够优先考虑到明确性,至少意味着能对不明确的地方提出疑问并对结果作出有效的估计。 @@ -49,7 +53,7 @@ via: https://opensource.com/article/19/12/zen-python-beauty-clarity 作者:[Moshe Zadka][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9204628ecff08e4cf2ebbf27887cbe9765a54c13 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 27 Dec 2019 09:17:39 +0800 Subject: [PATCH 286/676] PUB @HankChow https://linux.cn/article-11718-1.html --- ...Why your Python code needs to be beautiful and explicit.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191222 Why your Python code needs to be beautiful and explicit.md (98%) diff --git a/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md b/published/20191222 Why your Python code needs to be beautiful and explicit.md similarity index 98% rename from translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md rename to published/20191222 Why your Python code needs to be beautiful and explicit.md index 747efed262..4afb58bbb0 100644 --- a/translated/tech/20191222 Why your Python code needs to be beautiful and explicit.md +++ b/published/20191222 Why your Python code needs to be beautiful and explicit.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11718-1.html) [#]: subject: (Why your Python code needs to be beautiful and explicit) [#]: via: (https://opensource.com/article/19/12/zen-python-beauty-clarity) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 8078b8159cd372419ff1357dab343d59c2918782 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 27 Dec 2019 20:18:38 +0800 Subject: [PATCH 287/676] PRF @geekpi --- ...etro Apple desktop with the Linux MLVWM.md | 85 ++++++++----------- 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md b/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md index 6b43924213..70986e19af 100644 --- a/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md +++ b/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Build a retro Apple desktop with the Linux MLVWM) @@ -9,61 +9,56 @@ 使用 Linux MLVWM 打造复古苹果桌面 ====== -本文是 24 天 Linux 桌面特别系列的一部分。如果老式的苹果电脑用开源 POSIX 构建如何?你可以通过构建类 Macintosh 虚拟窗口管理器来实现。 + +> 本文是 24 天 Linux 桌面特别系列的一部分。如果老式的苹果电脑是用开源 POSIX 构建的呢?你可以通过构建 Macintosh 式的虚拟窗口管理器来实现。 + ![Person typing on a 1980's computer][1] -想象一下进入另外一个历史,Apple II GS 和 MacOS 7 是基于开源 [POSIX][2] 构建的,它使用了与现代 Linux 相同的所有约定,例如纯文本配置文件和模块化系统设计。这样的操作系统将为其用户带来什么?你可以使用[类 Macintosh 虚拟窗口管理器(MLVWM)][3]来回答这些问题(甚至更多!)。 +想象一下穿越到另一段平行历史,Apple II GS 和 MacOS 7 是基于开源 [POSIX][2] 构建的,它使用了与现代 Linux 相同的所有惯例,例如纯文本配置文件和模块化系统设计。这样的操作系统将为其用户带来什么?你可以使用 [Macintosh 式的虚拟窗口管理器(MLVWM)][3]来回答这些问题(甚至更多!)。 ![MLVWM running on Slackware 14.2][4] ### 安装 MLVWM -MLVWM 安装并不容易,并且可能不在发行版的软件仓库中。如果你有时间理解翻译不佳的 README 文件,编辑一些配置文件,收集并调整一些旧的 **.xpm**图像,编辑一两个 Xorg 选项,那么你就可以体验 MLVWM。否则,这是一个新奇的窗口管理器,其最新版本可以追溯到 2000 年。 - - -要编译 MLVWM,你必须安装 **imake**,它提供 **xmkmf** 命令。你可以从发行版的软件仓库中安装 imake,也可以直接从 [Freedesktop.org][5] 获得。假设你已经有 **xmkmf**命令,请进入包含 MLVWM 源码的目录,然后运行以下命令进行构建: +MLVWM 安装并不容易,并且可能不在你的发行版软件仓库中。如果你有时间理解翻译不佳的 README 文件,编辑一些配置文件,收集并调整一些旧的 .xpm 图片,编辑一两个 Xorg 选项,那么你就可以体验 MLVWM。不管怎么说,这是一个新奇的窗口管理器,其最新版本可以追溯到 2000 年。 +要编译 MLVWM,你必须安装 imake,它提供了 `xmkmf` 命令。你可以从发行版的软件仓库中安装 imake,也可以直接从 [Freedesktop.org][5] 获得。假设你已经有 `xmkmf` 命令,请进入包含 MLVWM 源码的目录,然后运行以下命令进行构建: ``` $ xmkmf -a $ make ``` -构建后,编译后的 **mlvwm** 二进制文件位于 **mlvwm** 目录中。将其移动到[你的 PATH ][6]的任何位置: - +构建后,编译后的 `mlvwm` 二进制文件位于 `mlvwm` 目录中。将其移动到[你的 PATH][6] 的任何位置: ``` -`$ mv mlvwm/mlvwm /usr/local/bin/` +$ mv mlvwm/mlvwm /usr/local/bin/ ``` #### 编辑配置文件 -现在已经安装 MLVWM,但是如果不调整几个配置文件并仔细排列所需的图像文件,它将无法正确启动。示例配置文件位于你下载的源代码的 **sample_rc** 目录中。将文件 **Mlvwm-Netscape** 和 **Mlvwm-Xterm** 复制到你的主目录: - +现在已经安装好 MLVWM,但是如果不调整几个配置文件并仔细放好所需的图像文件,它将无法正确启动。示例配置文件位于你下载的源代码的 `sample_rc` 目录中。将文件 `Mlvwm-Netscape` 和 `Mlvwm-Xterm` 复制到你的主目录: ``` -`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME` +$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME ``` -将 **Mlvwmrc** 移动到 **$HOME/.mlvwmrc**(是的,即使示例文件的名称看似是大写字母,但你也必须使用小写的 “m”): - +将 `Mlvwmrc` 改名为 `$HOME/.mlvwmrc`(是的,即使示例文件的名称看似是大写字母,但你也必须使用小写的 “m”): ``` -`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc` +$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc ``` -打开 **.mlwmrc** 并找到第 54-55 行,它们定义了 MLVWM 在菜单和 UI 中使用的像素图的路径(“IconPath”): - +打开 `.mlwmrc` 并找到第 54-55 行,它们定义了 MLVWM 在菜单和 UI 中使用的像素图的路径(`IconPath`): ``` # Set icon search path. It needs before "Style". IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap ``` -调整路径以匹配你填充图像的路径(我建议使用 **$HOME/.local/share/pixmaps**)。MLVWM 不提供像素图,因此需要你提供构建桌面所需图标。 - -即使你有位于系统其他位置的像素图(例如 **/usr/share/pixmaps**)),也要这样做,因为你需要调整像素图的大小,你可能也不想在系统范围内执行此操作。 +调整路径以匹配你填充图像的路径(我建议使用 `$HOME/.local/share/pixmaps`)。MLVWM 不提供像素图,因此需要你提供构建桌面所需图标。 +即使你有位于系统其他位置的像素图(例如 `/usr/share/pixmaps`),也要这样做,因为你需要调整像素图的大小,你可能也不想在系统范围内执行此操作。 ``` # Set icon search path. It needs before "Style". @@ -72,18 +67,17 @@ IconPath /home/seth/.local/share/pixmaps #### 选择像素图 -你已将 **.local/share/pixmaps** 目录定义为像素图源路径,但是该目录和图像均不存在。创建目录: - +你已将 `.local/share/pixmaps` 目录定义为像素图源路径,但是该目录和图像均不存在。创建目录: ``` -`$ mkdir -p $HOME/.local/share/pixmaps` +$ mkdir -p $HOME/.local/share/pixmaps ``` -现在,配置文件将图像分配给菜单项和 UI 元素,但是系统中不存在这些图像。要解决此问题,请通读配置文件并找到每个 **.xpm** 图像。对于配置中列出的每个图像,将具有相同文件名的图像(或更改配置文件中的文件名)添加到你的 IconPath 目录。 +现在,配置文件将图像分配给菜单项和 UI 元素,但是系统中不存在这些图像。要解决此问题,请通读配置文件并找到每个 .xpm 图像。对于配置中列出的每个图像,将具有相同文件名的图像(或更改配置文件中的文件名)添加到你的 IconPath 目录。 -**.mlvwmrc** 文件的注释很好,因此你可以大致了解要编辑的内容。无论如何,这只是第一步。你可以随时回来更改桌面外观。 +`.mlvwmrc` 文件的注释很好,因此你可以大致了解要编辑的内容。无论如何,这只是第一步。你可以随时回来更改桌面外观。 -这有些例子 +这有些例子。 此代码块设置屏幕左上角的图标: @@ -92,11 +86,10 @@ IconPath /home/seth/.local/share/pixmaps Menu Apple, Icon label1.xpm, Stick ``` -**label1.xpm** 图像实际上在源代码的 **pixmap**目录中,但我更喜欢使用来自 **/usr/share/pixmaps** 的 **Penguin.xpm**(在 Slackware 上)。无论使用什么,都必须将自定义像素图放在 **~/.local/share/pixmaps** 中,并在配置中更改像素图的名称,或者重命名像素图以匹配配置文件中当前的名称。 +`label1.xpm` 图像实际上在源代码的 `pixmap` 目录中,但我更喜欢使用来自 `/usr/share/pixmaps` 的 `Penguin.xpm`(在 Slackware 上)。无论使用什么,都必须将自定义像素图放在 `~/.local/share/pixmaps` 中,并在配置中更改像素图的名称,或者重命名像素图以匹配配置文件中当前的名称。 此代码块定义了左侧菜单中列出的应用: - ``` "About this Workstation..." NonSelect, Gray, Action About "" NonSelect @@ -106,24 +99,21 @@ Menu Apple, Icon label1.xpm, Stick END ``` -通过遵循与配置文件中相同的语法,你可以自定义像素图并将自己的应用添加到菜单中(例如,我将 **mule** 更改为 **emacs**)。 这是你在 MLVWM GUI 中打开应用的入口,因此请列出你要快速访问的所有内容。你可能还希望包括指向 **/usr/share/applications** 文件夹的快捷方式。 - +通过遵循与配置文件中相同的语法,你可以自定义像素图并将自己的应用添加到菜单中(例如,我将 `mule` 更改为 `emacs`)。这是你在 MLVWM GUI 中打开应用的入口,因此请列出你要快速访问的所有内容。你可能还希望包括指向 `/usr/share/applications` 文件夹的快捷方式。 ``` -`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications` +"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications ``` 完成编辑配置文件并将自己的图像添加到 IconPath 目录后,必须将所有像素图的大小都调整为大约 16x16 像素。(MLVWM 的默认设置不一致,因此存在变化空间。)你可以使用 ImageMagick 进行批量操作: - ``` -`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done` +$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done ``` ### 启动 MLVWM -最简单的运行 MLVWM 的方式是让 Xorg 完成大部分工作。首先,你必须创建一个 **$HOME/.xinitrc** 文件。我从 Slackware 复制了这个,它也是从 Xorg 来的: - +最简单的运行 MLVWM 的方式是让 Xorg 完成大部分工作。首先,你必须创建一个 `$HOME/.xinitrc` 文件。我从 Slackware 复制了这个,它也是从 Xorg 拿来的: ``` #!/bin/sh @@ -137,31 +127,30 @@ sysmodmap=/etc/X11/xinit/.Xmodmap # merge in defaults and keymaps if [ -f $sysresources ]; then -    xrdb -merge $sysresources + xrdb -merge $sysresources fi if [ -f $sysmodmap ]; then -    xmodmap $sysmodmap + xmodmap $sysmodmap fi if [ -f $userresources ]; then -    xrdb -merge $userresources + xrdb -merge $userresources fi if [ -f $usermodmap ]; then -    xmodmap $usermodmap + xmodmap $usermodmap fi # Start the window manager: if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then -  exec ck-launch-session /usr/local/bin/mlvwm + exec ck-launch-session /usr/local/bin/mlvwm else -  exec /usr/local/bin/mlvwm + exec /usr/local/bin/mlvwm fi ``` -根据此文件,**startx** 命令的默认操作是启动 MLVWM。但是,你的发行版可能对于图形服务器启动(或被终止重新启动)时会发生的情况有其他做法,因此此文件可能对你没有什么帮助。在许多发行版上,你可以添加 **.desktop** 文件到 **/usr/share/xsessions** 中,以将其列在 GDM 或 KDM 菜单中,因此创建名为 **mlvwm.desktop** 的文件并输入: - +根据此文件,`startx` 命令的默认操作是启动 MLVWM。但是,你的发行版可能对于图形服务器启动(或被终止以重新启动)时会发生的情况有其他做法,因此此文件可能对你没有什么帮助。在许多发行版上,你可以添加 .desktop 文件到 `/usr/share/xsessions` 中,以将其列在 GDM 或 KDM 菜单中,因此创建名为 `mlvwm.desktop` 的文件并输入: ``` [Desktop Entry] @@ -184,15 +173,15 @@ Type=Application #### 强制启动 -如果 MLVWM 无法启动,请尝试安装 XDM,这是一个轻量级会话管理器,它不会查询 **/usr/share/xsessions** 的内容,而是执行经过身份验证用户的所有 **.xinitrc** 操作。 +如果 MLVWM 无法启动,请尝试安装 XDM,这是一个轻量级会话管理器,它不会查询 `/usr/share/xsessions` 的内容,而是执行经过身份验证用户的所有 `.xinitrc` 操作。 ![MLVWM][9] ### 打造自己的复古苹果 -MLVWM 桌面未经打磨、不完美、准确且充满乐趣。你看到的许多菜单项都是未实现的,但你可以使它们变得活跃且有意义。 +MLVWM 桌面未经打磨、不完美、模仿到位且充满乐趣。你看到的许多菜单项都是未实现的,但你可以使它们变得活跃且有意义。 -这是一次让你时光倒流,改变历史,让老式苹果系列电脑成为开源堡垒的机会。成为一名修正主义者,设计你自己的复古苹果桌面,最重要的是,它有乐趣。 +这是一次让你时光倒流、改变历史,让老式苹果系列电脑成为开源堡垒的机会。成为一名修正主义者,设计你自己的复古苹果桌面,最重要的是,它有乐趣。 -------------------------------------------------------------------------------- @@ -201,7 +190,7 @@ via: https://opensource.com/article/19/12/linux-mlvwm-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 462dee3fec9108ee85ce219237721329c1c23f10 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 27 Dec 2019 20:50:28 +0800 Subject: [PATCH 288/676] PUB @geekpi https://linux.cn/article-11720-1.html --- ...191217 Build a retro Apple desktop with the Linux MLVWM.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191217 Build a retro Apple desktop with the Linux MLVWM.md (99%) diff --git a/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md b/published/20191217 Build a retro Apple desktop with the Linux MLVWM.md similarity index 99% rename from translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md rename to published/20191217 Build a retro Apple desktop with the Linux MLVWM.md index 70986e19af..6aee6a3fec 100644 --- a/translated/tech/20191217 Build a retro Apple desktop with the Linux MLVWM.md +++ b/published/20191217 Build a retro Apple desktop with the Linux MLVWM.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11720-1.html) [#]: subject: (Build a retro Apple desktop with the Linux MLVWM) [#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 8542d65d3312d0e4e3ccbfb52ea089295bf9e853 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 27 Dec 2019 21:42:58 +0800 Subject: [PATCH 289/676] PRF @chen-ni --- .../tech/20191218 How tracking pixels work.md | 67 ++++++++++++------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/translated/tech/20191218 How tracking pixels work.md b/translated/tech/20191218 How tracking pixels work.md index 9be6ed4049..4b8ba216c2 100644 --- a/translated/tech/20191218 How tracking pixels work.md +++ b/translated/tech/20191218 How tracking pixels work.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How tracking pixels work) [#]: via: (https://jvns.ca/blog/how-tracking-pixels-work/) [#]: author: (Julia Evans https://jvns.ca/) -追踪像素是如何工作的? +网络广告商的像素追踪是如何工作的? ====== -昨天,我和一名记者谈到了一个问题:广告商是如何在互联网上对人们进行追踪的?我们津津有味地查看了 Firefox 的开发者工具(虽然我不是一个互联网隐私专家,但至少还会使用开发者工具中的“network”标签页),从中我终于弄明白追踪像素在实际中是如何工作的了。 +![](https://img.linux.net.cn/data/attachment/album/201912/27/214125hvpv4e5ijepa0aqj.jpg) + +昨天,我和一名记者谈到了一个问题:广告商是如何在互联网上对人们进行追踪的?我们津津有味地查看了 Firefox 的开发者工具(虽然我不是一个互联网隐私专家,但至少还会使用开发者工具中的“network”标签页),从中我终于弄明白像素追踪tracking pixels在实际中是如何工作的了。 ### 问题:Facebook 怎么知道你逛了 Old Navy? 我时常听人们说起这种有些诡异的上网经历:你在线上浏览了一个商品,一天之后,竟然看到了同一款靴子(或者是别的什么你当时浏览的商品)的广告。这就是所谓的“再营销”,但它到底是如何实现的呢? -在本文中,我们来进行一个小实验,看看 Facebook 究竟是怎么知道你在线上浏览了什么商品的。这里使用 Facebook 作为示例,只是因为很容易找到投放了 Facebook 追踪像素的网站;其实,几乎所有互联网广告公司都会使用类似的追踪技术。 +在本文中,我们来进行一个小实验,看看 Facebook 究竟是怎么知道你在线上浏览了什么商品的。这里使用 Facebook 作为示例,只是因为很容易找到使用了 Facebook 像素追踪技术的网站;其实,几乎所有互联网广告公司都会使用类似的追踪技术。 ### 准备:允许第三方追踪器,同时关闭广告拦截器 @@ -24,16 +26,20 @@ 首先,我将隐私设置从默认设置([截图][1])修改为允许第三方追踪器的个性化设置([截图][2]),然后禁用了一些平时运行的隐私保护扩展。 -### 追踪像素:关键不在于 gif,而在于请求参数 +![截图][1] -追踪像素是网站用来追踪你的一个 1x1 大小的 gif。就其本身而言,一个小小的 1x1 gif 显然起不到什么作用。那么,追踪像素到底是如何进行追踪的?其中涉及两个方面: +![截图][2] - 1. 通过使用追踪像素上的**请求参数**,网站可以添加额外的信息,比如你正在访问的页面。这样一来,请求的就不是 `https://www.facebook.com/tr/`(这个链接是一个 44 字节大小的 1x1 gif),而是 `https://www.facebook.com/tr/?the_website_you're_on`。(邮件营销人员会使用类似的技巧,通过为追踪像素指定一个独特的 URL,弄清楚你是否打开了某一封邮件。) - 2. 在发送该请求的同时,还发送了相应的 cookie。这样一来广告商就可以知道,访问 oldnavy.com 的这个人和在同一台电脑上使用 Facebook 的是同一个人。 +### 像素追踪:关键不在于 gif,而在于请求参数 -### Old Navy 网站上的 Facebook 追踪像素 +像素追踪是网站用来追踪你的一个 1x1 大小的 gif。就其本身而言,一个小小的 1x1 gif 显然起不到什么作用。那么,像素追踪到底是如何进行追踪的?其中涉及两个方面: -为了对此进行验证,我在 Old Navy(GAP 旗下的一个服装品牌)网站上浏览了一个商品,相应的URL是 [https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1][3](这是一件“男款短绒格子花呢大衣”)。 +1. 通过使用像素追踪上的**请求参数**,网站可以添加额外的信息,比如你正在访问的页面。这样一来,请求的就不是 `https://www.facebook.com/tr/`(这个链接是一个 44 字节大小的 1x1 gif),而是 `https://www.facebook.com/tr/?the_website_you're_on`。(邮件营销人员会使用类似的技巧,通过为像素追踪指定一个独特的 URL,弄清楚你是否打开了某一封邮件。) +2. 在发送该请求的同时,还发送了相应的 cookie。这样一来广告商就可以知道,访问 oldnavy.com 的这个人和在同一台电脑上使用 Facebook 的是同一个人。 + +### Old Navy 网站上的 Facebook 像素追踪 + +为了对此进行验证,我在 Old Navy(GAP 旗下的一个服装品牌)网站上浏览了一个商品,相应的 URL 是 `https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1`(这是一件“男款短绒格子花呢大衣”)。 在我浏览这个商品的同时,页面上运行的 Javascript(用的应该是[这段代码][4])向 facebook.com 发送了一个请求。在开发者工具中,该请求看上去是这样的:(我屏蔽了大部分 cookie 值,因为其中有一些是我的登录 cookie) @@ -41,14 +47,23 @@ 下面对其进行拆解分析: - 1. 我的浏览器向 ` https://www.facebook.com/tr/?id=937725046402747&ev=PageView&dl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fproduct.do%3Fpid%3D504753002%26cid%3D1125694%26pcid%3Dxxxxxx0%26vid%3D1%26grid%3Dpds_0_109_1%23pdp-page-content&rl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fcategory.do%3Fcid%3D1135640%26mlink%3D5155%2Cm_mts_a&if=false&ts=1576684838096&sw=1920&sh=1080&v=2.9.15&r=stable&a=tmtealium&ec=0&o=30&fbp=fb.1.1576684798512.1946041422&it=15xxxxxxxxxx4&coo=false&rqm=GET` 发送了一个请求; - 2. 与该请求同时发送的,还有一个名为 `fr` 的 cookie,取值为 `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.`(估计是我的 Facebook 广告追踪 ID) +1. 我的浏览器向如下 URL 发送了一个请求; -在所发送的追踪像素查询字符串里,有三个值得注意的地方: + ``` +https://www.facebook.com/tr/?id=937725046402747&ev=PageView&dl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fproduct.do%3Fpid%3D504753002%26cid%3D1125694%26pcid%3Dxxxxxx0%26vid%3D1%26grid%3Dpds_0_109_1%23pdp-page-content&rl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fcategory.do%3Fcid%3D1135640%26mlink%3D5155%2Cm_mts_a&if=false&ts=1576684838096&sw=1920&sh=1080&v=2.9.15&r=stable&a=tmtealium&ec=0&o=30&fbp=fb.1.1576684798512.1946041422&it=15xxxxxxxxxx4&coo=false&rqm=GET +``` +2. 与该请求同时发送的,还有一个名为 `fr` 的 cookie,取值为 - * 我当前访问的页面:[https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1#pdp-page-content][6] - * 引导我来到当前页面的上一级页面:[https://oldnavy.gap.com/browse/category.do?cid=1135640&mlink=5155,m_mts_a][7]; - * 作为我的身份标识的 cookie:`10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.` + ``` +10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6. +``` +(估计是我的 Facebook 广告追踪 ID) + +在所发送的像素追踪查询字符串里,有三个值得注意的地方: + +* 我当前访问的页面:`https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1#pdp-page-content` +* 引导我来到当前页面的上一级页面:`https://oldnavy.gap.com/browse/category.do?cid=1135640&mlink=5155,m_mts_a`; +* 作为我的身份标识的 cookie:`10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.` ### 下面来逛逛 Facebook! @@ -60,11 +75,11 @@ Facebook 用来追踪我访问了哪些网站的 cookie,属于所谓的“第三方 cookie”,因为 Old Navy 的网站使用它为一个第三方(即 facebook.com)确认我的身份。这和用来维持登录状态的“第一方 cookie”有所不同。 -Safari 和 Firefox 默认都会拦截许多第三方 cookie(所以需要更改 Firefox 的隐私设置,才能够进行这个实验),而 Chrome 目前并不进行拦截(很可能是因为 Chrome 的所有者正是一个广告公司)。 +Safari 和 Firefox 默认都会拦截许多第三方 cookie(所以需要更改 Firefox 的隐私设置,才能够进行这个实验),而 Chrome 目前并不进行拦截(很可能是因为 Chrome 的所有者正是一个广告公司)。(LCTT 译注:Chrome 可以设置阻拦) -### 网站上的追踪像素有很多 +### 网站上的像素追踪有很多 -如我所料,网站上的追踪像素有 **很多**。比如,wrangler.com 在我的浏览器里加载了来自不同域的 19 个不同的追踪像素。wrangler.com 上的追踪像素分别来自:`ct.pinterest.com`、`af.monetate.net`、`csm.va.us.criteo.net`、`google-analytics.com`、`dpm.demdex.net`、`google.ca`、`a.tribalfusion.com`、`data.photorank.me`、`stats.g.doubleclick.net`、`vfcorp.dl.sc.omtrdc.net`、`ib.adnxs.com`、`idsync.rlcdn.com`、`p.brsrvr.com`,以及`adservice.google.com`。 +如我所料,网站上的像素追踪有 **很多**。比如,wrangler.com 在我的浏览器里加载了来自不同域的 19 个不同的像素追踪。wrangler.com 上的像素追踪分别来自:`ct.pinterest.com`、`af.monetate.net`、`csm.va.us.criteo.net`、`google-analytics.com`、`dpm.demdex.net`、`google.ca`、`a.tribalfusion.com`、`data.photorank.me`、`stats.g.doubleclick.net`、`vfcorp.dl.sc.omtrdc.net`、`ib.adnxs.com`、`idsync.rlcdn.com`、`p.brsrvr.com`,以及 `adservice.google.com`。 Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的大部分追踪器都会被拦截: @@ -72,13 +87,13 @@ Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的 ### 浏览器的重要性 -浏览器之所以如此重要,是因为你的浏览器最终决定了发送你的什么信息、发送到哪些网站。Old Navy 网站上的 Javascript 可以请求你的浏览器向 Facebook 发送关于你的追踪信息,但浏览器可以拒绝执行。浏览器的决定可以是:“哈,我知道 facebook.com/tr/ 是一个追踪像素,我不想让我的用户被追踪,所以我不会发送这个请求”。 +浏览器之所以如此重要,是因为你的浏览器最终决定了发送你的什么信息、发送到哪些网站。Old Navy 网站上的 Javascript 可以请求你的浏览器向 Facebook 发送关于你的追踪信息,但浏览器可以拒绝执行。浏览器的决定可以是:“哈,我知道 facebook.com/tr/ 是一个像素追踪,我不想让我的用户被追踪,所以我不会发送这个请求”。 浏览器还可以允许用户对上述行为进行配置,方法包括更改浏览器设置,以及安装浏览器扩展(所以才会有如此多的隐私保护扩展)。 ### 摸清其中原理,实为一件趣事 -在我看来,弄清楚 cookie / 追踪像素是怎么用于对你进行追踪的,实在是一件趣事(尽管显得有点阴险)。我之前大概明白其中的道理,但是并没有亲自查看过追踪像素上的 cookie,也没有看过发送的查询参数上究竟包含什么样的信息。 +在我看来,弄清楚 cookie/像素追踪是怎么用于对你进行追踪的,实在是一件趣事(尽管有点吓人)。我之前大概明白其中的道理,但是并没有亲自查看过像素追踪上的 cookie,也没有看过发送的查询参数上究竟包含什么样的信息。 当然,明白了其中的原理,也就更容易降低被追踪的概率了。 @@ -86,9 +101,9 @@ Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的 为了尽量避免在互联网上被追踪,我采取了几种简单的措施: - * 安装一个广告拦截器(比如 ublock origin 之类)。广告拦截器可以针对许多追踪器的域进行拦截。 - * 使用目前默认隐私保护强度更高的 Firefox/Safari,而不是 Chrome。 - * 使用 [Facebook Container][9] 这个 Firefox 扩展。该扩展针对 Facebook 进一步采取了防止追踪的措施。 +* 安装一个广告拦截器(比如 ublock origin 之类)。广告拦截器可以针对许多追踪器的域进行拦截。 +* 使用目前默认隐私保护强度更高的 Firefox/Safari,而不是 Chrome。 +* 使用 [Facebook Container][9] 这个 Firefox 扩展。该扩展针对 Facebook 进一步采取了防止追踪的措施。 虽然在互联网上被追踪的方式还有很多(尤其是在使用手机应用的时候,因为在这种情况下,你没有和像对浏览器一样的控制程度),但是能够理解这种追踪方法的工作原理,稍微减少一些被追踪的可能性,也总归是一件好事。 @@ -98,8 +113,8 @@ via: https://jvns.ca/blog/how-tracking-pixels-work/ 作者:[Julia Evans][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/chen-ni) -校对:[校对者ID](https://github.com/校对者ID) +译者:[chen-ni](https://github.com/chen-ni) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6af316f30ce157e6f4b94e15e67b6c04f91abcd0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 27 Dec 2019 21:43:46 +0800 Subject: [PATCH 290/676] PUB @chen-ni https://linux.cn/article-11721-1.html --- .../tech => published}/20191218 How tracking pixels work.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191218 How tracking pixels work.md (99%) diff --git a/translated/tech/20191218 How tracking pixels work.md b/published/20191218 How tracking pixels work.md similarity index 99% rename from translated/tech/20191218 How tracking pixels work.md rename to published/20191218 How tracking pixels work.md index 4b8ba216c2..5a47b5197f 100644 --- a/translated/tech/20191218 How tracking pixels work.md +++ b/published/20191218 How tracking pixels work.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11721-1.html) [#]: subject: (How tracking pixels work) [#]: via: (https://jvns.ca/blog/how-tracking-pixels-work/) [#]: author: (Julia Evans https://jvns.ca/) From 1d59ef66bf3f325a000ed508aceea917f7ab80ec Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Fri, 27 Dec 2019 23:42:30 +0800 Subject: [PATCH 291/676] Translated --- ...ry Kubernetes job candidate should know.md | 63 +++++++++---------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md b/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md index aecf855110..b7a6fa9c1d 100644 --- a/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md +++ b/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md @@ -7,65 +7,62 @@ [#]: via: (https://opensource.com/article/19/12/kubernetes-interview-questions) [#]: author: (Jessica Repka https://opensource.com/users/jrepka) -5 interview questions every Kubernetes job candidate should know +每个 Kubernetes 应聘者应该知道的5个面试题 ====== -If you're interviewing people for Kubernetes-related roles, here's what -to ask and why it matters. +如果你要面试Kubernetes相关的应聘者,这里给出了要提问的问题以及这些问题的重要性。 ![Pair programming][1] -Job interviews are hard for people on both sides of the table, but I've discovered that interviewing candidates for Kubernetes-related jobs has seemed especially hard lately. Why, you ask? For one thing, it's hard to find someone who can answer some of my questions. Also, it has been hard to confirm whether they have the right experience, regardless of their answers to my questions. +面试对面试官及候选人来说都很不容易。最近,我发现面试 Kubernetes 相关工作的候选人似乎尤其困难。为什么呢?一方面,很难找到可以回答他们问题的人。而且,不管回答者回答的怎样,都很难确定他们是否有正确的经验。 -I'll skip over my musings on that topic and get to some questions that you should ask of any job candidate who would be working with [Kubernetes][2]. +跳过这个问题,让我们来看看面试[Kubernetes][2]求职者时应该提问的一些问题。 -### What is Kubernetes? +### Kubernetes 是什么? -I've always found this question to be one of the best ones to ask in interviews. I always hear, "I work with Kubernetes," but when I ask, "what is it?" I never get a confident answer. +我发现这个问题是面试中最好的问题之一。我经常听到有人说“我用Kubernetes工作”,但是当我问道“Kubernetes 是什么时,从来都没有得到过一个满意答案。 -My favorite answer is from [Chris Short][3]: "Just an API with some YAML files." +我最喜欢克里斯•肖特[Chris Short][3]给出的答案:“Kubernetes 就是带有一些 YAML 文件的 API 。” -While he is not wrong, I'll give you a more detailed version. Kubernetes is a portable container orchestration tool that is used to automate the tasks of managing, monitoring, scaling, and deploying containerized applications. +虽然他的回答没有错,但我会给你更详细的解释。 Kubernetes 是一个便携式容器编排工具,用于自动执行管理,监控,扩展和部署容器化应用程序。 -I've found that "an orchestration tool for deploying containerized applications" is probably as good as you're going to get as an answer, which in my opinion is good enough. While many believe Kubernetes adds a great deal more, overall, it offers many APIs to add to this core feature: container orchestration. +我认为“用于部署容器化应用程序的编排工具”这个回答可能与你期望的答案差不多了。能回答出这个,我觉得已经很不错了。尽管许多人相信 Kubernetes 可以增加很多,但总的来说,它提供了许多API来增加其核心功能:容器编排。 -In my opinion, this is one of the best questions you can ask in an interview, as it at least proves whether the candidate knows what Kubernetes is. +我认为,这是你在面试中可以提问的最好的问题之一,因为它至少证明了候选人是否知道 Kubernetes 是什么。 -### What is the difference between a Kubernetes node and a pod? +### Kubernetes 的 node(节点)和 Pod 有什么区别? -This question reveals a great first look at the complexity of Kubernetes. It shifts the conversation to an architectural overview and can lead to many interesting follow-up details. It has also been explained incorrectly to me an innumerable amount of times. +该问题揭示了候选人对 Kubernetes 复杂性的初步了解。它将对话转换为体系结构概述,并可能导向许多有趣的后续细节问题。我已经听到了无数次关于该问题的错误解释了。 -A [node][4] is the worker machine. This machine can be a virtual machine (VM) or a physical machine, depending on whether you are running on a hypervisor or on bare metal. The node contains services to run containers, including the kubelet, kube-proxy, and container runtime. +[node][4] 是工作计算机。该计算机可以是虚拟机(VM)或物理计算机,具体取决于你是在虚拟机监控程序上运行还是在裸机上运行。该节点包含用于运行容器的服务,包括 kubelet,kube-proxy 和容器运行时。 -A [pod][5] includes (1) one or more containers (2) with shared network (3) and storage (4) and the specification on how to run the containers deployed together. All four of these details are important. For bonus points, an applicant could mention that, technically, a pod is the smallest deployable unit Kubernetes can create and manage—not a container. +[pod][5] pod 包括(1)一个或多个具有共享网络(3)和存储(4)的容器(2)以及有关如何运行一起部署的容器的规范。这四个细节都很重要。更进一步,申请人应从技术层面解释,pod 是Kubernetes 可以创建和管理的最小可部署单元,而不是容器。 -The best short answer I've received for this question is: "The node is the worker, and the pod is the thing the containers are in." The distinction matters. Most of a Kubernetes administrator's job depends on knowing when to deploy what, and nodes can be very, very expensive, depending on where they are run. I wouldn't want someone deploying nodes over and over when what they needed to do was deploy a bunch of pods. +对于这个问题,我听到的最好的简答是:“node 是计算机,而 pod 是容器中的东西。” 区别很重要。 Kubernetes 管理员的大部分工作是知道什么时间要部署什么,而节点可能非常非常昂贵,具体取决于它们的运行位置。我不希望有人一遍又一遍地部署节点,他们需要做的就是部署一堆Pod。 -### What is kubectl? (And how do you pronounce it?) +### kubectl 是什么? (你怎么发音?) -This question is one of my higher priority questions, but it may not be relevant for you and your team. In my organization, we don't use a graphical interface to manage our Kubernetes environments, which means command-line actions are all we do. +这个问题是我的优先级中较高的问题之一,但可能与你和你的团队无关。在我的团队中,我们不会使用图形化界面来管理Kubernetes环境,我们使用命令行操作。 -So what is [kubectl][6]? It is the command-line interface to Kubernetes. You can get and set anything from there, from gathering logs and events to editing deployments and secrets. It's always helpful to pop in a random question about how to use this tool to test the interviewee's familiarity with kubectl. +那么什么是[kubectl][6]?它是 Kubernetes 的命令行界面。你可以从该界面获取并设置任何内容,从收集日志和事件到编辑部署环境和机密文件。随机提问候选人关于如何使用此工具对测试候选人对 kubectl 的熟悉度是很有帮助的。 -How do you pronounce it? Well, that's up to you (there's a big disagreement on the matter), but I will gladly point you to this great video presentation by my friend [Waldo][7]. +你是怎么读的?好吧,你随便吧(对此有很大的分歧),但是我很高兴向你介绍我朋友[Waldo][7]的精彩视频演示。 -### What is a namespace? +### 名称空间是什么? -I haven't received an answer to this question on multiple interviews. I am not sure that namespaces are used as often in other environments as they are in the organization I work in. I'll give a short answer here: a namespace is a virtual cluster in a pod. This abstraction is what enables you to keep several virtual clusters in various environments for isolation purposes. +在多次面试中,我都没有得到关于这个问题的答案。我不确定在其他环境中使用的名称空间是否会在我所在的团队经常使用。我在这里给出一个简短的答案:名称空间是Pod中的虚拟集群。这种抽象可以使你将多个虚拟群集保留在各种环境中以此来进行隔离。 -### What is a container? +### 容器是什么? +了解 Pod 中正在部署的内容总是有帮助的,因为如果都不知道其中部署的是什么,何谈部署?容器是打包代码及其所有依赖项的软件的标准单元。我收到了两个可以接收的答案,其中包括:a)精简的操作系统映像,以及b)在受限的 OS 环境中运行的应用程序。如果你可以命名使用[Docker][8]以外的其他容器的编排软件(例如你最喜欢的公共云的容器服务),则可以得到加分。 -It always helps to know what is being deployed in your pod, because what's a deployment without knowing what you're deploying in it? A container is a standard unit of software that packages up code and all its dependencies. Two optional secondary answers I have received and am OK with include: a) a slimmed-down image of an OS and b) an application running in a limited OS environment. Bonus points if you can name orchestration software that uses containers other than [Docker][8], like your favorite public cloud's container service. +### 其他问题 +如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。 -### Other questions +**[阅读更多:如何准备 Kubernetes 相关的面试?]][9]** -If you're wondering why I didn't add more to this list of questions, I have an easy answer for you: these are the minimum set of things _you_ should know when you are asking candidates interview questions. The next set of questions should come from a large list of questions based on your specific team, environment, and organization. As you think through these, try to find interesting questions about how technology interacts with each other to see how people think through infrastructure challenges. Think about recent challenges your team had (outages), ask to walk through deployments step-by-step, or about strategies to improve something your team actively wants to improve (like a reduction to deployment time). The less abstract the questions, the more your asking about skills that will actually matter after the interview. +没有两个环境是完全相同的。这也适用于面试中。我在每次面试中都会混合提问。 我也有一个测试面试者的小环境。我经常发现回答问题是最容易的部分,而你所做的工作才是对你的真正的考验。 -**[Read more: [How to prepare for a Kubernetes job interview]][9]** +我给面试官的最后一点建议是:如果你遇到一个很有潜力但没有经验的候选人时,请给他们一个证明自己的机会。如果当初没有人看到我的潜力,没有给我机会的话,我不会拥有今天的知识和经验。 -No two environments will be the same, and this also applies when you are interviewing people. I mix up questions in every interview. I also have a small environment I can use to test interviewees. I always find that answering the questions is the easiest part, and doing the work is the real test you need to give. - -My last bit of advice for anyone giving interviews: If you meet someone who has potential but none of the experience, give them a chance to prove themselves. I wouldn't have the knowledge and experience I have today if someone hadn't seen the potential of what I could do and given me an opportunity. - -What are other important questions to ask interviewees about Kubernetes? Please add your list in the comments. +还有哪些重要的问题?请留言告诉我们。 -------------------------------------------------------------------------------- @@ -73,7 +70,7 @@ via: https://opensource.com/article/19/12/kubernetes-interview-questions 作者:[Jessica Repka][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[Morisun029](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3d2041ccba66637628cc599c796996aaf893e23c Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Fri, 27 Dec 2019 23:44:20 +0800 Subject: [PATCH 292/676] Translated. --- ...erview questions every Kubernetes job candidate should know.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191217 5 interview questions every Kubernetes job candidate should know.md (100%) diff --git a/sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md b/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md similarity index 100% rename from sources/tech/20191217 5 interview questions every Kubernetes job candidate should know.md rename to translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md From d43fe702f8991a69c291add54d9d7d6c938a8296 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 28 Dec 2019 01:00:21 +0800 Subject: [PATCH 293/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191227=20Top=20?= =?UTF-8?q?CI/CD=20resources=20to=20set=20you=20up=20for=20success?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191227 Top CI-CD resources to set you up for success.md --- ...-CD resources to set you up for success.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/tech/20191227 Top CI-CD resources to set you up for success.md diff --git a/sources/tech/20191227 Top CI-CD resources to set you up for success.md b/sources/tech/20191227 Top CI-CD resources to set you up for success.md new file mode 100644 index 0000000000..77d2391a5d --- /dev/null +++ b/sources/tech/20191227 Top CI-CD resources to set you up for success.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top CI/CD resources to set you up for success) +[#]: via: (https://opensource.com/article/19/12/cicd-resources) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +Top CI/CD resources to set you up for success +====== +Continuous integration and continuous deployment were key topics in 2019 +as organizations look to achieve seamless, flexible, and scalable +deployments. +![Plumbing tubes in many directions][1] + +This has been a fantastic year for continuous integration/continuous deployment (CI/CD) and the world of DevOps. Opensource.com authors shared how they're moving toward agile and scrum as they focus on seamless, flexible, and scalable deployments. Here are some of the big themes in the CI/CD articles we published this year. + +### Learning and improving your CI/CD skills + +Some of our favorite articles focus on hands-on CI/CD experience and cover a lot of ground as they do. The place to start is always with [Jenkins][2] pipelines, and Bryant Son's [_Building CI/CD pipelines with Jenkins_][3] will give you enough experience to get started building your first pipelines. Daniel Oh's [_Automate user acceptance testing with your DevOps pipeline_][4] provides great information on acceptance testing, including various CI/CD applications you can use for testing in its own right. And my article on [_Security scanning your DevOps pipeline_][5] is a very short, to the point tutorial on how to set up security in a pipeline using the Jenkins platform. + +### Delivery workflow + +While learning how to use and improve your skills with CI/CD, the workflow matters, especially when it comes to pipelines, as Jithin Emmanuel shares in [_Screwdriver: A scalable build platform for continuous delivery_][6]. Emily Burns explains having the flexibility to build exactly what you need with your CI/CD workflow in [_Why Spinnaker matters to CI/CD_][7]. And Willy-Peter Schaub extols the idea of creating a unified pipeline for everything to build consistently in [_One CI/CD pipeline per product to rule them all_][8]. These articles will give you a good sense of what happens after you onboard team members to the workflow process. + +### How CI/CD affects organizations + +2019 was also the year of recognizing CI/CD's business impact and how it affects day-to-day operations. Agnieszka Gancarczyk shares the results of Red Hat's [_Small Scale Scrum vs. Large Scale Scrum_][9] survey, including respondents' differing opinions on scrums, the agile movement, and the impact on teams. Will Kelly covers [_How continuous deployment impacts the entire organization_][10], including the importance of open communication, and Daniel Oh emphasizes the importance of metrics and observability in [_3 types of metric dashboards for DevOps teams_][11]. Last, but far from least, Ann Marie Fred's great article [_Don't test in production? Test in production!_][12] details why it's important for you to test in production—before your customers do. + +We are thankful to the many contributing authors who shared their insights with Opensource.com readers in 2019, and I look forward to learning more from them about the evolution of CI/CD in 2020. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/cicd-resources + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/plumbing_pipes_tutorial_how_behind_scenes.png?itok=F2Z8OJV1 (Plumbing tubes in many directions) +[2]: https://jenkins.io/ +[3]: https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins +[4]: https://opensource.com/article/19/4/devops-pipeline-acceptance-testing +[5]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[6]: https://opensource.com/article/19/3/screwdriver-cicd +[7]: https://opensource.com/article/19/8/why-spinnaker-matters-cicd +[8]: https://opensource.com/article/19/7/cicd-pipeline-rule-them-all +[9]: https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum +[10]: https://opensource.com/article/19/7/organizational-impact-continuous-deployment +[11]: https://opensource.com/article/19/7/dashboards-devops-teams +[12]: https://opensource.com/article/19/5/dont-test-production From 65dd7883d11294135f3d686e4b2d34b3d8961504 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 28 Dec 2019 01:01:03 +0800 Subject: [PATCH 294/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191227=20The=20?= =?UTF-8?q?importance=20of=20consistency=20in=20your=20Python=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191227 The importance of consistency in your Python code.md --- ...ance of consistency in your Python code.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/tech/20191227 The importance of consistency in your Python code.md diff --git a/sources/tech/20191227 The importance of consistency in your Python code.md b/sources/tech/20191227 The importance of consistency in your Python code.md new file mode 100644 index 0000000000..812a4df058 --- /dev/null +++ b/sources/tech/20191227 The importance of consistency in your Python code.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The importance of consistency in your Python code) +[#]: via: (https://opensource.com/article/19/12/zen-python-consistency) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +The importance of consistency in your Python code +====== +This is part of a special series about the Zen of Python focusing on the +12th, 13th, and 14th principles: the roles of ambiguity and obviousness. +![Two animated computers waving one missing an arm][1] + +The principle of least surprise is [a guideline][2] when designing user interfaces. It says that when the user performs an action, the program should do whatever would surprise the user the least. This is for the same reason kids love reading the same book over and over again: there is nothing more comforting to people than the ability to predict and have those predictions come true. + +A critical insight in the development of the [ABC language][3], Python's inspiration, was that programming languages are user interfaces and need to be designed with the same tools that UI designers use. Thankfully, since then, more languages have adopted the concepts of affordance and ergonomics from UI design, even if they apply them less strictly. + +This brings us to the next three principles in the [Zen of Python][4]. + +### In the face of ambiguity, refuse the temptation to guess. + +What should the result of **1 + "1"** be? Both **"11"** and **2** would be valid guesses. This expression is _ambiguous_: there is no single thing it can do that would not be a surprise to at least some people. + +Some languages choose to guess. In JavaScript, the result is **"11"**. In Perl, the result is **2**. In C, naturally, the result is the empty string. In the face of ambiguity, JavaScript, Perl, and C all guess. + +In Python, this raises a **TypeError**: an error that is not silent. It is atypical to catch **TypeError**: it will usually terminate the program or at least the current task (for example, in most web frameworks, it will terminate the handling of the current request). + +Python refuses to guess what **1 + "1"** means. The programmer is forced to write code with clear intention: either **1 + int("1")**, which would be **2**; or **str(1) + "1"**, which would be **"11"**; or **"1"[1:]**, which would be an empty string. By refusing to guess, Python makes programs more predictable. + +### There should be one—and preferably only one—obvious way to do it. + +Prediction also goes the other way. Given a task, can you predict the code that will be written to achieve it? It is impossible, of course, to predict perfectly. Programming, after all, is a creative task. + +However, there is no reason to intentionally provide multiple, redundant ways to achieve the same thing. There is a sense in which some solutions are "better" or "more Pythonic." + +Part of the appreciation for the Pythonic aesthetic is that it is OK to have healthy debates about which solution is better. It is even OK to disagree and keep programming. It is even OK to agree to disagree for the sake of harmony. But beneath it all, there has to be a feeling that, eventually, the right solution will come to light. There must be the hope that eventually we can live in true harmony by agreeing on the best way to achieve a goal. + +### Although that way may not be obvious at first (unless you're Dutch). + +This is an important caveat: It is often _not_ obvious, at first, what is the best way to achieve a task. Ideas are evolving. _Python_ is evolving. The best way to read a file block-by-block is, probably, to wait until Python 3.8 and use the [walrus operator][5]. + +This common task, reading a file block-by-block, did not have a "single best way to do it" for almost _30 years_ of Python's existence. + +When I started using Python in 1998 with Python 1.5.2, there was no single best way to read a file line-by-line. For many years, the best way to know if a dictionary had a key was to use **.haskey**, until the **in** operator became the best way. + +It is only by appreciating that sometimes, finding the one (and only one) way of achieving a goal can take 30 years of trying out alternatives that Python can keep aiming to find those ways. This view of history, where 30 years is an acceptable time for something to take, often feels foreign to people in the United States, when the country has existed for just over 200 years. + +The Dutch, whether it's Python creator [Guido van Rossum][6] or famous computer scientist [Edsger W. Dijkstra][7], have a different worldview according to this part of the Zen of Python. A certain European appreciation for time is essential to appreciate it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-consistency + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other11x_cc.png?itok=I_kCDYj0 (Two animated computers waving one missing an arm) +[2]: https://www.uxpassion.com/blog/the-principle-of-least-surprise/ +[3]: https://en.wikipedia.org/wiki/ABC_(programming_language) +[4]: https://www.python.org/dev/peps/pep-0020/ +[5]: https://www.python.org/dev/peps/pep-0572/#abstract +[6]: https://en.wikipedia.org/wiki/Guido_van_Rossum +[7]: http://en.wikipedia.org/wiki/Edsger_W._Dijkstra From 8edacd4abd6dbe74a770a0bfbc03d5c6a06af281 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 28 Dec 2019 01:01:59 +0800 Subject: [PATCH 295/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191227=2010=20r?= =?UTF-8?q?esources=20to=20boost=20your=20Git=20skills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191227 10 resources to boost your Git skills.md --- ...7 10 resources to boost your Git skills.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/tech/20191227 10 resources to boost your Git skills.md diff --git a/sources/tech/20191227 10 resources to boost your Git skills.md b/sources/tech/20191227 10 resources to boost your Git skills.md new file mode 100644 index 0000000000..b05f363e14 --- /dev/null +++ b/sources/tech/20191227 10 resources to boost your Git skills.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 resources to boost your Git skills) +[#]: via: (https://opensource.com/article/19/12/git-resources) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +10 resources to boost your Git skills +====== +Wrap up the year with a review of the best in Git. Here are the top 10 +articles about surprising ways you can use Git in the new year. +![open source button on keyboard][1] + +As we near the end of 2019, it is time to look back at the top 10 articles we published about Git this year. + +These articles range from use cases and tutorials to some very interesting, if somewhat unconventional, ways to use Git. All of these articles can help you improve your Git skills, but if you really need a Git 101 introduction, be sure to check out our _[Getting started with Git: Terminology 101][2]_ article and download our [Git cheat sheet][3]. + + 1. _[How GNOME uses Git][4]_ by Molly de Blanc looks at the GNOME project’s adoption of a self-hosted GitLab instance as the GNOME project’s centralized location for contributing to GNOME. De Blanc works in a non-coding position, so her article also explores how the switch to GitLab benefits contributors whose primary role is not writing code. + + 2. Ahmad Awais’ _[Emoji-Log: A new way to write Git commit messages][5]_ explains how to use Emoji-Log, "a straightforward, open source Git commit log standard," to write better, more user-friendly, Git commit messages. The article contains an overview of the theory behind Emoji-Log and configuration examples that can be added to **.bashrc, .zshrc, or .gitconfig** to quickly start using Emoji-Log. + + 3. In _[Manage your daily schedule with Git][6]_, Seth Kenlon explains how to use Git to manage your calendar. By combining Org mode, Git, and a few other tools, Kenlon describes how to create a Git-based calendar workflow that can be synced across devices. + + 4. [_Use Git as the backend for chat_][7] by Seth Kenlon explores another unconventional way to use Git. In this article, he explores GIC, which is a chat client written in Node.js with Git functioning as the backend database. GIC is proof of concept, not something intended for production use, but it provides an interesting example of a really unique way to use Git. + + 5. Alan Formy-Duval’s _[A practical learning exercise for Git][8]_ is a chronicle of his effort to improve his Git skills. He shares his experience for others to benefit from what he learned, and Git novices will gain a lot from this excellent overview of Git’s core functionality. + + 6. _[How writers can get work done better with Git][9]_ by Seth Kenlon looks at how writers can benefit from a Git-based workflow. The article explains how to use Git and Atom to write using Markdown. By following the examples in this article, writers can easily add a complex revision control system to their writing workflow. + + 7. In _[How to use Magit to manage Git projects][10]_, Sachin Patil explains how to use Emacs’ Magit extension to manage Git repositories. The article provides clear examples of how to perform a selection of key Git tasks inside Emacs. The examples are supported by screenshots illustrating the various tasks. + + 8. _[Move your dotfiles to version control][11]_ by Matthew Broberg shows how to use Git to store the dotfiles in your home directory. Storing your dotfiles in a Git repository makes it easier to share your system configuration between computers and, if you so choose, share your configurations with others. The article does come with a warning about what not to share because sharing the wrong dotfiles can expose others. + + 9. Austin Dewey’s _[4 secrets management tools for Git encryption][12]_ compares Git-crypt, BlackBox, SOPS, and Transcrypt in this article examining tools for storing secrets in Git. The article covers four major areas: encryption types supported, the goals of each project, the projects’ workflows and differences, and other features. + + 10. _[Run a server with Git][13]_ by Seth Kenlon explains how Gitolite can be used to manage a Git server. Gitolite is "a backend application managing the fiddly bits" involved in using Git to manage a Git server. The article demonstrates how to install, configure, and use Gitolite, with clear examples detailing each step the process. + + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/git-resources + +作者:[Joshua Allen Holm][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard) +[2]: https://opensource.com/article/19/2/git-terminology +[3]: https://opensource.com/downloads/cheat-sheet-git +[4]: https://opensource.com/article/19/10/how-gnome-uses-git +[5]: https://opensource.com/article/19/2/emoji-log-git-commit-messages +[6]: https://opensource.com/article/19/4/calendar-git +[7]: https://opensource.com/article/19/4/git-based-chat +[8]: https://opensource.com/article/19/5/practical-learning-exercise-git +[9]: https://opensource.com/article/19/4/write-git +[10]: https://opensource.com/article/19/1/how-use-magit +[11]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[12]: https://opensource.com/article/19/2/secrets-management-tools-git +[13]: https://opensource.com/article/19/4/server-administration-git From 624324d0a90eb698d13351a5727d2cd720ee5c8d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 28 Dec 2019 01:02:28 +0800 Subject: [PATCH 296/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191226=20"serve?= =?UTF-8?q?r"=20is=20hard=20to=20define?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191226 -server- is hard to define.md --- .../20191226 -server- is hard to define.md | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 sources/tech/20191226 -server- is hard to define.md diff --git a/sources/tech/20191226 -server- is hard to define.md b/sources/tech/20191226 -server- is hard to define.md new file mode 100644 index 0000000000..e53338857b --- /dev/null +++ b/sources/tech/20191226 -server- is hard to define.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: ("server" is hard to define) +[#]: via: (https://jvns.ca/blog/2019/12/26/whats-a-server/) +[#]: author: (Julia Evans https://jvns.ca/) + +"server" is hard to define +====== + +Somebody asked me recently what a server was, and I had a harder time explaining it than I expected! I thought I was going to be able to give some kind of simple pithy answer but it kind of got away from me. So here’s an short exploration of what the word “server” can mean: + +### a server responds to requests + +A server definitely responds to requests. A few examples: + +webserver: + +``` +Me: "please give me google.com" +Server: "here is the HTML for that webpage" +``` + +bittorrent server: + +``` +Me: "I would like this chunk of the good wife season 2" +Server: "here are some of the bytes from that .avi file!" +``` + +mail server: + +``` +Me: "can you send this email to [email protected]" +Server: "I sent it!" +``` + +But what is a server actually specifically exactly? + +### a server is a program + +My first instinct is to say “a server is a program” because for example a “the wordpress server” is a PHP program, so let’s start with that. + +A server is usually a program that listens on a **port** (like 80). For example, if we’re talking about a Rails webserver, then the program is a Ruby program that’s listening on a port for HTTP requests. + +For example, we can start a Python server to serve files out of the current directory. + +``` +$ python3 -m http.server & +Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) .. +``` + +and send requests to it with `curl`: + +``` +$ curl localhost:8000/config.yaml +baseurl: https://jvns.ca +disablePathToLower: true +languageCode: en-us +title: Julia Evans +author: Julia Evans +... +``` + +### a server might be a virtual machine + +But often when I talk about “a server” at work, I’ll use it in a sentence like “I’m going to SSH to that server to see what’s going on with it”, or “wow, that server is swapping a lot, that’s bad!“. + +So in those cases clearly I don’t mean a program when I say “that server” (you can’t ssh to a program, though the ssh server that runs on the VM is itself a program!), I mean the AWS instance that the server program is running on. That AWS instance is a virtual machine, which looks like a computer in a lot of ways (it’s running an operating system!) but it isn’t a physical computer. + +### a server might be a container + +Similarly to how your server might be a virtual machine, it could also be a container running in a virtual machine. So “the server is running out of memory” could mean “the container is running out of memory and crashing” which really means “we set a cgroup memory limit on this container and the programs in the container with that cgroup exceeded the limit so the Linux kernel OOM killed them”. + +But containers make everything a lot more complicated so I think we should stop there for now. + +### a server is a computer + +But also when you **buy** a server from Dell or some other computer company, you’re not buying a virtual machine, you’re buying an actual physical machine. + +Usually these computers are in building datacenters. For example in this video you can see thousands of servers in a Google datacenter. + +The computers in this datacenter don’t look like the computers in my house! They’re short and wide because they’re designed to fit into these giant racks of servers. For example if you search Newegg for [1U server][1] you’ll find servers that are 1 “[rack unit][2]” high, and a rack unit is 1.75 inches. There are also 2U servers which are twice as high. + +Here’s a picture of a 1U server I found on Newegg: + +![][3] + +I’ve only seen a server rack once at the [Internet Archive][4] which is in what used to be a church in San Francisco, and it was really cool to realize – wow, when I use the Wayback Machine it’s using the actual computers in this room! + +### “the server” might be 1000 computers + +Next, let’s say we’re talking about how Gmail works. You might ask “hey, when I search my email to find my boarding pass, does that happen in the frontend or on the server?”. + +The answer is “it happens on the server”, but what’s “the server” here? There’s not just one computer or program or virtual machine that searches your Gmail, there are probably lots of computers and programs at Google that are reponsible for that and they’re probably distributed across many datacenters all over the world. + +And even if we’re just talking about doing 1 search, there could easily be 20 different computers in 3 different countries involved in just running that 1 search. + +So the words “the server” in “oh yeah, that happens on the server” mean something kind of complicated here – what you’re actually saying is something “well the browser makes a request, and that request does _something_, but I’m not really going to worry about what because the important thing is just that the browser made a request and got some kind of response back.” + +### what happens when I search my email for a boarding pass? + +When I search for “boarding” in my email, the Javascript running on the frontend puts together this request. It’s mostly indecipherable but it definitely contains the word “boarding”: + +``` +{ + "1": { + "1": 79, + "2": 101, + "4": "boarding", + "5": { + "5": 0, + "12": "1577376926313", + "13": -18000000 + }, + "6": "itemlist-ViewType(79)-5", + "7": 1, + "8": 2000, + "10": 0, + "14": 1, + "16": { + "1": 1, + "2": 0, + "3": 0, + "7": 1 + }, + "19": 1 + }, + "3": { + "1": "0", + "2": 5, + "5": 1, + "6": 1, + "7": 1 + } +} +``` + +We get a response back which is large and complicated and definitely contains search results from my email about boarding passes. Here’s an excerpt: + +``` +"your electronic boarding pass. You could also be asked to display this \nmessage to airport security. * PLEASE NOTE: A printable", +"the attached boarding pass to present at the airport. Manage your booking \nBooking Details Passenger: JULIA EVANS Booking", +"Electronic boarding pass is not offered for your flight. Click the link \nbelow to access the PRINTABLE VERSION of your boarding", +"Save time at the airport Save time at the airport Web version", +"GET YOUR BOARDING PASS IN ADVANCE > You can now check in for your flight \nand you will receive a boarding pass > allowing", +"Save time at the airport Save time at the airport Web version", +"Booking Confirmation Booking Reference: xxxxxx Date of issue: xxxxxxxxxxxx \nSelect Seats eUpgrade", +"your electronic boarding pass. You could also be asked to display this \nmessage to airport security. * PLEASE NOTE: A printable", +"your electronic boarding pass. You could also be asked to display this \nmessage to airport security. * PLEASE NOTE: A printable", +"Save time at the airport Save time at the airport Web version", +"house was boarded up during the last round of bombings. I have no spatial \nimagination and cannot picture the house in three", +"Booking Confirmation Booking Reference: xxxxxx Date of issue: xxxxxxxxxxxx \nSelect Seats eUpgrade" +"required when boarding a flight to Canada. For more details, please visit \nCanada.ca/eTA . - Terms and Conditions of Sale", +"Your KLM boarding pass(s) on XXXXXX To: [image: KLM SkyTeam] Boarding \ninformation Thank you for checking in! Attached you", +"Boarding information Thank you for checking in! Attached you will find your \nboarding pass and/or other documents. Below", +"jetBlue® Your upcoming trip to SEATTLE, WA on xxxxxxxxxxx Flight status \nBaggage info Airport info TAG", +"your electronic boarding pass. You could also be asked to display this \nmessage to airport security. * PLEASE NOTE: A printable" +``` + +That request got sent to 172.217.13.197:443, which corresponds to some edge server near me. There were probably many other computers involved in searching my email than just the first one who got my request, but the nice thing about this is that we don’t need to care exactly what happened behind the scenes! The browser sent a request, and it got search results back, and it doesn’t need to know what servers. + +We can just say “it happens on the server” and not worry too much about the ambiguity of what exactly that means (until something weird goes wrong :)). + +### the meaning of “server” depends on the context + +So we’ve arrived somewhere a little bit interesting – at first when I thought about the question “what’s a server?” I really thought there was going to be a single simple answer! But it turns out that if you look at sentences where we use the word “server” it can actually refer to a lot of different things in a way that can be confusing: + + * “Let me just ssh into the server and see what’s going on” => a virtual machine (or possibly a computer) + * “I sent a SIGTERM to the server and that fixed the problem” => a program + * “Let’s look at the server code” => a program + * “Let’s buy 20 of those 2U servers” => a computer + * “We need to add more server capacity” => a program and a virtual machine probably + * “That happens on the server” => possibly some complex distributed system + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/12/26/whats-a-server/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.newegg.com/p/pl?d=1u+server +[2]: https://en.wikipedia.org/wiki/Rack_unit +[3]: https://c1.neweggimages.com/NeweggImage/ProductImage/11-152-136-02.jpg +[4]: https://archive.org/ From b9586be1c97ec8c378f1eb522335af7d42ff1458 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 28 Dec 2019 08:17:17 +0800 Subject: [PATCH 297/676] PRF @geekpi --- ...in Ubuntu and Other Linux Distributions.md | 74 +++++++++---------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md b/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md index ec3367d6ef..fab4be3462 100644 --- a/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md +++ b/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions) @@ -10,37 +10,33 @@ 如何在 Ubuntu 和其他 Linux 发行版中启动、停止和重启服务 ====== -服务是必不可少的后台进程,它通常随系统启动,并在关机时关闭。 +![](https://img.linux.net.cn/data/attachment/album/201912/28/081645vee5lkult55kituu.jpg) -如果你是系统管理员,那么你会定期处理服务。 - -如果你是普通桌面用户,你可能会遇到需要重启服务的情况,例如[安装 Barrier 来用于在计算机之间共享鼠标和键盘][1]。或[在使用 ufw 设置防火墙][2]时。 +服务是必不可少的后台进程,它通常随系统启动,并在关机时关闭。如果你是系统管理员,那么你会定期处理服务。如果你是普通桌面用户,你可能会遇到需要重启服务的情况,例如[安装 Barrier 来用于在计算机之间共享鼠标和键盘][1]。或[在使用 ufw 设置防火墙][2]时。 今天,我将向你展示两种管理服务的方式。你将学习在 Ubuntu 或任何其他 Linux 发行版中启动、停止和重启服务。 -systemd 与 init +> systemd 与 init +> +> 如今,Ubuntu 和许多其他发行版都使用 systemd 而不是旧的 init。 +> +> 在 systemd 中,可以使用 `systemctl` 命令管理服务。 +> +> 在 init 中,你可以使用 `service` 命令管理服务。 +> +> 你会注意到,即使你的 Linux 系统使用 systemd,它仍然可以使用 `service` 命令(与 init 系统一起使用的)。这是因为 `service` 命令实际上已重定向到 `systemctl`。systemd 引入了向后兼容性,因为系统管理员们习惯使用 `service` 命令。 +> +> 在本教程中,我将同时展示 `systemctl` 和 `service` 命令。 -如今,Ubuntu 和许多其他发行版都使用 systemd 而不是旧的 init。 - -在 systemd 中,可以使用 systemctl 命令管理服务。 - -在 init 中,你可以使用 service 命令管理服务。 - -你会注意到,即使你的 Linux 系统使用 systemd,它仍然可以使用 service 命令(为了与 init 系统一起使用)。这是因为 service 命令实际上已重定向到 systemctl。systemd 引入了向后兼容性,因为系统管理员们习惯使用 service 命令。 - -在本教程中,我将同时展示 systemctl 和 service 命令。 - -_我的是 Ubuntu 18.04,但其他版本的过程也一样_。 +我用的是 Ubuntu 18.04,但其他版本的过程也一样。 ### 方法 1:使用 systemd 在 Linux 中管理服务 我从 systemd 开始,因为它被广泛接受。 -#### 1\. 列出所有服务 +#### 1、列出所有服务 -为了管理服务,你首先需要知道系统上有哪些服务可用。 - -你可以使用 systemd 命令列出 Linux 系统上的所有服务: +为了管理服务,你首先需要知道系统上有哪些服务可用。你可以使用 systemd 的命令列出 Linux 系统上的所有服务: ``` systemctl list-unit-files --type service -all @@ -48,9 +44,9 @@ systemctl list-unit-files --type service -all ![systemctl list-unit-files][3] -此命令将输出所有服务的状态。服务状态有启用、禁用、屏蔽(在取消掩码之前处于非活动状态)、静态和已生成。 +此命令将输出所有服务的状态。服务状态有启用enabled禁用disabled屏蔽masked(在取消屏蔽之前处于非活动状态)、静态static已生成generated。 -与 [grep 命令][4] 结合,你可以**仅显示正在运行的服务**: +与 [grep 命令][4] 结合,你可以仅显示正在运行的服务: ``` sudo systemctl | grep running @@ -60,9 +56,9 @@ sudo systemctl | grep running 现在,你知道了如何引用所有不同的服务,你可以开始主动管理它们。 -**注意:** 命令中的 **<service-name>** 应该用你想管理的服务名代替。(比如:network-manager、ufw 等) +**注意:** 下列命令中的 `` 应该用你想管理的服务名代替。(比如:network-manager、ufw 等) -#### 2\. 启动服务 +#### 2、启动服务 要在 Linux 中启动服务,你只需使用它的名字: @@ -70,15 +66,15 @@ sudo systemctl | grep running systemctl start ``` -#### 3\. 停止服务 +#### 3、停止服务 -要停止 systemd 服务,可以使用 systemctl 命令的 stop 选项: +要停止 systemd 服务,可以使用 `systemctl` 命令的 `stop` 选项: ``` systemctl stop ``` -#### 4\. 重启服务 +#### 4、重启服务 要重启 systemd 服务,可以使用: @@ -86,7 +82,7 @@ systemctl stop systemctl restart ``` -#### 5\. 检查服务状态 +#### 5、检查服务状态 你可以通过打印服务状态来确认你已经成功执行特定操作: @@ -104,7 +100,7 @@ systemctl status init 的命令和 systemd 的一样简单。 -#### 1\. 列出所有服务 +#### 1、列出所有服务 要列出所有 Linux 服务,使用: @@ -114,9 +110,9 @@ service --status-all ![service –status-all][7] -前面的 **[ – ]** 代表**禁用**,**[ + ]** 代表**启用**。 +前面的 `[ – ]` 代表**禁用**,`[ + ]` 代表**启用**。 -#### 2\. 启动服务 +#### 2、启动服务 要在 Ubuntu 和其他发行版中启动服务,使用命令: @@ -124,7 +120,7 @@ service --status-all service start ``` -#### 3\. 停止服务 +#### 3、停止服务 停止服务同样简单。 @@ -132,7 +128,7 @@ service start service stop ``` -#### 4\. 重启服务 +#### 4、重启服务 如果你想重启服务,命令是: @@ -140,9 +136,9 @@ service stop service restart ``` -#### 5\. 检查服务状态 +#### 5、检查服务状态 -此外,要检查是否达到了预期的结果,你可以输出服务**状态**: +此外,要检查是否达到了预期的结果,你可以输出服务状态: ``` service status @@ -152,9 +148,9 @@ service status ![service status][8] -最重要的是,这将告诉你某项服务是否处于活跃状态(**正在运行**)。 +最重要的是,这将告诉你某项服务是否处于活跃状态(正在运行)。 -**总结** +### 总结 今天,我详细介绍了两种在 Ubuntu 或任何其他 Linux 系统上管理服务的非常简单的方法。 希望本文对你有所帮助。 @@ -167,7 +163,7 @@ via: https://itsfoss.com/start-stop-restart-services-linux/ 作者:[Sergiu][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6b7bc4de1a625a00374d34913137c2ac83f0bfaa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 28 Dec 2019 08:17:47 +0800 Subject: [PATCH 298/676] PUB @geekpi https://linux.cn/article-11722-1.html --- ...estart Services in Ubuntu and Other Linux Distributions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md (98%) diff --git a/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md b/published/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md similarity index 98% rename from translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md rename to published/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md index fab4be3462..bcb25f74e6 100644 --- a/translated/tech/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md +++ b/published/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11722-1.html) [#]: subject: (How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions) [#]: via: (https://itsfoss.com/start-stop-restart-services-linux/) [#]: author: (Sergiu https://itsfoss.com/author/sergiu/) From 2699a2ee63d19c22dd6d7dc436e8cd707be46712 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 28 Dec 2019 12:03:37 +0800 Subject: [PATCH 299/676] PRF --- ...Unix is turning 50. What does that mean.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/translated/tech/20191224 Unix is turning 50. What does that mean.md b/translated/tech/20191224 Unix is turning 50. What does that mean.md index f68c48ffd6..862eebb460 100644 --- a/translated/tech/20191224 Unix is turning 50. What does that mean.md +++ b/translated/tech/20191224 Unix is turning 50. What does that mean.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Unix is turning 50. What does that mean?) @@ -12,17 +12,17 @@ Unix 即将迎来 50 岁 Unix 时间(又称为“纪元时间epoch time”)是自 1970 年 1 月 1 日以来经过的秒数。当 Unix 即将 50 岁时,让我们看一下让内核开发人员担心的地方。 -[cbaquiran][1] +![](https://img.linux.net.cn/data/attachment/album/201912/28/120311hzghpxux1hp5t4xo.jpg) 对于 Unix 而言,2020 年是重要的一年。在这一年年初,Unix 进入 50 岁。 -尽管 Unix 的某些早期开发早于其“纪元”的正式开始,但 1970 年 1 月 1 日仍然是 POSIX 时间的零点,也是公认的 Unix 的万物之始。自那一刻算起,2020 年 1 月 1 日将是其 50 周年。 +尽管 Unix 的某些早期开发早于其“纪元”的正式开始,但 1970 年 1 月 1 日仍然是 POSIX 时间的零点,也是公认的 Unix 的万物之始。自那一刻算起,2020 年 1 月 1 日将是其 50 周年。(LCTT 译注:实际上,在 1971/11/3 出版的第一版《Unix 程序员手册》中,将 1971/1/1 作为 Unix 纪元的开始,并且一秒钟记录 60 个数,但是后来发现这样 32 位整型数字只能记录两年多,后来这个纪元被一再重新定义,改为从 1970/1/1 开始,每秒 1 个数。) ### Unix 时间与人类时间 就人类时间而言,50 年是很重要的。就 Unix 时间而言,50 年没有什么特别的。48.7 年同样重要。 -Unix(包括 Linux)系统将日期/时间值存储为自 1970-01-01 00:00:00 UTC 以来经过的秒数(32 位二进制)。要确定自该时间以来经过了几秒钟,看看 Unix 时间值是什么样子,你可以发出如下命令: +Unix(包括 Linux)系统将日期/时间值存储为自 1970-01-01 00:00:00 UTC 以来经过的秒数(32 位整型)。要确定自该时间以来经过了多少秒钟,看看 Unix 时间值是什么样子,你可以发出如下命令: ``` $ date +%s @@ -47,7 +47,7 @@ $ echo '2^31' | bc 2147483648 ``` -并且,由于 Unix 计数以 0 开头,这意味着我们有 2,147,483,648 个值,但最大的可能值为 2,147,483,647 个。Unix 日期/时间值不能超过该数字——就像汽车上的里程表可能不能超过 999,999 英里一样。加 1 该值就变为了 -2147483648。(LCTT 译注:此处原文描述有误,已修改。在达到最大值之后,即 2018/1/19 03:14:07,下 1 秒导致符号位变为 1,其余 31 位为 0,即 -2147483648,时间变为 1901/12/13 20:45:52,这就是 Y2K38 问题。) +并且,由于 Unix 计数以 0 开头,这意味着我们有 2,147,483,648 个值,但最大的可能值为 2,147,483,647 个。Unix 日期/时间值不能超过该数字——就像汽车上的里程表可能不能超过 999,999 英里一样。加 1 该值就变为了 -2147483648。(LCTT 译注:此处原文描述有误,已修改。在达到最大值之后,即 2038/1/19 03:14:07,下 1 秒导致符号位变为 1,其余 31 位为 0,即 -2147483648,时间变为 1901/12/13 20:45:52,这就是 Y2K38 问题。) ### 一年有多少秒? @@ -65,6 +65,8 @@ $ expr 24 \* 60 \* 60 \* 366 31622400 ``` +(LCTT 译注:Unix 时间将一天精确定义为 24 * 60 * 60 = 86400 秒,忽略闰秒。) + ### Unix 将如何庆祝其 50 岁生日? 2020 年 1 月 1 日中午 12:00 是纪元时间的 1577836800。这个计算有些棘手,但主要是因为我们必须适应闰年。自该纪元开始以来,我们经历了 12 个闰年,从 1972 年开始,到上一个闰年是 2016 年。而且,当我们达到 2020 年时,我们将有 38 个常规年份。 @@ -83,7 +85,7 @@ $ expr 31536000 \* 38 + 31622400 \* 12 1577836800 ``` -这种跟踪日期和时间的方式使 Unix 系统完全不受 Y2K 恐慌的影响,1999 年末人们开始担心进入 2000 年会对计算机系统造成严重破坏。但是实际遇到的问题比人们担心的少得多。实际上,只有以两位数格式存储年份的应用程序才会将年份变为 00,以表示时间倒退。尽管如此,许多应用程序开发人员还是做了很多额外的繁琐工作,以确保 2000 年到来时,他们的系统不会出现严重问题。 +这种跟踪日期和时间的方式使 Unix 系统完全不受 Y2K 恐慌的影响,1999 年末人们开始担心进入 2000 年会对计算机系统造成严重破坏,但是实际遇到的问题比人们担心的少得多。实际上,只有以两位数格式存储年份的应用程序才会将年份变为 00,以表示时间倒退。尽管如此,许多应用程序开发人员还是做了很多额外的繁琐工作,以确保 2000 年到来时,他们的系统不会出现严重问题。 ### Unix 时间何时会遇到问题? @@ -91,6 +93,8 @@ $ expr 31536000 \* 38 + 31622400 \* 12 2038 年的问题有时称为 Y2K38 问题。我们必须在 2038 年 1 月 19 日星期二之前解决这个问题。如果问题到时候仍未解决,则该日期之后的系统可能会认为是 1901 年。解决该问题的一种方法是切换为日期/时间信息的 64 位表示形式。有些人认为,即使那样,也会有比听起来更复杂的问题。无论如何,恐慌还为时过早。并且,与此同时,也许在新年前夜演唱了《Auld Lang Syne》之后,你可以向 Unix 唱《生日快乐》歌了。Unix 50 岁了,这仍然是大事。 +(LCTT 译注:建议阅读一下 Unix 时间的[维基百科][6]页面,有更多有趣和不为人知的信息。) + -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html @@ -98,7 +102,7 @@ via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-t 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -109,3 +113,4 @@ via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-t [3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) [4]: https://www.facebook.com/NetworkWorld/ [5]: https://www.linkedin.com/company/network-world +[6]: https://en.wikipedia.org/wiki/Unix_time From 19e8014531cc3918169e33400e7db51c43cfc05f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 28 Dec 2019 12:04:58 +0800 Subject: [PATCH 300/676] PUB @wxy https://linux.cn/article-11724-1.html --- .../20191224 Unix is turning 50. What does that mean.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191224 Unix is turning 50. What does that mean.md (98%) diff --git a/translated/tech/20191224 Unix is turning 50. What does that mean.md b/published/20191224 Unix is turning 50. What does that mean.md similarity index 98% rename from translated/tech/20191224 Unix is turning 50. What does that mean.md rename to published/20191224 Unix is turning 50. What does that mean.md index 862eebb460..948adc58bf 100644 --- a/translated/tech/20191224 Unix is turning 50. What does that mean.md +++ b/published/20191224 Unix is turning 50. What does that mean.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11724-1.html) [#]: subject: (Unix is turning 50. What does that mean?) [#]: via: (https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 7d6594f51dc98e31549d8d03206cf0474c812da2 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sat, 28 Dec 2019 13:46:25 +0800 Subject: [PATCH 301/676] translating --- sources/tech/20191219 Kubernetes namespaces for beginners.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191219 Kubernetes namespaces for beginners.md b/sources/tech/20191219 Kubernetes namespaces for beginners.md index 18839c3f4f..9813b3740f 100644 --- a/sources/tech/20191219 Kubernetes namespaces for beginners.md +++ b/sources/tech/20191219 Kubernetes namespaces for beginners.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1cc5b6dbc1279e743c4bd6807bcbab4b91217cc8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 28 Dec 2019 18:01:07 +0800 Subject: [PATCH 302/676] PRF --- sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md index dfa07d8896..d7f51003b6 100644 --- a/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md +++ b/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3c27ac9b5a8325237e65f578e96364fd85e492cd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 28 Dec 2019 18:50:39 +0800 Subject: [PATCH 303/676] TSL --- ... Pop-_OS vs Ubuntu- Which One is Better.md | 154 ------------------ ... Pop-_OS vs Ubuntu- Which One is Better.md | 154 ++++++++++++++++++ 2 files changed, 154 insertions(+), 154 deletions(-) delete mode 100644 sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md create mode 100644 translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md diff --git a/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md deleted file mode 100644 index d7f51003b6..0000000000 --- a/sources/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md +++ /dev/null @@ -1,154 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?) -[#]: via: (https://itsfoss.com/pop-os-vs-ubuntu/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Pop!_OS vs Ubuntu: Which One is Better? -====== - -Well, you might find it easy to pick one from the list of [best Linux distributions][1]. However, it is often confusing to compare two similar Linux distros, just like Pop!_OS vs Ubuntu. - -Interestingly, Pop!_OS is based on [Ubuntu][2]. So, what is the difference between Pop!_OS and Ubuntu? Why should you choose one over other? - -In this article, I’m going to compare Pop!_OS and Ubuntu (both of which happen to be my favorites). - -**Note:** _You might find some of the points opinionated, this article is just a reference for the comparison. With constant developments and updates to Linux distros, a lot can change over time._ - -### Comparing Ubuntu and Pop!_OS - -![Pop!_OS Vs Ubuntu][3] - -Spotting the similarity helps you distinguish other differences. So, let me start noting down some of the obvious similarities. - -Like I mentioned, Pop!_OS is a Linux distribution on top of Ubuntu. So, you get all the benefits of using Ubuntu (technically the same thing at its core) when you use Pop!_OS. - -They both ship with the [GNOME desktop environment][4] by default and hence they feature a similar user interface (UI). - -Without going into all the under-the-hood differences, I will be highlighting some important ones here. - -#### User Experience & Theming - -![Pop!_OS][5] - -A lot of users think that Pop!_OS is just Ubuntu with a different skin. - -From my experience, I’ll mention that it is not entirely true. - -Yes, they both rock [GNOME desktop environment][4] – however, Pop!_OS just feels more polished. - -In addition to the look and feel, [Ubuntu customizes the GNOME experience][6] by adding a dock and a few more tricks. You might find it better if you like a customized GNOME experience. - -But, if you prefer a pure GNOME experience, Pop!_OS gives you that by default. - -I cannot convince you enough until you try it out for yourself. But, the overall color scheme, icons, and the theme that goes on in Pop!_OS is arguably more pleasing as a superior user experience. - -It can be a subjective thing – but it is what I observed. You can also check out the video tour for Ubuntu 19.10 to check it out for yourself: - -#### Ease of Installing Third-Party Apps - -![Pop Os PPA][7] - -Ubuntu puts a lot of emphasis on Snap packages. This increases the number of application it offers. - -But there are some major issues with Snap packages. They take too much of disk space and they take a lot of time to start. - -This is why I prefer using the APT version of any application. - -Why am I telling you this? - -Because Pop!_OS has its [own official PPA][8] which is enabled by default. You’ll find some useful applications like Android Studio, TensorFlow in here. No need to download a 1 GB snap package for the Android Studio. Just use [apt-get install][9] and get done with it. - -#### Pre-installed Applications - -![Ubuntu installation slideshow][10] - -It may not be the biggest deal-breaker for some but having a lot of pre-installed apps could affect the experience and performance. Even if it does not affect the performance – some users just prefer fewer pre-installed apps. - -Pop!_OS comes bundled with fewer default apps (potentially less bloatware, if I may call it that) when compared to Ubuntu. - -Yet again, this is something subjective. If you want to have more apps pre-installed, you may consider Ubuntu over Pop!_OS. - -#### Snap Package Support - -![][11] - -For users comfortable with the snap packages, Ubuntu’s software center is a slightly better solution to Pop!_OS shop because you can have snap packages listed right in your software center. - -You cannot filter the snap packages in the software center but it will be easier to install a snap package when you notice one (look at the details for the source of the app as ‘_Snap store_‘ / ‘_Snapcraft_‘) in the Software Center. - -Pop!_OS does support snap packages as well – if you’re confused. But, you won’t find them through the Pop!_OS shop, that’s the only difference here. - -If you are not sure what a snap package is and what it does, you can check out our article on [installing snap apps on Linux][12]. - -#### Separate NVIDIA/AMD ISO File - -![ISOs][13] - -Technically, it isn’t a part of the comparison internally but it is a factor that some users care for. - -So, it is worth highlighting that Pop!_OS provides separate ISOs. One for the systems with NVIDIA graphics card and another for systems with/without AMD graphics. - -With Ubuntu 19.10, you get NVIDIA drivers on the Ubuntu ISO but there is no such thing for AMD graphics. - -#### Reliability & Issues - -Unquestionably, both the [distributions are beginner-friendly][14] and quite reliable. You might want to hold on to a Long Term Support (LTS) release if you want better reliability and fewer issues. - -When a new version of Ubuntu comes up, Pop!_OS works on it and potentially fixes the issues that users encounter on Ubuntu’s original release before making the new upgrade available. This gives them a slight edge but that’s nothing substantial because those fixes eventually reach Ubuntu. - -#### Performance - -The performance will highly depend on what you have installed and the hardware configuration you install it on. - -Unless you have a super old system, both distributions seem to perform very well. - -I’m rocking an i5-7400 processor coupled with 16 Gigs of RAM (with a GTX 1050ti Graphics Card) and I find the experience good enough on both the distros. - -Of course, you could manually do a few optimization tweaks to fit your requirements – if either of them does not work out for your hardware configuration. - -But, if you want to get your hands on a System76 laptop, Pop!_OS will prove to be [the Apple of Linux space][15] because Pop!_OS has been tailored for their hardware, unlike Ubuntu. - -#### Hardware Compatibility - -This is definitely something to consider when comparing other Linux distributions. However, in this case, there’s really no significant difference. - -You might consider Pop!_OS to constantly work with newer hardware configurations because they primarily tailor the OS for their laptops with a variety of configurations. And, it’s just an observation – not a fact. - -**Wrapping Up** - -I know it’s not easy to choose one among the two popular Linux distro without trying them out. If it’s a possibility, I’ll recommend you to give them both a try while keeping this comparison for reference. - -What’s your choice between these two? Did I miss something in the comparison? Let me know in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/pop-os-vs-ubuntu/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/best-linux-distributions/ -[2]: https://ubuntu.com/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/pop_os_vs_ubuntu.png?ssl=1 -[4]: https://www.gnome.org/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-UI.jpg?ssl=1 -[6]: https://itsfoss.com/gnome-tricks-ubuntu/ -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-ppa.jpg?ssl=1 -[8]: https://launchpad.net/~system76/+archive/ubuntu/pop/ -[9]: https://itsfoss.com/apt-get-linux-guide/ -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?resize=800%2C516&ssl=1 -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/snapcraft.jpg?ssl=1 -[12]: https://itsfoss.com/install-snap-linux/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/iso-amd-nvidia-pop-os.jpg?ssl=1 -[14]: https://itsfoss.com/best-linux-beginners/ -[15]: https://www.phoronix.com/scan.php?page=news_item&px=System76-Integrated-Vision diff --git a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md new file mode 100644 index 0000000000..3693d00e22 --- /dev/null +++ b/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?) +[#]: via: (https://itsfoss.com/pop-os-vs-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Pop!_OS 与 Ubuntu:哪个更棒? +====== + +好吧,你可能会发现从[最佳 Linux 发行版][1]列表中选择一个发行版很容易,但是,将两个类似的 Linux 发行版进行比较通常会令人困惑,就像 Pop!_OS 与 Ubuntu 一样。 + +有趣的是,Pop!\_OS 基于 [Ubuntu][2]。那么,Pop!\_OS 和 Ubuntu 之间有什么区别呢?为什么要从中选择一个呢? + +在本文中,我将比较 Pop!_OS 和 Ubuntu(两者都是我的最爱)。 + +**注意:**你可能会发现一些武断的观点,而本文只是一份比较的参考。随着 Linux 发行版的不断开发和更新,随着时间的流逝,很多事情都会改变。 + +### 比较 Ubuntu 和 Pop!_OS + +![Pop!_OS Vs Ubuntu][3] + +发现相似之处可帮助你区分其他差异之处。因此,让我们从一些明显的相似之处开始。 + +就像我提到的,Pop!\_OS 是基于 Ubuntu 之上的 Linux 发行版。因此,当你使用 Pop!_OS 时,你将获得使用 Ubuntu 的所有好处(从技术上说,其核心是一样的)。 + +它们都默认带有 [GNOME 桌面环境][4],因此它们具有相似的用户界面(UI)。 + +在不讨论所有底层差异的情况下,我将在这里重点介绍一些重要的差异。 + +#### 用户体验及主题 + +![Pop!_OS][5] + +许多用户认为 Pop!_OS 只是具有不同外观的 Ubuntu。 + +根据我的经验,我觉得这并非完全正确。 + +是的,它们俩都很喜欢 [GNOME 桌面环境][4] —— 但是,Pop!_OS 让人感觉更加优美。 + +除了外观之外,[Ubuntu 还通过添加程序坞和其他一些小花巧来定制了 GNOME 的体验][6]。如果你喜欢定制的 GNOME 体验,可能会发现它更好。 + +但是,如果你更喜欢纯粹的 GNOME 体验,默认情况下 Pop!_OS 会为你提供。 + +在你亲自尝试之前,我无法说服你。但是,Pop!_OS 中的总体配色方案、图标和主题可以说是令人愉悦的高级用户体验。 + +这可能是一个主观的事情,但这是我所观察到的。你还可以查看 Ubuntu 19.10 的视频教程,亲自感受一下。 + +#### 易于安装第三方应用 + +![Pop Os PPA][7] + +Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数量。 + +但是 Snap 软件包存在一些重要的问题。它们占用了过多的磁盘空间,并且启动要花费大量的时间。 + +这就是为什么我更喜欢使用应用程序的 APT 版本的原因。 + +我为什么要说这个呢? + +因为 Pop!_OS 具有其[自己的官方 PPA][8],并在默认情况下已启用。你会在此处找到一些有用的应用程序,例如 Android Studio、TensorFlow。无需下载 Android Studio 的 1GB 大的 Snap 程序包。只需使用 [apt-get install][9]就可以了。 + +#### 预装应用 + +![Ubuntu installation slideshow][10] + +对于某些人来说,它可能不是最大的问题,但是拥有大量预安装的应用程序可能会影响体验和性能。即使不影响性能,某些用户也只喜欢较少的预装应用程序。 + +与 Ubuntu 相比,Pop!_OS 捆绑了更少的默认应用程序(潜在地减少了胖软件)。 + +再一次提醒,这是主观的看法。如果你希望预安装更多应用程序,则可以考虑使用 Ubuntu 而不是 Pop!_OS。 + +#### Snap 软件包支持 + +![][11] + +对于熟悉 Snap 程序包的用户来说,Ubuntu 的软件中心是比 Pop!_OS 商店更好的解决方案,因为你可以在软件中心中列出快照程序包。 + +你无法在软件中心中过滤快照包,但是当你在软件中心中发现一个 Snap 包(查看应用程序来源的详细信息为“ Snap store ”/“Snapcraft”)时安装它就更容易了。 + +如果你感到困惑,Pop!\_OS 也确实支持快照包。但是,你不会在 Pop!_OS 商店中找到它们,这是唯一的区别。 + +如果不确定什么是 Snap 软件包及其功能,可以查看我们的文章[在 Linux 上安装 Snap 应用][12]。 + +#### 单独的 NVIDIA/AMD ISO 文件 + +![ISOs][13] + +从技术上讲,它不是内部比较的一部分,而是某些用户关心的一个因素。 + +因此,值得强调的是 Pop!_OS 提供了单独的 ISO。一个用于带 NVIDIA 显卡的系统,另一个用于带/不带 AMD 显卡的系统。 + +使用 Ubuntu 19.10,你可以在 Ubuntu ISO 上获得 NVIDIA 驱动程序,但 AMD 显卡没有这个。 + +#### 可靠性与问题 + +毫无疑问,这两个[发行版都适合初学者][14],并且相当可靠。如果你想要更好的可靠性和更少的问题,则可能希望一直用长期支持(LTS)版本。 + +当出现新版本的 Ubuntu 时,Pop!_OS 将在其上开发,并有可能解决用户在 Ubuntu 原始发行版上遇到的问题,然后再进行新的升级。这给他们带来了一点优势,但这没什么实质性的不同,因为这些修复最终都可以运用于 Ubuntu。 + +#### 性能 + +性能将高度取决于你所安装的内容以及所安装的硬件配置。 + +除非你有一个超级旧的系统,否则这两个发行版似乎都表现良好。 + +我的机器是 i5-7400 处理器和 16GB 的 RAM(带有 GTX 1050ti 显卡),我发现两种发行版上的体验都足够好。 + +当然,你可以手动进行一些优化调整以满足要求——无论它们中的哪个不满足你的硬件配置。 + +但是,如果你想使用 System76 笔记本电脑,那么 Pop!\_OS 将可以证明自己是 [Linux 领域的苹果][15],因为 Pop!_OS 是针对其硬件量身定制的,与 Ubuntu 有所不同。 + +#### 硬件兼容性 + +在比较其他 Linux 发行版时,这绝对是要考虑的事情。但是,在这种情况下,实际上并没有太大的区别。 + +你可能会考虑 Pop!_OS 一直在使用较新的硬件配置,因为他们主要是为他们的笔记本电脑量身定制具有各种配置的 OS。而且,这只是一个观察,而不是事实。 + +### 结语 + +我知道在不亲自尝试的情况下从两个流行的 Linux 发行版中选择一个并不容易。如果可能的话,我建议你在进行比较的同时尝试两者,以供参考。 + +你在这两者之间有何选择?我在比较中错过了什么吗?在下面的评论中让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pop-os-vs-ubuntu/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-distributions/ +[2]: https://ubuntu.com/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/pop_os_vs_ubuntu.png?ssl=1 +[4]: https://www.gnome.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-UI.jpg?ssl=1 +[6]: https://itsfoss.com/gnome-tricks-ubuntu/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-ppa.jpg?ssl=1 +[8]: https://launchpad.net/~system76/+archive/ubuntu/pop/ +[9]: https://itsfoss.com/apt-get-linux-guide/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?resize=800%2C516&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/snapcraft.jpg?ssl=1 +[12]: https://itsfoss.com/install-snap-linux/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/iso-amd-nvidia-pop-os.jpg?ssl=1 +[14]: https://itsfoss.com/best-linux-beginners/ +[15]: https://www.phoronix.com/scan.php?page=news_item&px=System76-Integrated-Vision From cfec9bfa5b459aa4deccc4410a774a4e06d2b3b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Sat, 28 Dec 2019 19:16:55 +0800 Subject: [PATCH 304/676] Translated --- ...on Ubuntu and Other Linux Distributions.md | 127 ------------------ ...on Ubuntu and Other Linux Distributions.md | 127 ++++++++++++++++++ 2 files changed, 127 insertions(+), 127 deletions(-) delete mode 100644 sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md create mode 100644 translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md b/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md deleted file mode 100644 index 870ec17f6b..0000000000 --- a/sources/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md +++ /dev/null @@ -1,127 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Update Grub on Ubuntu and Other Linux Distributions) -[#]: via: (https://itsfoss.com/update-grub/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Update Grub on Ubuntu and Other Linux Distributions -====== - -In this tutorial, you’ll learn to update grub on Ubuntu or any other Linux distribution. You’ll also learn a thing or two about how this grub update process works. - -### How to update grub - -Ubuntu and many other Linux distributions provide a handy command line utility called update-grub. - -To update grub, all you have to do is to run this command in the terminal with sudo. - -``` -sudo update-grub -``` - -You should see an output like this: - -``` -[email protected]:~$ sudo update-grub -[sudo] password for abhishek: -Sourcing file `/etc/default/grub' -Generating grub configuration file ... -Found linux image: /boot/vmlinuz-5.0.0-37-generic -Found initrd image: /boot/initrd.img-5.0.0-37-generic -Found linux image: /boot/vmlinuz-5.0.0-36-generic -Found initrd image: /boot/initrd.img-5.0.0-36-generic -Found linux image: /boot/vmlinuz-5.0.0-31-generic -Found initrd image: /boot/initrd.img-5.0.0-31-generic -Found Ubuntu 19.10 (19.10) on /dev/sda4 -Found MX 19 patito feo (19) on /dev/sdb1 -Adding boot menu entry for EFI firmware configuration -done -``` - -You may see a similar command called update-grub2. No need to be alarmed or confused between update-grub and update-grub2. Both of these commands do the same action. - -Around ten years ago, when grub2 was just introduced, update-grub2 command was also introduced. Today, update-grub2 is just a symbolic link to update-grub and both update grub2 configuration (because grub2 is the default). - -#### Can’t find update-grub command? Here’s what to do in that case - -It’s possible that your Linux distribution might not have update-grub command available. - -What do you do in that case? How do you update grub on such a Linux distribution? - -There is no need to panic. The update-grub command is simply a stub for running ‘grub-mkconfig -o /boot/grub/grub.cfg’ to generate grub2 config file. - -Which means that you can update grub with the following command on any Linux distribution: - -``` -sudo grub-mkconfig -o /boot/grub/grub.cfg -``` - -Of course, remembering update-grub command is a lot easier than the above command and this is the reason why it was created in the first place. - -### How does update-grub work? - -When you install a Linux distribution, it (usually) asks you to install the [grub boot loader][1]. - -Part of grub is installed on the MBR/ESP partition. Rest of the grub lies in /boo/grub directory of the Linux distributions. - -As per its [man page][2], update-grub works by looking into the /boot directory. All the files starting with [vmlinuz-][3] will be treated as kernels and they will get a grub menu entry. It will also add initrd lines for [ramdisk][4] images found with the same version as kernels found. - -It also looks into all disk partitions for other operating systems with [os-prober][5]. If it finds other operating systems, it adds them to the grub menu. - -![Representational image of Grub Menu][6] - -### Why would you need to update grub? - -There could be a number of scenarios when you need to update grub. - -Suppose you changed the grub config file (/etc/default/grub) to [change the default boot order][7] or reduce the default boot time. Your changes won’t take into effect unless you update the grub. - -Another scenario is when you have multiple Linux distributions installed on the same system. - -For example, on my Intel NUC, I have two disks. The first disk had Ubuntu 19.10 and then I installed Ubuntu 18.04 on it. The second OS (Ubuntu 18.04) also installed its own grub and now the grub screen is controlled by Ubuntu 18.04 grub. - -On the second disk, I installed MX Linux but I didn’t install grub this time. I want the existing grub (controlled by Ubuntu 18.04) to handle all the OS entries. - -Now, in this scenario, the grub on Ubuntu 18.04 needs to be updated so that it can see [MX Linux][8]. - -![][9] - -As you can see in the image above, when I update the grub, it finds various Linux kernels installed on 18.04 along with Ubuntu 19.10 and MX Linux on different partition. - -If I want MX Linux to control the grub, I can install grub on MX Linux with [grub-install][10] command and then the grub on MX Linux will start controlling the grub screen. You get the gist, right? - -Using a GUI tool like [Grub Customizer][11] is a simpler way to make changes in grub. - -**In the end…** - -Initially, I had intended to keep it a short article as a quick tip. But then I thought of explaining a few things associated with it so that (relatively) new Linux users could learn more than just a simple command. - -Did you like it? Do you have some questions or suggestions? Please feel free to leave a comment. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/update-grub/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/GNU_GRUB -[2]: https://manpages.debian.org/testing/grub-legacy/update-grub.8.en.html -[3]: https://www.ibm.com/developerworks/community/blogs/mhhaque/entry/anatomy_of_the_initrd_and_vmlinuz?lang=en -[4]: https://en.wikipedia.org/wiki/Initial_ramdisk -[5]: https://packages.debian.org/sid/utils/os-prober -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/grub_screen.png?ssl=1 -[7]: https://itsfoss.com/grub-customizer-ubuntu/ -[8]: https://mxlinux.org/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/update_grub.png?ssl=1 -[10]: https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html -[11]: https://itsfoss.com/customize-grub-linux/ diff --git a/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md b/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..25c811519d --- /dev/null +++ b/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Update Grub on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/update-grub/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 和其它 Linux 发行版上更新 Grub +====== + +在这篇文章中,你将学习在 Ubuntu 或任何其它 Linux 发行版上更新 grub 。你也将学习一个或两个关于如何更新这个 grub 过程的工作的事情。 + +### 如何更新 grub + +Ubuntu 和很多其它的 Linux 发行版提供一个易使用的称为 update-grub 命令行实用程序。 + +为更新 grub ,你所要的全部工作就是使用 sudo 在终端中运行这个命令。 + +``` +sudo update-grub +``` + +你应该看到一个像这样的输出: + +``` +[email protected]:~$ sudo update-grub +[sudo] password for abhishek: +Sourcing file `/etc/default/grub' +Generating grub configuration file ... +Found linux image: /boot/vmlinuz-5.0.0-37-generic +Found initrd image: /boot/initrd.img-5.0.0-37-generic +Found linux image: /boot/vmlinuz-5.0.0-36-generic +Found initrd image: /boot/initrd.img-5.0.0-36-generic +Found linux image: /boot/vmlinuz-5.0.0-31-generic +Found initrd image: /boot/initrd.img-5.0.0-31-generic +Found Ubuntu 19.10 (19.10) on /dev/sda4 +Found MX 19 patito feo (19) on /dev/sdb1 +Adding boot menu entry for EFI firmware configuration +done +``` + +你可能看到一个类似的称为 update-grub2 的命令。不需要在 update-grub 和 update-grub2 之间感到害怕或不知所措。这两个命令执行相同的动作。 + +大约在10年前,当 grub2 刚刚被引进时,update-grub2 命令也被引进。现在,update-grub2 只是一个链接到 update-grub 的符号,它们都更新 grub2 配置(因为 grub2 是默认的)。 + +#### 不能找到 update-grub 命令?这里是在这种情况下该做什么 + +它可能是,你的 Linux 发行版可能没有可用的 update-grub 命令。 + +在这种情况下你该做什么?你如何在这样一个 Linux 发行版上更新 grub ? + +在这里不需要惊慌。update-grub 命令只是一个存根,用于运行 ‘grub-mkconfig -o /boot/grub/grub.cfg’ 来生成 grub2 配置文件。 + +这意味着你可以在任意 Linux 发行版上使用下面的命令更新 grub : + +``` +sudo grub-mkconfig -o /boot/grub/grub.cfg +``` + +当然,记住 update-grub 命令比上面的命令容易很多,这是为什么它在一开始被创建的原因。 + +### update-grub 是如何工作的? + +当你安装一个 Linux 发行版时,它(通常)要求你安装 [grub 启动引导程序][1]。 + +grub 的一部分安装在 MBR/ESP 分区上。grub 的剩余部分保留在 Linux 发行版的 /boo/grub 目录中。 + +依据它的 [man 页面][2],update-grub 通过查找 /boot 目录来工作。所有以 [vmlinuz-][3] 开头的文件将被作为内核来对待,并且它们将得到一个 grub 菜单项。它也将为与所找到内核版本相同的 [ramdisk][4] 镜像添加 initrd 行。 + +它也使用 [os-prober][5] 为其它操作系统查找所有磁盘分区。如果找到其它操作系统,它添加它们到 grub 菜单。 + +![Representational image of Grub Menu][6] + +### 为什么你需要更新 grub ? + +当你需要更新 grub 时,可能有很多方案。 + +假设你更改 grub 配置文件 (/etc/default/grub) 为 [更改默认启动顺序][7] 或减少默认启动时间。除非你更新 grub ,否则你的更改将不会生效。 + +另一种情况是,你在同一个电脑系统上安装多个 Linux 发行。 + +例如,在我的 Intel NUC 上,我有两个磁盘。第一个磁盘有 Ubuntu 19.10 ,并且我在其上面安装了 Ubuntu 18.04 。第二个操作系统 (Ubuntu 18.04) 也安装其自己的 grub ,现在 grub 启动屏幕由 Ubuntu 18.04 grub 控制。 + +在第二个磁盘上,我安装了 MX Linux ,但是这次我没有安装 grub 。我希望现有的 grub (由 Ubuntu 18.04 控制) 来处理所有的操作系统项目。 + +现在,在这种情况中,在 Ubuntu 18.04 上的 grub 需要更新,以便它能够看到 [MX Linux][8] 。 + +![][9] + +如上图所示,当我更新 grub 时,它在 18.04 上找到很多安装的 Linux 内核, 以及在不同的分区上 Ubntu 19.10 和 MX Linux 。 + +如果你想 MX Linux 控制 grub ,我可以使用 [grub-install][10] 命令来在 MX Linux 上安装 grub,然后在 MX Linux 上的 grub 将开始控制 grub 启动屏幕。你已经明白这点,对吧? + +Using a GUI tool like使用一个像 [Grub Customizer][11] 的 GUI 工具是在 grub 中进行更改的一种简单的方法。 + +**最后…** + +最初,我打算保持它为一篇短文作为一种快速提示。但是后来我想解释一些与之相关的东西,以便(相对地)新的 Linux 用户能够学到更多,而不仅仅是一个简单命令。 + +你喜欢它吗?你有一些问题或建议吗?请随意发表评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/update-grub/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/GNU_GRUB +[2]: https://manpages.debian.org/testing/grub-legacy/update-grub.8.en.html +[3]: https://www.ibm.com/developerworks/community/blogs/mhhaque/entry/anatomy_of_the_initrd_and_vmlinuz?lang=en +[4]: https://en.wikipedia.org/wiki/Initial_ramdisk +[5]: https://packages.debian.org/sid/utils/os-prober +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/grub_screen.png?ssl=1 +[7]: https://itsfoss.com/grub-customizer-ubuntu/ +[8]: https://mxlinux.org/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/update_grub.png?ssl=1 +[10]: https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html +[11]: https://itsfoss.com/customize-grub-linux/ From 52e259ed9070b8d42ecbda3388f188b9f072511d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 29 Dec 2019 00:53:49 +0800 Subject: [PATCH 305/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191228=20Most-r?= =?UTF-8?q?ead=20open=20source=20news=20stories=20of=202019?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191228 Most-read open source news stories of 2019.md --- ...t-read open source news stories of 2019.md | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 sources/tech/20191228 Most-read open source news stories of 2019.md diff --git a/sources/tech/20191228 Most-read open source news stories of 2019.md b/sources/tech/20191228 Most-read open source news stories of 2019.md new file mode 100644 index 0000000000..6c5955bc84 --- /dev/null +++ b/sources/tech/20191228 Most-read open source news stories of 2019.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Most-read open source news stories of 2019) +[#]: via: (https://opensource.com/article/19/12/open-source-news) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Most-read open source news stories of 2019 +====== +Here are some of the big news items from the year and a look at the +future of open source. +![Radio wave.][1] + +A great deal happened in the world of open source in 2019. Once upon a time, you would have been hard-pressed to find news about Linux, free software, and open source software outside of a small handful of specialist publications. Today, though, news about open source is everywhere; the online edition of Forbes even has its own [Linux columnist][2]. + +We regularly round up many of the most interesting and topical news articles in [fortnightly articles][3]. Of those, we’ve compiled the top 10 most read (by you, our readers) stories we curated during 2019. + +### Google's trusted hardware project + +Many of us take the security of our software seriously but, at the same time, take the security of our hardware for granted. How do we know if the hardware we’re using is secure and trusted? To help ensure that it is, Google [announced OpenTitan][4], a secure, open source chip design project. The project builds upon a chip that Google developed called Titan, and the search giant has recruited several hardware manufacturers to join this initiative. + +### Database makers embrace open source licenses + +Over the last 18 months or so, several open source database firms moved to less open licenses for the software they develop in an attempt to stay competitive in a tough market. Cloudera and YugaByte, however, went in the opposite direction in 2019. Cloudera put the proprietary portions of its products under the umbrella of the [AGPL and Apache 2.0 licenses][5], while YugaByte [announced it was adopting][6] the Apache 2.0 license for its wares. + +### GNOME and KDE agree to work together + +It’s always great when two rivals put aside their differences to work for a greater good; especially when that greater good is the further advancement of the Linux desktop. That’s what happened when the GNOME Foundation and KDE [announced they were going to work together][7]. The goal is to bring the GNOME and KDE communities together "to build an application ecosystem that transcends individual distros and broadens the market for everyone." + +### System76 announces Linux laptops with Coreboot firmware + +While there are several small companies selling Linux-powered computers, not all components of those computers are open source. That’s especially true for their firmware. Computer maker System76 is trying to change that. The company announced that it will [ship two of its most popular laptops][8] with the lightweight Coreboot open source firmware. According to Forbes Online, by adopting Coreboot (which helps computers start faster) System76 is taking another step in "the company’s steady march toward offering open source software and hardware." + +### Open source platform spans the globe to help local communities + +Open source knows no borders. Proof of that is at the St. Francis Neighborhood Center in West Baltimore, which [adopted the Lutèce platform][9] to help deliver its programs and services. While Lutèce was developed in France and runs services in French cities like Paris, Lyon, and Marseille, the implementation in West Baltimore is the first time the platform has been used outside of its country of origin. + +### Australian government uses open source to build notification platform + +When Australia’s Digital Transformation Agency (DTA) need to quickly deploy an email and text message notification system, it turned to software developed by the Government Digital Service in the UK. The result was a platform called Notify. Using existing software enabled the DTA to [get the platform up and running][10] in eight weeks. Notify is now being used by over 100 government departments across the country. + +### Dutch city to further embrace open source + +Like many cities in Europe, Nijmegen in the eastern part of the Netherlands has long been an advocate of using open source in government. Unfortunately, the city’s procurement processes still favored proprietary solutions. That’s starting to change, thanks to a [resolution passed in 2019][11] which requires the city to "deploy both the mandatory and the recommended open standards listed by the Dutch Standardisation Forum." The municipal government hopes that the resolution will spur wider use of open source software to avoid vendor lock-in. + +### Acquia buys Mautic + +Acquia, the company behind the popular open source content management system Drupal, took a big step in its ambition to create the first "open digital experience platform" by acquiring open source marketing automation firm Mautic. The idea behind the acquisition is to give companies that use Acquia’s offerings "the freedom they need to own their digital destiny without the constraint of vendor lock-in." + +### Mozilla Labs makes a return + +A few years ago, Mozilla had seemed to abandoned Mozilla Labs. Labs, you might remember, was the home of various beta features for Firefox that users could test drive. In early 2019, Mozilla [brought Labs back][12] with more experimental goodness. The new edition of Mozilla Labs is aimed at sharing ways to expand the capabilities of Firefox. It also showcases technologies that make it easier for anyone interact with virtual reality and the Internet of Things. + +### Making it easier to announce software's end of life + +Like many things, older versions of software have a use-by date - a date after which it won’t be supported or be compatible with its supporting software or operating systems. That information often gets buried on a project’s website. That’s where [endoflife.date][13] comes in. It’s a repository of information that "aims to overcome the complexity of end of life (EOL) announcements for software." + +### Predictions for 2020 + +What Linux and open source projects and news do you predict being big stories in 2020? Let us know about them in the comments, or send a story proposal to [open@opensource.com][14]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/open-source-news + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/news-radio-wave-lead_520.png?itok=J86HG1Vg (Radio wave.) +[2]: https://opensource.com/article/19/9/found-linux-video-gaming +[3]: https://opensource.com/tags/news +[4]: https://techcrunch.com/2019/11/05/google-opentitan-secure-chip/ +[5]: https://www.cbronline.com/news/cloudera-open-source +[6]: http://www.dbta.com/Editorial/News-Flashes/YugaByte-Becomes-100-percent-Open-Source-Under-Apache-20-License-133083.aspx +[7]: https://www.zdnet.com/article/gnome-and-kde-work-together-on-the-linux-desktop/ +[8]: https://www.forbes.com/sites/jasonevangelho/2019/10/10/system76-will-begin-shipping-2-linux-laptops-with-coreboot-based-open-source-firmware/#3c5fb7294e64 +[9]: https://technical.ly/baltimore/2019/04/19/paris-lutece-open-source-platform-city-services-west-baltimore-community-center-st-francis/ +[10]: https://www.zdnet.com/article/open-source-notify-gov-au-delivered-in-eight-weeks-for-a-cost-of-au150k/ +[11]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/not-having-choose +[12]: https://betanews.com/2018/12/28/mozilla-labs-is-back/ +[13]: https://endoflife.date/ +[14]: mailto:open@opensource.com From 553938366dd2747aba247815acdc729262a8b5f6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 10:37:23 +0800 Subject: [PATCH 306/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @XLCYun 许久不见啊! --- .../20190711 DevOps for introverted people.md | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/translated/tech/20190711 DevOps for introverted people.md b/translated/tech/20190711 DevOps for introverted people.md index 8422b1fb87..5873f488b9 100644 --- a/translated/tech/20190711 DevOps for introverted people.md +++ b/translated/tech/20190711 DevOps for introverted people.md @@ -1,19 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (XLCYun) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (DevOps for introverted people) [#]: via: (https://opensource.com/article/19/7/devops-introverted-people) -[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) 内向者的 DevOps ====== -我们邀请 Opensource.com 的 DevOps 团队,希望他们能够谈一谈作为 DevOps 内向者的休验,同时给 DevOps 外向者一些建议。下面是他们的回答。 -![问答][1] +> 我们邀请 Opensource.com 的 DevOps 团队,希望他们能够谈一谈作为 DevOps 内向者的休验,同时给 DevOps 外向者一些建议。下面是他们的回答。 -我们请求我们的 [DevOps 团队][2] 谈一谈他们作为一个内向者的体验,并给外向者们一些建议。但是在我们开始了解他们的回答之前,让我们先来定义一下这些词汇。 +![](https://img.linux.net.cn/data/attachment/album/201912/29/103642jmzt6t6mggjjx5yt.jpg) + +我们邀请我们的 [DevOps 团队][2] 谈一谈他们作为一个内向者的体验,并给外向者们一些建议。但是在我们开始了解他们的回答之前,让我们先来定义一下这些词汇。 ### “内向者”是什么意思? @@ -25,27 +26,27 @@ ### DevOps 技术主管可以通过哪些方式来让内向者感觉他们是团队的一部分并且愿意分享他们的想法? -“每个人都会不大一样,所以观察敏锐就很重要了。从 GitLab 过来的一个人告诉我,他们的哲学就是如果他们没有提供任何意见,那么他们就是被排除在外的。如果有人在一个会议上没有提供任何的意见,那就想办法让他们加入进来。**当我知道一个内向者对我们将要讨论的会议论题感兴趣的时候,我会提前请他写一些书面文本。有非常多的会议其实是可以避免的,只要通过把讨论放到 Slack 或者 GitLab 上就行了,内向者会更愿意参与进来**。在站立会议中,每个人都会交代最新的进展,在这个环境下,内向者表现得很好。有时候我们在其实会议上会重复做一些事情,仅仅是为了保证每个人都有时间发言。我同时也会鼓励内向者在工作小组或者社区小组面前发言,以此来锻炼他们的这些技能。—— 丹·巴克 +“每个人都会不大一样,所以观察敏锐就很重要了。从 GitLab 过来的一个人告诉我,他们的哲学就是如果他们没有提供任何意见,那么他们就是被排除在外的。如果有人在一个会议上没有提供任何的意见,那就想办法让他们加入进来。**当我知道一个内向者对我们将要讨论的会议论题感兴趣的时候,我会提前请他写一些书面文本。有非常多的会议其实是可以避免的,只要通过把讨论放到 Slack 或者 GitLab 上就行了,内向者会更愿意参与进来**。在站立会议中,每个人都会交代最新的进展,在这个环境下,内向者表现得很好。有时候我们在其实会议上会重复做一些事情,仅仅是为了保证每个人都有时间发言。我同时也会鼓励内向者在工作小组或者社区小组面前发言,以此来锻炼他们的这些技能。”—— 丹·巴克 -“**我觉得别人对我做的最好的事情,就是他们保证了当重大问题来临的时候,我拥有必要的技能去回答它**。彼时,我作为一名非常年轻的入伍空军的一员,我需要给我们部队的高级领导做状态简报的汇报。我必须在任何时候都有一些可用的数据点,以及在实现我们确立的目标的过程中,产生延误以及偏差的背后的原因。那样的经历推动着我从一个“幕后人员”逐渐变得更加愿意和别人分享自己的观点和想法。 +“**我觉得别人对我做的最好的事情,就是他们保证了当重大问题来临的时候,我拥有必要的技能去回答它**。彼时,我作为一名非常年轻的入伍空军的一员,我需要给我们部队的高级领导做状态简报的汇报。我必须在任何时候都有一些可用的数据点,以及在实现我们确立的目标的过程中,产生延误以及偏差的背后的原因。那样的经历推动着我从一个‘幕后人员’逐渐变得更加愿意和别人分享自己的观点和想法。”—— 克里斯·肖特 -“**通过文化去领导。为你的同僚一起设计和尝试仪式。**你可以为给你的小组或团队设计一个小的每周仪式,甚至给你的部门或组织设计一个年度的大仪式。它的意义在于去尝试一些事物,并观察你在其中的领导角色。去找到你们文化当中的代沟以及对立。回顾团队的信仰和行为。你能从哪里观察到对立?你们的文化中缺失了什么?从一个小陈述开始‘我从 X 和 Y 之间看到了对立’,或者‘我的团队缺少了 Z’。接着,将代沟与对立转换为问题:写下三个‘我们如何能……(How might we's, HMWs)’。”——凯瑟琳·路易斯 +“**通过文化去领导。为你的同僚一起设计和尝试仪式。**你可以为给你的小组或团队设计一个小的每周仪式,甚至给你的部门或组织设计一个年度的大仪式。它的意义在于去尝试一些事物,并观察你在其中的领导角色。去找到你们文化当中的代沟以及对立。回顾团队的信仰和行为。你能从哪里观察到对立?你们的文化中缺失了什么?从一个小陈述开始‘我从 X 和 Y 之间看到了对立’,或者‘我的团队缺少了 Z’。接着,将代沟与对立转换为问题:写下三个‘我们如何能……(How might we's, HMWs)’。”—— 凯瑟琳·路易斯 “内向者不是一个不同的群体,他们要么是在分享他们的想法之前想得太多或等得太久的一些人,要么就是一些根本不知道发生了什么的人。我就是第一种,我想太多了,有时候还担心我的意见会被其他人嘲笑,或者没有什么意思,或者想偏了。形成那样的思维方式很难,但它同时也在吞噬着我学习更好事物的机会。有一次,我们团队在讨论一个实现问题。我当时的老大一次又一次地问我,为什么我没有作为团队中更具经验的人参与进来,然后我就(集齐了全宇宙的力量之后)开口说我想说的大家都已经说过了。他说,有时候我可以重复说一次,事情纷繁,如果你能够重复一遍你的想法,即使它已经被讨论过了,也会大有裨益。好吧,虽然它不是一种特别信服的方式,但是我知道了至少有人想听听我怎么说,它给了我一点信心。 -“现在,我所使用的让团队中的人发言的方法是**我经常向内向的人求助,即使我知道解决方法,并且在团队会议和讨论中感谢他们来建立他们的自信心,通过给他们时间让他们一点一点的从他们寡言的本性中走出来,从而跟团队分享很多的知识**。他们在外面的世界中可能仍然会有一点点孤立,但是在团队里面,有些会成为我们可以信赖的人。——阿布希什克·塔姆拉卡尔 +“现在,我所使用的让团队中的人发言的方法是**我经常向内向的人求助,即使我知道解决方法,并且在团队会议和讨论中感谢他们来建立他们的自信心,通过给他们时间让他们一点一点的从他们寡言的本性中走出来,从而跟团队分享很多的知识**。他们在外面的世界中可能仍然会有一点点孤立,但是在团队里面,有些会成为我们可以信赖的人。”—— 阿布希什克·塔姆拉卡尔 -“我给参加会议的内向者的建议是,找一个同样要参加会议的朋友或者同事,这样到时你就会有人可以跟你一起舒服地交谈,在会议开始之前,提前跟其他的与会者(朋友,行业联系人,前同事等等)约着见个面或者吃顿饭,**要注意你的疲劳程度,并且照顾好自己**:如果你需要重新恢复能量,就跳过那些社交或者夜晚的活动,在事后回顾中记录一下自己的感受。”——伊丽莎白·约瑟夫 +“我给参加会议的内向者的建议是,找一个同样要参加会议的朋友或者同事,这样到时你就会有人可以跟你一起舒服地交谈,在会议开始之前,提前跟其他的与会者(朋友、行业联系人、前同事等等)约着见个面或者吃顿饭,**要注意你的疲劳程度,并且照顾好自己**:如果你需要重新恢复能量,就跳过那些社交或者夜晚的活动,在事后回顾中记录一下自己的感受。”—— 伊丽莎白·约瑟夫 ### 和一个内向者倾向的同事一起工作时,有什么提高生产效率的小建议? -“在保证质量时,生产效率会越来越具备挑战性。在大多数时候,工作中的一个小憩或者轻松随意的交谈,可能正是我们的创造性活动中需要的一个火花。再说一次,我发现当你的团队中有内向者时, Slack 和 Github 会是一个非常有用的用于交换想法以及和其他人互动的媒介。**我同时也发现,结对编程对于大部分的内向者也非常有用,虽然一对一的交流对于他们来说,并不像交税那么频繁,但是生产质量和效率的提升却是重大的**。但是,当一个内向者在独自工作的时间,团队中的所有人都不应该去打断他们。最好是发个邮件,或者使用没有那么强的侵入性的媒介。——丹·巴克 +“在保证质量时,生产效率会越来越具备挑战性。在大多数时候,工作中的一个小憩或者轻松随意的交谈,可能正是我们的创造性活动中需要的一个火花。再说一次,我发现当你的团队中有内向者时, Slack 和 Github 会是一个非常有用的用于交换想法以及和其他人互动的媒介。**我同时也发现,结对编程对于大部分的内向者也非常有用,虽然一对一的交流对于他们来说,并不像交税那么频繁,但是生产质量和效率的提升却是重大的**。但是,当一个内向者在独自工作的时间,团队中的所有人都不应该去打断他们。最好是发个邮件,或者使用没有那么强的侵入性的媒介。”—— 丹·巴克 -“给他们趁手的工具,让他们工作并归档他们的工作。**让他们能够在他们的工作上做到最好**。要足够经常地去检查一下,保证他们没有走偏路,但是要记住,相比外向者而言,这样做是更大的一种让人分心的困扰。 +“给他们趁手的工具,让他们工作并归档他们的工作。**让他们能够在他们的工作上做到最好**。要足够经常地去检查一下,保证他们没有走偏路,但是要记住,相比外向者而言,这样做是更大的一种让人分心的困扰。”—— 克里斯·肖特 -“**当我低着头的时候,不要打断我。真的,别打断我**!当我沉浸在某件事物中时,这样做会造成我至少需要花费两个小时,才能让我的大脑重新回到之前的状态。感觉很痛苦。真的。你可以发个邮件让我去有白板的地方。然后从客户的角度而不是你的角度——通过画图的方式——分享下有什么问题。要知道,可能同时会有十几个客户问题缠绕在我的脑海中,如果你的问题听起来就是“这样子做会让我在我的领导面前显得很好”的那一类问题,那么相比我脑袋中已经有的真正的客户问题而言,它不会得到更多的关注的。画个图,给我点时间思考。当我准备分享我的看法的时候,保证有多支马克笔可以使用。准备好接受你对问题的假设有可能完全是错误的。”——凯瑟琳·路易斯 +“**当我低着头的时候,不要打断我。真的,别打断我!**当我沉浸在某件事物中时,这样做会造成我至少需要花费两个小时,才能让我的大脑重新回到之前的状态。感觉很痛苦。真的。你可以发个邮件让我去有白板的地方。然后从客户的角度而不是你的角度——通过画图的方式——分享下有什么问题。要知道,可能同时会有十几个客户问题缠绕在我的脑海中,如果你的问题听起来就是‘这样子做会让我在我的领导面前显得很好’的那一类问题,那么相比我脑袋中已经有的真正的客户问题而言,它不会得到更多的关注的。画个图,给我点时间思考。当我准备分享我的看法的时候,保证有多支马克笔可以使用。准备好接受你对问题的假设有可能完全是错误的。”—— 凯瑟琳·路易斯 -“感谢和鼓励就是解决的方法,感谢可能不是一份工作评估,但是感谢能让人舒服地感受到自己并不仅仅是一个活着的独立实体,**因而每个人都能够感觉到自己是被倾听的,而不是被嘲笑或者低估的**。”——阿布希什克·塔姆拉卡尔 +“感谢和鼓励就是解决的方法,感谢可能不是一份工作评估,但是感谢能让人舒服地感受到自己并不仅仅是一个活着的独立实体,**因而每个人都能够感觉到自己是被倾听的,而不是被嘲笑或者低估的**。”—— 阿布希什克·塔姆拉卡尔 ### 结语 @@ -53,16 +54,16 @@ -------------------------------------------------------------------------------- -转载自: https://opensource.com/article/19/7/devops-introverted-people +via: https://opensource.com/article/19/7/devops-introverted-people 作者:[Matthew Broberg][a] 选题:[lujun9972][b] 译者:[XLCYun](https://github.com/XLCYun) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]: https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo +[a]: https://opensource.com/users/mbbroberg [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_QandAorange_520x292_0311LL.png?itok=qa3hHSou (Q and A letters) [2]: https://opensource.com/devops-team From 3a17956117e75661800d26da02b617fcd724e00f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 10:37:55 +0800 Subject: [PATCH 307/676] PUB @XLCYun https://linux.cn/article-11725-1.html --- .../20190711 DevOps for introverted people.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190711 DevOps for introverted people.md (99%) diff --git a/translated/tech/20190711 DevOps for introverted people.md b/published/20190711 DevOps for introverted people.md similarity index 99% rename from translated/tech/20190711 DevOps for introverted people.md rename to published/20190711 DevOps for introverted people.md index 5873f488b9..e18b27da4f 100644 --- a/translated/tech/20190711 DevOps for introverted people.md +++ b/published/20190711 DevOps for introverted people.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (XLCYun) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11725-1.html) [#]: subject: (DevOps for introverted people) [#]: via: (https://opensource.com/article/19/7/devops-introverted-people) [#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) From 6893ebbb01f3808c20a20880b9950338cadd1442 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 11:02:32 +0800 Subject: [PATCH 308/676] PRF @robsean --- ...on Ubuntu and Other Linux Distributions.md | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md b/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md index 25c811519d..8c8925feab 100644 --- a/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md +++ b/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Update Grub on Ubuntu and Other Linux Distributions) [#]: via: (https://itsfoss.com/update-grub/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何在 Ubuntu 和其它 Linux 发行版上更新 Grub +如何在 Ubuntu 和其它 Linux 发行版上更新 grub ====== -在这篇文章中,你将学习在 Ubuntu 或任何其它 Linux 发行版上更新 grub 。你也将学习一个或两个关于如何更新这个 grub 过程的工作的事情。 +![](https://img.linux.net.cn/data/attachment/album/201912/29/110155d51bhogs5ezp5p71.png) + +在这篇文章中,你将学习在 Ubuntu 或任何其它 Linux 发行版上更新 grub 。你也将学习一个或两个关于更新这个 grub 过程如何工作的事情。 ### 如何更新 grub -Ubuntu 和很多其它的 Linux 发行版提供一个易使用的称为 update-grub 命令行实用程序。 +Ubuntu 和很多其它的 Linux 发行版提供一个易使用的称为 `update-grub` 命令行实用程序。 -为更新 grub ,你所要的全部工作就是使用 sudo 在终端中运行这个命令。 +为更新 grub ,你所要的全部工作就是使用 `sudo` 在终端中运行这个命令。 ``` sudo update-grub @@ -41,17 +43,17 @@ Adding boot menu entry for EFI firmware configuration done ``` -你可能看到一个类似的称为 update-grub2 的命令。不需要在 update-grub 和 update-grub2 之间感到害怕或不知所措。这两个命令执行相同的动作。 +你可能看到一个类似的称为 `update-grub2` 的命令。不需要在 `update-grub` 和 `update-grub2` 之间感到害怕或不知所措。这两个命令执行相同的动作。 -大约在10年前,当 grub2 刚刚被引进时,update-grub2 命令也被引进。现在,update-grub2 只是一个链接到 update-grub 的符号,它们都更新 grub2 配置(因为 grub2 是默认的)。 +大约在 10 年前,当 grub2 刚刚被引进时,`update-grub2` 命令也被引进。现在,`update-grub2` 只是一个链接到 `update-grub` 的符号,它们都更新 grub2 配置(因为 grub2 是默认的)。 #### 不能找到 update-grub 命令?这里是在这种情况下该做什么 -它可能是,你的 Linux 发行版可能没有可用的 update-grub 命令。 +它可能是,你的 Linux 发行版可能没有可用的 `update-grub` 命令。 在这种情况下你该做什么?你如何在这样一个 Linux 发行版上更新 grub ? -在这里不需要惊慌。update-grub 命令只是一个存根,用于运行 ‘grub-mkconfig -o /boot/grub/grub.cfg’ 来生成 grub2 配置文件。 +在这里不需要惊慌。`update-grub` 命令只是一个入口,用于运行 `grub-mkconfig -o /boot/grub/grub.cfg` 来生成 grub2 配置文件。 这意味着你可以在任意 Linux 发行版上使用下面的命令更新 grub : @@ -59,15 +61,15 @@ done sudo grub-mkconfig -o /boot/grub/grub.cfg ``` -当然,记住 update-grub 命令比上面的命令容易很多,这是为什么它在一开始被创建的原因。 +当然,记住 `update-grub` 命令比上面的命令容易很多,这是为什么它在一开始被创建的原因。 ### update-grub 是如何工作的? -当你安装一个 Linux 发行版时,它(通常)要求你安装 [grub 启动引导程序][1]。 +当你安装一个 Linux 发行版时,它(通常)要求你安装 [grub 启动引导程序][1]。 -grub 的一部分安装在 MBR/ESP 分区上。grub 的剩余部分保留在 Linux 发行版的 /boo/grub 目录中。 +grub 的一部分安装在 MBR/ESP 分区上。grub 的剩余部分保留在 Linux 发行版的 `/boot/grub` 目录中。 -依据它的 [man 页面][2],update-grub 通过查找 /boot 目录来工作。所有以 [vmlinuz-][3] 开头的文件将被作为内核来对待,并且它们将得到一个 grub 菜单项。它也将为与所找到内核版本相同的 [ramdisk][4] 镜像添加 initrd 行。 +依据它的 [man 页面][2],`update-grub` 通过查找 `/boot` 目录来工作。所有以 [vmlinuz-][3] 开头的文件将被作为内核来对待,并且它们将得到一个 grub 菜单项。它也将为与所找到内核版本相同的 [ramdisk][4] 镜像添加 initrd 行。 它也使用 [os-prober][5] 为其它操作系统查找所有磁盘分区。如果找到其它操作系统,它添加它们到 grub 菜单。 @@ -75,15 +77,15 @@ grub 的一部分安装在 MBR/ESP 分区上。grub 的剩余部分保留在 Lin ### 为什么你需要更新 grub ? -当你需要更新 grub 时,可能有很多方案。 +在有很多场景下你需要更新 grub。 -假设你更改 grub 配置文件 (/etc/default/grub) 为 [更改默认启动顺序][7] 或减少默认启动时间。除非你更新 grub ,否则你的更改将不会生效。 +假设你修改 grub 配置文件(`/etc/default/grub`)以 [更改默认启动顺序][7] 或减少默认启动时间。除非你更新 grub ,否则你的修改将不会生效。 -另一种情况是,你在同一个电脑系统上安装多个 Linux 发行。 +另一种情况是,你在同一个电脑系统上安装多个 Linux 发行版。 -例如,在我的 Intel NUC 上,我有两个磁盘。第一个磁盘有 Ubuntu 19.10 ,并且我在其上面安装了 Ubuntu 18.04 。第二个操作系统 (Ubuntu 18.04) 也安装其自己的 grub ,现在 grub 启动屏幕由 Ubuntu 18.04 grub 控制。 +例如,在我的 Intel NUC 上,我有两个磁盘。第一个磁盘有 Ubuntu 19.10 ,并且我在其上面安装了 Ubuntu 18.04 。第二个操作系统(Ubuntu 18.04)安装了其自己的 grub ,现在 grub 启动屏幕由 Ubuntu 18.04 grub 控制。 -在第二个磁盘上,我安装了 MX Linux ,但是这次我没有安装 grub 。我希望现有的 grub (由 Ubuntu 18.04 控制) 来处理所有的操作系统项目。 +在第二个磁盘上,我安装了 MX Linux ,但是这次我没有安装 grub。我希望现有的 grub(由 Ubuntu 18.04 控制)来处理所有的操作系统项目。 现在,在这种情况中,在 Ubuntu 18.04 上的 grub 需要更新,以便它能够看到 [MX Linux][8] 。 @@ -91,13 +93,13 @@ grub 的一部分安装在 MBR/ESP 分区上。grub 的剩余部分保留在 Lin 如上图所示,当我更新 grub 时,它在 18.04 上找到很多安装的 Linux 内核, 以及在不同的分区上 Ubntu 19.10 和 MX Linux 。 -如果你想 MX Linux 控制 grub ,我可以使用 [grub-install][10] 命令来在 MX Linux 上安装 grub,然后在 MX Linux 上的 grub 将开始控制 grub 启动屏幕。你已经明白这点,对吧? +如果你想让 MX Linux 控制 grub ,我可以使用 [grub-install][10] 命令来在 MX Linux 上安装 grub,然后在 MX Linux 上的 grub 将开始控制 grub 启动屏幕。你已经明白这点,对吧? -Using a GUI tool like使用一个像 [Grub Customizer][11] 的 GUI 工具是在 grub 中进行更改的一种简单的方法。 +使用一个像 [Grub Customizer][11] 的 GUI 工具是在 grub 中进行更改的一种简单的方法。 -**最后…** +### 最后… -最初,我打算保持它为一篇短文作为一种快速提示。但是后来我想解释一些与之相关的东西,以便(相对地)新的 Linux 用户能够学到更多,而不仅仅是一个简单命令。 +最初,我打算保持它为一篇短文作为一种快速提示。但是后来我想解释一些与之相关的东西,以便(相对)新的 Linux 用户能够学到更多,而不仅仅是一个简单命令。 你喜欢它吗?你有一些问题或建议吗?请随意发表评论。 @@ -108,7 +110,7 @@ via: https://itsfoss.com/update-grub/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 22403789b8a59d50c516f193960e2c5ae8d31ffb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 11:03:06 +0800 Subject: [PATCH 309/676] PUB @robsean https://linux.cn/article-11726-1.html --- ... to Update Grub on Ubuntu and Other Linux Distributions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md (98%) diff --git a/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md b/published/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md similarity index 98% rename from translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md rename to published/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md index 8c8925feab..c422b4d808 100644 --- a/translated/tech/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md +++ b/published/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11726-1.html) [#]: subject: (How to Update Grub on Ubuntu and Other Linux Distributions) [#]: via: (https://itsfoss.com/update-grub/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 7c26ead27eae79daea3b2b46b71485b238d6c0a1 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sun, 29 Dec 2019 11:36:32 +0800 Subject: [PATCH 310/676] translated --- ...219 Kubernetes namespaces for beginners.md | 192 ------------------ ...219 Kubernetes namespaces for beginners.md | 189 +++++++++++++++++ 2 files changed, 189 insertions(+), 192 deletions(-) delete mode 100644 sources/tech/20191219 Kubernetes namespaces for beginners.md create mode 100644 translated/tech/20191219 Kubernetes namespaces for beginners.md diff --git a/sources/tech/20191219 Kubernetes namespaces for beginners.md b/sources/tech/20191219 Kubernetes namespaces for beginners.md deleted file mode 100644 index 9813b3740f..0000000000 --- a/sources/tech/20191219 Kubernetes namespaces for beginners.md +++ /dev/null @@ -1,192 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Kubernetes namespaces for beginners) -[#]: via: (https://opensource.com/article/19/12/kubernetes-namespaces) -[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) - -Kubernetes namespaces for beginners -====== -What is a namespace and why do you need it? -![Ship captain sailing the Kubernetes seas][1] - -What is in a Kubernetes namespace? As Shakespeare once wrote, which we call a namespace, by any other name, would still be a virtual cluster. By virtual cluster, I mean Kubernetes can offer multiple Kubernetes clusters on a single cluster, much like a virtual machine is an abstraction of its host. According to the [Kubernetes docs][2]: - -> Kubernetes supports multiple virtual clusters backed by the same physical cluster. These virtual clusters are called namespaces. - -Why do you need to use namespaces? In one word: isolation. - -Isolation has many advantages, including that it supports secure and clean environments. If you are the owner of the infrastructure and are supporting developers, isolation is fairly important. The last thing you need is someone who is unfamiliar with how your cluster is built going and changing the system configuration—and possibly disabling everyone's ability to log in. - -### The namespaces that start it all - -The first three namespaces created in a cluster are always **default**, **kube-system**, and **kube-public**. While you can technically deploy within these namespaces, I recommend leaving these for system configuration and not for your projects.  - - * **Default** is for deployments that are not given a namespace, which is a quick way to create a mess that will be hard to clean up if you do too many deployments without the proper information. I leave this alone because it serves that one purpose and has confused me on more than one occasion. - * **Kube-system** is for all things relating to, you guessed it, the Kubernetes system. Any deployments to this namespace are playing a dangerous game and can accidentally cause irreparable damage to the system itself. Yes, I have done it; I do not recommend it. - * **Kube-public** is readable by everyone, but the namespace is reserved for system usage. - - - -### Using namespaces for isolation - -I have used namespaces for isolation in a couple of ways. I use them most often to split many users' projects into separate environments. This is useful in preventing cross-project contamination since namespaces provide independent environments. Users can install multiple versions of Jenkins, for example, and their environmental variables won't collide if they are in different namespaces. - -This separation also helps with cleanup. If development groups are working on various projects that suddenly become obsolete, you can delete the namespace and remove everything in one swift movement with **kubectl delete ns <$NAMESPACENAME>**. (Please make sure it's the right namespace. I deleted the wrong one in production once, and it's not pretty.) - -Be aware that this can cause damage across teams and problems for you if you are the infrastructure owner. For example, if you create a namespace with some special, extra-secure DNS functions and the wrong person deletes it, all of your pods and their running applications will be removed with the namespace. Any use of **delete** should be reviewed by a peer (through [GitOps][3]) before hitting the cluster. - -While the official documentation suggests not using multiple namespaces [with 10 or fewer users][2], I still use them in my own cluster for architectural purposes. The cleaner the cluster, the better. - -### What admins need to know about namespaces - -For starters, namespaces cannot be nested in other namespaces. There can be only one namespace with deployments in it. You don't have to use namespaces for versioned projects, but you can always use the labels to separate versioned apps with the same name. Namespaces divide resources between users using resource quotas; for example, _this namespace can only have x_ _number_ _of nodes_. Finally, all namespaces scope down to a unique name for the resource type. - -### Namespace commands in action - -To try out the following namespace commands, you need to have [Minikube][4], [Helm][5], and the [kubectl][6] command line installed. For information about installing them, see my article [_Security scanning your DevOps pipeline_][7] or each project's homepage. I am using the most recent release of Minikube. The manual installation is fast and has consistently worked correctly the first time. - -To get your first set of namespaces: - - -``` -jess@Athena:~$ kubectl get namespace -NAME            STATUS   AGE -default         Active   5m23s -kube-public     Active   5m24s -kube-system     Active   5m24s -``` - -To create a namespace: - - -``` -jess@Athena:~$ kubectl create namespace athena -namespace/athena created -``` - -Now developers can deploy to the namespace you created; for example, here's a small and easy Helm chart: - - -``` -jess@Athena:~$ helm install teset-deploy stable/redis --namespace athena -NAME: teset-deploy -LAST DEPLOYED: Sat Nov 23 13:47:43 2019 -NAMESPACE: athena -STATUS: deployed -REVISION: 1 -TEST SUITE: None -NOTES: -** Please be patient while the chart is being deployed ** -Redis can be accessed via port 6379 on the following DNS names from within your cluster: - -teset-deploy-redis-master.athena.svc.cluster.local for read/write operations -teset-deploy-redis-slave.athena.svc.cluster.local for read-only operations -``` - -To get your password: - - -``` -`export REDIS_PASSWORD=$(kubectl get secret --namespace athena teset-deploy-redis -o jsonpath="{.data.redis-password}" | base64 --decode)` -``` - -To connect to your Redis server: - - 1. Run a Redis pod that you can use as a client: [code] kubectl run --namespace athena teset-deploy-redis-client --rm --tty -i --restart='Never' \ -        --env REDIS_PASSWORD=$REDIS_PASSWORD \ -\--image docker.io/bitnami/redis:5.0.7-debian-9-r0 -- bash -``` - 2. Connect using the Redis CLI: [code] redis-cli -h teset-deploy-redis-master -a $REDIS_PASSWORD -redis-cli -h teset-deploy-redis-slave -a $REDIS_PASSWORD -``` - - - -To connect to your database from outside the cluster: - - -``` -kubectl port-forward --namespace athena svc/teset-deploy-redis-master 6379:6379 & -redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD -``` - -Now that this deployment is out, you have a chart deployed in your namespace named **test-deploy**. - -To look at what pods are in your namespace: - - -``` -jess@Athena:~$ kubectl get pods --namespace athena -NAME                            READY   STATUS  RESTARTS   AGE -teset-deploy-redis-master-0   1/1       Running   0             2m38s -teset-deploy-redis-slave-0      1/1     Running   0             2m38s -teset-deploy-redis-slave-1      1/1     Running   0             90s -``` - -At this point, you have officially isolated your application to a single namespace and created one virtual cluster that talks internally only to itself. - -Delete everything with a single command: - - -``` -jess@Athena:~$ kubectl delete namespace athena -namespace "athena" deleted -``` - -Because this deletes the application's entire internal configuration, the delete may take some time, depending on how large your deployment is. - -Double-check that everything has been removed: - - -``` -jess@Athena:~$ kubectl get pods --all-namespaces -NAMESPACE       NAME                            READY   STATUS  RESTARTS   AGE -kube-system   coredns-5644d7b6d9-4vxv6          1/1     Running   0             32m -kube-system   coredns-5644d7b6d9-t5wn7          1/1     Running   0             32m -kube-system   etcd-minikube                     1/1     Running   0             31m -kube-system   kube-addon-manager-minikube       1/1     Running   0             32m -kube-system   kube-apiserver-minikube           1/1     Running   0             31m -kube-system   kube-controller-manager-minikube  1/1     Running   0             31m -kube-system   kube-proxy-5tdmh                  1/1     Running   0             32m -kube-system   kube-scheduler-minikube           1/1     Running   0             31m -kube-system   storage-provisioner               1/1     Running   0             27m -``` - -This is a list of all the pods and all the known namespaces where they live. As you can see, the application and namespace you previously made are now gone. - -### Namespaces in practice - -I currently use namespaces for security purposes, including reducing the privileges of users with limitations. You can limit everything—from which roles can access a namespace to their quota levels for cluster resources, like CPUs. For example, I use resource quotas and role-based access control (RBAC) configurations to confirm that a namespace is accessible only by the appropriate service accounts. - -On the isolation side of security, I don't want my home Jenkins application to be accessible over a trusted local network as secure images that have public IP addresses (and thus, I have to assume, could be compromised). - -Namespaces can also be helpful for budgeting purposes if you have a hard budget on how much you can use in your cloud platform for nodes (or, in my case, how much I can deploy before [segfaulting][8] my home server). Although this is out of scope for this article, and it's complicated, it is worth researching and taking advantage of to prevent overextending your cluster. - -### Conclusion - -Namespaces are a great way to isolate projects and applications. This is just a quick introduction to the topic, so I encourage you to do more advanced research on namespaces and use them more in your work. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/kubernetes-namespaces - -作者:[Jessica Cherry][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jrepka -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) -[2]: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ -[3]: https://www.weave.works/blog/gitops-operations-by-pull-request -[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/ -[5]: https://helm.sh/ -[6]: https://kubernetes.io/docs/tasks/tools/install-kubectl/ -[7]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline -[8]: https://en.wikipedia.org/wiki/Segmentation_fault diff --git a/translated/tech/20191219 Kubernetes namespaces for beginners.md b/translated/tech/20191219 Kubernetes namespaces for beginners.md new file mode 100644 index 0000000000..5c1f6267b0 --- /dev/null +++ b/translated/tech/20191219 Kubernetes namespaces for beginners.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Kubernetes namespaces for beginners) +[#]: via: (https://opensource.com/article/19/12/kubernetes-namespaces) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +Kubernetes 命名空间入门 +====== +命名空间是什么?你为什么需要它? +![Ship captain sailing the Kubernetes seas][1] + +kubernetes 命名空间是什么?Shakespeare 以前写过,我们声称的命名空间,或者任何其他名字,仍是一个虚拟集群。命名空间,意味着 kubernetes 可以在单个集群上提供多个 kubernetes 的集群,类似一个对其主机进行抽象的虚拟机。[kubernetes 文档][2] 中的解释: + +> kubernetes 在一个物理集群上提供了多个虚拟集群。这些虚拟集群被称为命名空间。 + +你为什么需要命名空间?一句话概括:隔离。 + +隔离有很多优点,如它提供了安全和干净的环境。如果你是基础设施的所属者,并且为开发者提供环境,隔离就相当重要。你最不需要的就是,一个不熟悉你集群是如何搭建的人去修改系统配置 — 这可能导致所有人都无法登录。 + +### 初始命名空间 + + 一个集群的三个初始命名空间:**default**、**kube-system** 和 **kube-public**。虽然你可以用这三个命名空间作技术部署,但我还是推荐你把这三个命名空间留作系统配置用,而不是你的项目。 + + * **Default** 某些部署没有指明命名空间,这样部署可以快速创建一个网格,但如果做了很多错误信息的部署,就很能去清理。我不去修改它,因为它在为某一个目的服务时,会在不止一种情况下误导我。 + * **Kube-system** 系统相关的所有对象组成的命名空间。任何此命名空间的部署都可能是危险的操作,可能对系统本身造成不可挽回的破坏。没错,我试过;所以我不推荐。 + * **Kube-public** 所有人可读,但是这个命名空间是为系统保留的。 + +### 用命名空间来实现隔离 + +我用了多种方式通过命名空间来实现隔离。我经常用命名空间来把多个用户项目分割到不同的环境。这种方式可以有效防止跨项目的污染,因为命名空间提供了独立的环境。例如,使用者可以安装不同版本的 Jenkins,如果它们的环境变量是在不同的命名空间,就不会冲突。 + +这种隔离对于清理也很有帮助。如果部署组的多个项目被废弃,你可以用命令 `kubectl delete ns <$NAMESPACENAME>` 一键删除命名空间,清理命名空间内的所有东西。(请确认被删除的是正确的命名空间。我曾经在生产环境删除了错误的命名空间,这很不好。) + +如果你是基础设施所有者,请谨慎操作,因为这可能会引发其他团队的的故障或引发其他问题。例如,如果你创建了一个特定的命名空间,里面有 DNS 函数,其他人删除了它,那么命名空间内的所有 pod 和它们运行的应用都会被清空。所有的**删除**操作在真正实施之前都应该由同事(通过 [GitOps][3])评审一下。 + +虽然官方文档不建议 [10 人以下团队][2] 使用多个命名空间,但出于架构需要,在我自己的集群上还是用了多个命名空间。集群越干净越好。 + +### 关于命名空间管理员应该知道的 + +首先,命名空间不能嵌套。部署只能在一个命名空间中进行。对于版本化项目,你不一定要用命名空间,你可以使用标签来区分有相同名字的版本化应用。命名空间使用配额来为不同的用户划分资源;例如,*某个命名空间最多能有 x 个 node*。最后,所有的命名空间对于资源类型只能使用一个独一无二的名字。 + +### 命名空间命令操作 + +你需要安装 [Minikube][4]、 [Helm][5] 和 [kubectl][6] 命令行,才能使用下面的命名空间命令。我的文章 [_安全浏览你的 DevOps 流水线_][7] 中有它们的安装教程,你也可以去每个工程的官方主页去找安装教程。我使用的是最新的 Minikube。手动安装很快,第一次就能成功运行。 + +获取你的第一组命名空间: + +``` +jess@Athena:~$ kubectl get namespace +NAME            STATUS   AGE +default         Active   5m23s +kube-public     Active   5m24s +kube-system     Active   5m24s +``` + +创建一个命名空间: + +``` +jess@Athena:~$ kubectl create namespace athena +namespace/athena created +``` + +现在开发者可以部署到你创建的命名空间;例如,这里是一个简短的 Helm 结构信息: + +``` +jess@Athena:~$ helm install teset-deploy stable/redis --namespace athena +NAME: teset-deploy +LAST DEPLOYED: Sat Nov 23 13:47:43 2019 +NAMESPACE: athena +STATUS: deployed +REVISION: 1 +TEST SUITE: None +NOTES: +** Please be patient while the chart is being deployed ** +Redis can be accessed via port 6379 on the following DNS names from within your cluster: + +teset-deploy-redis-master.athena.svc.cluster.local for read/write operations +teset-deploy-redis-slave.athena.svc.cluster.local for read-only operations +``` + +获取你的密码: + +``` +export REDIS_PASSWORD=$(kubectl get secret --namespace athena teset-deploy-redis -o jsonpath="{.data.redis-password}" | base64 --decode) +``` + +连接你的 redis 服务: + +1. 运行一个你可以作为客户端用的 Redis pod: + + ```bash + kubectl run --namespace athena teset-deploy-redis-client --rm --tty -i --restart='Never' \ +   --env REDIS_PASSWORD=$REDIS_PASSWORD \ + --image docker.io/bitnami/redis:5.0.7-debian-9-r0 -- bash + ``` + +2. 使用 Redis CLI 连接: + ```bash + redis-cli -h teset-deploy-redis-master -a $REDIS_PASSWORD + redis-cli -h teset-deploy-redis-slave -a $REDIS_PASSWORD + ``` + +从集群外连接你的数据库: + +```bash +kubectl port-forward --namespace athena svc/teset-deploy-redis-master 6379:6379 & +redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD +``` + +现在这一套部署已经完成了,你有一个在命名空间 **test-deploy** 中部署的图表。 + +查看你的命名空间中有哪些 pod: + + +``` +jess@Athena:~$ kubectl get pods --namespace athena +NAME                            READY   STATUS  RESTARTS   AGE +teset-deploy-redis-master-0   1/1       Running   0             2m38s +teset-deploy-redis-slave-0      1/1     Running   0             2m38s +teset-deploy-redis-slave-1      1/1     Running   0             90s +``` + +现在,你已经正式把你的应用隔离到了一个命名空间,创建了一个只在内部通信的虚拟集群。 + +一键删除所有东西: + + +```bash +jess@Athena:~$ kubectl delete namespace athena +namespace "athena" deleted +``` + +因为这会删除应用的所有内部配置,所以这个删除操作可能会持续一段时间,持续时间取决于你的部署到底有多大。 + +再次检查一下所有东西是否被删除了: + + +```bash +jess@Athena:~$ kubectl get pods --all-namespaces +NAMESPACE       NAME                            READY   STATUS  RESTARTS   AGE +kube-system   coredns-5644d7b6d9-4vxv6          1/1     Running   0             32m +kube-system   coredns-5644d7b6d9-t5wn7          1/1     Running   0             32m +kube-system   etcd-minikube                     1/1     Running   0             31m +kube-system   kube-addon-manager-minikube       1/1     Running   0             32m +kube-system   kube-apiserver-minikube           1/1     Running   0             31m +kube-system   kube-controller-manager-minikube  1/1     Running   0             31m +kube-system   kube-proxy-5tdmh                  1/1     Running   0             32m +kube-system   kube-scheduler-minikube           1/1     Running   0             31m +kube-system   storage-provisioner               1/1     Running   0             27m +``` + +这是一个所有 pod 及它们存在于的已知命名空间的列表。你可以看到,之前创建的应用和命名空间现在已经不在了。 + +### 命名空间实践 + +现在我是为了安全使用命名空间,如限制用户的权限。你可以限制所有的东西 — 从哪些角色可以访问命名空间,到命名空间可使用的集群资源(CPU 等)的配额等级。例如,我通过资源配额和基于角色的访问控制(role-based access control,RBAC)配置来确保只有允许的服务账号可以访问命名空间。 + +对于隔离方面的安全,我不希望我的私人 Jenkins 应用可以通过一个信任的本地网络被当做有公共 IP 地址的安全镜像来访问(我不得不假定,可能会做出妥协)。 + +如果你很难提前计算出到底要在你的云平台上部署多少 node(就我而言,在把我的私人服务器放到 [segfaulting][8] 之前可以部署多少个 node),那么命名空间在预算方面也很有用。虽然这超出了本文的讨论范围,而且很复杂,但值得你去调研和使用来防止你的集群过分扩展。 + +### 总结 + +命名空间是一个很好的隔离项目和应用的方法。本文仅是一个关于命名空间的简短介绍,所以我建议你更深入地研究下命名空间,在你的实践中更多地去使用它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/kubernetes-namespaces + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ +[3]: https://www.weave.works/blog/gitops-operations-by-pull-request +[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/ +[5]: https://helm.sh/ +[6]: https://kubernetes.io/docs/tasks/tools/install-kubectl/ +[7]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[8]: https://en.wikipedia.org/wiki/Segmentation_fault From f0ad173351dfd9b8bdbc675db3617dda4b7d4a23 Mon Sep 17 00:00:00 2001 From: chen ni Date: Sun, 29 Dec 2019 13:17:43 +0800 Subject: [PATCH 311/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ow to make an old computer useful again.md | 148 ++++++++---------- 1 file changed, 68 insertions(+), 80 deletions(-) diff --git a/sources/tech/20190724 How to make an old computer useful again.md b/sources/tech/20190724 How to make an old computer useful again.md index 7048848930..8e05a25631 100644 --- a/sources/tech/20190724 How to make an old computer useful again.md +++ b/sources/tech/20190724 How to make an old computer useful again.md @@ -7,136 +7,124 @@ [#]: via: (https://opensource.com/article/19/7/how-make-old-computer-useful-again) [#]: author: (Howard Fosdick https://opensource.com/users/howtechhttps://opensource.com/users/don-watkinshttps://opensource.com/users/suehlehttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/dragonbitehttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/seth) -How to make an old computer useful again +如何把你的老爷机重新利用起来 ====== -Refurbish an old machine with these step-by-step instructions. +按照下面各个步骤,让你的老爷机焕然一新 ![Person typing on a 1980's computer][1] -Have an old computer gathering dust in your basement? Why not put it to use? A backup machine could come in handy if your primary computer fails and you want to be online with a larger screen than your smartphone. Or it could act as a cheap secondary computer shared by the family. You could even make it into a retro gaming box. +你的地下室里有一台用来落灰的旧电脑?为什么不把它利用起来呢?如果你常用的电脑坏了,又想用一个比手机更大的屏幕上网,这时候一台备用电脑可能就派上用场了。或者,它也可以充当一台全家人共用的廉价辅助电脑,甚至还可以改造为一台复古游戏机。 -You can take any computer up to a dozen years old and—with the right software—perform many of the same tasks you can with new machines. Open source software is the key. +哪怕是一台有十余年历史的老爷机,只要选对了软件,也可以胜任很多新电脑能够完成的任务。其中的关键在于,要使用开源软件。 -I've refurbished computers for two decades, and in this article, I'll share how I do it. We're talking about dual-core laptops and desktops between five and 12 years old. +我进行电脑翻新已经有二十年了。在这篇文章里,我会分享一下电脑翻新的技巧。此处讨论的范围包括双核笔记本,以及机龄在 5 到 12 年之间的台式机。 -### Verify the hardware +### 检查硬件 -Step one is to verify that your hardware all works. Overlooking a problem here could cause you big headaches later. +第一步是检查硬件是否运转正常。如果在这个环节忽略了一个问题,后面可能会让你非常头疼。 -Dust kills electronics, so open up the box and clean out the dirt. [Compressed air][2] comes in handy. Be careful that you're [grounded][3] whenever you touch the machine. And _don't_ rub anything with a cleaning cloth. Even a static shock so small you won't feel it can destroy circuitry. +灰尘是电子器件的天敌,所以第一件事应该是打开机箱,清除灰尘。[压缩空气设备][2]这时候可能会派上用场。请注意,进行任何接触电脑的操作时,都应该确保你是[触地][3]的。此外,_避免_ 清洁布与任何物体发生摩擦。即使是一次小到你无法察觉的静电放电,也可能会导致电路损毁。 -Then close the clean computer and verify that all the hardware works. Test: +清洁工作完成之后,关闭机箱,检查是否所有硬件都可以正常工作。需要测试的项目包括: - * Memory - * Disk - * Motherboard - * Peripherals (DVD drive, USB ports, sound, etc.) + * 内存 + * 硬盘 + * 主板 + * 外围设备(DVD 驱动器、USB 接口、声卡,等等) +首先,将计算机启动面板([UEFI][4] 或者是 [BIOS][5]面板)上的诊断测试依次运行一遍。如果不知道按哪个程序功能按键进入你电脑的启动面板,可以参考 [这份列表][6]。 +此外,也可以使用诸如 [Hirens BootCD][7] 和 [Ultimate Boot CD][8] 之类的免费资源工具包,进行启动面板覆盖不到的测试。这些资源工具包涵盖了数百个测试程序,它们都是免费的,尽管不都开源。运行这些工具包无需安装任何软件,因为它们都是从 U 盘或者 DVD 驱动器启动的。 -Run any diagnostic tests in the computer's boot panels (the [UEFI][4] or [BIOS][5] panels). [This list][6] tells you which program function (PF) key to press to access those panels for your computer. +测试一定要彻底!对于内存和硬盘来说,基础测试还不够,应该运行深度测试,哪怕是运行一整夜也无妨。只有这样,才能够查出那些不易发现的瞬时故障。 -Free resource kits like [Hirens BootCD][7] or [Ultimate Boot CD][8] enable you to test what your boot panels don't. They contain hundreds of testing programs; all are free, but not all are open source. You don't have to install anything to run these kits because they'll boot from a USB thumb drive or DVD drive. +如果发现了问题,可以参考我的[硬件故障排除快速指南][9],帮你解决最常见的硬件问题。 -Be thorough! Run the extended tests for memory and disk—not just the short tests. Let them run overnight. That's the only way to catch transient (sporadic) errors. +### 选择软件 -If you find problems, my [Quick guide to fixing hardware][9] will help you solve the most common hardware issues. +电脑翻新的关键在于,根据手头的硬件资源,恰如其分地安装软件。最核心的三种硬件资源分别是: -### Select the software + 1. 处理器(核数、速度) + 2. 内存 + 3. 显存 -The key to refurbishing is to install software appropriate for the hardware resources you have. The three essential hardware resources are: +可以在启动时的 UEFI/BIOS 面板上,弄清楚你电脑的硬件资源。记得抄下数据,以免遗忘。接下来,可以在 [CPU Benchmark][10] 网站上查看你的处理器,该网站除了提供 CPU 的背景资料,还提供 CPU 的一个性能分数。 - 1. Processor (number of cores and speed) - 2. Memory - 3. Video memory +了解了硬件性能之后,就可以选择能够在硬件上高效运行的软件了。软件的选择涉及四个重要的层面: + 1. 操作系统(OS) + 2. 桌面环境(DE) + 3. 浏览器 + 4. 应用 +一个优秀的 Linux 发行版可以满足全部四个层面。不要试图使用已经停止维护的 Windows 版本,例如 Windows 8、Vista 或者 XP,哪怕已经安装在电脑上了。恶意软件的 [风险][11] 你是承受不起的。明智的做法是,使用一个更抗病毒的最新版本操作系统。 -You can identify your computer's resources in its boot-time UEFI/BIOS panels. Write down your findings so that you don't forget them. Then, look up your processor at [CPU Benchmark][10]. That website gives you background on your CPU plus a CPU Mark that indicates its performance. +那 Windows 7 呢?[维护宽限期][12] 至 2020 年 1 月 14 日结束,也就是说,在此日期之前你还可以获得安全补丁,之后就想都别想了。现在正是迁出 Windows 7 的绝佳时机。 -Now that you know your hardware's power, you're ready to select software that it can efficiently run. Your software choices are divided into four critical areas: +Linux 的巨大优势在于,有许多专门为过时硬件设计的[发行版][13]。此外,[桌面环境][14]和操作系统在 Linux 的设计中是分开的,你可以自行选择搭配。这一点非常重要,因为桌面环境对低端系统的性能有很大影响。(对于 Windows 和 MacOS 来说,你选择的操作系统版本决定了桌面环境,没得可选。) - 1. Operating system (OS) - 2. Desktop environment (DE) - 3. Browser - 4. Applications +Linux 的另一个好处是,拥有数以千计免费且开源的应用,不需要担心激活或者许可的问题。此外,Linux 是可移植的,可以在不同的分区、硬盘、设备或计算机之间,对操作系统和应用进行复制、移动或克隆。(Windows 则不然,使用注册表将系统捆绑在了所安装的计算机上。) +### 翻新后的电脑能够做什么? +这里讨论的是大约在 2006 年和 2013 年之间生产的双核计算机,尤其是装载了 [Intel 酷睿 2][15] CPU 或者 [AMD 速龙 64 X2][16] 系列处理器的计算机。它们的 [CPU 分数][10] 大多在 1000 到 4000 分之间。这种电脑卖不了几个钱,但用在运行轻量级 Linux 软件上,性能还是足够的。 -A good Linux distribution covers all four. Don't be tempted to run an unsupported version of Windows like 8, Vista, or XP just because it's already on the computer! The [risk][11] of malware is too great. You're much better off with a more virus-resistant, up-to-date operating system. +有一点需要注意:你的电脑应该至少拥有 2GB 内存,如果不够就进行升级。就我翻新过的电脑来说,使用者用到的内存(不包括数据缓存)一般在 0.5 到 2 GB 之间,很少超过 2 GB。如果将内存升级到 2GB,系统就不至于进行 _swap_,即将硬盘当做内存使用。如果想要获得良好性能,这一点十分关键。 -How about Windows 7? [Extended support][12] ends January 14, 2020, meaning you get security fixes only until that date. After that, zilch. Now is the perfect time to migrate off Windows 7. +以我自己为例,我用来写作这篇文章的是一台有十年机龄的翻新电脑。取下 1 GB 内存条之后,它只剩下了 1 GB 内存,然后就慢得像一只乌龟。用它浏览网页,或者是做类似的事情,都让人感到灰心,甚至痛苦。一旦把内存条重新装回去,有了 2 GB 内存,它就立马回到了可以使用的状态。 -Linux's big benefit is that it offers [many distros][13] specifically designed for older hardware. Plus, its design decouples [DEs][14] from the OS, so you can mix and match the two. This is important because DEs heavily impact low-end system performance. (With Windows and MacOS, the OS version you run dictates the DE.) +一台 2 GB 的双核计算机可以满足大多数人的需求,只要安装的是轻量级发行版和浏览器。你可以用它浏览网页、发送电子邮件、编辑文档和电子表格、观看 YouTube 视频、参与 eBay 拍卖竞标、在社交网络上发帖、听播客、查看相簿、管理家庭收支和个人日程、玩游戏,等等。 -Other Linux advantages: Its thousands of apps are free and open source, so you don't have to worry about activation and licensing. And Linux is portable. You can copy, move, or clone the OS and applications across partitions, disks, devices, or computers. (Windows binds itself to the computer it's installed on via its Registry.) +### 翻新电脑的局限 -### What can your refurbished computer do? +那么,这些老爷机又有什么局限呢?由于它们的并发比不上最先进的计算机,所以应该使用轻量级浏览器,同时拦截广告(广告正是让网页加载变慢的罪魁祸首)。如果可以使用虚拟专用网络(VPN)拦截广告,为处理器免除广告加载的负荷,那就再好不过了。此外,还需要禁用视频自动播放、Flash 以及网页动效;将浏览器上的标签页控制在少数几个,不要同时打开 20 个;以及下载可以开启/禁用 JavaScript 的浏览器扩展。 -We're talking dual-core machines dating from about 2006 to 2013, especially [Intel Core 2][15] CPUs and [AMD Athlon 64 X2][16] family processors. Most have a [CPU Mark][10] of between 1,000 and 4,000. You can often pick up these machines for a song, yet they're still powerful enough to run lightweight Linux software. +让处理器专注于你目前正在做的事情吧,不要同时打开一堆应用,也不要在后台运行很多程序。此外,图像编辑和视频编辑的高级工具可能会很慢。至于运行虚拟机,还是别想了吧。 -One caution: be sure your computer has at least 2GB of memory. Upgrade the RAM if you have to. End users on my refurbished machines typically use between 0.5 and 2GB of RAM (exclusive of data buffering); rarely do they go over 2 gig. So if you can bump memory to 2GB, your system won't be forced to _swap_, or substitute disk for memory. That's critical for good performance. +那游戏呢?开源软件仓库提供了数以千计的游戏。这就是我为什么将显存列为三种核心硬件资源之一。如果你的电脑没有显卡,那很可能只有 32 或者 64 MB 的显存。可以增加一张显卡,将显存提升到 256 或者 512 MB,这样一来,处理器密集型的游戏就会顺畅很多了。如果不确定你的电脑有多少显存,可以参考[这里][17]。请注意,需要确保显卡与电脑的[显卡插槽][18](AGP、PCI-Express 或者 PCI)相匹配,同时使用正确的[连接线][19](VGA、DVI 或者 HDMI)。 -For example, I removed 1GB RAM from the decade-old rebuild I'm writing this article on, which dropped memory down to 1GB. The machine slowed to a crawl. Web surfing and other tasks became frustrating, even painful. I popped the memory stick back in and, with 2GB RAM, the desktop instantly reverted to its usable self. +#### 与 Windows 系统的兼容性如何? -With a 2 gig dual-core computer, most people can do whatever they want, so long as they run a lightweight distro and browser. You can web surf, email, edit documents, do spreadsheets, watch YouTube videos, bid on eBay auctions, post on social media, listen to podcasts, view photo collections, manage home finance and personal scheduling, play games, and more. +很多人都会问,Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 的替代版本][20]。 -### Limitations +退一步说,即使你真的必须要运行某个特定的 Windows 程序,通常也可以使用 [Wine][21] 在 Linux 上运行。可以在 [Wine 数据库][22] 里查找一下你的应用,看看是否可以在 Wine 上运行,顺便学一些特殊安装技巧。[Winetricks][23] 和 [PlayOnLinux][24] 这两个辅助工具可以帮助你进行安装和配置。 -What can't these older computers do? Their concurrency is less than state-of-the-art machines. So run a fast browser and block ads, because that's what slows down web surfing. If your virtual private network (VPN) can block ads for you and offload that work from your processor, that's ideal. Disable autoplay of videos, Flash, and animation. Surf with a couple of tabs open rather than 20. Install a browser extension so you can toggle JavaScript. +Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP、ME/98/95 和 3.1。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。使用 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 -Direct the processors to what you're working on; don't keep a ton of apps open or run lots of stuff in the background. High-end graphics and video editing may be slow. Virtual machine hosting is out. +对了,与 Microsoft Office 的兼容性怎么样?我使用的是 LibreOffice,经常编辑并交换 Word 和 Excel 文件,完全没有问题。不过,你应该避免使用隐晦的或者过于专业的功能。 -How about games? The open source software repositories offer literally thousands of games. That's why I listed video memory as one of the three essential hardware resources. If your box doesn't have a video card, it likely has only 32 or 64MB of VRAM. Bump that to 256 or 512MB by adding a video card, and you'll find that processor-intensive games run much better. [Here's how][17] to see how much VRAM your computer has. Be sure to get a card that fits your computer's [video slot][18] (AGP, PCI-Express, or PCI) and has the right [cable connector][19] (VGA, DVI, or HDMI). +### 如何选择发行版? -#### What about Windows compatibility? +假设选择了 Linux 作为操作系统,那么你还需要选择桌面环境、浏览器和各种应用。最简单的方法是,安装一个包含了你所需要的一切的发行版。 -People often ask about Windows compatibility. First, there's a [Linux equivalent][20] for every Windows program. +通过从 [live USB][28] U 盘或者 DVD 启动,你无需安装任何程序,就可以尝试不同的发行版。关于在 Linux 或 Windows 上创建可启动的 Linux 的方法,可以参考 [这里][29]。 -Second, if you really must run a specific Windows program, you can usually do that on Linux using [Wine][21]. Look up your application in the [Wine database][22] to verify it runs under Wine and learn any special install tricks. Then the auxiliary tools [Winetricks][23] or [PlayOnLinux][24] will help you with installation and setup. +我进行电脑翻新的目的是做慈善,所以无法指望电脑使用者具备任何相应知识。我需要的发行版应该具有以下特性: -Wine's other benefit is that it runs programs from old Windows versions like Vista, XP, ME/98/95, and 3.1. I know a guy who set up a fantastic game box running his old XP games. You can even run thousands of [free DOS programs][25] using [DOSBox.][26] One caution: if Windows programs can run, so can Windows [viruses][27]. You must protect your Wine environment inside Linux just as you would any other Windows environment. + * 用户友好 + * 具有轻量级界面 + * 自带各种轻量级应用 + * 拥有足够大的软件仓库 + * 历史表现良好 + * 拥有庞大的用户社区和活跃的论坛 + * 通过长期维护版本(而不是滚动发布版本)确保稳定性 + * 更重视可靠性,而不是尖端功能 + * 可以通过图形化用户界面进行设置,而不是只能通过文本文件进行设置 -How about compatibility with Microsoft Office? I use LibreOffice and routinely edit and exchange Word and Excel files without problems. You must, however, avoid using obscure or specialized features. +许多发行版都能够满足上面的要求。我曾经尝试成功的有 [Mint/Xfce][30]、[Xubuntu,][31] 和 [Lubuntu][32]。前两个发行版使用 Xfce 桌面环境,第三个使用 LXQt。相比 GNOME、Unity、KDE、MATE 和 Cinnamon 这些桌面环境,运行上面这两种桌面环境只需要[更少][33]的处理器和内存资源。 -### Which distro? +Xfce 和 LXQt 用起来非常简单,我的客户们之前从未见过 Linux,但是都可以自如使用这些简单的、菜单驱动的用户界面。 -Assuming Linux is the OS, you need to select a DE, browser, and applications. The easy way to do this is to install a distribution that bundles everything you need. +对于旧电脑来说,运行最快速、最高效的浏览器是一件非常重要的事情。[很多人觉得][34] Chromium 是最好的浏览器;此外,我还安装了 Firefox Quantum,因为大家都比较熟悉它,并且[它的性能][35]可以和 [Chromium 的性能][36]媲美。我还加上了 Opera,因为它速度快,而且有一些独特功能,比如内置的广告拦截,以及免费的 [虚拟专用网络][37]。Opera 是免费的,但并非开源。 -Remember that you can try out different distros without installing anything by booting from a [live USB][28] thumb drive or DVD. [Here's how to create a bootable Linux][29] from within Linux or Windows. +无论你使用什么浏览器,一定要拦截广告和追踪器,尽量降低浏览器的负荷。此外,除非得到你的明确批准,否则视频和 Flash 都不应该被允许运行。 -I rebuild computers for charity, so I can't assume any knowledge on the part of my users. I need a distro with these traits: +至于应用,我使用的是 Mint/Xfce、Xubuntu 和 Lubuntu 自带的轻量级应用,它们可以满足一切需求。 - * User-friendly - * Lightweight interface - * Bundles lightweight apps - * Big repository - * Solid track record - * Large user community with an active forum - * Stability through long-term support releases (not rolling releases) - * Prioritizes reliability over cutting-edge features - * Configurable by a GUI rather than by text files +### 行动起来吧 +你是否会对翻新后的电脑感到满意呢?就我来说,我所使用的两台电脑的机龄都已经超过十年了,其中一个装载的是 Intel 双核处理器([eMachines T5274a][38]),另一个装载的是 AMD 速龙 64 x2 处理器([HP dc5750][39]),两台电脑都有 2 GB 内存。它们和我的另一台具备四核 i5 处理器和 16 GB 内存 的电脑一样,完全能够胜任我的办公工作。如果说有什么功能是这两台电脑缺失的,那就是运行虚拟机了。 - -Many distros fulfill these criteria. The three I've successfully deployed are [Mint/Xfce][30], [Xubuntu,][31] and [Lubuntu][32]. The first two use the Xfce desktop environment, while the latter runs LXQt. These DEs [use less][33] processor and memory resources than alternatives like GNOME, Unity, KDE, MATE, and Cinnamon. - -Xfce and LXQt are very easy to use. My clients have never seen Linux before, yet they have no trouble using these simple, menu-driven interfaces. - -It's vital to run the fastest, most efficient browser on older equipment. [Many feel][34] Chromium wins the browser race. I also install Firefox Quantum because people are familiar with it and [its performance][35] rivals [that of Chromium][36]. I toss in Opera because it's speedy and has some unique features, like integrated ad-blocking and a free [virtual private network][37]. Opera is free but not open source. - -Whatever browser you use, block ads and trackers! Minimize browser overhead. And don't allow videos or Flash to run without your explicit say-so. - -For applications, I rely on the lightweight apps bundled with Mint/Xfce, Xubuntu, and Lubuntu. They address every possible need. - -### Go for it - -Will you be happy with your rebuild? The computers I've been using lately are both over a decade old. One has an Intel dual-core processor ([eMachines T5274a][38]) while the other features an AMD Athlon 64 x2 processor ([HP dc5750][39]). Both have 2 gig memory. They're as effective for my office workload as my quad-core i5 with 16GB RAM. The only function I miss when using them is the ability to host virtual machines. - -We live in an amazing era. You can take a five- to 12-year-old computer and, with a little effort, restore it to practical use. What could be more fun? - -Having recently co-authored a book about building things with the Raspberry Pi ( Raspberry Pi Hacks... - -I can see the brightness of curiosity in my six year old niece Shuchi's eyes when she explores a... +我们生活在一个非常神奇的年代。只需要付出一点努力,就可以将一台机龄在 5 到 12 年之间的旧电脑,翻新为一台具备实用价值的机器。还有什么比这更有趣吗? -------------------------------------------------------------------------------- @@ -144,7 +132,7 @@ via: https://opensource.com/article/19/7/how-make-old-computer-useful-again 作者:[Howard Fosdick][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/chen-ni) +译者:[chen-ni](https://github.com/chen-ni) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0c922daee912126332ab1be7b37af82ded0b7534 Mon Sep 17 00:00:00 2001 From: chen ni Date: Sun, 29 Dec 2019 13:40:24 +0800 Subject: [PATCH 312/676] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ow to make an old computer useful again.md | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/sources/tech/20190724 How to make an old computer useful again.md b/sources/tech/20190724 How to make an old computer useful again.md index 8e05a25631..6eb7209c0f 100644 --- a/sources/tech/20190724 How to make an old computer useful again.md +++ b/sources/tech/20190724 How to make an old computer useful again.md @@ -26,14 +26,14 @@ 清洁工作完成之后,关闭机箱,检查是否所有硬件都可以正常工作。需要测试的项目包括: - * 内存 - * 硬盘 - * 主板 - * 外围设备(DVD 驱动器、USB 接口、声卡,等等) +* 内存 +* 硬盘 +* 主板 +* 外围设备(DVD 驱动器、USB 接口、声卡,等等) 首先,将计算机启动面板([UEFI][4] 或者是 [BIOS][5]面板)上的诊断测试依次运行一遍。如果不知道按哪个程序功能按键进入你电脑的启动面板,可以参考 [这份列表][6]。 -此外,也可以使用诸如 [Hirens BootCD][7] 和 [Ultimate Boot CD][8] 之类的免费资源工具包,进行启动面板覆盖不到的测试。这些资源工具包涵盖了数百个测试程序,它们都是免费的,尽管不都开源。运行这些工具包无需安装任何软件,因为它们都是从 U 盘或者 DVD 驱动器启动的。 +此外,也可以使用诸如 [Hirens BootCD][7] 和 [Ultimate Boot CD][8] 之类的免费资源工具包,进行启动面板覆盖不到的测试。这些资源工具包涵盖了数百个测试程序,并且都是免费的,尽管不都开源。运行这些工具包无需安装任何软件,因为它们都是从 U 盘或者 DVD 驱动器启动的。 测试一定要彻底!对于内存和硬盘来说,基础测试还不够,应该运行深度测试,哪怕是运行一整夜也无妨。只有这样,才能够查出那些不易发现的瞬时故障。 @@ -43,18 +43,18 @@ 电脑翻新的关键在于,根据手头的硬件资源,恰如其分地安装软件。最核心的三种硬件资源分别是: - 1. 处理器(核数、速度) - 2. 内存 - 3. 显存 +1. 处理器(核数、速度) +2. 内存 +3. 显存 -可以在启动时的 UEFI/BIOS 面板上,弄清楚你电脑的硬件资源。记得抄下数据,以免遗忘。接下来,可以在 [CPU Benchmark][10] 网站上查看你的处理器,该网站除了提供 CPU 的背景资料,还提供 CPU 的一个性能分数。 +可以在启动时的 UEFI/BIOS 面板上,弄清楚你电脑的硬件资源。记得抄下数据,以免遗忘。接下来,可以在 [CPU Benchmark][10] 网站上查看你的处理器,该网站除了提供 CPU 的背景资料,还提供一个 CPU 的性能分数。 了解了硬件性能之后,就可以选择能够在硬件上高效运行的软件了。软件的选择涉及四个重要的层面: - 1. 操作系统(OS) - 2. 桌面环境(DE) - 3. 浏览器 - 4. 应用 +1. 操作系统(OS) +2. 桌面环境(DE) +3. 浏览器 +4. 应用 一个优秀的 Linux 发行版可以满足全部四个层面。不要试图使用已经停止维护的 Windows 版本,例如 Windows 8、Vista 或者 XP,哪怕已经安装在电脑上了。恶意软件的 [风险][11] 你是承受不起的。明智的做法是,使用一个更抗病毒的最新版本操作系统。 @@ -66,9 +66,9 @@ Linux 的另一个好处是,拥有数以千计免费且开源的应用,不 ### 翻新后的电脑能够做什么? -这里讨论的是大约在 2006 年和 2013 年之间生产的双核计算机,尤其是装载了 [Intel 酷睿 2][15] CPU 或者 [AMD 速龙 64 X2][16] 系列处理器的计算机。它们的 [CPU 分数][10] 大多在 1000 到 4000 分之间。这种电脑卖不了几个钱,但用在运行轻量级 Linux 软件上,性能还是足够的。 +这里讨论的是大约在 2006 年到 2013 年之间生产的双核计算机,尤其是装载了 [Intel 酷睿 2][15] CPU 或 [AMD 速龙 64 X2][16] 系列处理器的计算机。它们的 [CPU 分数][10] 大多在 1000 到 4000 分之间。这种电脑卖不了几个钱,但用在运行轻量级 Linux 软件上,性能还是足够的。 -有一点需要注意:你的电脑应该至少拥有 2GB 内存,如果不够就进行升级。就我翻新过的电脑来说,使用者用到的内存(不包括数据缓存)一般在 0.5 到 2 GB 之间,很少超过 2 GB。如果将内存升级到 2GB,系统就不至于进行 _swap_,即将硬盘当做内存使用。如果想要获得良好性能,这一点十分关键。 +有一点需要注意:你的电脑应该至少拥有 2 GB 内存,如果不够就进行升级。就我翻新过的电脑来说,使用者用到的内存(不包括数据缓存)一般在 0.5 到 2 GB 之间,很少超过 2 GB。如果将内存升级到 2GB,系统就不至于进行 _swap_,即将硬盘当做内存使用。如果想要获得良好性能,这一点十分关键。 以我自己为例,我用来写作这篇文章的是一台有十年机龄的翻新电脑。取下 1 GB 内存条之后,它只剩下了 1 GB 内存,然后就慢得像一只乌龟。用它浏览网页,或者是做类似的事情,都让人感到灰心,甚至痛苦。一旦把内存条重新装回去,有了 2 GB 内存,它就立马回到了可以使用的状态。 @@ -76,21 +76,21 @@ Linux 的另一个好处是,拥有数以千计免费且开源的应用,不 ### 翻新电脑的局限 -那么,这些老爷机又有什么局限呢?由于它们的并发比不上最先进的计算机,所以应该使用轻量级浏览器,同时拦截广告(广告正是让网页加载变慢的罪魁祸首)。如果可以使用虚拟专用网络(VPN)拦截广告,为处理器免除广告加载的负荷,那就再好不过了。此外,还需要禁用视频自动播放、Flash 以及网页动效;将浏览器上的标签页控制在少数几个,不要同时打开 20 个;以及下载可以开启/禁用 JavaScript 的浏览器扩展。 +那么,这些老爷机又有什么局限呢?由于它们的并发比不上最先进的计算机,所以应该使用轻量级浏览器,同时拦截广告(广告正是让网页加载变慢的罪魁祸首)。如果可以使用虚拟专用网络(VPN)拦截广告,为处理器免除广告加载的负荷,那就再好不过。此外,还需要禁用视频自动播放、Flash 以及网页动效;将浏览器上的标签页控制在少数几个,不要同时打开 20 个;以及下载可以开启/禁用 JavaScript 的浏览器扩展。 -让处理器专注于你目前正在做的事情吧,不要同时打开一堆应用,也不要在后台运行很多程序。此外,图像编辑和视频编辑的高级工具可能会很慢。至于运行虚拟机,还是别想了吧。 +让处理器专注于你目前正在做的事情吧,不要同时打开一堆应用,也不要在后台运行很多程序。图像编辑和视频编辑的高级工具可能会很慢;至于运行虚拟机,还是别想了吧。 那游戏呢?开源软件仓库提供了数以千计的游戏。这就是我为什么将显存列为三种核心硬件资源之一。如果你的电脑没有显卡,那很可能只有 32 或者 64 MB 的显存。可以增加一张显卡,将显存提升到 256 或者 512 MB,这样一来,处理器密集型的游戏就会顺畅很多了。如果不确定你的电脑有多少显存,可以参考[这里][17]。请注意,需要确保显卡与电脑的[显卡插槽][18](AGP、PCI-Express 或者 PCI)相匹配,同时使用正确的[连接线][19](VGA、DVI 或者 HDMI)。 #### 与 Windows 系统的兼容性如何? -很多人都会问,Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 的替代版本][20]。 +很多人都关心 Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 的替代版本][20]。 -退一步说,即使你真的必须要运行某个特定的 Windows 程序,通常也可以使用 [Wine][21] 在 Linux 上运行。可以在 [Wine 数据库][22] 里查找一下你的应用,看看是否可以在 Wine 上运行,顺便学一些特殊安装技巧。[Winetricks][23] 和 [PlayOnLinux][24] 这两个辅助工具可以帮助你进行安装和配置。 +退一步说,即使你真的必须要运行某个特定的 Windows 程序,通常也可以借助 [Wine][21] 在 Linux 上运行。可以在 [Wine 数据库][22] 里查找一下你的应用,看看是否可以在 Wine 上运行,顺便学一些特殊安装技巧。[Winetricks][23] 和 [PlayOnLinux][24] 这两个辅助工具可以帮助你进行安装和配置。 -Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP、ME/98/95 和 3.1。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。使用 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 +Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP、ME/98/95 和 3.1。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。凭借 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 -对了,与 Microsoft Office 的兼容性怎么样?我使用的是 LibreOffice,经常编辑并交换 Word 和 Excel 文件,完全没有问题。不过,你应该避免使用隐晦的或者过于专业的功能。 +对了,与 Microsoft Office 的兼容性又如何呢?我使用的是 LibreOffice,经常编辑并交换 Word 和 Excel 文件,完全没有问题。不过,你应该避免使用隐晦或者过于专业的功能。 ### 如何选择发行版? @@ -100,25 +100,25 @@ Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP 我进行电脑翻新的目的是做慈善,所以无法指望电脑使用者具备任何相应知识。我需要的发行版应该具有以下特性: - * 用户友好 - * 具有轻量级界面 - * 自带各种轻量级应用 - * 拥有足够大的软件仓库 - * 历史表现良好 - * 拥有庞大的用户社区和活跃的论坛 - * 通过长期维护版本(而不是滚动发布版本)确保稳定性 - * 更重视可靠性,而不是尖端功能 - * 可以通过图形化用户界面进行设置,而不是只能通过文本文件进行设置 +* 用户友好 +* 具有轻量级界面 +* 自带各种轻量级应用 +* 拥有足够大的软件仓库 +* 历史表现良好 +* 拥有庞大的用户社区和活跃的论坛 +* 通过长期维护版本(而不是滚动发布版本)确保稳定性 +* 更重视可靠性,而不是尖端功能 +* 可以通过图形化用户界面进行设置,而不是只能通过文本文件进行设置 许多发行版都能够满足上面的要求。我曾经尝试成功的有 [Mint/Xfce][30]、[Xubuntu,][31] 和 [Lubuntu][32]。前两个发行版使用 Xfce 桌面环境,第三个使用 LXQt。相比 GNOME、Unity、KDE、MATE 和 Cinnamon 这些桌面环境,运行上面这两种桌面环境只需要[更少][33]的处理器和内存资源。 Xfce 和 LXQt 用起来非常简单,我的客户们之前从未见过 Linux,但是都可以自如使用这些简单的、菜单驱动的用户界面。 -对于旧电脑来说,运行最快速、最高效的浏览器是一件非常重要的事情。[很多人觉得][34] Chromium 是最好的浏览器;此外,我还安装了 Firefox Quantum,因为大家都比较熟悉它,并且[它的性能][35]可以和 [Chromium 的性能][36]媲美。我还加上了 Opera,因为它速度快,而且有一些独特功能,比如内置的广告拦截,以及免费的 [虚拟专用网络][37]。Opera 是免费的,但并非开源。 +对于旧电脑来说,运行最快速、最高效的浏览器是一件非常重要的事情。[很多人觉得][34] Chromium 是最好的浏览器;此外,我还安装了 Firefox Quantum,因为大家比较熟悉它,并且[它的性能][35]可以和 [Chromium 的性能][36]媲美。我还加上了 Opera,因为它速度快,而且有一些独特功能,比如内置的广告拦截,以及免费的 [虚拟专用网络][37]。Opera 是免费的,但并非开源。 无论你使用什么浏览器,一定要拦截广告和追踪器,尽量降低浏览器的负荷。此外,除非得到你的明确批准,否则视频和 Flash 都不应该被允许运行。 -至于应用,我使用的是 Mint/Xfce、Xubuntu 和 Lubuntu 自带的轻量级应用,它们可以满足一切需求。 +至于应用,我使用的是 Mint/Xfce、Xubuntu 和 Lubuntu 自带的轻量级应用。它们足以满足一切需求了。 ### 行动起来吧 From 1d4ca0cb171d69a8d04b936892906451fcc2b158 Mon Sep 17 00:00:00 2001 From: chen ni Date: Sun, 29 Dec 2019 13:47:55 +0800 Subject: [PATCH 313/676] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190724 How to make an old computer useful again.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190724 How to make an old computer useful again.md b/sources/tech/20190724 How to make an old computer useful again.md index 6eb7209c0f..216f4ee65e 100644 --- a/sources/tech/20190724 How to make an old computer useful again.md +++ b/sources/tech/20190724 How to make an old computer useful again.md @@ -84,7 +84,7 @@ Linux 的另一个好处是,拥有数以千计免费且开源的应用,不 #### 与 Windows 系统的兼容性如何? -很多人都关心 Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 的替代版本][20]。 +许多人关心 Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 的替代版本][20]。 退一步说,即使你真的必须要运行某个特定的 Windows 程序,通常也可以借助 [Wine][21] 在 Linux 上运行。可以在 [Wine 数据库][22] 里查找一下你的应用,看看是否可以在 Wine 上运行,顺便学一些特殊安装技巧。[Winetricks][23] 和 [PlayOnLinux][24] 这两个辅助工具可以帮助你进行安装和配置。 From 8535a58ea71b5acab51e73890b8ee28c794139e3 Mon Sep 17 00:00:00 2001 From: chen ni Date: Sun, 29 Dec 2019 13:49:40 +0800 Subject: [PATCH 314/676] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190724 How to make an old computer useful again.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190724 How to make an old computer useful again.md b/sources/tech/20190724 How to make an old computer useful again.md index 216f4ee65e..1df6d5fabd 100644 --- a/sources/tech/20190724 How to make an old computer useful again.md +++ b/sources/tech/20190724 How to make an old computer useful again.md @@ -88,7 +88,7 @@ Linux 的另一个好处是,拥有数以千计免费且开源的应用,不 退一步说,即使你真的必须要运行某个特定的 Windows 程序,通常也可以借助 [Wine][21] 在 Linux 上运行。可以在 [Wine 数据库][22] 里查找一下你的应用,看看是否可以在 Wine 上运行,顺便学一些特殊安装技巧。[Winetricks][23] 和 [PlayOnLinux][24] 这两个辅助工具可以帮助你进行安装和配置。 -Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP、ME/98/95 和 3.1。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。凭借 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 +Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP、ME/98/95 和 3.1。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。借助 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 对了,与 Microsoft Office 的兼容性又如何呢?我使用的是 LibreOffice,经常编辑并交换 Word 和 Excel 文件,完全没有问题。不过,你应该避免使用隐晦或者过于专业的功能。 From 715f04a07a2be33bf75a49204a2a322e210d1574 Mon Sep 17 00:00:00 2001 From: chen ni Date: Sun, 29 Dec 2019 13:50:14 +0800 Subject: [PATCH 315/676] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190724 How to make an old computer useful again.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190724 How to make an old computer useful again.md (100%) diff --git a/sources/tech/20190724 How to make an old computer useful again.md b/translated/tech/20190724 How to make an old computer useful again.md similarity index 100% rename from sources/tech/20190724 How to make an old computer useful again.md rename to translated/tech/20190724 How to make an old computer useful again.md From e39ecde04435a21c03ea2c03b54cda4b5d9bdd09 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 14:43:58 +0800 Subject: [PATCH 316/676] APL --- sources/tech/20191227 10 resources to boost your Git skills.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191227 10 resources to boost your Git skills.md b/sources/tech/20191227 10 resources to boost your Git skills.md index b05f363e14..6012455ab6 100644 --- a/sources/tech/20191227 10 resources to boost your Git skills.md +++ b/sources/tech/20191227 10 resources to boost your Git skills.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0812a625a24a943354520efa9dc4c873026ac54c Mon Sep 17 00:00:00 2001 From: chen ni Date: Sun, 29 Dec 2019 16:36:49 +0800 Subject: [PATCH 317/676] =?UTF-8?q?=E7=94=B3=E9=A2=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...our Distribution Still Using an ‘Outdated- Linux Kernel.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md b/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md index 224f848f2d..6152697eb3 100644 --- a/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md +++ b/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chen-ni) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -101,7 +101,7 @@ via: https://itsfoss.com/why-distros-use-old-kernel/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[chen-ni](https://github.com/chen-ni) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3c3880d31759ea371e491176f6bac2bc802ae8bf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 19:59:20 +0800 Subject: [PATCH 318/676] TSL --- ...7 10 resources to boost your Git skills.md | 68 ------------------- ...7 10 resources to boost your Git skills.md | 57 ++++++++++++++++ 2 files changed, 57 insertions(+), 68 deletions(-) delete mode 100644 sources/tech/20191227 10 resources to boost your Git skills.md create mode 100644 translated/tech/20191227 10 resources to boost your Git skills.md diff --git a/sources/tech/20191227 10 resources to boost your Git skills.md b/sources/tech/20191227 10 resources to boost your Git skills.md deleted file mode 100644 index 6012455ab6..0000000000 --- a/sources/tech/20191227 10 resources to boost your Git skills.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 resources to boost your Git skills) -[#]: via: (https://opensource.com/article/19/12/git-resources) -[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) - -10 resources to boost your Git skills -====== -Wrap up the year with a review of the best in Git. Here are the top 10 -articles about surprising ways you can use Git in the new year. -![open source button on keyboard][1] - -As we near the end of 2019, it is time to look back at the top 10 articles we published about Git this year. - -These articles range from use cases and tutorials to some very interesting, if somewhat unconventional, ways to use Git. All of these articles can help you improve your Git skills, but if you really need a Git 101 introduction, be sure to check out our _[Getting started with Git: Terminology 101][2]_ article and download our [Git cheat sheet][3]. - - 1. _[How GNOME uses Git][4]_ by Molly de Blanc looks at the GNOME project’s adoption of a self-hosted GitLab instance as the GNOME project’s centralized location for contributing to GNOME. De Blanc works in a non-coding position, so her article also explores how the switch to GitLab benefits contributors whose primary role is not writing code. - - 2. Ahmad Awais’ _[Emoji-Log: A new way to write Git commit messages][5]_ explains how to use Emoji-Log, "a straightforward, open source Git commit log standard," to write better, more user-friendly, Git commit messages. The article contains an overview of the theory behind Emoji-Log and configuration examples that can be added to **.bashrc, .zshrc, or .gitconfig** to quickly start using Emoji-Log. - - 3. In _[Manage your daily schedule with Git][6]_, Seth Kenlon explains how to use Git to manage your calendar. By combining Org mode, Git, and a few other tools, Kenlon describes how to create a Git-based calendar workflow that can be synced across devices. - - 4. [_Use Git as the backend for chat_][7] by Seth Kenlon explores another unconventional way to use Git. In this article, he explores GIC, which is a chat client written in Node.js with Git functioning as the backend database. GIC is proof of concept, not something intended for production use, but it provides an interesting example of a really unique way to use Git. - - 5. Alan Formy-Duval’s _[A practical learning exercise for Git][8]_ is a chronicle of his effort to improve his Git skills. He shares his experience for others to benefit from what he learned, and Git novices will gain a lot from this excellent overview of Git’s core functionality. - - 6. _[How writers can get work done better with Git][9]_ by Seth Kenlon looks at how writers can benefit from a Git-based workflow. The article explains how to use Git and Atom to write using Markdown. By following the examples in this article, writers can easily add a complex revision control system to their writing workflow. - - 7. In _[How to use Magit to manage Git projects][10]_, Sachin Patil explains how to use Emacs’ Magit extension to manage Git repositories. The article provides clear examples of how to perform a selection of key Git tasks inside Emacs. The examples are supported by screenshots illustrating the various tasks. - - 8. _[Move your dotfiles to version control][11]_ by Matthew Broberg shows how to use Git to store the dotfiles in your home directory. Storing your dotfiles in a Git repository makes it easier to share your system configuration between computers and, if you so choose, share your configurations with others. The article does come with a warning about what not to share because sharing the wrong dotfiles can expose others. - - 9. Austin Dewey’s _[4 secrets management tools for Git encryption][12]_ compares Git-crypt, BlackBox, SOPS, and Transcrypt in this article examining tools for storing secrets in Git. The article covers four major areas: encryption types supported, the goals of each project, the projects’ workflows and differences, and other features. - - 10. _[Run a server with Git][13]_ by Seth Kenlon explains how Gitolite can be used to manage a Git server. Gitolite is "a backend application managing the fiddly bits" involved in using Git to manage a Git server. The article demonstrates how to install, configure, and use Gitolite, with clear examples detailing each step the process. - - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/git-resources - -作者:[Joshua Allen Holm][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/holmja -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard) -[2]: https://opensource.com/article/19/2/git-terminology -[3]: https://opensource.com/downloads/cheat-sheet-git -[4]: https://opensource.com/article/19/10/how-gnome-uses-git -[5]: https://opensource.com/article/19/2/emoji-log-git-commit-messages -[6]: https://opensource.com/article/19/4/calendar-git -[7]: https://opensource.com/article/19/4/git-based-chat -[8]: https://opensource.com/article/19/5/practical-learning-exercise-git -[9]: https://opensource.com/article/19/4/write-git -[10]: https://opensource.com/article/19/1/how-use-magit -[11]: https://opensource.com/article/19/3/move-your-dotfiles-version-control -[12]: https://opensource.com/article/19/2/secrets-management-tools-git -[13]: https://opensource.com/article/19/4/server-administration-git diff --git a/translated/tech/20191227 10 resources to boost your Git skills.md b/translated/tech/20191227 10 resources to boost your Git skills.md new file mode 100644 index 0000000000..eee2be8848 --- /dev/null +++ b/translated/tech/20191227 10 resources to boost your Git skills.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 resources to boost your Git skills) +[#]: via: (https://opensource.com/article/19/12/git-resources) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +10 个提高 Git 技能的资源 +====== + +> 年末总结一下 Git 的最佳表现。以下是在新的一年中以新奇的方式使用 Git 的十篇文章。 + +![open source button on keyboard][1] + +快到 2019 年底了,是时候回顾一下我们今年发表的有关 Git 的前 10 篇文章了。 + +这些文章包括从用例和教程到一些非常有趣的(甚至有些非常规的)使用 Git 的方法。所有这些文章都可以帮助你提高 Git 技能,但是,如果你确实需要 Git 入门介绍,请务必查看我们的《[Git 入门:术语入门][2]》文章,并下载我们的 [Git 备忘单][3]。 + +1. Molly de Blanc 写的《[GNOME 如何使用 Git][4]》考察了 GNOME 项目采用的自托管 GitLab 实例的做法,该实例作为 GNOME 项目集中保存为 GNOME 做出的贡献的位置。De Blanc 从事于非编码职位,因此她的文章还探讨了切换到 GitLab 如何使主要角色不是编写代码的贡献者受益。 +2. Ahmad Awais 写的《[Emoji-Log:编写 Git 提交信息的新方法][5]》解释了如何使用 Emoji-Log(一种直白的、开源的 Git 提交日志标准)来编写更好、更用户友好的 Git 提交消息。本文概述了 Emoji-Log 背后的理论以及可添加到 `.bashrc`、`.zshrc` 或 `.gitconfig` 中的配置示例,以便你快速开始使用 Emoji-Log。 +3. 在《[用 Git 管理你的每日行程][6]》中,Seth Kenlon 解释了如何使用 Git 来管理日历。通过结合 Org 模式、Git 和其他一些工具,Kenlon 描述了如何创建可在设备之间同步的基于 Git 的日历工作流。 +4. 《[用 Git 作为聊天应用的后端][7]》,Seth Kenlon 探索了另一种使用 Git 的非常规方式。在本文中,他探讨了 GIC,这是一个用 Node.js 编写的聊天客户端,其中 Git 用作后端数据库。GIC 是一个概念验证模型,不是供产品环境使用的东西,但是它提供了一个有趣的示例,说明了使用 Git 的真正独特方法。 +5. Alan Formy-Duval 的《[Git 学习实用练习][8]》是一份他为提高 Git 技能而努力的编年史。他分享了自己的经验,以使其他人受益于他所学,而 Git 新手将从这篇对 Git 核心功能的出色概述中受益匪浅。 +6. 《[用 Git 帮助写作者更好地完成工作][9]》的作者 Seth Kenlon 着眼于写作者如何从基于 Git 的工作流中受益。本文介绍了如何使用 Git 和 Atom 利用 Markdown 进行书写。通过遵循本文中的示例,写作者可以轻松地将复杂的修订控制系统添加到其编写工作流中。 +7. Sachin Patil 在《[如何使用 Magit 管理 Git 项目][10]》中,解释了如何使用 Emacs 的 Magit 扩展来管理 Git 存储库。本文提供了有关如何在 Emacs 中执行一系列关键 Git 任务的清晰示例。这些示例由说明各种任务的屏幕截图支持。 +8. 《[把“点文件”放到版本控制中][11]》的作者 Matthew Broberg 演示了如何使用 Git 存储放在主目录中的点文件。将你的点文件存储在 Git 存储库中,可以更轻松地在计算机之间共享系统配置,并且,如果你愿意的话,也可以与其他人共享配置。这篇文章也有什么不要共享的警告,因为共享错误的点文件会暴露给其他人。 +9. Austin Dewey 的《[4 种用于 Git 加密的机密管理工具][12]》在本文中比较了 Git-crypt、BlackBox、SOPS 和 Transcrypt,研究了在 Git 中存储机密的工具。本文涵盖四个主要领域:支持的加密类型、每个项目的目标、项目的工作流和差异以及其他功能。 +10. Seth Kenlon 的《[使用 Git 管理 Git 服务器][13]》解释了如何使用 Gitolite 管理 Git 服务器。Gitolite 是使用 Git 来管理 Git 服务器的“管理杂项的后端应用程序”。本文演示了如何安装、配置和使用 Gitolite,并提供了清晰的示例详细说明了该过程的每个步骤。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/git-resources + +作者:[Joshua Allen Holm][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard) +[2]: https://opensource.com/article/19/2/git-terminology +[3]: https://opensource.com/downloads/cheat-sheet-git +[4]: https://opensource.com/article/19/10/how-gnome-uses-git +[5]: https://linux.cn/article-10627-1.html +[6]: https://linux.cn/article-11320-1.html +[7]: https://linux.cn/article-11342-1.html +[8]: https://opensource.com/article/19/5/practical-learning-exercise-git +[9]: https://linux.cn/article-11499-1.html +[10]: https://opensource.com/article/19/1/how-use-magit +[11]: https://linux.cn/article-11419-1.html +[12]: https://opensource.com/article/19/2/secrets-management-tools-git +[13]: https://opensource.com/article/19/4/server-administration-git From 65d17132c3e768ba812c5933771776d6c3f8cc11 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 20:41:08 +0800 Subject: [PATCH 319/676] APL --- sources/tech/20191204 Fedora Desktops - Memory Footprints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md b/sources/tech/20191204 Fedora Desktops - Memory Footprints.md index f9a3ea0f3b..f69a975a37 100644 --- a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md +++ b/sources/tech/20191204 Fedora Desktops - Memory Footprints.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ba98913fbc23359ede2cc125a751956f3b0fb6d5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 29 Dec 2019 21:07:54 +0800 Subject: [PATCH 320/676] TSL --- ...204 Fedora Desktops - Memory Footprints.md | 82 ------------------- ...204 Fedora Desktops - Memory Footprints.md | 82 +++++++++++++++++++ 2 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 sources/tech/20191204 Fedora Desktops - Memory Footprints.md create mode 100644 translated/tech/20191204 Fedora Desktops - Memory Footprints.md diff --git a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md b/sources/tech/20191204 Fedora Desktops - Memory Footprints.md deleted file mode 100644 index f69a975a37..0000000000 --- a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md +++ /dev/null @@ -1,82 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fedora Desktops – Memory Footprints) -[#]: via: (https://fedoramagazine.org/fedora-desktops-memory-footprints/) -[#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) - -Fedora Desktops – Memory Footprints -====== - -![][1] - -There are over 40 desktops in Fedora. Each desktop has it’s own strengths and weaknesses. Usually picking a desktop is a very personal preference based on features, looks, and other qualities. Sometimes, what you pick for a desktop is limited by hardware constraints. - -This article is to help people compare Fedora desktops based on the desktop baseline memory. To narrow the scope, we are only looking at the desktops that have an official Fedora Live image. - -### Installation and Setup - -Each of the desktops was installed on it’s own KVM virtual machine. Each virtual machine had 1 CPU, 4GB of memory, 15 GB virtio solid state disk, and everything else that comes standard on RHEL 8.0 kvm. - -The images for installation were the standard Fedora 31 Live images. For GNOME, that image was the Fedora Workstation. For the other desktops, the corresponding Spin was used. Sugar On A Stick (SOAS) was not tested because it does not install easily onto a local drive. - -The virtual machine booted into the Live CD. “Install to Hard Disk” was selected. During the install, only the defaults were used. A root user, and a regular users were created. After installation and reboot, the Live image was verified to not be in the virtual CDROM. - -The settings for each desktop was not touched. They each ran whatever settings came default from the Live CD installation. Each desktop was logged into via the regular user. A terminal was opened. Using sudo each machine ran “dnf -y update”. After update, in that sudo terminal, each machine ran “/sbin/shutdown -h now” to shut down. - -### Testing - -Each machine was started up. The desktop was logged into via the regular user. Three of the desktop terminals were opened. xterm was never used, it was always the terminal for that desktop, such as konsole. - -In one terminal, top was started and M pressed, showing the processes sorted by memory. In another terminal, a simple while loop showed “free -m” every 30 seconds. The third terminal was idle. - -I then waited 5 minutes. This allowed any startup services to finish. I recorded the final free result, as well as the final top three memory consumers from top. - -### Results - - * Cinnamon - * 624 MB Memory used - * cinnamon 4.8% / Xorg 2.2% / dnfdragora 1.8% - * GNOME - * 612 MB Memory used - * gnome-shell 6.9% / gnome-software 1.8% / ibus-x11 1.5% - * KDE - * 733 MB Memory used - * plasmashell 6.2% / kwin_x11 3.6% / akonadi_mailfil 2.9% - * LXDE - * 318 MB Memory used - * Xorg 1.9% / nm-applet 1.8% / dnfdragora 1.8% - * LXQt - * 391 MB Memory used - * lxqt-panel 2.2% / pcmanfm-qt 2.1% / Xorg 2.1% - * MATE - * 465 MB Memory used - * Xorg 2.5% / dnfdragora 1.8% / caja 1.5% - * XFCE - * 448 MB Memory used - * Xorg 2.3% / xfwm4 2.0% / dnfdragora 1.8% - - - -### Conclusion - -I will let the numbers speak for themselves. - -Remember that these numbers are from a default Live install. If you remove, or add services and features, your memory usage will change. But this is a good baseline to look at if you are determining your desktop based on memory consumption. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/fedora-desktops-memory-footprints/ - -作者:[Troy Dawson][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/tdawson/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/desktop-memory-footprint-816x346.jpg diff --git a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md b/translated/tech/20191204 Fedora Desktops - Memory Footprints.md new file mode 100644 index 0000000000..0fe78be674 --- /dev/null +++ b/translated/tech/20191204 Fedora Desktops - Memory Footprints.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora Desktops – Memory Footprints) +[#]: via: (https://fedoramagazine.org/fedora-desktops-memory-footprints/) +[#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) + +Fedora 上的桌面环境内存占用测试 +====== + +![][1] + +Fedora 中有 40 多中桌面环境。每种桌面环境都有自己的优点和缺点。通常,根据功能、外观和其他品质,选择桌面是非常个人的偏爱。但有时,你选择的桌面环境还会受到硬件限制。 + +本文旨在帮助人们根据桌面环境占用的基准内存来比较 Fedora 桌面环境。为了缩小范围,我们仅查看具有正式 Fedora Live 镜像的桌面环境。 + +### 安装与系统配置 + +每个桌面环境都安装在自己的 KVM 虚拟机上。每个虚拟机都有 1 个 CPU、4GB 内存、15GB virtio 固态磁盘,以及 RHEL 8.0 kvm 上所有其他标准配置。 + +用于安装的镜像是标准的 Fedora 31 Live 镜像。对于 GNOME,该镜像是 Fedora 工作站。对于其他桌面,使用了相应的 Spin 版本。未对“糖葫芦Sugar On A Stick”(SOAS)进行测试,因为它不容易安装到本地驱动器上。 + +用 Live CD 启动虚拟机,然后选择“安装到硬盘”。在安装过程中,仅使用默认值。创建一个 root 用户和一个普通用户。安装并重新启动后,live 镜像已确认不在虚拟 CDROM 中。 + +每个桌面环境的设置都没有改动。它们每个都以 Live CD 安装中默认的设置运行。每个桌面环境都是通过普通用户登录的。打开了一个终端,在每台虚拟机中都使用 `sudo` 运行了 `dnf -y update`。在更新后,在该 sudo 终端中,每台虚拟机都运行 `/sbin/shutdown -h now` 以关闭。 + +### 测试方式 + +每台机器都已启动。桌面环境已通过普通用户登录。打开了三个桌面终端。xterm 从未使用过,始终用的是该桌面环境的终端,例如 konsole。 + +在一个终端中,启动 `top` 并按下 `M`,以显示按内存排序的进程。在另一个终端中,一个简单的 `while` 循环每 30 秒显示一次 `free -m`。第三个终端闲置。 + +然后,我等待了 5 分钟。这样就可以让所有启动的服务都启动完成。我记录了最终的 `free` 结果,以及 `top` 中最终的前三名内存使用者。 + +### 结果 + + * Cinnamon + * 使用了624 MB + * cinnamon 4.8% / Xorg 2.2% / dnfdragora 1.8% + * GNOME + * 使用了 612 MB + * gnome-shell 6.9% / gnome-software 1.8% / ibus-x11 1.5% + * KDE + * 使用了 733 MB + * plasmashell 6.2% / kwin_x11 3.6% / akonadi_mailfil 2.9% + * LXDE + * 使用了 318 MB + * Xorg 1.9% / nm-applet 1.8% / dnfdragora 1.8% + * LXQt + * 使用了 391 MB + * lxqt-panel 2.2% / pcmanfm-qt 2.1% / Xorg 2.1% + * MATE + * 使用了 465 MB + * Xorg 2.5% / dnfdragora 1.8% / caja 1.5% + * XFCE + * 使用了 448 MB + * Xorg 2.3% / xfwm4 2.0% / dnfdragora 1.8% + + + +### 结论 + +我会让数字说明一切。 + +请记住,这些数字来自默认的 Live 安装环境。如果删除或添加服务和功能,则内存使用量将发生变化。但是,如果要根据内存消耗确定桌面环境,这是一个很好的基准。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-desktops-memory-footprints/ + +作者:[Troy Dawson][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/tdawson/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/desktop-memory-footprint-816x346.jpg From 2d1507f24ab878d7ab5eb4af873dad57da2c8b95 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 30 Dec 2019 00:53:06 +0800 Subject: [PATCH 321/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191230=20Fixing?= =?UTF-8?q?=20=E2=80=9CVLC=20is=20Unable=20to=20Open=20the=20MRL=E2=80=9D?= =?UTF-8?q?=20Error=20[Quick=20Tip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md --- ...nable to Open the MRL- Error -Quick Tip.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md diff --git a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md new file mode 100644 index 0000000000..d8bbaf3185 --- /dev/null +++ b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) +[#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Fixing “VLC is Unable to Open the MRL” Error [Quick Tip] +====== + +One of the [VLC tips][1] is to play YouTube and other online videos with [VLC][2]. This could help you [watch online videos with subtitles][3]. + +But things may not always be simple because at times you’ll encounter this error when trying to open YouTube video with VLC: + +**Your input can’t be opened: +VLC is unable to open the MRL ‘. Check the log for details.** + +![VLC error while playing YouTube videos][4] + +The thing here is that Google doesn’t want you to use any third party application for watching YouTube because then they cannot collect data properly. + +So, they keep changing stuff from their side to make it harder for third party devs to work with YouTube. + +Take [youtube-dl][5] for example. You’ll notice that you cannot [download YouTube videos][6] with it all of a sudden and the simplest solution is to have the latest version of youtube-dl installed. + +Same goes for VLC. If you [install the latest VLC in Ubuntu][7] or whichever operating system you are using, you probably won’t see this error. + +### Fixing “VLC is unable to open the MRL” error + +Let me show you the steps to fix this problem for YouTube at least. + +Go to this page and use Ctrl+S to save the file from the official GitHub repository of VLC media player: + +[Download youtube.lua file][8] + +Now, what you need to do is to replace the youtube.luac (mind the ‘c’ in luac) in lib/vlc/lua/playlist directory with this downloaded file. + +#### Steps for Linux + +If you are using Linux, open the terminal and use the [locate command][9] to find the exact location of youtube.luac file: + +``` +locate youtube.luac +``` + +When you get the path of the file, you just replace that file with your downloaded file. I trust you to handle this simple task. + +For me, it showed the path of the file here: + +``` +[email protected]:~$ locate youtube.lua +/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac +``` + +So all I did was to move the downloaded file to this location and replace the content of the file: + +``` +sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac +``` + +You should be able to play the YouTube videos in VLC now. + +#### Steps for Windows + +If you are using Windows, you should follow these steps: + + * Rename the downloaded youtube.lua file to youtube.luac + * Now copy this file and paste it to C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\ + + + +That’s it. + +If you have trouble with Dailymotion or other video streaming websites, you can download their respective lua files from the VLC repository [here][10] and replace the existing one in your VLC install. + +I hope this quick tip fixed the problem with VLC unable to play YouTube videos for you. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/simple-vlc-tips/ +[2]: https://www.videolan.org/index.html +[3]: https://itsfoss.com/penguin-subtitle-player/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc_error_input_cant_be_played.png?ssl=1 +[5]: https://itsfoss.com/download-youtube-linux/ +[6]: https://itsfoss.com/download-youtube-videos-ubuntu/ +[7]: https://itsfoss.com/install-latest-vlc/ +[8]: https://raw.githubusercontent.com/videolan/vlc/master/share/lua/playlist/youtube.lua +[9]: https://linuxhandbook.com/locate-command/ +[10]: https://github.com/videolan/vlc/tree/master/share/lua/playlist From 65b8a6879bbc03c98d1d0327710589a894fd6c75 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 30 Dec 2019 00:53:57 +0800 Subject: [PATCH 322/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191229=20The=20?= =?UTF-8?q?best=20resources=20for=20agile=20software=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191229 The best resources for agile software development.md --- ...esources for agile software development.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20191229 The best resources for agile software development.md diff --git a/sources/tech/20191229 The best resources for agile software development.md b/sources/tech/20191229 The best resources for agile software development.md new file mode 100644 index 0000000000..2e504f3d45 --- /dev/null +++ b/sources/tech/20191229 The best resources for agile software development.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The best resources for agile software development) +[#]: via: (https://opensource.com/article/19/12/agile-resources) +[#]: author: (Leigh Griffin https://opensource.com/users/lgriffin) + +The best resources for agile software development +====== +Read our top articles that highlight the discussion around agile's past, +present, and what it may look like in the future. +![Women programming][1] + +It has been a great year for agile topics on Opensource.com. As we approach the end of 2019, reviewed our top agile-related articles, as read by you, our readers! + +### Small Scale Scrum guide + +Opensource.com's six-part guide to [Small Scale Scrum][2] (which I helped co-author) advises smaller teams on how to bring agile into their work. The traditional scrum framework outlined in the official [Scrum Guide][3] recommends a minimum of three people for the framework to realize its full potential. However, it provides no guidance for how teams of one or two people can follow scrum successfully. Our six-part series aims to formalize Small Scale Scrum and examines our experience with it in the real world. The series was received very warmly by our readers—so much such that the six individual articles comprise 60% of our Top 10 list. So, if you haven't already, make sure to download them from our [_Introduction to Small Scale Scrum_ page][2]. + +### A comprehensive guide to agile project management + +Teams following traditional project management approaches, initially skeptical about agile, have warmed up to the agile way of working. Now agile has reached acceptance, and a more flexible, hybrid style has found a home. [_A comprehensive guide to agile project management_][4] by Matt Shealy covers 12 guiding principles of agile project management and is perfect for traditional project managers looking to bring some agility to their projects. + +### 4 steps to becoming an awesome agile developer + +A DevOps culture has emerged in many modern software teams that embrace agile software development principles that leverage cutting-edge tooling and automation. But this mechanically agile approach does not guarantee that developers are following agile practices in their day-to-day work. In [_4 steps to becoming an awesome agile developer_][5], Daniel Oh gives great tips for increasing your agility by focusing on design thinking, using predictable approaches, putting quality at the center, and continuously learning and exploring. Complementing these methods with your agile tooling will create very flexible and strong agile developers. + +### Scrum vs. kanban: Which agile framework is better? + +Scrum and kanban are two of the most popular approaches for teams running in an agile manner, and in [_Scrum vs. kanban: Which agile framework is better?_][6] Taz Brown explores the history and purpose of both. While reading this article, a great saying came to my mind: "If the only tool in your toolbox is a hammer, every problem looks like a nail." Knowing when to use kanban and when to use scrum is important, and this article helps show that both have a place, depending on your team, your challenge, and your goals. + +### 4 ways developers can have a say in what agile looks like + +Developers often have a fear of having a workstyle imposed upon them when the topic of adopting agile comes up. In [_4 ways developers can have a say in what agile looks like_][7], [Clément Verna][8] looks at ways that developers can flip that narrative by helping to determine what agile looks like on their team. Examining the origins and the basics of agile is a great starting point, but the real value is in having metrics to help guide your journey. Knowing what challenges you can expect to have will give you a firm ground to move forward. And making decisions empirically not only empowers teams but gives them a sense of ownership of the journey. Verna's article also examines the importance of putting people over processes and working as a team to achieve your goals. + +### Agile now and later + +This year, Opensource.com authors created a lot of discussion around agile's past, present, and what it may look like in the future. Thank you to all of them, and be sure to [share your own agile story][9] here in 2020. + +A look back at the tools Opensource.com covered in 2014 and 2015 , with updates on new releases,... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/agile-resources + +作者:[Leigh Griffin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lgriffin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard2.png?itok=WnKfsl-G (Women programming) +[2]: https://opensource.com/downloads/small-scale-scrum +[3]: https://scrumguides.org/scrum-guide.html +[4]: https://opensource.com/article/19/8/guide-agile-project-management +[5]: https://opensource.com/article/19/2/steps-agile-developer +[6]: https://opensource.com/article/19/8/scrum-vs-kanban +[7]: https://opensource.com/article/19/10/ways-developers-what-agile +[8]: https://twitter.com/clemsverna +[9]: https://opensource.com/how-submit-article From c54ad8e3352a78b284f4ffcc41986ef216189ea3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 30 Dec 2019 09:01:26 +0800 Subject: [PATCH 323/676] translated --- ...Falkon Open Source Web Browser from KDE.md | 121 ------------------ ...Falkon Open Source Web Browser from KDE.md | 121 ++++++++++++++++++ 2 files changed, 121 insertions(+), 121 deletions(-) delete mode 100644 sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md create mode 100644 translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md diff --git a/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md deleted file mode 100644 index 7f3ec34562..0000000000 --- a/sources/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ /dev/null @@ -1,121 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) -[#]: via: (https://itsfoss.com/falkon-browser/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -App Highlight: Falkon Open Source Web Browser from KDE -====== - -_**Formerly known as Qupzilla, Falkon is a web browser based on QtWebEngine. In this week’s App Highlight, we take a look at this open source software.**_ - -### Falkon: Open Source Web Browser for Linux (and Windows) - -![][1] - -First thing first, [Falkon][2] is not a new web browser. It has been in development since 2010 but it was known as Qupzilla. - -In 2017, QupZilla moved under KDE umbrella and changed its name to Falkon. Being under KDE umbrella means that project is actively maintained following KDE standards. - -It uses the [QtWebEngine][3] rendering engine – which is a striped down version of Chromium core. - -In this article, I shall take a closer look at what it offers and how it’s different than other dominant web browsers on Linux out there. - -### Features of Falkon Browser - -Thought it may not be a popular browser, I did find it capable enough to browse modern web services. - -Let me highlight the key features of Falkon and if you find it interesting enough, give it a try. - -#### Simple User Interface - -![][4] - -I know it’s not exactly a “feature” but the user experience (UX) matters a lot. Despite being a lightweight browser, you have a decent looking interface here. You won’t feel like you are using a browser from the early 2000’s. - -#### AdBlock Extension - -![][5] - -It comes packed in with the AdBlock extension that works pretty well if you want to get rid of the advertisements while browsing a website. You can also customize the behavior of the AdBlock extension. - -#### DuckDuckGo Default Search Engine - -It’s a good thing to have one of the [privacy-oriented search engines][6] as the default search engine if you do not like using Google. - -#### Session Manager - -![][7] - -Falkon includes a useful session manager from the available options in the browser menu. You can restore a specific recent session using this – which should come in handy. - -#### Extension Support - -![][8] - -It does support adding extensions but you cannot add extensions from Chrome/Firefox add-on marketplace. You have a limited set of extensions to choose from. - -#### Theme Support - -Falkon also lets you customize the appearance to some extent. You can try them out if you want to change the appearance of the browser. - -![][9] - -#### Other Essential Settings - -![][10] - -I also explored other settings/functionalities like adding a bookmark or being able to manage the passwords. - -Or, maybe manage the notification access of a webpage. - -Oh, I also tried using YouTube – with no problems whatsoever. - -Of course, this isn’t an extensive review – but yes, Falkon does have all the essential options that you will need in a browser (unless you have a specific requirements). - -### Installing Falkon Browser - -You can easily find Falkon browser available in your Software Center. - -In case you don’t, you can find Flatpak/Snap packages available from its [official download page][11]. You’ll also find Windows installer files on the download page. - -[Download Falkon Browser][11] - -**Wrapping Up** - -As a KDE product, Falkon is tailored for KDE desktop environment. Some KDE distributions like OpenMandriva use Falkon as the default web browser. - -Falkon browser is for the ones looking for a lightweight and feature-rich web browser. An alternative worth taking a look is [Midori][12]. - -In my opinion, it is a good alternative browser – unless you need tons of extensions, cross-platform synchronization and require to access some browser-specific websites. - -What do you think about the Falkon browser? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/falkon-browser/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-screenshot.jpg?ssl=1 -[2]: https://www.falkon.org/ -[3]: https://wiki.qt.io/QtWebEngine -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser.png?ssl=1 -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-adblock.jpg?ssl=1 -[6]: https://itsfoss.com/privacy-search-engines/ -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/session-manager-falkon.jpg?ssl=1 -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-extensions.png?ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-theme.png?ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-preference.png?ssl=1 -[11]: https://www.falkon.org/download/ -[12]: https://itsfoss.com/midori-browser/ diff --git a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md new file mode 100644 index 0000000000..18d42af58a --- /dev/null +++ b/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) +[#]: via: (https://itsfoss.com/falkon-browser/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +应用推荐:来自 KDE 的 Falkon 开源 Web 浏览器 +====== + +_**它以前称为 Qupzilla,Falkon 是基于 QtWebEngine 的 Web 浏览器。在本周的“应用推荐”中,我们来看看这个开源软件。**_ + +### Falkon:适用于 Linux(和 Windows)的开源 Web 浏览器 + +![][1] + +首先,[Falkon][2] 不是新的 Web 浏览器。它自 2010 年以来一直在开发中,但被称为 Qupzilla。 + +2017 年,QupZilla 移到 KDE 旗下,并更名为 Falkon。处于 KDE 旗下意味着项目会按照 KDE 标准积极维护。 + +它使用 [QtWebEngine][3] 渲染引擎,这是 Chromium 核心的简化版本。 + +在本文中,我将仔细研究它提供的功能以及与 Linux 上其他主流 Web 浏览器的不同之处。 + +### Falkon 浏览器的功能 + +我认为它可能不是流行的浏览器,但我发现它足以浏览现代 Web 服务。 + +让我重点介绍 Falkon 的主要功能,如果你觉得它很有趣,请尝试一下。 + +#### 简单的用户界面 + +![][4] + +我知道这不完全是一项“功能”,但是用户体验 (UX) 至关重要。尽管是轻量级的浏览器,但你会拥有一个不错的界面。你不会觉得使用的是 2000 年早期的浏览器。 + +#### AdBlock 扩展 + +![][5] + +它附带了 AdBlock 扩展程序,如果你想在浏览网站时摆脱广告,它大的效果很好。你还可以自定义 AdBlock 扩展的行为。 + +#### DuckDuckGo 作为默认搜索引擎 + +如果你不喜欢使用 Google,那么最好将[主打隐私的搜索引擎][6]之一设为默认搜索引擎。 + +#### 会话管理器 + +![][7] + +Falkon 在浏览器菜单的可用选项中包含了一个有用的会话管理器。你可以用它还原特定的近期会话,这应该能派上用场。 + +#### 扩展支持 + +![][8] + +它确实支持添加扩展,但你不能从 Chrome/Firefox 插件市场添加扩展。你只能选择有限的一组扩展。 + +#### 主题支持 + +Falkon 还允许你在某种程度上自定义外观。如果要更改浏览器的外观,可以尝试一下。 + +![][9] + +#### 其他基本设置 + +![][10] + +我还尝试了其他设置/功能,例如添加书签或管理密码。 + +或者,管理网页的通知。 + +我还试了 YouTube,没有任何问题。 + +当然,这不是一个详尽的评测。但是,Falkon 确实拥有浏览器中需要的所有基本功能(除非你有特定要求)。 + +### 安装 Falkon 浏览器 + +你可以在软件中心轻松找到 Falkon 浏览器。 + +如果没有,你可以从它的[官方下载页面][11]中找到 Flatpak/Snap 包。你还可以在下载页面上找到 Windows 的安装程序。 + +[Download Falkon Browser][11] + +**总结** + +作为 KDE 产品,Falkon 是为 KDE 桌面环境量身定制的。一些 KDE 发行版(例如 OpenMandriva)使用 Falkon 作为默认的 Web 浏览器。 + +Falkon 浏览器适合那些正在寻求轻巧且功能丰富的 Web 浏览器的人。值得尝试的一个替代是 [Midori][12]。 + +我认为,除非你需要大量的扩展、跨平台同步并且需要访问某些特定于浏览器的网站,不然它是一个很好的替代浏览器,。 + +你如何看待 Falkon 浏览器?请在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/falkon-browser/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-screenshot.jpg?ssl=1 +[2]: https://www.falkon.org/ +[3]: https://wiki.qt.io/QtWebEngine +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-adblock.jpg?ssl=1 +[6]: https://itsfoss.com/privacy-search-engines/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/session-manager-falkon.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-extensions.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-theme.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-preference.png?ssl=1 +[11]: https://www.falkon.org/download/ +[12]: https://itsfoss.com/midori-browser/ From 4f52933f2e7e3246e017175ae0d2625920a1de0e Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 30 Dec 2019 09:08:34 +0800 Subject: [PATCH 324/676] translating --- ...226 Darktable 3 Released With GUI Rework and New Features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md index 9463a07712..665f5f585a 100644 --- a/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md +++ b/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From beabd728b8c7fb0fe791ef2636a499b712ea17c6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 30 Dec 2019 09:35:49 +0800 Subject: [PATCH 325/676] PRF @geekpi --- ...mize your Linux desktop with KDE Plasma.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md b/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md index 402fcd0e3b..c4a3f64a24 100644 --- a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md +++ b/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Customize your Linux desktop with KDE Plasma) @@ -9,12 +9,14 @@ 使用 KDE Plasma 定制 Linux 桌面 ====== -本文是 24 天 Linux 桌面特别系列的一部分。如果你认为没有太多机会进行自定义桌面,KDE Plasma 可能适合你。 + +> 本文是 24 天 Linux 桌面特别系列的一部分。如果你认为没有太多自定义桌面的需要,KDE Plasma 可能适合你。 + ![5 pengiuns floating on iceburg][1] -KDE 社区的 Plasma 桌面是开源桌面中的巅峰之作。KDE 很早就进入了 Linux 桌面市场,但是由于它的 基础 Qt 工具包当时没有完全开放的许可证,因此才有 [GNOME][2] 桌面。在此之后,Qt 开源了,并且 KDE(及其衍生产品,例如 [Trinity桌面][3])开始蓬勃发展。 +KDE 社区的 Plasma 桌面是开源桌面环境中的巅峰之作。KDE 很早就进入了 Linux 桌面环境市场,但是由于它的基础 Qt 工具包当时没有完全开放的许可证,因此才有 [GNOME][2] 桌面。在此之后,Qt 开源了,并且 KDE(及其衍生产品,例如 [Trinity 桌面][3])开始蓬勃发展。 -你可能会在发行版的软件仓库中找到 KDE 桌面,或者可以下载并安装将 KDE 作为默认桌面的发行版。在安装之前,请注意,KDE 提供了完整、集成且强大的桌面体验,因此会同时安装几个 KDE 应用。如果你已经在运行其他桌面,那么将发现有几个冗余的应用(两个 PDF 阅读器、多个媒体播放器、两个或多个文件管理器,等等)。如果你只想尝试而不是一直使用 KDE 桌面,那么可以在虚拟机,如[GNOME Boxes][4]中安装基于 KDE 的发行版,也可以尝试使用可引导的操作系统,例如 [Porteus][5]。 +你可能会在发行版的软件仓库中找到 KDE 桌面,或者可以下载并安装将 KDE 作为默认桌面的发行版。在安装之前,请注意,KDE 提供了完整、集成且强大的桌面体验,因此会同时安装几个 KDE 应用。如果你已经在运行其他桌面,那么将发现有几个冗余的应用(两个 PDF 阅读器、多个媒体播放器、两个或多个文件管理器,等等)。如果你只想尝试而不是一直使用 KDE 桌面,那么可以在虚拟机,如 [GNOME Boxes][4] 中安装基于 KDE 的发行版,也可以尝试使用可引导的操作系统,例如 [Porteus][5]。 ### KDE 桌面之旅 @@ -22,15 +24,15 @@ KDE 社区的 Plasma 桌面是开源桌面中的巅峰之作。KDE 很早就进 ![KDE Plasma desktop][7] -但是,使 KDE 与众不同的是,你几乎可以更改任何想要的东西。Qt 工具包可以以令人惊讶的方式分割和重新排列,这意味着你实质上可以使用 KDE 的部件作为基础来设计自己的桌面。桌面行为的可用设置也很多。KDE 可以充当标准桌面,平铺窗口管理器以及两者之间的任意形式。你可以通过窗口类、角色、类型、标题或它们的任意组合来创建自己的窗口规则,因此,如果希望特定应用的行为不同于其他行为,那么可以创建全局设置的例外。 +但是,使 KDE 与众不同的是,你几乎可以更改任何想要的东西。Qt 工具包可以以令人惊讶的方式分割和重新排列,这意味着你实质上可以使用 KDE 的部件作为基础来设计自己的桌面。桌面行为的可用设置也很多。KDE 可以充当标准桌面、平铺窗口管理器以及两者之间的任意形式。你可以通过窗口类、角色、类型、标题或它们的任意组合来创建自己的窗口规则,因此,如果希望特定应用的行为不同于其他行为,那么可以创建全局设置的例外。 -此外,它还有丰富的小部件集合,使你可以自定义与桌面交互的方式。它有一个类似 GNOME 的全屏应用启动器,一个类似 Unity 的 dock 启动器和仅有图标的任务栏,一个传统的任务栏。你可以在屏幕的任何边缘上创建和放置面板。 +此外,它还有丰富的小部件集合,使你可以自定义与桌面交互的方式。它有一个类似 GNOME 的全屏应用启动器,一个类似 Unity 的 dock 启动器和仅有图标的任务栏,以及一个传统的任务栏。你可以在屏幕的任何边缘上创建和放置面板。 ![A slightly customized KDE desktop][8] -实际上,它有太多的自定义项了,因此 KDE 最常见的批评之一是它的_太过可定制化_,所以请记住,自定义项是可选的。你可以在默认配置下使用 Plasma 桌面,并仅在你认为必要时逐步进行更改。Plasma 桌面配置选项最重要的不是它们的数目,而是它们容易发现和直观,它们都在系统设置应用或者右键单击中。 +实际上,它有太多的自定义项了,因此 KDE 最常见的批评之一是它的*太过可定制化*,所以请记住,自定义项是可选的。你可以在默认配置下使用 Plasma 桌面,并仅在你认为必要时逐步进行更改。Plasma 桌面配置选项最重要的不是它们的数目,而是它们容易发现和直观,它们都在系统设置应用或者右键单击中。 -事实是,在 KDE 上,几乎绝不会只有一种方法可以完成任何给定的任务,并且它的用户将其视为其最大的优势。KDE 中没有隐含的工作流,只有默认的。并且可以更改所有默认设置,直到你需要桌面做的成为你的习惯。 +事实是,在 KDE 上,几乎绝不会只有一种方法可以完成任何给定的任务,并且它的用户将这个视为其最大的优势。KDE 中没有隐含的工作流,只有默认的。并且可以更改所有默认设置,直到你需要桌面做的成为你的习惯。 ### 一致性和集成 @@ -42,8 +44,6 @@ KDE 社区以一致性和集成为荣,出色的开发人员、社区管理以 KDE 适合所有人。使用其默认设置可获得流畅、原始的桌面体验,或对其进行自定义以使其成为自己专属。它是一个稳定、有吸引力且强大的桌面环境,可能有你想要在 Linux 完成要做的事的一切。 -KDE 最初代表 Kool Desktop Environment,但现在被许多人称为 K Desktop。 - -------------------------------------------------------------------------------- via: https://opensource.com/article/19/12/linux-kde-plasma @@ -51,7 +51,7 @@ via: https://opensource.com/article/19/12/linux-kde-plasma 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -67,4 +67,4 @@ via: https://opensource.com/article/19/12/linux-kde-plasma [8]: https://opensource.com/sites/default/files/uploads/advent-kde-dock.jpg (A slightly customized KDE desktop) [9]: https://kde.org/applications/ [10]: https://opensource.com/life/16/5/how-use-digikam-photo-management -[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus) \ No newline at end of file +[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus) From 27a8309da928f8c80bd1a779951709db944121ee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 30 Dec 2019 09:36:24 +0800 Subject: [PATCH 326/676] PUB @geekpi https://linux.cn/article-11728-1.html --- .../20191221 Customize your Linux desktop with KDE Plasma.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191221 Customize your Linux desktop with KDE Plasma.md (98%) diff --git a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md b/published/20191221 Customize your Linux desktop with KDE Plasma.md similarity index 98% rename from translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md rename to published/20191221 Customize your Linux desktop with KDE Plasma.md index c4a3f64a24..23f83f5d41 100644 --- a/translated/tech/20191221 Customize your Linux desktop with KDE Plasma.md +++ b/published/20191221 Customize your Linux desktop with KDE Plasma.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11728-1.html) [#]: subject: (Customize your Linux desktop with KDE Plasma) [#]: via: (https://opensource.com/article/19/12/linux-kde-plasma) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From e527b584873e3b2838a4bf93f82cc291d03d4e32 Mon Sep 17 00:00:00 2001 From: algzjh Date: Mon, 30 Dec 2019 14:08:24 +0800 Subject: [PATCH 327/676] translating by algzjh --- ...0191229 The best resources for agile software development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191229 The best resources for agile software development.md b/sources/tech/20191229 The best resources for agile software development.md index 2e504f3d45..84c8c09548 100644 --- a/sources/tech/20191229 The best resources for agile software development.md +++ b/sources/tech/20191229 The best resources for agile software development.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (algzjh) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 31b79577a8c9c3510734778f15e389f2236cfb4f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 30 Dec 2019 21:08:04 +0800 Subject: [PATCH 328/676] APL --- .../20191113 How to cohost GitHub and GitLab with Ansible.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md index a635054dae..e71aed34ce 100644 --- a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md +++ b/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 02beba8457b17969a9c75c3f4332fe306511bc88 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 30 Dec 2019 23:31:08 +0800 Subject: [PATCH 329/676] TSL --- ...o cohost GitHub and GitLab with Ansible.md | 175 ------------------ ...o cohost GitHub and GitLab with Ansible.md | 168 +++++++++++++++++ 2 files changed, 168 insertions(+), 175 deletions(-) delete mode 100644 sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md create mode 100644 translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md diff --git a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md deleted file mode 100644 index e71aed34ce..0000000000 --- a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md +++ /dev/null @@ -1,175 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to cohost GitHub and GitLab with Ansible) -[#]: via: (https://opensource.com/article/19/11/how-host-github-gitlab-ansible) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to cohost GitHub and GitLab with Ansible -====== -Protect your access to important projects by mirroring Git repositories -with Ansible. -![Hands programming][1] - -Open source is everywhere. It's in your computer at home, it's in your computer at work, it's on the internet, and a lot of it is managed with [Git][2]. Because Git is decentralized, many people also think of it as a kind of crowdsourced backup solution. The theory is that each time someone clones a Git repository to their local computer, they are creating a backup of the project's source code. If 100 people do that, then there are 100 backup copies of a repository. - -This, in theory, mitigates "disasters" such as a project maintainer [suddenly deciding to remove a repository][3] or [inexplicably blocking all traffic][4] and leaving developers scrambling to figure out who has the latest version of the master branch. Similarly, entire code-hosting sites have disappeared in the past. Nobody anticipated the closure of Google Code, Microsoft CodePlex, or Gitorious when they were at their peak. - -In short, if the internet has taught us anything over the past few decades, it's that relying on the internet to magically create backups isn't the most reliable road to redundancy. - -Besides, it's a problem for a lot of people that many open source projects are hosted on GitHub, which is not an open platform. Many developers and users would prefer to support and interact with a stack such as GitLab, which has an open source community edition. - -### Using Ansible for Git - -Git's decentralization is useful in solving this problem. Using pure Git, you can easily push to two or more repositories with a single **push** command. However, for that to be useful against unexpected failure, you must be interacting (and pushing, specifically) with a Git repository frequently. Furthermore, there may be repositories out there that you want to back up, even though you may never push or pull the code yourself. - -But using Ansible, you can automate Git pulls of a project's master branch (or any other branch, for that matter) and then automate Git pushes of the repository to an "offsite" mirror. In other words, you can have your computer regularly pull from GitHub and push to GitLab or [Gitolite][5] or Gitea (or whatever Git host you prefer). - -### Ansible modules - -There wouldn't be much to Ansible if it weren't for its excellent collection of modules. Like third-party libraries for Python or applications for Linux, the technical _driver_ of the useful and surprisingly easy tricks Ansible is famous for are the parts that other people have already figured out for you. Because this article is tackling how to effectively and reliably backup a Git repository, the modules used here are the [Git module][6] and the [ini_file][7] module. - -To begin, create a file called **mirror.yaml** to serve as the playbook. You can start mostly as you usually do with Ansible, with **name** and **task** entries. This example adds **localhost** to the **hosts** list so that the play runs on the controller machine (the computer you're sitting at right now), but in real life, you would probably run this on a specific host or group of hosts on your network. - - -``` -\--- -\- name: "Mirror a Git repo with Ansible" -  hosts: localhost -  tasks: -``` - -### Git pull and clone - -If you're going to make a backup, then you need a copy of the latest code. The obvious way to make that happen with a Git repository is to perform a **git pull**. However, **pull** assumes that a clone already exists, and a well-written Ansible _play_ (an Ansible script) assumes as little as possible. It's better to tell Ansible to **clone** a repository first. - -Add your first task to your playbook: - - -``` -\--- -\- name: "Mirror a Git repo with Ansible" -  hosts: localhost -  vars: -    git_dir: /tmp/soso.git -  tasks: - -  - name: "Clone the git repo" -    git: -       repo: '' -       dest: '{{ git_dir }}' -       clone: yes -       update: yes -``` - -This example uses the open source, Unix-like operating system **soso** as the repository I want to mirror. This is a completely arbitrary choice and in no way implies a lack of confidence in this repository's future. It also uses a variable to refer to the destination folder, **/tmp/soso.git**, which is convenient now and also beneficial later should you want to scale this out to be a generic mirroring script. In real life, you would probably have a more permanent location than **/tmp**, such as **/home/gitmirrors/soso.git** or **/opt/gitmirrors/soso.git**, on your worker machine. - -Run your playbook: - - -``` -`$ ansible-playbook mirror.yaml` -``` - -The first time you run the playbook, Ansible correctly detects that the Git repository does not yet exist locally, so it clones it. - - -``` -PLAY [Ansible Git mirror] ******** - -TASK [Gathering Facts] *********** -ok: [localhost] - -TASK [Clone git repo] ************ -changed: [localhost] - -PLAY RECAP *********************** -localhost: ok=2 changed=1 failed=0 [...] -``` - -Should you run the playbook again, Ansible correctly detects that there have been no changes since the last time it was run and it reports that no actions were performed: - - -``` -`localhost: ok=2 changed=0 failed=0 [...]` -``` - -Next, Ansible must be instructed to push the repository to another Git server. - -### Git push - -The Git module in Ansible doesn't provide a **push** function, so that part of the process is manual. However, before you can push the repo to an alternate mirror, you have to have a mirror, and you have to configure the mirror as an alternate remote. - -First, you must add an alternate remote to your Git configuration. Because the Git config file is an INI-style configuration, you can use the **ini_file** Ansible module to append the required information easily. Add this to your playbook: - - -``` - - name: "Add alternate remote" -    ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='[git@gitlab.com][8]:example/soso-mirror.git' -    tags: configuration -``` - -For this to work, you must have an empty repository on your destination server (in this case, [GitLab.com][9]). If you need to create destination repositories in your playbook, you can do that by following Steve Ovens' excellent article "[How to use Ansible to set up a Git server over SSH][10]." - -Finally, use Git directly to push HEAD to your alternate remote: - - -``` - - name: "Push the repo to alternate remote" -    shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' -``` - -Run the playbook as usual, and then automate the process so that you never have to run it directly again. You can adjust the script with variables and specific Git commands to suit your needs, but with regular pulls and pushes, you can be sure that an important project that lives on one server is safely mirrored on another. - -Here is the full playbook for reference: - - -``` -\--- -\- name: "Mirror a Git repository with Ansible" -  hosts: localhost -  vars: -    git_dir: /tmp/soso.git - -  tasks: - -  - name: "Clone the Git repo" -    git: -       repo: '' -       dest: '{{ git_dir }}' -       clone: yes -       update: yes - -  - name: "Add alternate remote" -    ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='[git@gitlab.com][8]:example/soso-mirror.git' -    tags: configuration -  -  - name: "Push the repo to alternate remote" -    shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/how-host-github-gitlab-ansible - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) -[2]: https://opensource.com/resources/what-is-git -[3]: https://github.com/AntiMicro/antimicro/issues/3 -[4]: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons -[5]: https://opensource.com/article/19/4/server-administration-git -[6]: https://docs.ansible.com/ansible/latest/modules/git_module.html -[7]: https://docs.ansible.com/ansible/latest/modules/ini_file_module.html -[8]: mailto:git@gitlab.com -[9]: http://GitLab.com -[10]: https://opensource.com/article/17/8/ansible-environment-management diff --git a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md new file mode 100644 index 0000000000..4d9193d930 --- /dev/null +++ b/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to cohost GitHub and GitLab with Ansible) +[#]: via: (https://opensource.com/article/19/11/how-host-github-gitlab-ansible) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何使用 Ansible 同步 GitHub 和 GitLab +====== + +> 通过使用 Ansible 镜像 Git 存储库,保护对重要项目的访问。 + +![Hands programming][1] + +开源无处不在。它在家里的计算机上、在工作场所的计算机上、在互联网上,并且很多都由 [Git][2] 管理。由于 Git 是分布式的,因此许多人也将其视为一种众包的备份解决方案。从理论上讲,每当有人将 Git 存储库克隆到其本地计算机时,他们就是创建了项目源代码的备份。如果有 100 个人这样做,则存储库就有 100 个备份副本。 + +从理论上讲,这可以缓解“灾难”,例如项目维护者[突然决定删除存储库][3]或[莫名其妙地阻止所有流量][4],导致开发人员们无头苍蝇般地寻找谁拥有主分支的最新版本。类似的,整个代码托管站点也会消失。没有人会想到 Google Code、Microsoft CodePlex 或 Gitorious 会在鼎盛时期将被关闭。 + +简而言之,如果在过去的几十年中互联网教给了我们一些东西,那就是依靠互联网神奇地创建备份并不是冗余的最可靠途径。 + +此外,对于许多人来说,很多开源项目都托管在 GitHub 上是个问题,而 GitHub 不是开放平台。许多开发人员和用户都希望支持诸如 GitLab 之类的堆栈并与之交互,它具有开源社区版本。 + +### 使用 Ansible 管理 Git + +Git 的去中心方式对于解决这个问题很有用。使用纯 Git,你可以使用一个 `push` 命令轻松地将其推到两个或多个存储库。但是,为了使其在发生意外故障时有用,你必须经常与 Git 存储库进行交互(特别是推送)。此外,即使你可能永远不会自己推送或拉出代码,也可能有一些要备份的存储库。 + +但是,使用 Ansible,你可以自动执行项目主分支(或其他任何分支)的 Git 拉取,然后自动存储库到“异地”镜像的 Git 推送。换句话说,你可以让你的计算机定期从 GitHub 拉取并推送到 GitLab 或 [Gitolite][5] 或 Gitea(或你喜欢的任何 Git 主机)。 + +### Ansible 模块 + +如果 Ansible 并不是因为其出色的模块集合,那么它就没那么出色。像 Python 的第三方库或 Linux 的应用程序一样,这个技术驱动器有用而令人惊讶的简单技巧是,Ansible 以其他人贡献的组件而闻名。因为本文正在研究如何有效和可靠地备份 Git 存储库,所以这里使用的模块是 [Git 模块][6]和 [ini_file][7] 模块。 + +首先,创建一个名为 `mirror.yaml` 的文件作为剧本playbook。你可以像通常使用 Ansible 一样,从 `name` 和 `task` 条目开始。本示例将 `localhost` 添加到 `hosts` 列表中,以便在控制器计算机(你现在坐在前面的计算机)上运行动作play,但是在现实生活中,你可能会在特定的主机或一组网络上的主机上运行。 + +``` +--- +- name: "Mirror a Git repo with Ansible" + hosts: localhost + tasks: +``` + +### Git 拉取和克隆 + +如果要进行备份,则需要最新代码的副本。在 Git 仓库中实现这一目标的明显方法是执行 `git pull`。 但是,`pull` 会假定克隆已经存在,而写得很好的 Ansible 动作(Ansible 脚本)则尽可能少的假定。 最好先告诉 Ansible `clone` 存储库。 + +将你的第一个任务添加到剧本: + +``` +--- +- name: "Mirror a Git repo with Ansible" + hosts: localhost + vars: + git_dir: /tmp/soso.git + tasks: + + - name: "Clone the git repo" + git: + repo: 'https://github.com/ozkl/soso.git' + dest: '{{ git_dir }}' + clone: yes + update: yes +``` + +这个例子使用了开源的,类似于 Unix 的操作系统 soso 作为我要镜像的存储库。这是一个完全任意的选择,绝不意味着对该存储库的未来缺乏信心。它还使用变量来引用目标文件夹 `/tmp/soso.git`,这很方便,并且如果以后你希望将它扩展为一个通用的镜像脚本也会受益。在现实生活中,你的工作机上可能会比 `/tmp` 具有更永久的位置,例如 `/home/gitmirrors/soso.git` 或 `/opt/gitmirrors/soso.git`。 + +运行你的剧本: + +``` +$ ansible-playbook mirror.yaml +``` + +首次运行该剧本时,Ansible 会正确检测到 Git 存储库在本地尚不存在,因此将其克隆。 + +``` +PLAY [Ansible Git mirror] ******** + +TASK [Gathering Facts] *********** +ok: [localhost] + +TASK [Clone git repo] ************ +changed: [localhost] + +PLAY RECAP *********************** +localhost: ok=2 changed=1 failed=0 [...] +``` + +如果你再次运行该剧本,Ansible 会正确检测到自上次运行以来没有任何更改,并且会报告未执行任何操作: + +``` +localhost: ok=2 changed=0 failed=0 [...] +``` + +接下来,必须指示 Ansible 将存储库推送到另一个 Git 服务器。 + +### Git 推送 + +Ansible 中的 Git 模块不提供 `push` 功能,因此该过程的一部分是手动的。但是,在将存储库推送到备用镜像之前,你必须具有一个镜像,并且必须将镜像配置为备用远程服务器remote。 + +首先,必须将备用的远程服务器添加到 Git 配置。因为 Git 配置文件是 INI 样式的配置,所以你可以使用 `ini_file` Ansible 模块轻松地添加所需的信息。将此添加到你的剧本: + +``` + - name: "Add alternate remote" + ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='git@gitlab.com:example/soso-mirror.git' + tags: configuration +``` + +为此,你必须在目标服务器上有一个空的存储库(在本例中为 [GitLab.com][9])。如果需要在剧本中创建目标存储库,可以按照 Steve Ovens 的出色文章《[如何使用 Ansible 通过 SSH 设置 Git 服务器][10]》来完成。 + +最后,直接使用 Git 将 HEAD 推送到备用远程服务器: + +``` + - name: "Push the repo to alternate remote" + shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' +``` + +像往常一样运行该剧本,然后使该过程自动化,这样你就不必再次直接运行它了。你可以使用变量和特定的 Git 命令来调整脚本以适应你的需求,但是通过常规的拉取和推送操作,可以确保驻留在一台服务器上的重要项目可以安全地镜像到另一台服务器上。 + +这是完整的剧本,供参考: + +``` +--- +- name: "Mirror a Git repository with Ansible" + hosts: localhost + vars: + git_dir: /tmp/soso.git + + tasks: + + - name: "Clone the Git repo" + git: + repo: 'https://github.com/ozkl/soso.git' + dest: '{{ git_dir }}' + clone: yes + update: yes + + - name: "Add alternate remote" + ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='git@gitlab.com:example/soso-mirror.git' + tags: configuration + + - name: "Push the repo to alternate remote" + shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/how-host-github-gitlab-ansible + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/resources/what-is-git +[3]: https://github.com/AntiMicro/antimicro/issues/3 +[4]: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons +[5]: https://opensource.com/article/19/4/server-administration-git +[6]: https://docs.ansible.com/ansible/latest/modules/git_module.html +[7]: https://docs.ansible.com/ansible/latest/modules/ini_file_module.html +[8]: mailto:git@gitlab.com +[9]: http://GitLab.com +[10]: https://opensource.com/article/17/8/ansible-environment-management From 5f1725dca61cce9890bdce61d3a0866fbe191b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 31 Dec 2019 08:08:05 +0800 Subject: [PATCH 330/676] Translated --- ... chapter template in LibreOffice Writer.md | 118 ----------------- ... chapter template in LibreOffice Writer.md | 124 ++++++++++++++++++ 2 files changed, 124 insertions(+), 118 deletions(-) delete mode 100644 sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md create mode 100644 translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md diff --git a/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md deleted file mode 100644 index 0d8bfed9ce..0000000000 --- a/sources/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md +++ /dev/null @@ -1,118 +0,0 @@ -Translating by robsean -How to create an e-book chapter template in LibreOffice Writer -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_colorbooks.png?itok=vNhsYYyC) -For many people, using a word processor is the fastest, easiest, and most familiar way to write and publish an e-book. But firing up your word processor and typing away isn't enough--you need to follow a format. - -That's where a template comes in. A template ensures that your book has a consistent look and feel. Luckily, creating a template is quick and easy, and the time and effort you spend on it will give you a better-looking book. - -In this article, I'll walk you through how to create a simple template for writing individual chapters of an e-book using LibreOffice Writer. You can use this template for both PDF and EPUB books and modify it to suit your needs. - -### My approach - -Why am I focusing on creating a template for a chapter rather than one for an entire book? Because it's easier to write and manage individual chapters than it is to work on a single monolithic document. - -By focusing on individual chapters, you can focus on what you need to write. You can easily move those chapters around, and it's less cumbersome to send a reviewer a single chapter rather than your full manuscript. When you've finished writing a chapter, you can simply stitch your chapters together to publish the book (I'll discuss how to do that below). But don't feel that you're stuck with this approach--if you prefer to write in single file, simply adapt the steps described in this article to doing so. - -Let's get started. - -### Setting up the page - -This is important only if you plan to publish your e-book as a PDF. Setting up the page means your book won't comprise a mass of eye-straining text running across the screen. - -Select **Format > Page** to open the **Page Style** window. My PDF e-books are usually 5x8 inches tall (about 13x20cm, for those of us in the metric world). I also set the margins to half an inch (around 1.25 cm). These are my preferred dimensions; use whatever size suits you. - -![LibreOffice Page Style window][2] - - -The Page Style window in LibreOffice Writer lets you set margins and format the page. - -Next, add a footer to display a page number. Keep the Page Style window open and click the **Footer** tab. Select **Footer on** and click **OK**. - -On the page, click in the footer, then select **Insert > Field > Page Number**. Don't worry about the position and appearance of the page number; we'll take care of that next. - -### Setting up your styles - -Like the template itself, styles provide a consistent look and feel for your documents. If you want to change the font or the size of a heading, for example, you need do it in only one place rather than manually applying formatting to each heading. - -The standard LibreOffice template comes with a number of styles that you can fiddle with to suit your needs. To do that, press **F11** to open the **Styles and Formatting** window. - - -![LibreOffice styles and formatting][4] - - -Change fonts and other details using the Styles and Formatting window. - -Right-click on a style and select **Modify** to edit it. Here are the main styles that I use in every book I write: - -Style Font Spacing/Alignment Heading 1 Liberation Sans, 36 pt 36 pt above, 48 pt below, aligned left Heading 2 Liberation Sans, 18 pt 12 pt above, 12 pt below, aligned left Heading 3 Liberation Sans, 14 pt 12 pt above, 12 pt below, aligned left Text Body Liberation Sans, 12 pt 12 pt above, 12 pt below, aligned left Footer Liberation Sans, 10 pt Aligned center - - -![LibreOffice styles in action][6] - - -Here's what a selected style looks like when applied to ebook content. - -That's usually the bare minimum you need for most books. Feel free to change the fonts and spacing to suit your needs. - -Depending on the type of book you're writing, you might also want to create or modify styles for bullet and number lists, quotes, code samples, figures, etc. Just remember to use fonts and their sizes consistently. - -### Saving your template - -Select **File > Save As**. In the Save dialog box, select _ODF Text Document Template (.ott)_ from the formats list. This saves the document as a template, which you'll be able to quickly call up later. - -The best place to save it is in your LibreOffice templates folder. In Linux, for example, that's in your **/home** directory, under . **config/libreoffice/4/user/template**. - -### Writing your book - -Before you start writing, create a folder on your computer that will hold all the files--chapters, images, notes, etc.--for your book. - -When you're ready to write, fire up LibreOffice Writer and select **File > New > Templates**. Then select your template from the list and click **Open**. - - -![LibreOffice Writer template list][8] - - -Select your template from the list you set up in LibreOffice Writer and begin writing. - -Then save the document with a descriptive name. - -Avoid using conventions like _Chapter 1_ and _Chapter 2_ --at some point, you might decide to shuffle your chapters around, and it can get confusing when you're trying to manage those chapters. You could, however, put chapter numbers, like _Chapter 1_ or _Ch1,_ in the file name. It's easier to rename a file like that if you do wind up rearranging the chapters of your book. - -With that out of the way, start writing. Remember to use the styles in the template to format the text--that's why you created the template, right? - -### Publishing your e-book - -Once you've finished writing a bunch of chapters and are ready to publish them, create a master document. Think of a master document as a container for the chapters you've written. Using a master document, you can quickly assemble your book and rearrange your chapters at will. The LibreOffice help offers detailed instructions for working with [master documents][9]. - -Assuming you want to generate a PDF, don't just click the **Export Directly to PDF** button. That will create a decent PDF, but you might want to optimize it. To do that, select **File > Export as PDF** and tweak the settings in the PDF options window. You can learn more about that in the [LibreOffice Writer documentation][10]. - -If you want to create an EPUB instead of, or in addition to, a PDF, install the [Writer2EPUB][11] extension. Opensource.com's Bryan Behrenshausen [shares some useful instructions][12] for the extension. - -### Final thoughts - -The template we've created here is bare-bones, but you can use it for a simple book, or as the starting point for building a more complex template. Either way, this template will quickly get you started writing and publishing your e-book. - -### About The Author -Scott Nesbitt;I'M A Long-Time User Of Free Open Source Software;Write Various Things For Both Fun;Profit. I Don'T Take Myself Too Seriously;I Do All Of My Own Stunts. You Can Find Me At These Fine Establishments On The Web - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/10/creating-ebook-chapter-template-libreoffice-writer - -作者:[Scott Nesbitt][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/scottnesbitt -[2]:https://opensource.com/sites/default/files/images/life-uploads/lo-page-style.png (LibreOffice Page Style window) -[4]:https://opensource.com/sites/default/files/images/life-uploads/lo-paragraph-style.png (LibreOffice styles and formatting window) -[5]:/file/374466 -[6]:https://opensource.com/sites/default/files/images/life-uploads/lo-styles-in-action.png (Example of LibreOffice styles) -[8]:https://opensource.com/sites/default/files/images/life-uploads/lo-template-list.png (Template list - LibreOffice Writer) -[9]:https://help.libreoffice.org/Writer/Working_with_Master_Documents_and_Subdocuments -[10]:https://help.libreoffice.org/Common/Export_as_PDF -[11]:http://writer2epub.it/en/ -[12]:https://opensource.com/life/13/8/how-create-ebook-open-source-way diff --git a/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md new file mode 100644 index 0000000000..c73f774162 --- /dev/null +++ b/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md @@ -0,0 +1,124 @@ +如何在 LibreOffice Writer 中创建一个电子书章节模板 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_colorbooks.png?itok=vNhsYYyC) + +对于很多人来说,使用 word 程序来写和发布一本电子书是一种最好的,最容易的,最熟悉的方法。但是,启动你的 word 程序和打字是不够的--你需要遵循一种格式。 + +这就是模板的来源。一个模板确保你的电子书有一个一致的外观和体验。幸运的是,创建一个模板是快速和容易的,并你在其上花费的时间和努力将给你一本更好感官的书。 + +在这片文章中,我将陪伴你走过如何使用 LibreOffice Writer 创建一个简单的用于写一本电子书的各个章节的模板。你可以将这个模板用于 PDF 和 EPUB 书籍,并假以修改来满足你的需要。 + +### 我的方法 + +为什么我聚焦于为一个章节创建一个模板,而不是为一整本书创建一个模板?因为编写和管理单独的章节比编写和管理单个庞大而僵化的文档更容易。 + +通过聚焦于单独的章节,你可以聚焦于你需要编写的东西。你可以容易地向各处移动这些章节,给审阅者发单独一章节比发你完整的原稿更简单而高效。当你写完一章后,你可以简单地把你的章节拼凑在一起来出版这本书(我将在下面讨论如何做到这一点)。但是不要觉得你被这种方法所束缚 --如果你更喜欢在单个文件中编写,简单地调整在这篇文章中描述的步骤来做做成这样。 + +让我们开始吧。 + +### 设置页面 + +仅当你计划发布你的电子书为一本 PDF 书时,这是很重要的。设置页面意味着你的书将不包含大量的穿越屏幕的让眼睛疲劳的文本。 + +选择 **格式 > 页面** 来打开 **页面样式** 窗口。我的 PDF 电子书通常是 5x8 英寸高(大约 13x20cm ,对于我们这些生活在米制世界的人来说)。我也设置页边距为半英寸(约 1.25 cm)。这些是我较喜欢的尺寸;使用任何适合你的尺寸。 + +![LibreOffice Page Style window][2] + + +在 LibreOffice Writer 中的页面样式窗口让你设置页边距和页格式。 + +接下来,添加页脚以显示页码。保持页面样式窗口打开着,并单击 **页脚** 选项卡。选择 **在页脚上** 并单击 **确定** 。 + +在该页面上,在页脚中单击,然后选择 **插入 > 字段 > 页码**。不要担心页码的位置和外观;我们接下来会处理。 + +### 设置你的样式 + +像模板本身一样,样式为你的文档提供一种一致的外观和体验。如果你想更改一个标题的字体或大小,例如,你只需要在一个地方完成它,而不是手动应用格式化到每个标题。 + +标准化的 LibreOffice 模板带有许多样式,你可以调整它们以适应你的需要。为此,按 **F11** 来打开 **样式和格式** 窗口。 + + +![LibreOffice styles and formatting][4] + + +使用样式和格式窗口更改字体和其它细节。 + +在一个样式上右键单击,并选择 **修改** 来编辑它。 这里是我在每本中使用的主要样式: + + 样式 | 字体 | 间距 / 对齐方式 + :-: | :-: | :-: + 标题 1 | Liberation Sans, 36 pt | 上面 36 pt ,下面 48 pt ,左对齐 + 标题 2 | Liberation Sans, 18 pt | 上面 12 pt ,下面 12 pt ,左对齐 + 标题 3 | Liberation Sans, 14 pt | 上面 12 pt ,下面 12 pt ,左对齐 + 正文 | Liberation Sans, 12 pt | 上面 12 pt ,下面 12 pt ,左对齐 + 页脚 | Liberation Sans, 10 pt | 居中对齐 + + +![LibreOffice styles in action][6] + + +这是当我们应用到电子书内容时的一个选择的样式外观。 + +对于大多数书来说,这通常是最小量要求。可以随便更改字体和空格来适应你的要求。 + +根据你正在编写书的类型,你可能也想创建或修改项目符合样式,以及数字列表,引号、代码示例,数字符号等等。只需要记住始终如一地使用字体以及其大小。 + +### 保存你的模板 + +选择 **文件 > 另存为** 。在保持对话框中,从格式列表中选择 _ODF 文本文档模板 (.ott)_ 。这将保存模板为一个模板,以后你可以快速调用该模板。 + +保存模板的最佳位置是 LibreOffice 模板文件夹。例如,在 Linux 中,那是在你的 **/home** 目录下,在 . **config/libreoffice/4/user/template** 下。 + +### 编写你的书 + +在你开始编写前,在你的计算机上创建一个文件夹,它将为你的书保存所有的文件--章节,图像,笔记等等。 + +当你准备编写时,启动 LibreOffice Writer 并选择 **文件 > 新建 > 模板** 。然后从列表中选择你的模板,并单击 **打开**。 + + +![LibreOffice Writer template list][8] + + +从你在 LibreOffice Writer 中设置的列表中选择你的模板,并开始编写。 + +然后用一个描述性名称保存文档。 + +建议使用像 _章节 1_ 和 _章节 2_ 这样的惯例--在某些时候,你可能决定重新编排你的章节,当你尝试管理这些章节时,它可能会变得混乱。然而,你可以在文件名称中放置章节数字,像 _章节 1_ 或 _Ch1 。很容易重命名一个文件,_ 。如果你完成重新排版书的章节,像这样重命名更容易。 + +别再碍事,开始编写。记住在模板中使用样式来格式化文本--这就是为什么你要创建模板,对吧? + +### 发布你的电子书 + +在完成编写一堆章节后,并准备发布它们时,创建一个主控文档。把一个主控文档作为你所编写章节的一个容器。使用一个主控文档,你可以快速地组装你的书,并任意重新排序你的章节。LibreOffice 帮助提供使用[主控文档][9]的详细信息。 + +假设你想生成一个 PDF ,不要只是单击**直接导出到 PDF** 按钮。这将创建一个相当不错的 PDF ,但是你可能想优化它。为此,选择 **文件 > 导出为 PDF** ,并在 PDF 窗口中轻微调整。你可以在 [LibreOffice Writer 文档][10] 中学到更多东西。 + +如果你想创建一个 EPUB 而不是 一个PDF ,或者除了一个 PDF 以外,另外创建一个 EPUB,安装 [Writer2EPUB][11] 扩展。Opensource.com 的 Bryan Behrenshausen 为这个扩展[分享一些有用的说明][12] 。 + +### 结束语 + +我们在这里创建的模板是极简单的,但是你将其用于一本简单的书,或者作为构建一个复杂模板的起点。不管怎样,这个模板都会让你快速地开始编写和发布你的电子书。 + +### 关于作者About The Author +Scott Nesbitt ;我是一个长期使用自由开放源码软件的人;写各种东西都是为了玩;盈利。我不太看重我自己;我做我自己的特效。你可以在网上的一些高质量的大型组装找到我的踪迹。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/10/creating-ebook-chapter-template-libreoffice-writer + +作者:[Scott Nesbitt][a] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/scottnesbitt +[2]:https://opensource.com/sites/default/files/images/life-uploads/lo-page-style.png (LibreOffice Page Style window) +[4]:https://opensource.com/sites/default/files/images/life-uploads/lo-paragraph-style.png (LibreOffice styles and formatting window) +[5]:/file/374466 +[6]:https://opensource.com/sites/default/files/images/life-uploads/lo-styles-in-action.png (Example of LibreOffice styles) +[8]:https://opensource.com/sites/default/files/images/life-uploads/lo-template-list.png (Template list - LibreOffice Writer) +[9]:https://help.libreoffice.org/Writer/Working_with_Master_Documents_and_Subdocuments +[10]:https://help.libreoffice.org/Common/Export_as_PDF +[11]:http://writer2epub.it/en/ +[12]:https://opensource.com/life/13/8/how-create-ebook-open-source-way From 78974b2caeaab7c4bd48012d11366adb70a08c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 31 Dec 2019 08:15:47 +0800 Subject: [PATCH 331/676] translating --- ...App Highlight- Open Source Disk Partitioning Tool GParted.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md index 6c78a12ecb..fe72f5695a 100644 --- a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md +++ b/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cb8f1da5653ede53266c00f859a84020c8abc920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 31 Dec 2019 08:17:27 +0800 Subject: [PATCH 332/676] Translating --- sources/tech/20191215 How to Add Border Around Text in GIMP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191215 How to Add Border Around Text in GIMP.md b/sources/tech/20191215 How to Add Border Around Text in GIMP.md index d691bafb41..0b2e3858f2 100644 --- a/sources/tech/20191215 How to Add Border Around Text in GIMP.md +++ b/sources/tech/20191215 How to Add Border Around Text in GIMP.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 93d7c5fdc1cef4e8de5c17202aab97bdc0266b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 31 Dec 2019 08:24:49 +0800 Subject: [PATCH 333/676] Translated --- .../20191016 Open source interior design with Sweet Home 3D.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md b/sources/tech/20191016 Open source interior design with Sweet Home 3D.md index bc5a17c51c..309b816f81 100644 --- a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md +++ b/sources/tech/20191016 Open source interior design with Sweet Home 3D.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f7de60aabef2eedd4f50271abd1ace60dc27e55a Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 31 Dec 2019 08:45:17 +0800 Subject: [PATCH 334/676] translated --- ...h the Linux Equinox Desktop Environment.md | 95 ------------------- ...h the Linux Equinox Desktop Environment.md | 92 ++++++++++++++++++ 2 files changed, 92 insertions(+), 95 deletions(-) delete mode 100644 sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md create mode 100644 translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md diff --git a/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md deleted file mode 100644 index 59abeb92b8..0000000000 --- a/sources/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md +++ /dev/null @@ -1,95 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Chill out with the Linux Equinox Desktop Environment) -[#]: via: (https://opensource.com/article/19/12/ede-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Chill out with the Linux Equinox Desktop Environment -====== -This article is part of a special series of 24 days of Linux desktops. -EDE is not the most glamorous, minimal, nor efficient desktop. But its -soft, muted tones are calming, its familiarity soothing, and its icon -theme fun. -![Linux penguin at the north pole beside an igloo][1] - -I haven't used the Fast Light Toolkit ([FLTK][2]) for anything serious yet, but I'm a fan of the C++ GUI toolkit that's pretty simple to learn and (in my experience) reliable even across updates. When I found out that there was a desktop environment built with FLTK, I was eager to try it—and I was quickly glad I did. The [Equinox Desktop Environment (EDE)][3] is a fast and simple desktop written in C++ and FLTK for Unix desktops. It uses common desktop conventions, so it looks and feels familiar right away, and after only a few days of using it, I found its simplicity provides a minimal elegance that I enjoy. - -![EDE desktop][4] - -### Installing EDE - -You are likely to find EDE included in your distribution's software repository, but you can also find it in its [SourceForge repository][5]. If you're already running a different desktop, it's safe to install EDE on the same system because it brings along just a few extra applications, which are specific to EDE so they won't get in your way on other desktops. - -EDE is only the desktop, and it uses the [Pekwm][6] window manager to handle layout. - -After installing EDE, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -With GDM: - -![][7] - -With SDDM: - -![][8] - -When EDE first boots, you might be prompted to confirm some startup tasks. On my Slackware workstation, KDE had marked some services as startup tasks (such as the HPLIP print monitor and a Bluetooth daemon), and EDE imported them with just one confirmation box. - -![Importing desktop services in EDE][9] - -After setting it up once, you won't need to do it again. - -### EDE desktop tour - -EDE's layout is exactly what most people expect from a desktop: application menu on the left, taskbar in the middle, system tray on the right. It's the standard off-the-shelf layout that confuses nobody; this is a desktop that's safe to install on a Linux computer and hand over, with confidence, to someone who's never used Linux in their life. They'll fall right into this desktop with a soft and gentle landing. - -You can bring up a small desktop menu with a right-click. This allows you to make an application launcher on the desktop, create a folder, and set some theme options. - -The panel at the bottom of the screen is retractable, so you can work full-screen if you prefer. Click the clock in the bottom-right of the screen to bring up a calendar and time-zone settings. - -EDE has a small Configuration Place application that provides access to a few simple preferences: - - * Background and icon settings - * Screensaver settings - * Time and clock - * System bell - * Keyboard - * Preferred applications - - - -![EDE Configuration Place][10] - -There's not much more to EDE. There's no file manager, no text editor, or paint program, or game of solitaire. You must bring anything you want to run on your desktop. That means you get to pick and choose from the wide array of Linux applications and use whatever you love the most. - -### EDE as a statement - -I found the simplicity of EDE oddly comforting, at least as a kind of "holiday" desktop; it's a nice place to visit. It's not the most glamorous desktop available, nor the most minimal, nor the most efficient. But its soft, muted tones are calming, its familiarity soothing, and its icon theme fun and exuberant. EDE is a desktop that's proud of its slow and steady pace. - -If you're in the mood to put your feet up and enjoy a clean and pleasant interface, try EDE. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/ede-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/penguin.igloo_.png?itok=K92O7H6b (Linux penguin at the north pole beside an igloo) -[2]: https://www.fltk.org/ -[3]: https://sourceforge.net/projects/ede/ -[4]: https://opensource.com/sites/default/files/uploads/advent-ede.jpg (EDE desktop) -[5]: http://ede.sf.net -[6]: https://opensource.com/article/19/12/pekwm-linux-desktop -[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg -[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg -[9]: https://opensource.com/sites/default/files/uploads/advent-ede-init.jpg (Importing desktop services in EDE) -[10]: https://opensource.com/sites/default/files/uploads/advent-ede-conf.jpg (EDE Configuration Place) diff --git a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md new file mode 100644 index 0000000000..cfa8489c40 --- /dev/null +++ b/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Chill out with the Linux Equinox Desktop Environment) +[#]: via: (https://opensource.com/article/19/12/ede-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +轻松使用 Linux Equinox 桌面环境 +====== +本文是 24 天 Linux 桌面特别系列的一部分。EDE 不是最迷人、最小或效率最高的桌面。但它的柔和、静音让人平静,它让人感到熟悉舒缓,它的图标主题有趣。 +![Linux penguin at the north pole beside an igloo][1] + +我还没有认真用过 Fast Light Toolkit([FLTK] [2]),但我是 C++ GUI 工具箱的粉丝,它非常易于学习,并且即使跨更新时也很可靠。当我发现有一个用 FLTK 构建的桌面环境时,我很想尝试一下,并且我很快为我的决定感到高兴。[Equinox 桌面环境(EDE)][3] 是用 C++ 和 FLTK 为 Unix 桌面编写的快速、简单的桌面。它使用通用的桌面约定,因此外观和感觉都非常熟悉,并且在使用几天后,我发现它的简单性提供了我所喜欢的最低限度的优雅。 + +![EDE desktop][4] + +### 安装 EDE + +你可能会发现 EDE 包含在发行版的软件仓库中,但你也可以在它的 [SourceForge 仓库][5]中找到它。如果你已经在运行其他桌面,你可以安全地在同一系统上安装 EDE,因为它仅带来了一些额外的应用,这些应用程序特定于 EDE,因此它们不会妨碍你的其他桌面。 + +EDE 只是桌面,它使用 [Pekwm][6] 窗口管理器来处理布局。 + +安装 EDE 之后,注销当前的桌面会话,以便你可以登录到新的会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 + +在 GDM 中: + +![][7] + +在 SDDM 中: + +![][8] + +首次启动 EDE 时,可能会提示你确认一些启动任务。在我的 Slackware 工作站上,KDE 将某些服务标记为启动任务(例如 HPLIP 打印监视器和蓝牙守护程序),并且 EDE 在一个确认框中显示了它们。 + +![Importing desktop services in EDE][9] + +设置一次后,你无需再次进行设置。 + +### EDE 桌面之旅 + +EDE 的布局恰恰是大多数人在桌面上所期望的布局:左侧的应用菜单、中间的任务栏、右侧的系统托盘。这是标准的现成布局,不会让任何人感到困惑。这是一个可以安全地装在 Linux 上并且可以自信地给任何没有使用过 Linux 的人使用的桌面。他们将以舒适的方式很快地适应这个桌面。 + +你可以单击鼠标右键打开一个小型桌面菜单。这可以让你在桌面上创建应用启动器、创建文件夹并设置一些主题选项。 + +屏幕底部的面板是可伸缩的,因此你可以根据需要在全屏模式下工作。单击屏幕右下角的时钟来调出日历和时区设置。 + +EDE 有一个小的配置应用,可用于设置一些简单的选项: + + * 背景和图标设置 +  * 屏幕保护程序设置 +  * 时间和时钟 +  * 系统铃声 +  * 键盘 +  * 偏好应用 + + + +![EDE Configuration Place][10] + +EDE 的功能不多。没有文件管理器、文本编辑器、绘画程序或纸牌游戏。你必须安装你想在桌面运行的程序。这意味着你可以从各种各样的 Linux 应用中进行选择,并使用你最喜欢的。 + +### EDE 总结 + +我发现 EDE 至少作为一种”假日“桌面而言,它的简单性令人舒适。它值得一看。它不是最迷人的桌面,也不是最小的、也不是最高效的。但它的柔和、静音让人平静,它让人感到熟悉舒缓,并且它的图标主题充满乐趣和生气。EDE 是一个以其缓慢而稳定的步调而自豪的桌面。 + +如果你想放松心情使用一个干净和令人愉悦的界面,请试试 EDE。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ede-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/penguin.igloo_.png?itok=K92O7H6b (Linux penguin at the north pole beside an igloo) +[2]: https://www.fltk.org/ +[3]: https://sourceforge.net/projects/ede/ +[4]: https://opensource.com/sites/default/files/uploads/advent-ede.jpg (EDE desktop) +[5]: http://ede.sf.net +[6]: https://opensource.com/article/19/12/pekwm-linux-desktop +[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg +[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg +[9]: https://opensource.com/sites/default/files/uploads/advent-ede-init.jpg (Importing desktop services in EDE) +[10]: https://opensource.com/sites/default/files/uploads/advent-ede-conf.jpg (EDE Configuration Place) From 6b402b9fa0e0233319bb3074be5a718a5ac95474 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 31 Dec 2019 08:53:59 +0800 Subject: [PATCH 335/676] translating --- ...0 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md index d8bbaf3185..b8314533cf 100644 --- a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md +++ b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b5871344bd0d89a1d3788b179a966f8103307779 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:13:03 +0800 Subject: [PATCH 336/676] PRF --- ...ry Kubernetes job candidate should know.md | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md b/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md index b7a6fa9c1d..94ae41a3e9 100644 --- a/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md +++ b/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md @@ -1,64 +1,66 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 interview questions every Kubernetes job candidate should know) [#]: via: (https://opensource.com/article/19/12/kubernetes-interview-questions) [#]: author: (Jessica Repka https://opensource.com/users/jrepka) -每个 Kubernetes 应聘者应该知道的5个面试题 +每个 Kubernetes 应聘者应该知道的 5 个面试题 ====== -如果你要面试Kubernetes相关的应聘者,这里给出了要提问的问题以及这些问题的重要性。 -![Pair programming][1] + +> 如果你是要面试 Kubernetes 相关职位的应聘者,这里给出了要提问的问题以及这些问题的重要性。 + +![](https://img.linux.net.cn/data/attachment/album/201912/31/101229mmjumsesrzhh6rhk.jpg) 面试对面试官及候选人来说都很不容易。最近,我发现面试 Kubernetes 相关工作的候选人似乎尤其困难。为什么呢?一方面,很难找到可以回答他们问题的人。而且,不管回答者回答的怎样,都很难确定他们是否有正确的经验。 -跳过这个问题,让我们来看看面试[Kubernetes][2]求职者时应该提问的一些问题。 +跳过这个问题,让我们来看看面试 [Kubernetes][2] 求职者时应该提问的一些问题。 ### Kubernetes 是什么? -我发现这个问题是面试中最好的问题之一。我经常听到有人说“我用Kubernetes工作”,但是当我问道“Kubernetes 是什么时,从来都没有得到过一个满意答案。 +我发现这个问题是面试中最好的问题之一。我经常听到有人说“我用 Kubernetes 工作”,但是当我问道“Kubernetes 是什么”时,从来都没有得到过一个满意答案。 -我最喜欢克里斯•肖特[Chris Short][3]给出的答案:“Kubernetes 就是带有一些 YAML 文件的 API 。” +我最喜欢 [Chris Short][3] 给出的答案:“Kubernetes 就是带有一些 YAML 文件的 API 。” -虽然他的回答没有错,但我会给你更详细的解释。 Kubernetes 是一个便携式容器编排工具,用于自动执行管理,监控,扩展和部署容器化应用程序。 +虽然他的回答没有错,但我会给你更详细的解释。 Kubernetes 是一个可移植容器的编排工具,用于自动执行管理、监控、扩展和部署容器化应用程序。 -我认为“用于部署容器化应用程序的编排工具”这个回答可能与你期望的答案差不多了。能回答出这个,我觉得已经很不错了。尽管许多人相信 Kubernetes 可以增加很多,但总的来说,它提供了许多API来增加其核心功能:容器编排。 +我认为“用于部署容器化应用程序的编排工具”这个回答可能与你期望的答案差不多了。能回答出这个,我觉得已经很不错了。尽管许多人认为 Kubernetes 做了更多更棒的工作,但总的来说,它为其核心功能——容器编排——添加了许多 API。 我认为,这是你在面试中可以提问的最好的问题之一,因为它至少证明了候选人是否知道 Kubernetes 是什么。 -### Kubernetes 的 node(节点)和 Pod 有什么区别? +### Kubernetes 的节点和 Pod 有什么区别? -该问题揭示了候选人对 Kubernetes 复杂性的初步了解。它将对话转换为体系结构概述,并可能导向许多有趣的后续细节问题。我已经听到了无数次关于该问题的错误解释了。 +该问题揭示了候选人对 Kubernetes 复杂性的初步了解。它将面试对话转换为对体系结构的概述,并可能导向许多有趣的后续细节问题。我已经听到了无数次关于该问题的错误解释了。 -[node][4] 是工作计算机。该计算机可以是虚拟机(VM)或物理计算机,具体取决于你是在虚拟机监控程序上运行还是在裸机上运行。该节点包含用于运行容器的服务,包括 kubelet,kube-proxy 和容器运行时。 +[节点][4] 是工作计算机。该计算机可以是虚拟机(VM)或物理计算机,具体取决于你是在虚拟机监控程序上运行还是在裸机上运行。该节点包含用于运行容器的服务,包括 kubelet、kube-proxy 和容器运行时。 -[pod][5] pod 包括(1)一个或多个具有共享网络(3)和存储(4)的容器(2)以及有关如何运行一起部署的容器的规范。这四个细节都很重要。更进一步,申请人应从技术层面解释,pod 是Kubernetes 可以创建和管理的最小可部署单元,而不是容器。 +[Pod][5] 包括:一个或多个**容器**、具有共享**网络**和**存储**,以及有关如何运行一起部署的容器的**规范**。这四个细节都很重要。更进一步,职位申请人应从技术层面解释,Pod 是 Kubernetes 可以创建和管理的最小可部署单元,而不是容器。 -对于这个问题,我听到的最好的简答是:“node 是计算机,而 pod 是容器中的东西。” 区别很重要。 Kubernetes 管理员的大部分工作是知道什么时间要部署什么,而节点可能非常非常昂贵,具体取决于它们的运行位置。我不希望有人一遍又一遍地部署节点,他们需要做的就是部署一堆Pod。 +对于这个问题,我听到的最好的简答是:“节点是计算机,而 Pod 是容器运行于其中的东西。”这个区别很重要。Kubernetes 管理员的大部分工作是知道什么时间要部署什么,而节点的部署成本可能非常非常高,具体取决于它们的运行位置。我不希望有人一遍又一遍地部署节点,他们需要做的就是部署一堆 Pod。 -### kubectl 是什么? (你怎么发音?) +### kubectl 是什么?(你怎么发音?) -这个问题是我的优先级中较高的问题之一,但可能与你和你的团队无关。在我的团队中,我们不会使用图形化界面来管理Kubernetes环境,我们使用命令行操作。 +这个问题是我优先级较高的问题之一,但可能与你和你的团队无关。在我的团队中,我们不会使用图形化界面来管理 Kubernetes 环境,我们使用命令行操作。 -那么什么是[kubectl][6]?它是 Kubernetes 的命令行界面。你可以从该界面获取并设置任何内容,从收集日志和事件到编辑部署环境和机密文件。随机提问候选人关于如何使用此工具对测试候选人对 kubectl 的熟悉度是很有帮助的。 +那么什么是 [kubectl][6]?它是 Kubernetes 的命令行界面。你可以从该界面获取并设置任何内容,从收集日志和事件到编辑部署环境和机密文件。随机提问候选人关于如何使用此工具对测试候选人对 kubectl 的熟悉度是很有帮助的。 -你是怎么读的?好吧,你随便吧(对此有很大的分歧),但是我很高兴向你介绍我朋友[Waldo][7]的精彩视频演示。 +你是怎么读的?好吧,你随便吧(对此有很大的分歧),但是我很高兴向你介绍我朋友 [Waldo][7] 的精彩视频演示。 -### 名称空间是什么? +### 命名空间是什么? -在多次面试中,我都没有得到关于这个问题的答案。我不确定在其他环境中使用的名称空间是否会在我所在的团队经常使用。我在这里给出一个简短的答案:名称空间是Pod中的虚拟集群。这种抽象可以使你将多个虚拟群集保留在各种环境中以此来进行隔离。 +在多次面试中,我都没有得到关于这个问题的答案。我不确定在其他环境中使用的命名空间是否会在我所在的团队经常使用。我在这里给出一个简短的答案:命名空间是 Pod 中的虚拟集群。这种抽象可以使你将多个虚拟集保留在多个环境中以此来进行隔离。 ### 容器是什么? -了解 Pod 中正在部署的内容总是有帮助的,因为如果都不知道其中部署的是什么,何谈部署?容器是打包代码及其所有依赖项的软件的标准单元。我收到了两个可以接收的答案,其中包括:a)精简的操作系统映像,以及b)在受限的 OS 环境中运行的应用程序。如果你可以命名使用[Docker][8]以外的其他容器的编排软件(例如你最喜欢的公共云的容器服务),则可以得到加分。 + +了解 Pod 中正在部署的内容总是有帮助的,因为如果都不知道其中部署的是什么,何谈部署?容器是打包代码及其所有依赖项的软件的标准单元。我收到了两个可以接受的答案,其中包括:a)精简的操作系统镜像,以及 b)在受限的操作系统环境中运行的应用程序。如果你可以叫得出使用 [Docker][8] 以外的其他容器的编排软件(例如你最喜欢的公共云的容器服务),则可以得到加分。 ### 其他问题 -如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。 -**[阅读更多:如何准备 Kubernetes 相关的面试?]][9]** +如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。当你仔细研究这些内容时,尝试寻找有关技术如何相互作用的有趣问题,以了解人们如何应对基础架构挑战。考虑一下你的团队最近遇到的挑战(中断),要求逐步进行部署,或者考虑改善团队积极想要改进的策略(例如减少部署时间)。问题越不抽象,对面试后真正重要的技能的询问就越多。 -没有两个环境是完全相同的。这也适用于面试中。我在每次面试中都会混合提问。 我也有一个测试面试者的小环境。我经常发现回答问题是最容易的部分,而你所做的工作才是对你的真正的考验。 +没有两个环境是完全相同的。这也适用于面试中。我在每次面试中都会混合提问。我也有一个测试面试者的小环境。我经常发现回答问题是最容易的部分,而你所做的工作才是对你的真正的考验。 我给面试官的最后一点建议是:如果你遇到一个很有潜力但没有经验的候选人时,请给他们一个证明自己的机会。如果当初没有人看到我的潜力,没有给我机会的话,我不会拥有今天的知识和经验。 @@ -70,8 +72,8 @@ via: https://opensource.com/article/19/12/kubernetes-interview-questions 作者:[Jessica Repka][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1d21973e3b172b38ecaf12396c6d5f73cc043952 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:13:47 +0800 Subject: [PATCH 337/676] PUB @Morisun029 https://linux.cn/article-11730-1.html --- ...ew questions every Kubernetes job candidate should know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191217 5 interview questions every Kubernetes job candidate should know.md (99%) diff --git a/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md b/published/20191217 5 interview questions every Kubernetes job candidate should know.md similarity index 99% rename from translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md rename to published/20191217 5 interview questions every Kubernetes job candidate should know.md index 94ae41a3e9..f6d0f6685f 100644 --- a/translated/tech/20191217 5 interview questions every Kubernetes job candidate should know.md +++ b/published/20191217 5 interview questions every Kubernetes job candidate should know.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11730-1.html) [#]: subject: (5 interview questions every Kubernetes job candidate should know) [#]: via: (https://opensource.com/article/19/12/kubernetes-interview-questions) [#]: author: (Jessica Repka https://opensource.com/users/jrepka) From 5aac22f376dcdac37e57533b79d7162eacb215d2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:48:00 +0800 Subject: [PATCH 338/676] PRF @geekpi --- ...Falkon Open Source Web Browser from KDE.md | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md index 18d42af58a..5e04937565 100644 --- a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ b/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) @@ -10,15 +10,13 @@ 应用推荐:来自 KDE 的 Falkon 开源 Web 浏览器 ====== -_**它以前称为 Qupzilla,Falkon 是基于 QtWebEngine 的 Web 浏览器。在本周的“应用推荐”中,我们来看看这个开源软件。**_ +> Falkon 是基于 QtWebEngine 的 Web 浏览器,它以前称为 Qupzilla。在本周的“应用推荐”中,我们来看看这个开源软件。 ### Falkon:适用于 Linux(和 Windows)的开源 Web 浏览器 ![][1] -首先,[Falkon][2] 不是新的 Web 浏览器。它自 2010 年以来一直在开发中,但被称为 Qupzilla。 - -2017 年,QupZilla 移到 KDE 旗下,并更名为 Falkon。处于 KDE 旗下意味着项目会按照 KDE 标准积极维护。 +首先,[Falkon][2] 并不是一款新的 Web 浏览器。它自 2010 年以来一直在开发中,但被称为 Qupzilla。2017 年,QupZilla 移到 KDE 旗下,并更名为 Falkon。处于 KDE 旗下意味着项目会按照 KDE 标准积极维护。 它使用 [QtWebEngine][3] 渲染引擎,这是 Chromium 核心的简化版本。 @@ -26,25 +24,23 @@ _**它以前称为 Qupzilla,Falkon 是基于 QtWebEngine 的 Web 浏览器。 ### Falkon 浏览器的功能 -我认为它可能不是流行的浏览器,但我发现它足以浏览现代 Web 服务。 - -让我重点介绍 Falkon 的主要功能,如果你觉得它很有趣,请尝试一下。 +我认为它可能不是流行的浏览器,但我发现它足以浏览现代 Web 服务。让我重点介绍 Falkon 的主要功能,如果你觉得它很有趣,请尝试一下。 #### 简单的用户界面 ![][4] -我知道这不完全是一项“功能”,但是用户体验 (UX) 至关重要。尽管是轻量级的浏览器,但你会拥有一个不错的界面。你不会觉得使用的是 2000 年早期的浏览器。 +我知道这不完全是一项“功能”,但是用户体验(UX)至关重要。尽管是轻量级的浏览器,但你会拥有一个不错的界面。你不会觉得使用的是一款源自 2000 年早期的浏览器。 #### AdBlock 扩展 ![][5] -它附带了 AdBlock 扩展程序,如果你想在浏览网站时摆脱广告,它大的效果很好。你还可以自定义 AdBlock 扩展的行为。 +它附带了 AdBlock 扩展程序,如果你想在浏览网站时摆脱广告,它的效果很好。你还可以自定义 AdBlock 扩展的行为。 #### DuckDuckGo 作为默认搜索引擎 -如果你不喜欢使用 Google,那么最好将[主打隐私的搜索引擎][6]之一设为默认搜索引擎。 +如果你不喜欢使用 Google,那么这是一件好事,它将这个[主打隐私的搜索引擎][6]设为默认搜索引擎。 #### 会话管理器 @@ -68,29 +64,23 @@ Falkon 还允许你在某种程度上自定义外观。如果要更改浏览器 ![][10] -我还尝试了其他设置/功能,例如添加书签或管理密码。 - -或者,管理网页的通知。 - -我还试了 YouTube,没有任何问题。 +我还尝试了其他设置/功能,例如添加书签或管理密码。或者,管理网页的通知。我还试了 YouTube,没有任何问题。 当然,这不是一个详尽的评测。但是,Falkon 确实拥有浏览器中需要的所有基本功能(除非你有特定要求)。 ### 安装 Falkon 浏览器 -你可以在软件中心轻松找到 Falkon 浏览器。 - -如果没有,你可以从它的[官方下载页面][11]中找到 Flatpak/Snap 包。你还可以在下载页面上找到 Windows 的安装程序。 +你可以在软件中心轻松找到 Falkon 浏览器。如果没有,你可以从它的[官方下载页面][11]中找到 Flatpak/Snap 包。你还可以在下载页面上找到 Windows 的安装程序。 [Download Falkon Browser][11] -**总结** +### 总结 作为 KDE 产品,Falkon 是为 KDE 桌面环境量身定制的。一些 KDE 发行版(例如 OpenMandriva)使用 Falkon 作为默认的 Web 浏览器。 -Falkon 浏览器适合那些正在寻求轻巧且功能丰富的 Web 浏览器的人。值得尝试的一个替代是 [Midori][12]。 +Falkon 浏览器适合那些正在寻求轻巧且功能丰富的 Web 浏览器的人。值得尝试的另一个替代是 [Midori][12]。 -我认为,除非你需要大量的扩展、跨平台同步并且需要访问某些特定于浏览器的网站,不然它是一个很好的替代浏览器,。 +我认为,除非你需要大量的扩展、跨平台同步并且需要访问某些特定于浏览器的网站,不然它是一个很好的替代浏览器。 你如何看待 Falkon 浏览器?请在下面的评论中让我知道你的想法。 @@ -101,7 +91,7 @@ via: https://itsfoss.com/falkon-browser/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0e0b96babd5f3cead1afb0f06d1c60310dabb8cb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:48:50 +0800 Subject: [PATCH 339/676] PUB @geekpi https://linux.cn/article-11732-1.html --- ... App Highlight- Falkon Open Source Web Browser from KDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md (98%) diff --git a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md similarity index 98% rename from translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md rename to published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md index 5e04937565..7bd221d6f8 100644 --- a/translated/tech/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ b/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11732-1.html) [#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE) [#]: via: (https://itsfoss.com/falkon-browser/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 8139d5e08b1c92f197d807237851db92ad3c0a1e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 10:51:03 +0800 Subject: [PATCH 340/676] PRF --- ...24 App Highlight- Falkon Open Source Web Browser from KDE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md index 7bd221d6f8..bd4a26bc8e 100644 --- a/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md +++ b/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md @@ -12,6 +12,8 @@ > Falkon 是基于 QtWebEngine 的 Web 浏览器,它以前称为 Qupzilla。在本周的“应用推荐”中,我们来看看这个开源软件。 +![](https://img.linux.net.cn/data/attachment/album/201912/31/105027tblfjlzn9xx8keud.png) + ### Falkon:适用于 Linux(和 Windows)的开源 Web 浏览器 ![][1] From 5d8cacfd0a1b8e7f1f1d770e84e0ac7756249421 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 11:00:55 +0800 Subject: [PATCH 341/676] PRF --- .../20191204 Fedora Desktops - Memory Footprints.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md b/translated/tech/20191204 Fedora Desktops - Memory Footprints.md index 0fe78be674..967b172a63 100644 --- a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md +++ b/translated/tech/20191204 Fedora Desktops - Memory Footprints.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Fedora Desktops – Memory Footprints) @@ -12,7 +12,7 @@ Fedora 上的桌面环境内存占用测试 ![][1] -Fedora 中有 40 多中桌面环境。每种桌面环境都有自己的优点和缺点。通常,根据功能、外观和其他品质,选择桌面是非常个人的偏爱。但有时,你选择的桌面环境还会受到硬件限制。 +Fedora 中有 40 多种桌面环境(DE)。每种桌面环境都有自己的优点和缺点。通常,根据功能、外观和其它品质,选择桌面是一件非常个人的偏好。但有时,你选择的桌面环境还会受到硬件限制。 本文旨在帮助人们根据桌面环境占用的基准内存来比较 Fedora 桌面环境。为了缩小范围,我们仅查看具有正式 Fedora Live 镜像的桌面环境。 @@ -20,11 +20,11 @@ Fedora 中有 40 多中桌面环境。每种桌面环境都有自己的优点和 每个桌面环境都安装在自己的 KVM 虚拟机上。每个虚拟机都有 1 个 CPU、4GB 内存、15GB virtio 固态磁盘,以及 RHEL 8.0 kvm 上所有其他标准配置。 -用于安装的镜像是标准的 Fedora 31 Live 镜像。对于 GNOME,该镜像是 Fedora 工作站。对于其他桌面,使用了相应的 Spin 版本。未对“糖葫芦Sugar On A Stick”(SOAS)进行测试,因为它不容易安装到本地驱动器上。 +用于安装的镜像是标准的 Fedora 31 Live 镜像。对于 GNOME,该镜像是 “Fedora 工作站”。对于其它桌面,使用了相应的 Spin 版本。未对“糖葫芦Sugar On A Stick”(SOAS)进行测试,因为它不容易安装到本地驱动器上。 -用 Live CD 启动虚拟机,然后选择“安装到硬盘”。在安装过程中,仅使用默认值。创建一个 root 用户和一个普通用户。安装并重新启动后,live 镜像已确认不在虚拟 CDROM 中。 +用 Live CD 启动虚拟机,然后选择“安装到硬盘”。在安装过程中,仅使用默认值。创建了一个 root 用户和一个普通用户。安装并重新启动后,live 镜像已确认不在虚拟 CDROM 中。 -每个桌面环境的设置都没有改动。它们每个都以 Live CD 安装中默认的设置运行。每个桌面环境都是通过普通用户登录的。打开了一个终端,在每台虚拟机中都使用 `sudo` 运行了 `dnf -y update`。在更新后,在该 sudo 终端中,每台虚拟机都运行 `/sbin/shutdown -h now` 以关闭。 +每个桌面环境的设置都没有改动。它们每个都以 Live CD 环境中默认的设置运行。每个桌面环境都是通过普通用户登录的。打开了一个终端,在每台虚拟机中都使用 `sudo` 运行了 `dnf -y update`。在更新后,在该 sudo 终端中,每台虚拟机都运行 `/sbin/shutdown -h now` 以关闭。 ### 测试方式 @@ -73,7 +73,7 @@ via: https://fedoramagazine.org/fedora-desktops-memory-footprints/ 作者:[Troy Dawson][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a359e68dfa931102f16e5b60568cced1ecda85c4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 11:01:26 +0800 Subject: [PATCH 342/676] PUB @geekpi https://linux.cn/article-11733-1.html --- .../20191204 Fedora Desktops - Memory Footprints.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191204 Fedora Desktops - Memory Footprints.md (98%) diff --git a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md b/published/20191204 Fedora Desktops - Memory Footprints.md similarity index 98% rename from translated/tech/20191204 Fedora Desktops - Memory Footprints.md rename to published/20191204 Fedora Desktops - Memory Footprints.md index 967b172a63..c11f1ea98f 100644 --- a/translated/tech/20191204 Fedora Desktops - Memory Footprints.md +++ b/published/20191204 Fedora Desktops - Memory Footprints.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11733-1.html) [#]: subject: (Fedora Desktops – Memory Footprints) [#]: via: (https://fedoramagazine.org/fedora-desktops-memory-footprints/) [#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) From c024e1d20427996ffa85a97315ee5cb71a258320 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 11:05:24 +0800 Subject: [PATCH 343/676] PRF --- published/20191204 Fedora Desktops - Memory Footprints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20191204 Fedora Desktops - Memory Footprints.md b/published/20191204 Fedora Desktops - Memory Footprints.md index c11f1ea98f..21ae866e77 100644 --- a/published/20191204 Fedora Desktops - Memory Footprints.md +++ b/published/20191204 Fedora Desktops - Memory Footprints.md @@ -44,7 +44,7 @@ Fedora 中有 40 多种桌面环境(DE)。每种桌面环境都有自己的 * gnome-shell 6.9% / gnome-software 1.8% / ibus-x11 1.5% * KDE * 使用了 733 MB - * plasmashell 6.2% / kwin_x11 3.6% / akonadi_mailfil 2.9% + * plasmashell 6.2% / kwin\_x11 3.6% / akonadi\_mailfil 2.9% * LXDE * 使用了 318 MB * Xorg 1.9% / nm-applet 1.8% / dnfdragora 1.8% From a6d3519379bb8e69ecc88cb1753b3e721f9786b2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 20:44:47 +0800 Subject: [PATCH 344/676] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2019 年过去了 --- ... And Upload Files To Compatible Hosting Sites Automatically.md | 0 .../20180207 23 open source audio-visual production tools.md | 0 ...k global- How to overcome cultural communication challenges.md | 0 ...ad Text Snippets To Pastebin-like Services From Commandline.md | 0 ...90217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md | 0 published/{ => 201912}/20190225 Netboot a Fedora Live CD.md | 0 published/{ => 201912}/20190322 Easy means easy to debug.md | 0 .../20190513 How To Set Password Complexity On Linux.md | 0 ...stall LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md | 0 published/{ => 201912}/20190711 DevOps for introverted people.md | 0 ...0190725 24 sysadmin job interview questions you should know.md | 0 published/{ => 201912}/20190827 curl exercises.md | 0 published/{ => 201912}/20190927 5 tips for GNU Debugger.md | 0 published/{ => 201912}/20191004 What-s in an open source name.md | 0 published/{ => 201912}/20191007 Using the Java Persistence API.md | 0 published/{ => 201912}/20191017 How to type emoji on Linux.md | 0 published/{ => 201912}/20191017 Using multitail on Linux.md | 0 ...14 SCP Command Examples to Securely Transfer Files in Linux.md | 0 ...o program with Bash- Logical operators and shell expansions.md | 0 .../{ => 201912}/20191023 How to program with Bash- Loops.md | 0 .../20191024 Get sorted with sort at the command line.md | 0 .../{ => 201912}/20191028 6 signs you might be a Linux user.md | 0 .../20191028 How to remove duplicate lines from files with awk.md | 0 ...1101 Awk one-liners and scripts to help you sort text files.md | 0 .../20191113 Edit images on Fedora easily with GIMP.md | 0 .../20191114 Debugging Software Deployments with strace.md | 0 .../{ => 201912}/20191115 How to port an awk script to Python.md | 0 ...ly Check if a Website is up or down from the Linux Terminal.md | 0 .../20191118 How internet security works- TLS, SSL, and CA.md | 0 ...19 Top 10 Vim plugins for programming in multiple languages.md | 0 ... Switching from Python 2 to Python 3- What you need to know.md | 0 ...w System Information on Linux Every Time You Log into Shell.md | 0 ...How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md | 0 published/{ => 201912}/20191125 How to use loops in awk.md | 0 published/{ => 201912}/20191125 The many faces of awk.md | 0 ...ds to Find the IP Address of a Domain in the Linux Terminal.md | 0 .../20191127 Create virtual machines with Cockpit in Fedora.md | 0 .../20191127 How to write a Python web API with Flask.md | 0 ...a quietly unveils faster, lower power Tesla GPU accelerator.md | 0 .../20191129 A quick introduction to Toolbox on Fedora.md | 0 .../20191202 Use the Window Maker desktop on Linux.md | 0 ... Kubernetes, low-code developers, and other industry trends.md | 0 .../20191203 Using Ansible to organize your SSH keys in AWS.md | 0 ...191203 Why use the Pantheon desktop for Linux Elementary OS.md | 0 ...XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md | 0 .../{ => 201912}/20191204 Fedora Desktops - Memory Footprints.md | 0 .../20191204 Java vs. Python- Which should you choose.md | 0 .../{ => 201912}/20191206 5 cool terminal pagers in Fedora.md | 0 .../20191206 6 Ways to Send Email from the Linux Command Line.md | 0 .../{ => 201912}/20191206 Pekwm- A lightweight Linux desktop.md | 0 .../20191207 Getting started with the GNOME Linux desktop.md | 0 .../{ => 201912}/20191209 Counting down the days using bash.md | 0 .../20191210 3 easy steps to update your apps to Python 3.md | 0 ...210 Breaking Linux files into pieces with the split command.md | 0 .../20191210 Customize your Linux desktop with FVWM.md | 0 .../20191211 Annotate screenshots on Linux with Ksnip.md | 0 ...0191211 How to Find High CPU Consumption Processes in Linux.md | 0 .../20191212 How to configure Openbox for your Linux desktop.md | 0 ...0191213 What GNOME 2 fans love about the Mate Linux desktop.md | 0 .../20191214 Get started with Lumina for your Linux desktop.md | 0 ...erview questions every Kubernetes job candidate should know.md | 0 .../20191217 Build a retro Apple desktop with the Linux MLVWM.md | 0 published/{ => 201912}/20191218 How tracking pixels work.md | 0 ... - Restart Services in Ubuntu and Other Linux Distributions.md | 0 .../20191221 Customize your Linux desktop with KDE Plasma.md | 0 ... How to Update Grub on Ubuntu and Other Linux Distributions.md | 0 ...222 Why your Python code needs to be beautiful and explicit.md | 0 ...1224 App Highlight- Falkon Open Source Web Browser from KDE.md | 0 .../20191224 Unix is turning 50. What does that mean.md | 0 69 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201912}/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md (100%) rename published/{ => 201912}/20180207 23 open source audio-visual production tools.md (100%) rename published/{ => 201912}/20181018 Think global- How to overcome cultural communication challenges.md (100%) rename published/{ => 201912}/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md (100%) rename published/{ => 201912}/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md (100%) rename published/{ => 201912}/20190225 Netboot a Fedora Live CD.md (100%) rename published/{ => 201912}/20190322 Easy means easy to debug.md (100%) rename published/{ => 201912}/20190513 How To Set Password Complexity On Linux.md (100%) rename published/{ => 201912}/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md (100%) rename published/{ => 201912}/20190711 DevOps for introverted people.md (100%) rename published/{ => 201912}/20190725 24 sysadmin job interview questions you should know.md (100%) rename published/{ => 201912}/20190827 curl exercises.md (100%) rename published/{ => 201912}/20190927 5 tips for GNU Debugger.md (100%) rename published/{ => 201912}/20191004 What-s in an open source name.md (100%) rename published/{ => 201912}/20191007 Using the Java Persistence API.md (100%) rename published/{ => 201912}/20191017 How to type emoji on Linux.md (100%) rename published/{ => 201912}/20191017 Using multitail on Linux.md (100%) rename published/{ => 201912}/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md (100%) rename published/{ => 201912}/20191022 How to program with Bash- Logical operators and shell expansions.md (100%) rename published/{ => 201912}/20191023 How to program with Bash- Loops.md (100%) rename published/{ => 201912}/20191024 Get sorted with sort at the command line.md (100%) rename published/{ => 201912}/20191028 6 signs you might be a Linux user.md (100%) rename published/{ => 201912}/20191028 How to remove duplicate lines from files with awk.md (100%) rename published/{ => 201912}/20191101 Awk one-liners and scripts to help you sort text files.md (100%) rename published/{ => 201912}/20191113 Edit images on Fedora easily with GIMP.md (100%) rename published/{ => 201912}/20191114 Debugging Software Deployments with strace.md (100%) rename published/{ => 201912}/20191115 How to port an awk script to Python.md (100%) rename published/{ => 201912}/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md (100%) rename published/{ => 201912}/20191118 How internet security works- TLS, SSL, and CA.md (100%) rename published/{ => 201912}/20191119 Top 10 Vim plugins for programming in multiple languages.md (100%) rename published/{ => 201912}/20191120 Switching from Python 2 to Python 3- What you need to know.md (100%) rename published/{ => 201912}/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md (100%) rename published/{ => 201912}/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md (100%) rename published/{ => 201912}/20191125 How to use loops in awk.md (100%) rename published/{ => 201912}/20191125 The many faces of awk.md (100%) rename published/{ => 201912}/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md (100%) rename published/{ => 201912}/20191127 Create virtual machines with Cockpit in Fedora.md (100%) rename published/{ => 201912}/20191127 How to write a Python web API with Flask.md (100%) rename published/{ => 201912}/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md (100%) rename published/{ => 201912}/20191129 A quick introduction to Toolbox on Fedora.md (100%) rename published/{ => 201912}/20191202 Use the Window Maker desktop on Linux.md (100%) rename published/{ => 201912}/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md (100%) rename published/{ => 201912}/20191203 Using Ansible to organize your SSH keys in AWS.md (100%) rename published/{ => 201912}/20191203 Why use the Pantheon desktop for Linux Elementary OS.md (100%) rename published/{ => 201912}/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md (100%) rename published/{ => 201912}/20191204 Fedora Desktops - Memory Footprints.md (100%) rename published/{ => 201912}/20191204 Java vs. Python- Which should you choose.md (100%) rename published/{ => 201912}/20191206 5 cool terminal pagers in Fedora.md (100%) rename published/{ => 201912}/20191206 6 Ways to Send Email from the Linux Command Line.md (100%) rename published/{ => 201912}/20191206 Pekwm- A lightweight Linux desktop.md (100%) rename published/{ => 201912}/20191207 Getting started with the GNOME Linux desktop.md (100%) rename published/{ => 201912}/20191209 Counting down the days using bash.md (100%) rename published/{ => 201912}/20191210 3 easy steps to update your apps to Python 3.md (100%) rename published/{ => 201912}/20191210 Breaking Linux files into pieces with the split command.md (100%) rename published/{ => 201912}/20191210 Customize your Linux desktop with FVWM.md (100%) rename published/{ => 201912}/20191211 Annotate screenshots on Linux with Ksnip.md (100%) rename published/{ => 201912}/20191211 How to Find High CPU Consumption Processes in Linux.md (100%) rename published/{ => 201912}/20191212 How to configure Openbox for your Linux desktop.md (100%) rename published/{ => 201912}/20191213 What GNOME 2 fans love about the Mate Linux desktop.md (100%) rename published/{ => 201912}/20191214 Get started with Lumina for your Linux desktop.md (100%) rename published/{ => 201912}/20191217 5 interview questions every Kubernetes job candidate should know.md (100%) rename published/{ => 201912}/20191217 Build a retro Apple desktop with the Linux MLVWM.md (100%) rename published/{ => 201912}/20191218 How tracking pixels work.md (100%) rename published/{ => 201912}/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md (100%) rename published/{ => 201912}/20191221 Customize your Linux desktop with KDE Plasma.md (100%) rename published/{ => 201912}/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md (100%) rename published/{ => 201912}/20191222 Why your Python code needs to be beautiful and explicit.md (100%) rename published/{ => 201912}/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md (100%) rename published/{ => 201912}/20191224 Unix is turning 50. What does that mean.md (100%) diff --git a/published/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md b/published/201912/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md similarity index 100% rename from published/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md rename to published/201912/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md diff --git a/published/20180207 23 open source audio-visual production tools.md b/published/201912/20180207 23 open source audio-visual production tools.md similarity index 100% rename from published/20180207 23 open source audio-visual production tools.md rename to published/201912/20180207 23 open source audio-visual production tools.md diff --git a/published/20181018 Think global- How to overcome cultural communication challenges.md b/published/201912/20181018 Think global- How to overcome cultural communication challenges.md similarity index 100% rename from published/20181018 Think global- How to overcome cultural communication challenges.md rename to published/201912/20181018 Think global- How to overcome cultural communication challenges.md diff --git a/published/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/published/201912/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md similarity index 100% rename from published/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md rename to published/201912/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md diff --git a/published/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md b/published/201912/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md similarity index 100% rename from published/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md rename to published/201912/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md diff --git a/published/20190225 Netboot a Fedora Live CD.md b/published/201912/20190225 Netboot a Fedora Live CD.md similarity index 100% rename from published/20190225 Netboot a Fedora Live CD.md rename to published/201912/20190225 Netboot a Fedora Live CD.md diff --git a/published/20190322 Easy means easy to debug.md b/published/201912/20190322 Easy means easy to debug.md similarity index 100% rename from published/20190322 Easy means easy to debug.md rename to published/201912/20190322 Easy means easy to debug.md diff --git a/published/20190513 How To Set Password Complexity On Linux.md b/published/201912/20190513 How To Set Password Complexity On Linux.md similarity index 100% rename from published/20190513 How To Set Password Complexity On Linux.md rename to published/201912/20190513 How To Set Password Complexity On Linux.md diff --git a/published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/published/201912/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md similarity index 100% rename from published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md rename to published/201912/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md diff --git a/published/20190711 DevOps for introverted people.md b/published/201912/20190711 DevOps for introverted people.md similarity index 100% rename from published/20190711 DevOps for introverted people.md rename to published/201912/20190711 DevOps for introverted people.md diff --git a/published/20190725 24 sysadmin job interview questions you should know.md b/published/201912/20190725 24 sysadmin job interview questions you should know.md similarity index 100% rename from published/20190725 24 sysadmin job interview questions you should know.md rename to published/201912/20190725 24 sysadmin job interview questions you should know.md diff --git a/published/20190827 curl exercises.md b/published/201912/20190827 curl exercises.md similarity index 100% rename from published/20190827 curl exercises.md rename to published/201912/20190827 curl exercises.md diff --git a/published/20190927 5 tips for GNU Debugger.md b/published/201912/20190927 5 tips for GNU Debugger.md similarity index 100% rename from published/20190927 5 tips for GNU Debugger.md rename to published/201912/20190927 5 tips for GNU Debugger.md diff --git a/published/20191004 What-s in an open source name.md b/published/201912/20191004 What-s in an open source name.md similarity index 100% rename from published/20191004 What-s in an open source name.md rename to published/201912/20191004 What-s in an open source name.md diff --git a/published/20191007 Using the Java Persistence API.md b/published/201912/20191007 Using the Java Persistence API.md similarity index 100% rename from published/20191007 Using the Java Persistence API.md rename to published/201912/20191007 Using the Java Persistence API.md diff --git a/published/20191017 How to type emoji on Linux.md b/published/201912/20191017 How to type emoji on Linux.md similarity index 100% rename from published/20191017 How to type emoji on Linux.md rename to published/201912/20191017 How to type emoji on Linux.md diff --git a/published/20191017 Using multitail on Linux.md b/published/201912/20191017 Using multitail on Linux.md similarity index 100% rename from published/20191017 Using multitail on Linux.md rename to published/201912/20191017 Using multitail on Linux.md diff --git a/published/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/published/201912/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md similarity index 100% rename from published/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md rename to published/201912/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md diff --git a/published/20191022 How to program with Bash- Logical operators and shell expansions.md b/published/201912/20191022 How to program with Bash- Logical operators and shell expansions.md similarity index 100% rename from published/20191022 How to program with Bash- Logical operators and shell expansions.md rename to published/201912/20191022 How to program with Bash- Logical operators and shell expansions.md diff --git a/published/20191023 How to program with Bash- Loops.md b/published/201912/20191023 How to program with Bash- Loops.md similarity index 100% rename from published/20191023 How to program with Bash- Loops.md rename to published/201912/20191023 How to program with Bash- Loops.md diff --git a/published/20191024 Get sorted with sort at the command line.md b/published/201912/20191024 Get sorted with sort at the command line.md similarity index 100% rename from published/20191024 Get sorted with sort at the command line.md rename to published/201912/20191024 Get sorted with sort at the command line.md diff --git a/published/20191028 6 signs you might be a Linux user.md b/published/201912/20191028 6 signs you might be a Linux user.md similarity index 100% rename from published/20191028 6 signs you might be a Linux user.md rename to published/201912/20191028 6 signs you might be a Linux user.md diff --git a/published/20191028 How to remove duplicate lines from files with awk.md b/published/201912/20191028 How to remove duplicate lines from files with awk.md similarity index 100% rename from published/20191028 How to remove duplicate lines from files with awk.md rename to published/201912/20191028 How to remove duplicate lines from files with awk.md diff --git a/published/20191101 Awk one-liners and scripts to help you sort text files.md b/published/201912/20191101 Awk one-liners and scripts to help you sort text files.md similarity index 100% rename from published/20191101 Awk one-liners and scripts to help you sort text files.md rename to published/201912/20191101 Awk one-liners and scripts to help you sort text files.md diff --git a/published/20191113 Edit images on Fedora easily with GIMP.md b/published/201912/20191113 Edit images on Fedora easily with GIMP.md similarity index 100% rename from published/20191113 Edit images on Fedora easily with GIMP.md rename to published/201912/20191113 Edit images on Fedora easily with GIMP.md diff --git a/published/20191114 Debugging Software Deployments with strace.md b/published/201912/20191114 Debugging Software Deployments with strace.md similarity index 100% rename from published/20191114 Debugging Software Deployments with strace.md rename to published/201912/20191114 Debugging Software Deployments with strace.md diff --git a/published/20191115 How to port an awk script to Python.md b/published/201912/20191115 How to port an awk script to Python.md similarity index 100% rename from published/20191115 How to port an awk script to Python.md rename to published/201912/20191115 How to port an awk script to Python.md diff --git a/published/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md b/published/201912/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md similarity index 100% rename from published/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md rename to published/201912/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md diff --git a/published/20191118 How internet security works- TLS, SSL, and CA.md b/published/201912/20191118 How internet security works- TLS, SSL, and CA.md similarity index 100% rename from published/20191118 How internet security works- TLS, SSL, and CA.md rename to published/201912/20191118 How internet security works- TLS, SSL, and CA.md diff --git a/published/20191119 Top 10 Vim plugins for programming in multiple languages.md b/published/201912/20191119 Top 10 Vim plugins for programming in multiple languages.md similarity index 100% rename from published/20191119 Top 10 Vim plugins for programming in multiple languages.md rename to published/201912/20191119 Top 10 Vim plugins for programming in multiple languages.md diff --git a/published/20191120 Switching from Python 2 to Python 3- What you need to know.md b/published/201912/20191120 Switching from Python 2 to Python 3- What you need to know.md similarity index 100% rename from published/20191120 Switching from Python 2 to Python 3- What you need to know.md rename to published/201912/20191120 Switching from Python 2 to Python 3- What you need to know.md diff --git a/published/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md b/published/201912/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md similarity index 100% rename from published/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md rename to published/201912/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md diff --git a/published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/published/201912/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md similarity index 100% rename from published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md rename to published/201912/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md diff --git a/published/20191125 How to use loops in awk.md b/published/201912/20191125 How to use loops in awk.md similarity index 100% rename from published/20191125 How to use loops in awk.md rename to published/201912/20191125 How to use loops in awk.md diff --git a/published/20191125 The many faces of awk.md b/published/201912/20191125 The many faces of awk.md similarity index 100% rename from published/20191125 The many faces of awk.md rename to published/201912/20191125 The many faces of awk.md diff --git a/published/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/published/201912/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md similarity index 100% rename from published/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md rename to published/201912/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md diff --git a/published/20191127 Create virtual machines with Cockpit in Fedora.md b/published/201912/20191127 Create virtual machines with Cockpit in Fedora.md similarity index 100% rename from published/20191127 Create virtual machines with Cockpit in Fedora.md rename to published/201912/20191127 Create virtual machines with Cockpit in Fedora.md diff --git a/published/20191127 How to write a Python web API with Flask.md b/published/201912/20191127 How to write a Python web API with Flask.md similarity index 100% rename from published/20191127 How to write a Python web API with Flask.md rename to published/201912/20191127 How to write a Python web API with Flask.md diff --git a/published/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/published/201912/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md similarity index 100% rename from published/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md rename to published/201912/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md diff --git a/published/20191129 A quick introduction to Toolbox on Fedora.md b/published/201912/20191129 A quick introduction to Toolbox on Fedora.md similarity index 100% rename from published/20191129 A quick introduction to Toolbox on Fedora.md rename to published/201912/20191129 A quick introduction to Toolbox on Fedora.md diff --git a/published/20191202 Use the Window Maker desktop on Linux.md b/published/201912/20191202 Use the Window Maker desktop on Linux.md similarity index 100% rename from published/20191202 Use the Window Maker desktop on Linux.md rename to published/201912/20191202 Use the Window Maker desktop on Linux.md diff --git a/published/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md b/published/201912/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md similarity index 100% rename from published/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md rename to published/201912/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md diff --git a/published/20191203 Using Ansible to organize your SSH keys in AWS.md b/published/201912/20191203 Using Ansible to organize your SSH keys in AWS.md similarity index 100% rename from published/20191203 Using Ansible to organize your SSH keys in AWS.md rename to published/201912/20191203 Using Ansible to organize your SSH keys in AWS.md diff --git a/published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/published/201912/20191203 Why use the Pantheon desktop for Linux Elementary OS.md similarity index 100% rename from published/20191203 Why use the Pantheon desktop for Linux Elementary OS.md rename to published/201912/20191203 Why use the Pantheon desktop for Linux Elementary OS.md diff --git a/published/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md b/published/201912/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md similarity index 100% rename from published/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md rename to published/201912/20191204 Dell XPS 13 7390 Review- The Best Laptop For Desktop Linux Users.md diff --git a/published/20191204 Fedora Desktops - Memory Footprints.md b/published/201912/20191204 Fedora Desktops - Memory Footprints.md similarity index 100% rename from published/20191204 Fedora Desktops - Memory Footprints.md rename to published/201912/20191204 Fedora Desktops - Memory Footprints.md diff --git a/published/20191204 Java vs. Python- Which should you choose.md b/published/201912/20191204 Java vs. Python- Which should you choose.md similarity index 100% rename from published/20191204 Java vs. Python- Which should you choose.md rename to published/201912/20191204 Java vs. Python- Which should you choose.md diff --git a/published/20191206 5 cool terminal pagers in Fedora.md b/published/201912/20191206 5 cool terminal pagers in Fedora.md similarity index 100% rename from published/20191206 5 cool terminal pagers in Fedora.md rename to published/201912/20191206 5 cool terminal pagers in Fedora.md diff --git a/published/20191206 6 Ways to Send Email from the Linux Command Line.md b/published/201912/20191206 6 Ways to Send Email from the Linux Command Line.md similarity index 100% rename from published/20191206 6 Ways to Send Email from the Linux Command Line.md rename to published/201912/20191206 6 Ways to Send Email from the Linux Command Line.md diff --git a/published/20191206 Pekwm- A lightweight Linux desktop.md b/published/201912/20191206 Pekwm- A lightweight Linux desktop.md similarity index 100% rename from published/20191206 Pekwm- A lightweight Linux desktop.md rename to published/201912/20191206 Pekwm- A lightweight Linux desktop.md diff --git a/published/20191207 Getting started with the GNOME Linux desktop.md b/published/201912/20191207 Getting started with the GNOME Linux desktop.md similarity index 100% rename from published/20191207 Getting started with the GNOME Linux desktop.md rename to published/201912/20191207 Getting started with the GNOME Linux desktop.md diff --git a/published/20191209 Counting down the days using bash.md b/published/201912/20191209 Counting down the days using bash.md similarity index 100% rename from published/20191209 Counting down the days using bash.md rename to published/201912/20191209 Counting down the days using bash.md diff --git a/published/20191210 3 easy steps to update your apps to Python 3.md b/published/201912/20191210 3 easy steps to update your apps to Python 3.md similarity index 100% rename from published/20191210 3 easy steps to update your apps to Python 3.md rename to published/201912/20191210 3 easy steps to update your apps to Python 3.md diff --git a/published/20191210 Breaking Linux files into pieces with the split command.md b/published/201912/20191210 Breaking Linux files into pieces with the split command.md similarity index 100% rename from published/20191210 Breaking Linux files into pieces with the split command.md rename to published/201912/20191210 Breaking Linux files into pieces with the split command.md diff --git a/published/20191210 Customize your Linux desktop with FVWM.md b/published/201912/20191210 Customize your Linux desktop with FVWM.md similarity index 100% rename from published/20191210 Customize your Linux desktop with FVWM.md rename to published/201912/20191210 Customize your Linux desktop with FVWM.md diff --git a/published/20191211 Annotate screenshots on Linux with Ksnip.md b/published/201912/20191211 Annotate screenshots on Linux with Ksnip.md similarity index 100% rename from published/20191211 Annotate screenshots on Linux with Ksnip.md rename to published/201912/20191211 Annotate screenshots on Linux with Ksnip.md diff --git a/published/20191211 How to Find High CPU Consumption Processes in Linux.md b/published/201912/20191211 How to Find High CPU Consumption Processes in Linux.md similarity index 100% rename from published/20191211 How to Find High CPU Consumption Processes in Linux.md rename to published/201912/20191211 How to Find High CPU Consumption Processes in Linux.md diff --git a/published/20191212 How to configure Openbox for your Linux desktop.md b/published/201912/20191212 How to configure Openbox for your Linux desktop.md similarity index 100% rename from published/20191212 How to configure Openbox for your Linux desktop.md rename to published/201912/20191212 How to configure Openbox for your Linux desktop.md diff --git a/published/20191213 What GNOME 2 fans love about the Mate Linux desktop.md b/published/201912/20191213 What GNOME 2 fans love about the Mate Linux desktop.md similarity index 100% rename from published/20191213 What GNOME 2 fans love about the Mate Linux desktop.md rename to published/201912/20191213 What GNOME 2 fans love about the Mate Linux desktop.md diff --git a/published/20191214 Get started with Lumina for your Linux desktop.md b/published/201912/20191214 Get started with Lumina for your Linux desktop.md similarity index 100% rename from published/20191214 Get started with Lumina for your Linux desktop.md rename to published/201912/20191214 Get started with Lumina for your Linux desktop.md diff --git a/published/20191217 5 interview questions every Kubernetes job candidate should know.md b/published/201912/20191217 5 interview questions every Kubernetes job candidate should know.md similarity index 100% rename from published/20191217 5 interview questions every Kubernetes job candidate should know.md rename to published/201912/20191217 5 interview questions every Kubernetes job candidate should know.md diff --git a/published/20191217 Build a retro Apple desktop with the Linux MLVWM.md b/published/201912/20191217 Build a retro Apple desktop with the Linux MLVWM.md similarity index 100% rename from published/20191217 Build a retro Apple desktop with the Linux MLVWM.md rename to published/201912/20191217 Build a retro Apple desktop with the Linux MLVWM.md diff --git a/published/20191218 How tracking pixels work.md b/published/201912/20191218 How tracking pixels work.md similarity index 100% rename from published/20191218 How tracking pixels work.md rename to published/201912/20191218 How tracking pixels work.md diff --git a/published/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md b/published/201912/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md similarity index 100% rename from published/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md rename to published/201912/20191220 How to Start, Stop - Restart Services in Ubuntu and Other Linux Distributions.md diff --git a/published/20191221 Customize your Linux desktop with KDE Plasma.md b/published/201912/20191221 Customize your Linux desktop with KDE Plasma.md similarity index 100% rename from published/20191221 Customize your Linux desktop with KDE Plasma.md rename to published/201912/20191221 Customize your Linux desktop with KDE Plasma.md diff --git a/published/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md b/published/201912/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md similarity index 100% rename from published/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md rename to published/201912/20191222 How to Update Grub on Ubuntu and Other Linux Distributions.md diff --git a/published/20191222 Why your Python code needs to be beautiful and explicit.md b/published/201912/20191222 Why your Python code needs to be beautiful and explicit.md similarity index 100% rename from published/20191222 Why your Python code needs to be beautiful and explicit.md rename to published/201912/20191222 Why your Python code needs to be beautiful and explicit.md diff --git a/published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md b/published/201912/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md similarity index 100% rename from published/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md rename to published/201912/20191224 App Highlight- Falkon Open Source Web Browser from KDE.md diff --git a/published/20191224 Unix is turning 50. What does that mean.md b/published/201912/20191224 Unix is turning 50. What does that mean.md similarity index 100% rename from published/20191224 Unix is turning 50. What does that mean.md rename to published/201912/20191224 Unix is turning 50. What does that mean.md From dcb5b04648c41f26caf577f53b03a12e5e8d512b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 22:04:33 +0800 Subject: [PATCH 345/676] PRF @geekpi --- ...e the Herbstluftwm Linux window manager.md | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md index cba33f5166..91bb816e93 100644 --- a/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md +++ b/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md @@ -1,22 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11734-1.html) [#]: subject: (Why Vim fans love the Herbstluftwm Linux window manager) [#]: via: (https://opensource.com/article/19/12/herbstluftwm-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) 为什么 Vim 爱好者喜欢 Herbstluftwm Linux 窗口管理器 ====== -本文是 24 天 Linux 桌面特别系列的一部分。如果你是Vim爱好者,请试试 Herbstluftwm,这是一个受到 ”Vim 方式“启发的基于平铺的 Linux 窗口管理器。 -![OpenStack source code \(Python\) in VIM][1] -每个人都喜欢 Vim(除了 Dvorak 和 Emacs 用户)。Vim 非常流行,以至于有整个 Web 浏览器都使用 Vim 键绑定来浏览网页,非常流行的 [Zsh][2] 终端仿真器中的 Vim 模式,甚至是文本编辑器。 还有一个名为 [herbstluftwm][3] 的窗口管理器,它部分模仿了 “Vim 方式”。Herbstluftwm 取消了窗口,在程序载入和使用时使用平铺或者象限代替。 你可以使用键盘(**Alt+h**、**Alt+j**、**Alt+k** 和 **Alt+l**)从一个平铺块移动到另一个平铺块。 +> 本文是 24 天 Linux 桌面特别系列的一部分。如果你是 Vim 爱好者,请试试 Herbstluftwm,这是一个受到 “Vim 方式”启发的平铺式 Linux 窗口管理器。 -![Herbstluftwm][4] +![](https://img.linux.net.cn/data/attachment/album/201912/31/215943pisvzwkm8mvsefhm.jpg) -从发行版软件仓库安装 Herbstluftwm。安装后,请退出当前桌面会话,以便可以登录到新会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,具体取决于你的设置)将继续登录到以前的桌面,因此在登录之前必须覆盖它。 +每个人都喜欢 Vim(除了 Dvorak 和 Emacs 用户)。Vim 非常流行,它不仅仅是个编辑器,还有整个都使用 Vim 键绑定来浏览网页的 Web 浏览器,在非常流行的 [Zsh][2] 终端仿真器中也有 Vim 模式。此外,还有一个名为 [herbstluftwm][3] 的窗口管理器,它部分模仿了 “Vim 方式”。Herbstluftwm 取消了窗口,而是在程序载入和使用时使用平铺的贴片或者象限代替。你可以使用键盘(`Alt+h`、`Alt+j`、`Alt+k` 和 `Alt+l`)从一个平铺贴片移动到另一个平铺贴片。 + +可以从发行版软件仓库安装 Herbstluftwm。安装后,请退出当前桌面会话,以便可以登录到新会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,具体取决于你的设置)将继续登录到以前的桌面,因此在登录之前必须覆盖它。 在 GDM 中: @@ -28,59 +28,56 @@ ### Herbstluftwm 桌面之旅 -第一次登录 Herbstluftwm 时,你只会看到绿屏,边缘有深绿色边框。你所看到的是初始平铺,其中没有加载任何应用程序。要启动默认应用,请按 **Alt+回车**。 - -文档中强调使用 **$HOME/.config/herbstluftwm/autostart** 作为登录时启动应用的配置文件。对于不必在每次登录时启动的应用,可以使用 xterm 作为启动守护进程。与往常一样,在命令将 shell 的控制权返回给你后加一个 **amp;** 符号。例如,要启动 Emacs: +第一次登录 Herbstluftwm 时,你只会看到一个绿屏,边缘有深绿色边框。你所看到的是初始的平铺贴片,其中没有加载任何应用程序。要启动默认应用,请按 `Alt+Enter`。 +![][4] +文档中强调使用 `$HOME/.config/herbstluftwm/autostart` 作为登录时启动重要应用的配置文件。对于不必在每次登录时启动的应用,可以使用 xterm 作为启动守护进程。与往常一样,在命令后加一个 `&` 符号会将 shell 的控制权返回给你。例如,要启动 Emacs: ``` -`% emacs &` +% emacs & ``` -这将在新平铺中启动 Emacs 窗口,然后返回命令行。 +这将在新的平铺贴片中启动 Emacs 窗口,然后返回命令行。 ![Emacs running in Herbstluftwm][7] -#### 切换平铺 +#### 切换平铺贴片 -要从一个平铺块移动到另一个平铺块,请使用经典的 **h**、**j**、**k** 或 **l** 与 **Alt** 的 Vim 导航组合键。例如,要从终端切换到其下方平铺中的应用(即屏幕底部),请按 **Alt+j**。要返回,请按 **Alt+k**。左移和右移分别为 **Alt+h** 和 **Alt+l**。 +要从一个平铺贴片移动到另一个平铺贴片,请使用经典的 `h`、`j`、`k` 或 `l` 与 `Alt` 的 Vim 导航组合键。例如,要从终端切换到其下方的平铺贴片中的应用(即屏幕底部),请按 `Alt+j`。要返回,请按 `Alt+k`。左移和右移分别为 `Alt+h` 和 `Alt+l`。 #### 分割屏幕 -你可以使用 **Alt+o** 垂直分割屏幕,使用 **Alt+u** 水平分割屏幕。 +你可以使用 `Alt+o` 垂直分割屏幕,使用 `Alt+u` 水平分割屏幕。 -要删除空白平铺块,请移动到该平铺块,然后按 **Alt+r**。 +要删除空白平铺贴片,请移动到该平铺贴片,然后按 `Alt+r`。 ### 配置 herbstluftwm -除了 **Alt** 键绑定外,你还可通过 **herbstclient** 命令与 Herbstluftwm 进行通信。此命令可以在 shell 中交互,或者你可在配置文件中保留你的首选项。 +除了 `Alt` 键绑定外,你还可通过 `herbstclient` 命令与 Herbstluftwm 进行通信。此命令可以在 shell 中交互,或者你可在配置文件中保留你的首选项。 你可以查看 Herbstluftwm 中的所有可用属性: - ``` -`$ herbstclient attr` +$ herbstclient attr ``` -Herbstluftwm 的默认行为在默认配置文件中定义,你可以将其复制到家目录并进行修改。启动后,Herbstluftwm 执行配置文件中包含的命令。例如,你觉得使用以 **Alt** 为中心的键绑定很笨拙(它传统上是应用内保留快捷键),那你可以在配置文件中更改触发 Herbstluftwm 操作的键: - +Herbstluftwm 的默认行为定义在其默认配置文件中,你可以将其复制到你的家目录并进行修改。启动后,Herbstluftwm 执行配置文件中包含的命令。例如,你觉得使用以 `Alt` 为中心的键绑定很笨拙(它传统上是应用内保留快捷键),那你可以在配置文件中更改触发 Herbstluftwm 操作的键: ``` % mkdir ~/.config/herbstluftwm -% cp /usr/xdg/herbstluftwm/autostart \ -~/.config/herbstluftwm +% cp /usr/xdg/herbstluftwm/autostart ~/.config/herbstluftwm % sed -i 's/Mod=Mod1/Mod=Mod4/' ~/.config/herbstluftwm % herbstclient reload ``` -这将使 Herbstluftwm 的修饰键更改为 Super 键(”Windows“或 ”Tux“ 键,具体取决于你的键盘)。 +这将使 Herbstluftwm 的修饰键更改为 `Super` 键(“Windows” 或 “Tux” 键,具体取决于你的键盘)。 -使用自动启动文件,你可以设置自定义键绑定,为特定类型的应用创建标签,以便以一致的方式平铺应用,并执行更多操作。 +使用 `autostart` 文件,你可以设置自定义键绑定,为特定类型的应用创建标签,以便以一致的方式平铺应用,并执行更多操作。 ### 为何你要尝试 herbstluftwm -Herbstluftwm 是一个平铺窗口管理器的很好例子。它默认平铺窗口,并允许用户定义全局规则例外。它使用类似 Vim 的导航,但可以快速简单地覆盖它。你可能是你一直在寻找的平铺管理器,所以请尽快尝试一下。 +Herbstluftwm 是一个平铺窗口管理器的很好例子。它默认平铺窗口,并允许用户定义全局规则的例外。它使用类似 Vim 的导航方式,但可以快速简单地覆盖它。它可能是你一直在寻找的平铺管理器,所以请马上尝试一下。 -------------------------------------------------------------------------------- @@ -89,7 +86,7 @@ via: https://opensource.com/article/19/12/herbstluftwm-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 00fd6dc8c46dd4496de0263851c4b12ca97b087c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 31 Dec 2019 22:04:43 +0800 Subject: [PATCH 346/676] PUB @geekpi https://linux.cn/article-11734-1.html --- ...220 Why Vim fans love the Herbstluftwm Linux window manager.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md (100%) diff --git a/translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md b/published/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md similarity index 100% rename from translated/tech/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md rename to published/20191220 Why Vim fans love the Herbstluftwm Linux window manager.md From 67ecaf1a65908b22b9697e50ab0afd9c59d01259 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 31 Dec 2019 23:05:33 +0800 Subject: [PATCH 347/676] translating by lxbwolf --- sources/tech/20191017 Intro to the Linux useradd command.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191017 Intro to the Linux useradd command.md b/sources/tech/20191017 Intro to the Linux useradd command.md index b2befd4650..ab23c72db5 100644 --- a/sources/tech/20191017 Intro to the Linux useradd command.md +++ b/sources/tech/20191017 Intro to the Linux useradd command.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2e5996fdc49832db9741b05177624359300e57b3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:06:36 +0800 Subject: [PATCH 348/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200101=20Signal?= =?UTF-8?q?:=20A=20Secure,=20Open=20Source=20Messaging=20App?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md --- ...al- A Secure, Open Source Messaging App.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md diff --git a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md new file mode 100644 index 0000000000..4dd4037627 --- /dev/null +++ b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Signal: A Secure, Open Source Messaging App) +[#]: via: (https://itsfoss.com/signal-messaging-app/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Signal: A Secure, Open Source Messaging App +====== + +**_Brief: Signal is a secure open-source messaging app for smartphones. It also offers a standalone desktop app for Linux, Windows, and macOS_. _Here, we take a look at its features and usability._** + +### Signal is an Excellent Alternative to WhatsApp (and Telegram) for Privacy Concerned People + +![Signal App On Linux][1] + +Signal is an open source application with a keen focus on privacy. It is recommended by privacy advocates like [Edward Snowden][2]. + +It may not have as many features as Telegram or WhatsApp – but if you want to enhance your privacy while having a conversation, this is a solid open-source solution. + +You can install it on your smartphone ([iOS][3]/[Android][4]) and it is also available for Linux, Windows, and macOS. + +### Features of Signal Messenger + +**Note:** _Some of the features are specific/exclusive to smartphones. You may not observe all the features mentioned in the desktop app._ + +As I already mentioned, this is tailored to enhance your privacy. So, the user experience may not be the “best” you’ve ever seen. But, privacy/security-wise, I think it is a good option to have. + +![Signal Features][5] + +#### Disappearing Messages + +You can set a timer for messages in a conversation – so that it will be automatically deleted as per the timer. + +Essentially, anyone in the conversation can activate this feature. So, you control if the messages should stay in a conversation or disappear. + +#### Use it As Default SMS App + +If you want to utilize an open-source app for all your SMSs, you can simply go to Signal’s app settings and set it as the default for SMS and MMS. + +#### Screen Security + +There’s a neat feature to block screenshots in-app, “Screen Security”. + +If you enable it, you won’t be able to take a screenshot of any conversation in the app. You can find the option to enable or disable it from the app settings. + +It may not be useful to everyone – but you can try it out. + +#### Safety Number + +If you want to verify the security of your encryption with a friend, you can simply tap on the profile and scroll down to find “View Safety Number”. + +You can either scan it to verify or simply take a look at it to mark it verified. + +#### Locked Messages + +If you protect the app with a lock (pin/fingerprint), even if your device has been unlocked, you won’t be able to see the messages on your notifications. + +So, when you get a notification while Signal is locked, you will notice the content of the notification as “**Locked Message**” – which is a plus for privacy-oriented users. + +#### Other Features + +![][6] + +As you would expect in a messaging app – you get a couple of stickers to utilize and you can also create a group if you want. + +However, you won’t have the ability to moderate your group – you can just add members and change the profile picture. + +In addition to this, Signal also supports biometric security for its app. + +### Installing Signal on Ubuntu/Linux + +Unfortunately, you don’t get a .**deb** or .**AppImage** to install it on your Linux distro. So, you will need to utilize the terminal as per the [official installation instructions][7]. + +Here’s what you have to type in the terminal: + +``` +curl -s https://updates.signal.org/desktop/apt/keys.asc | sudo apt-key add - +echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/signal-xenial.list +sudo apt update && sudo apt install signal-desktop +``` + +Simply copy-paste the commands one by one in the terminal and you should be good to go. + +[Download Signal for Other Devices][7] + +### My Thoughts On Signal + +I’ve been using Signal for a few years now and it has improved with what it offers. However, I still feel that the user experience can be improved. + +Privacy-wise, it is definitely a good alternative to what we already have (in my opinion). You can give it a try and see how well it works for your usage. + +You can also take a look at their [GitHub page][8] for the latest developments and beta releases if you want to try them out. + +Signal app may not be a popular messaging app when compared to WhatsApp or even [Telegram on Linux][9]. But, you can try it for yourself and encourage your friends to use an open-source messaging app. + +Have you tried it yet? Let me know what you think about the ‘Signal’ app in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/signal-messaging-app/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot.jpg?ssl=1 +[2]: https://en.wikipedia.org/wiki/Edward_Snowden +[3]: https://apps.apple.com/us/app/signal-private-messenger/id874139669 +[4]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&hl=en_IN +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-phone.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot-1.jpg?ssl=1 +[7]: https://signal.org/download/ +[8]: https://github.com/signalapp +[9]: https://itsfoss.com/install-telegram-desktop-linux/ From bef234c00747c8c4eb7baecaa210db4c15f8bee5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:07:31 +0800 Subject: [PATCH 349/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191231=2012=20p?= =?UTF-8?q?rogramming=20resources=20for=20coders=20of=20all=20levels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191231 12 programming resources for coders of all levels.md --- ...ming resources for coders of all levels.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20191231 12 programming resources for coders of all levels.md diff --git a/sources/tech/20191231 12 programming resources for coders of all levels.md b/sources/tech/20191231 12 programming resources for coders of all levels.md new file mode 100644 index 0000000000..5da5148542 --- /dev/null +++ b/sources/tech/20191231 12 programming resources for coders of all levels.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (12 programming resources for coders of all levels) +[#]: via: (https://opensource.com/article/19/12/programming-resources) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +12 programming resources for coders of all levels +====== +No matter where you are in your programming journey, there are things +for you to learn in Opensource.com's top 12 programming articles from +2019. +![Woman sitting in front of her computer][1] + +> "The best time to learn computer programming was 20 years ago. The second best time is now." +> — A computer science proverb, maybe. + +Are you a new programmer, an experienced web dev, a backend wizard, a grizzled system programmer, or some other yet-to-be-discovered species of computer geek? Wherever you land in the vast ecosystem of software developers, the only constant in our field is the need to learn about new technologies and how to apply them. Here is an ensemble of the most-read Opensource.com articles from the past year that inform and entertain, and I'm excited to share them with you here. + +### For the noble newbie + +Whatever your skillset or interests, learning how to write computer programs turns that domain-specific knowledge into a superpower. Unfortunately, it isn't possible to learn how to program from the bite of a radioactive computer, at least not yet. Until that's a thing, I recommend these excellent articles to help bootstrap your programming skills. They address important questions like which languages to consider learning and different ways to get started. + + * [Which programming languages should you learn?][2] + * [A dozen ways to learn Python][3] + * [Three popular programming languages you can learn with Raspberry Pi][4] + * [Introducing kids to computational thinking with Python][5] + + + +### Keeping up with emerging technologies + +Experienced programmers know that the only thing harder than learning to program is keeping your skills and knowledge up to date. But we are an [autodidactic][6] breed, always looking to level up our expertise and understanding. Even if we don't anticipate using a new technology, we know that eventually, someone will ask about it. These articles on Rust, WebAssembly, and Podman are great places to start learning about just a few of the upcoming trends in software technology. + + * [Why should you use Rust in WebAssembly?][7] + * [Level up command-line playgrounds with WebAssembly][8] + * [How does rootless Podman work?][9] + * [Why to choose Rust as your next programming language][10] + + + +### Old programs never die + +Despite the never-ending cascade of new technologies, it never hurts to look back to help you look forward. Today's amazing technologies are built on top of yesterday's tools, and it will serve us well to understand the abilities and limitations of those tools, even if we never write a line of code in these languages of legend. This collection of articles focuses on the C language, a practical application written in AWK, and an interesting discussion of computer languages that are declining in popularity, but perhaps not dead yet. + + * [The monumental impact of C][11] + * [How to write a good C main function][12] + * [Drinking coffee with AWK][13] + * [What's your favorite "dead" language?][14] + + + +### Keep on learning + +No matter where you are in your programming journey, there will always be more to learn. I hope these top resources from 2019 will get you ready for 2020. Thanks to the authors and you, the reader. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/programming-resources + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_3.png?itok=qw2A18BM (Woman sitting in front of her computer) +[2]: https://opensource.com/article/19/2/which-programming-languages-should-you-learn +[3]: https://opensource.com/article/19/8/dozen-ways-learn-python +[4]: https://opensource.com/article/19/3/programming-languages-raspberry-pi +[5]: https://opensource.com/article/19/2/break-down-stereotypes-python +[6]: https://en.wikipedia.org/wiki/Autodidacticism +[7]: https://opensource.com/article/19/2/why-use-rust-webassembly +[8]: https://opensource.com/article/19/4/command-line-playgrounds-webassembly +[9]: https://opensource.com/article/19/2/how-does-rootless-podman-work +[10]: https://opensource.com/article/19/10/choose-rust-programming-language +[11]: https://opensource.com/article/19/10/command-line-heroes-c +[12]: https://opensource.com/article/19/5/how-write-good-c-main-function +[13]: https://opensource.com/article/19/2/drinking-coffee-awk +[14]: https://opensource.com/article/19/6/favorite-dead-language From 45412c36e320ff7b81f913a3da4e4002a4c9eaa4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:08:01 +0800 Subject: [PATCH 350/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191231=207=20re?= =?UTF-8?q?sources=20to=20grow=20your=20Java=20skills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191231 7 resources to grow your Java skills.md --- ...31 7 resources to grow your Java skills.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20191231 7 resources to grow your Java skills.md diff --git a/sources/tech/20191231 7 resources to grow your Java skills.md b/sources/tech/20191231 7 resources to grow your Java skills.md new file mode 100644 index 0000000000..e3ce14f901 --- /dev/null +++ b/sources/tech/20191231 7 resources to grow your Java skills.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 resources to grow your Java skills) +[#]: via: (https://opensource.com/article/19/12/java-resources) +[#]: author: (Stephon Brown https://opensource.com/users/stephb) + +7 resources to grow your Java skills +====== +Java is still evolving and going strong decades after its launch. Catch +up with our hottest Java articles from 2019. +![Coffee beans and a cup of coffee][1] + +Java is still one of the most influential programming languages today. It only recently dropped from #2 to the third most used [programming language on GitHub][2]. You may say usage is not everything, but Java also remains popular. According to [Stack Overflow's Developer Survey Results for 2019][3], Java is the fifth most popular programming language. It was first released to the public in 1998, and it stays high on the usage and popularity scale after all this time. A big reason for that fact is that Java has grown and evolved significantly since its release. As a strongly-typed language, Java continues to push the envelope of the object-oriented programming (OOP) paradigm and is continually used to implement new concepts and technologies. + +Testifying to its ongoing popularity, Opensource.com publishes many excellent articles about the language. The following seven are Opensource.com's top read Java articles of 2019. + +### What is an object in Java? + +Chris Hermansen provides an in-depth look at the OOP paradigm and its importance to Java development in [_What is an object in Java?_][4] OOP is based on the idea that data and programs should all be viewed as "objects." Each object has properties and behaviors that describe how it is used in a program. + +There are a number of principals that define OOP and its use of objects for all aspects of programming. These include: + + * **Inheritance:** This is the hierarchical use of objects for mutating and reusing object properties and behaviors from parent objects to child objects. + * **Typing:** Static and strong typing express the idea that, at compile time, the type should be defined and constant unless explicitly converted or changed, which helps with both debugging and consistent functionality. + * **Classes and primitives:** Objects natively implemented into OOP languages are called "primitives," including int, long, etc.; however, objects designed and implemented using class declarations and by assigning properties and behaviors to primitives are called classes. + * **Object class:** In Java, the Object class is the parent class that all classes inherit from. It allows the use of basic functions and properties, including comparison and **hashCode** functionality. + + + +Overall, objects are the basis of Java development, and Chris expounds upon them in his in-depth article. + +### What is a Java constructor? + +As a great follow-up to Chris Hermansen's overview of the Java object, I recommend reading [_What is a Java constructor?_][5] The constructor is an important concept to understand when working within the realms of OOP and Java, and Seth Kenlon introduces it in this easy-to-understand guide. The constructor in Java (and most OOP languages) is where you instantiate or create an instance of an object you have defined. In many languages, an instance is created with the **new** keyword and the object you want to create. For example, **Dog fluffy = new Dog();** will create a new instance of **Dog**. Constructors can also set properties within the object you are instantiating; therefore, if you have an implementation for a constructor to set your object's size, height, and type, you can set those all from the constructor. By default, Java allows objects to be instantiated with the **new** keyword without having an explicit constructor defined and creates them at compilation time. + +### Initializing arrays in Java + +An array is a longstanding data structure that originates in early math concepts. In computer science, as Chris Hermansen says in [_Initializing arrays in Java_][6], it represents "…a contiguous block of memory where each location is a certain type," which can be any type—from primitives (int, long, etc.) to custom objects (Dog, Cat, Car). An array is initialized with a specific type of constructor that reserves the fixed length of the array; in other words, it is a defined amount of memory that the array is reserving. It looks like this: **int[] a = new int[15]**. Much like instantiating a new object, arrays are similar in form and functions. In addition, because arrays inherit from the Object class, they can utilize methods and properties associated with the Object class, including **GetClass()**. + +In addition to simple arrays, Java implements **ArrayLists** and **Map** objects by default. Both of these collection types allow elements to be added or removed dynamically; there is no need to set the size of each manually. The ArrayList allows the addition, retrieval, and removal of elements dynamically as your code runs. These lists must be of one type, which is defined when it is instantiated. The Map allows a dictionary object to be created, which means each index, or "key," is connected to another object. For example, **Map<string, Integer> scores = new Map<String, Integer>()** would allow you to insert a student's score, with the key being their name, with **scores.put("Stephon", 50)**. Arrays, ArrayLists, and Maps are excellent ways to store, retrieve, and manipulate data within your Java application. + +### Getting started with blockchain for Java developers + +Blockchain is an amalgamation of cryptography, computer science, cryptocurrency, and many other fields. It is the technology at the heart of Bitcoin and other cryptocurrencies, but it can stand alone and is powerful when implemented with other concepts. As Bilgin Ibrayam writes in [_Getting started with blockchain for Java developers_][7], "the technologies most people know, such as Java, .NET, and relational databases, are not common in the blockchain space; instead, blockchain is primarily dominated by C, Go, and Rust on the server side, and JavaScript on the client side." However, this should not deter you from using Java for developing blockchain projects, and Ibrayam provides seven Java-based open source technologies that leverage the Java language and the Java Virtual Machine (JVM) for blockchain development. + +The seven technologies he presents are: Corda, a business-focused, blockchain technology that focuses on building smart contracts to process and streamline business transactions on the chain; Hyperledger's Pantheon (or Besu), an Ethereum client that enables use of private and public networks and was created to introduce Java developers to blockchain development; Bitcoinj, a Java implementation of the Bitcoin protocol that allows the use of a wallet and transactions without Bitcoin Core; Web3j, a lightweight Ethereum client that has implementations for both Android and Java for smart contract development; Hyperledger Fabric SDK, a complete solution for building and providing security for a localized or distributed blockchain; FundRequest, a decentralized platform/marketplace that enables requesting open source work and is completely implemented in Java on top of the Ethereum network; and Eventeum, which allows monitoring of the Ethereum network and storage of events and their details on a messaging server like Kafka or RabbitMQ. + +### 7 Java tips for new developers + +When learning a new language, there are always obstacles, whether they be syntactical differences or entire development paradigm shifts. Seth Kenlon provides [_7 Java tips for new developers_][8], focusing on what to look for when diving into Java programming. Installing Java and the Java Development Kit (JDK) are the first steps to developing in Java. Most computers may already have Java and JVM installed, but you will need JDK to begin programming. + +In brief, Seth's tips are: + + * Most other languages allow importing and exporting libraries or other code that you may require when developing a project. Java packages are external or internal libraries that need to be managed. The packages are separated and organized by namespaces, which are like buckets for organizing code. + * Packages are imported with the simple syntax of **import** with the library's namespace. + * Declaring a class allows you to create an object in your program. These classes can use different access modifiers; within the classes are properties and methods or functions that also can have access modifiers that define whether they can be used only inside of the class, outside of the class with inherited classes, or by any other class. + * The class modifier **Static** allows the use of properties or functions without having to instantiate or create an instance of an object. + * Code will eventually have bugs; it is inevitable. "Try and catch" flow control allows you to catch errors and exceptions and implement recovery and logging mechanisms. + * To run a Java application outside an integrated development environment (IDE), such as Netbeans or Eclipse, navigate to your Java project folders from the command line and type **java <filename.java>** or, if the application is already compiled into a .jar file, **java -jar <filename.jar>**. + + + +### Using the Java Persistence API + +[_Using the Java Persistence API_][9] (JPA) is my introduction to connecting Java to various data persistence solutions, whether they be relational, NoSQL, or basic file representations in a system. Java provides a broad interface that allows connection to generally any type of persistence solution. This tutorial walks through creating an application with common libraries, including Spring Boot, a module/template for quickly configuring applications in Java; Maven, a package manager for Java; Lombok, a library that simplifies defining object accessors/mutators; and Netbeans, a popular IDE for developing in Java. + +The tutorial uses these libraries to create models for a fictitious bike shop's database. The models' accessors/mutators are defined with Lombok and provide data annotations that are used when persisting to the chosen database. Then the database is set up and configured through the **application.properties** file, which the JPA reads to connect and persist data. The persisting and fetching implementation is done mostly with the Spring framework for Mongo; however, you can also override functions for more control of what should be fetched when finding, updating, or persisting objects. In a matter of minutes, you will be able to define objects and call basic functions on local databases without much boilerplate. + +### How to compare strings in Java + +Flexibility is often considered a gift, and while there are tradeoffs between statically typed and dynamically typed languages, one of Java's strengths is its ability to compare types and equality of types. In fact, Girish Managoli explains in [_How to compare strings in Java_][10], there six different ways to compare the immutable string type in Java. + +The double-equal operator (**==**) compares memory location rather than string content. When the compiler sees two strings that are equal, it will allocate the same memory for both. If a new string is instantiated, it will not share the same memory location or object reference. + +The **equals** method compares the case-sensitive content of the string, not the object information. For example, if you use **equals** to compare **Dog** and **Dog**, the result would be true, even if they are two different objects; however, **dog** and **Dog** would be false because the function is case-sensitive. The **equalsIgnoreCase** function is the same as **equals**, except that it removes case-sensitivity; therefore, comparing **dog** and **Dog** would be true. The **compareTo** and **compareToIgnoreCase** functions compare strings based on the Unicode value of each character in the string; they compare the total value to the other string and return the total lexical value difference between the two (with case-sensitivity and case-insensitivity, respectively). Last but not least, the **Objects equals** function allows the comparison of two string object references and of null values. + +### Java: Still growing and evolving + +Java is still going strong, evolving, and staying relevant after all this time, and there is continued optimism in its growth. Since its release, the Java platform has continued to change with the times, from OpenJDK to release schedule changes, and push the envelope of what you can accomplish with it. + +As you can see from the top Java articles on Opensource.com in 2019, it never hurts to know the language, because you never know where you can use it for your next project. These (and other) Opensource.com articles have been really helpful to me as a [new developer transitioning from higher education][11]. I look forward to reading and sharing more in 2020, and I hope you'll join me. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/java-resources + +作者:[Stephon Brown][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stephb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee) +[2]: https://octoverse.github.com/#top-languages +[3]: https://insights.stackoverflow.com/survey/2019 +[4]: https://opensource.com/article/19/8/what-object-java +[5]: https://opensource.com/article/19/6/what-java-constructor +[6]: https://opensource.com/article/19/10/initializing-arrays-java +[7]: https://opensource.com/article/19/4/blockchain-java-developers +[8]: https://opensource.com/article/19/10/java-basics +[9]: https://opensource.com/article/19/10/using-java-persistence-api +[10]: https://opensource.com/article/19/9/compare-strings-java +[11]: https://opensource.com/article/19/6/5-transferable-higher-education-skills From 6aa74361f167f7cda6eeba1cca25d953efda8ce8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:08:36 +0800 Subject: [PATCH 351/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191231=20How=20?= =?UTF-8?q?to=20be=20a=20better=20organization:=20Top=2010=20reads=20for?= =?UTF-8?q?=20leaders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md --- ... organization- Top 10 reads for leaders.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md diff --git a/sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md b/sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md new file mode 100644 index 0000000000..762f6b6c08 --- /dev/null +++ b/sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to be a better organization: Top 10 reads for leaders) +[#]: via: (https://opensource.com/article/19/12/open-leadership) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +How to be a better organization: Top 10 reads for leaders +====== +Get tips and strategies to help you leverage open principles in your +organization. +![Shaking hands, networking][1] + +Modern organizations are adopting key elements from open source software. By leveraging the "open" in open source, leaders can help shape a more responsive and productive enterprise. Check out these top 10 articles from 2019 that can help you develop your own path in open leadership. + +### 19 resolutions of an open leader + +Open organizations succeed when leaders are open and transparent, demonstrating open skills, including transparency, inclusivity, adaptability, collaboration, and community. In [_19 resolutions of an open leader_][2], Angela Robertson shares her plan for continuing on the path of an open leader. + +### The psychology behind a blameless retrospective + +"One of the Agile Manifesto's principles suggests all teams regularly reflect on how to become more effective," writes Dominika Bula in [_The psychology behind a blameless retrospective_][3]. She says the main goals of a retrospective are to promote self-improvement, improve processes, and advance team members' skills. She also outlines the three foundational pillars that will "ensure your blameless retrospective truly is successful." + +### A guide to human communication for sysadmins + +The job of a systems administrator is no longer defined simply by running racks of servers and poking bits to optimize performance. In modern organizations, sysadmins can and should increase the value they deliver to the organization they work for. In [_A guide to human communication for sysadmins_][4], Maxim Burgerhout describes the best way to increase your value to an organization: getting to know the people around you. + +### The innovation delusion + +Red Hat CEO Jim Whitehurst observes that organizations (and especially leaders) like to think success is always planned—that they've become masters of chaos and can almost predict the future. But these assessments are often made with the benefit of hindsight. In [_The innovation delusion_][5], Jim advises that different kinds of challenges require different kinds of approaches, and we need to get better at building flexible organizations capable of responding to the unforeseen or unknowable. + +### The power of being vulnerable in the workplace + +In open organizations, high-performing teams must feel comfortable taking risks and appearing vulnerable in front of each other. These are necessary ingredients for creativity, curiosity, and diversity of ideas. In [_The power of being vulnerable in the workplace_][6], Kathleen Hayes explains psychological safety and explores some real-life examples where new mindsets and behaviors have helped teams thrive. + +### Let's be real: Diversity and inclusion is a business issue + +"If the problem is a struggle to innovate, then the solution is greater diversity and inclusion," DeLisa Alexander writes in [_Let's be real: Diversity and inclusion is a business issue_][7]. She says when diversity and inclusion are solutions to problems that affect us every day, we all do better work and generate value for customers. + +### How to plan your next IT career move + +Like many people in open source, being part of technology-oriented communities has been an essential part of Matthew Broberg's career development. In [_How to plan your next IT career move_][8], Matthew challenges us to ask essential career questions about the cloud, DevOps, coding, and where you're going next in IT. + +**[Read next: [The new rules of CIO leadership][9]]** + +### How to advance your career by contributing to open source projects + +After working as a recruiter for 10 years at Red Hat, Josh Wulf decided it was time for a change. He quit his job as a recruiter, contributed to open source software, and landed a job as a software engineer. Josh explains in [_How to advance your career by contributing to open source projects_][10] how he did it and how you can, too. + +### 7 tips to ace your tech job interview + +In [_7 tips to ace your tech job interview_][11], Jessica Repka shares an insightful list of interviewing tips that should help you stand out in a good way. Based on her own job interviews and what she's seen in person while interviewing others, Jessica's tips can give you the edge you need to find your next job. + +### Why DevOps is the most important tech strategy today + +"Many people first learn about DevOps when they see one of its outcomes and ask how it happened. It's not necessary to understand why something is part of DevOps to implement it," Kelly Albrecht writes in [_Why DevOps is the most important tech strategy today_][12]. Albrecht clears up some of the confusion about DevOps and explains how a DevOps strategy can mean the difference between being a leader or a follower in an industry. + +### Open leadership in 2020 + +What do you want to know about open leadership in the coming year? Please share your ideas for article topics in the comments—or even share your own experiences with open leadership by [writing an article for Opensource.com][13]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/open-leadership + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/network_team_career_hand.png?itok=_ztl2lk_ (Shaking hands, networking) +[2]: https://opensource.com/open-organization/19/1/leadership-goals +[3]: https://opensource.com/article/19/4/psychology-behind-blameless-retrospective +[4]: https://opensource.com/article/19/9/communication-sysadmins +[5]: https://opensource.com/open-organization/19/6/innovation-delusion +[6]: https://opensource.com/open-organization/19/3/introduction-psychological-safety +[7]: https://opensource.com/open-organization/19/5/inclusivity-solution-innovation +[8]: https://opensource.com/article/19/8/plan-next-IT-career-move +[9]: https://enterprisersproject.com/cio-new-rules-report +[10]: https://opensource.com/article/19/5/how-get-job-doing-open-source +[11]: https://opensource.com/article/19/1/job-interviewing-tips +[12]: https://opensource.com/article/19/3/devops-most-important-tech-strategy +[13]: https://opensource.com/how-submit-article From 29442beb945e4a3b0820cbb5a558f16bec9ad0cf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:08:54 +0800 Subject: [PATCH 352/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191231=2010=20A?= =?UTF-8?q?nsible=20resources=20to=20accelerate=20your=20automation=20skil?= =?UTF-8?q?ls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md --- ...es to accelerate your automation skills.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md diff --git a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md new file mode 100644 index 0000000000..a522f0c869 --- /dev/null +++ b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Ansible resources to accelerate your automation skills) +[#]: via: (https://opensource.com/article/19/12/ansible-resources) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +10 Ansible resources to accelerate your automation skills +====== +Gear up and get crackin' with awesome Ansible automation skills this +year. +![Gears above purple clouds][1] + +This year saw a wide range of really helpful Ansible articles. Whether you are just starting out with Ansible or a seasoned pro, there is something for everyone here to learn from. + +A good number of these articles are worthy of your bookmarking and perhaps a cron (or maybe a Tower/AWX job) reminder to reread them periodically. + +If you are new to Ansible, start with the following articles: + + * [_A quickstart guide to Ansible_][2] has some good starter information as well as deeper dives into more advanced topics + * [_10 Ansible modules you need to know_][3] and [_5 ops tasks to do with Ansible_][4] review some of the more fundamental functions that every Ansible admin should be familiar with + * [_How to use Ansible to document procedures_][5] also presents a survey of additional topics you might find it interesting to follow up on + + + +The remainder of these articles cover more advanced topics like Windows management, testing, hardware, cloud, and containers—and even a case study in managing the demands of tech-curious children. + +I hope you enjoyed this Ansible year as much as I did. Never stop learning! + + 1. _[How Ansible brought peace to my home][6]_ is a whimsical case study in applying Ansible skills to quickly provision new (or rather old) laptops for my children. + 2. _[Ansible for the Windows admin][7]_ by Taz Brown and Abner Malivert: Did you know Ansible can manage Windows nodes as well? This piece reviews basic Ansible server and Windows client setups with an example on how to deploy an IIS server. + 3. _[10 Ansible modules you need to know][3]_ by Shashank Hegde is a great place to start for some of the most common and basic Ansible modules all admins should know. Running commands, installing packages, and handling files are the basis for many useful automation plays. + 4. _[How to use Ansible to document procedures][5]_ by Marco Bravo: Ansible’s YAML files make for easy reading, so much so that they can be used to document the manual steps needed to accomplish a task. This makes your work easier to debug and extend later on. Also contained in this article are pointers on related topics like testing and analysis. + 5. _[Using Testinfra with Ansible to verify server state][8]_ by Clement Verna: Testing is an integral part of any CI/CD DevOps pipeline, so why not test Ansible’s results as well? This primer on Testinfra can be used to help check the configuration results you need. + 6. _[Hardware bootstrapping with Ansible][9]_ by Mark Phillips: Not all the world is containers and virtual machines. Many of us sysadmins still have significant hardware deployments to manage. With a little PXE dust and DHCP magic (among other tidbits), you can create a convenient framework using Ansible to get real hardware up and running easily. + 7. _[What you need to know about Ansible modules][10]_ by Jairo da Silva Junior: Modules bring real power to Ansible. Many modules are already available, but when there is none, you may need to roll your own. Read this article to look a bit deeper into how modules are made. + 8. _[5 ops tasks to do with Ansible][4]_ by Mark Phillips: This is another more basic review of Ansible use to manage common system operations tasks. The draw here is the list of examples given in Tower (or AWX) instead of the old familiar command line. + 9. _[A quickstart guide to Ansible][2]_ by Chris Short is a great PDF download that you should keep on hand and reread from time to time. It begins with a great primer to get started in Ansible. It also covers other areas of interest including Molecule testing, sysadmin tasks, and Kubernetes object management, to name a few. + 10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ by Mark Phillips: This is a monthly round-up article full of interesting links to follow. Topics span Ansible basics, managing Netapp E-Series storage, debugging, patching, and more. Videos are included here as well as some pointers to Ansible meetup groups. Check it out! + + + +Let us know if you had a favorite Ansible article this year and why in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ansible-resources + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) +[2]: https://opensource.com/article/19/2/quickstart-guide-ansible +[3]: https://opensource.com/article/19/9/must-know-ansible-modules +[4]: https://opensource.com/article/19/8/ops-tasks-ansible +[5]: https://opensource.com/article/19/4/ansible-procedures +[6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops +[7]: https://opensource.com/article/19/2/ansible-windows-admin +[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state +[9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible +[10]: https://opensource.com/article/19/3/developing-ansible-modules +[11]: https://opensource.com/article/19/7/ansible-news-edition-one From adf802b41304ef5608a981381d7c68143cb01a32 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:09:12 +0800 Subject: [PATCH 353/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191230=2010=20a?= =?UTF-8?q?rticles=20to=20enhance=20your=20security=20aptitude?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191230 10 articles to enhance your security aptitude.md --- ...icles to enhance your security aptitude.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/tech/20191230 10 articles to enhance your security aptitude.md diff --git a/sources/tech/20191230 10 articles to enhance your security aptitude.md b/sources/tech/20191230 10 articles to enhance your security aptitude.md new file mode 100644 index 0000000000..7c4314b7ad --- /dev/null +++ b/sources/tech/20191230 10 articles to enhance your security aptitude.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 articles to enhance your security aptitude) +[#]: via: (https://opensource.com/article/19/12/security-resources) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +10 articles to enhance your security aptitude +====== +Whether you're learning the first steps or looking to add to your +skills, there's something for you in Opensource.com's top 10 security +articles of 2019. +![A secure lock.][1] + +If security is a process (and it is), then it stands to reason that different projects (and contributors) are in different places. Some applications have years of security testing, with design done by people who have worked in information security for decades. Others are brand new projects by developers working on their first open source project. It comes as no surprise that Opensource.com's top security articles of 2019 represent this range of experience. We have articles that introduce basic security practices as well as deep dives into more advanced topics. + +Whether you're learning the first steps or looking to add to your skills acquired over a storied career, there's something for you in the top 10 security articles of 2019. + +### 7 steps to securing your Linux server + +Security is like a house: if the foundation is bad, the rest is at risk. Patrick H. Mullins' excellent _[7 steps to securing your Linux server][2]_ gets you started with basic security steps for Linux servers. Even if you have a lot of experience administering servers, this article provides a good checklist to make sure you have the basics covered. From there, you can begin adding additional layers of security. + +### Make Linux stronger with firewalls + +One of the seven steps to securing your server is enabling a firewall. But what _is_ a firewall, and how does it work? Seth Kenlon answers these questions and then describes in detail how to configure your firewall for better security in _[Make Linux stronger with firewalls][3]_. Using firewalld and Network Manager, you can set different firewall configurations for different networks. This allows you to have a trusting configuration on your home network, for example, and a more paranoid configuration on your favorite coffee shop's WiFi network. + +### Reducing security risks with centralized logging + +Once you've secured your system, you're not done: security is a process, not a state. Part of _keeping_ systems secure is keeping an eye on what goes on. One way to do that, especially with multiple systems, is to centralize your logging. In _[Reducing security risks with centralized logging][4]_, Hannah Suarez shares how to get started (she based this article on her lightning talk at FOSDEM '19). + +### Using GPG keys for SSH + +Most people who use key-based authentication for SSH use SSH keys. And why wouldn't you? It's right there in the name. These are perfectly fine from a security standpoint, but if you want to make some forms of key distribution and backup easier, there's another way. Brian Exelbierd's three-part series walks through _[How to enable SSH access with a GPG subkey][5]_, _[How to import existing SSH keys][6]_, and _[How to reduce your backup needs to a single key file][7]_. + +### Graphically manage SSH keys with Seahorse + +Using GPG for SSH keys isn't everyone's cup of tea, but that doesn't mean you're out of luck when it comes to key management. Seahorse is a graphical tool for managing SSH keys (and other authentication methods) that is included in the GNOME desktop. Alan Formy-Duval's [_Graphically manage SSH keys with Seahorse_][8], is particularly helpful to the novice user. + +### Security scanning your DevOps pipeline + +Containers are everywhere these days. But what's in them? Knowing that containers meet your security policies is an important part of staying secure. Fortunately, you can use open source tools to help automate compliance checking. Jessica Cherry's (formly Repka) [_Security scanning your DevOps pipeline_][9] is a step-by-step tutorial that shows you how to use the Jenkins build system and the Anchore inspection service to create a scanning pipeline for container images and registries. + +### 4 open source cloud security tools + +One of the great things about cloud services is that your data can be accessed from anywhere. One of the downsides to cloud services is that your data can be accessed from anywhere. If you're using "-as-a-Service" offerings, you want to make sure they're securely configured. Anderson Silva, Alison Naylor, Travis McPeak, and Rich Monk join forces to introduce [_4 open source cloud security tools_][10] to help improve security when using GitHub and AWS. If you're looking for accidentally committed secrets—or trying to prevent them from being committed in the first place—this article has tools you can use. + +### How to use OpenSSL: hashes, digital signatures, and more + +Much of information security is based on math: specifically, the cryptographic functions used to encrypt data and authenticate users or file contents. After providing an introduction in [_Getting started with OpenSSL: Cryptography basics_][11], Marty Kalin digs deeper into the details of _[How to use OpenSSL: Hashes, digital signatures, and more][12]_, explaining how to use the OpenSSL utility to explore these commonly used but uncommonly understood concepts. + +### Learn about computer security with the Raspberry Pi and Kali Linux + +Cheap hardware and open source software make a great combination, especially for people looking to learn by doing. In this article, Anderson Silva introduces the security-oriented Kali Linux distribution in _[Learn about computer security with the Raspberry Pi and Kali Linux][13]_. It's a short article, but it's full of useful links to documentation and security-related projects that you can use with your own Raspberry Pi. + +### Will quantum computing break security? + +Has the rest of this article been a waste? Will quantum computing render everything we know about security obsolete? The good news is that the answer is "no," but quantum computing can still have a profound impact on security and the computing world more broadly. In _[Will quantum computing break security?][14]_ Mike Bursell examines its potential impacts—both the good news and the bad. And of course, quantum computing may make it easier to break encryption, but that doesn't matter if the baddies can't get your data in the first place. + +### Looking to 2020 + +Security will always be important, and (as the quantum computing article suggests) the next few years will be an interesting time in the field. In 2020, Opensource.com articles will look at the leading edge of open source security and help explain the basics to the ever-growing open source community. If you have a topic you want us to cover, please share it in the comments, or—better yet— if you have an article in mind, [write for us][15]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/security-resources + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko (A secure lock.) +[2]: https://opensource.com/article/19/10/linux-server-security +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging +[5]: https://opensource.com/article/19/4/gpg-subkeys-ssh +[6]: https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples +[7]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage +[8]: https://opensource.com/article/19/4/ssh-keys-seahorse +[9]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[10]: https://opensource.com/article/19/9/open-source-cloud-security +[11]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 +[12]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 +[13]: https://opensource.com/article/19/3/computer-security-raspberry-pi +[14]: https://opensource.com/article/19/1/will-quantum-computing-break-security +[15]: https://opensource.com/how-submit-article From 2da940ad6fcc5ae1d4f168a530fce7cc2f7624f8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:10:46 +0800 Subject: [PATCH 354/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191230=208=20mu?= =?UTF-8?q?st-read=20DevOps=20articles=20for=20success=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191230 8 must-read DevOps articles for success in 2020.md --- ...ead DevOps articles for success in 2020.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sources/tech/20191230 8 must-read DevOps articles for success in 2020.md diff --git a/sources/tech/20191230 8 must-read DevOps articles for success in 2020.md b/sources/tech/20191230 8 must-read DevOps articles for success in 2020.md new file mode 100644 index 0000000000..3ea0d05f72 --- /dev/null +++ b/sources/tech/20191230 8 must-read DevOps articles for success in 2020.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 must-read DevOps articles for success in 2020) +[#]: via: (https://opensource.com/article/19/12/devops-resources) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +8 must-read DevOps articles for success in 2020 +====== +Get up to speed on DevOps with our eight most popular DevOps articles +this year. +![Brick wall between two people, a developer and an operations manager][1] + +I am an avid reader, but I go through periods where I'm so busy that it's hard to find the time to keep up with my reading list. Even during my busiest times, I try to stay up to date on DevOps news since it's one of my areas of focus. + +Here, I've summarized key takeaways from the top eight DevOps articles Opensource.com published this year so you can increase your knowledge even if you don't have time to read all of them. Since DevOps is about **people**, **processes**, and **tools**, I've categorized the top eight articles around those themes. + +### People + +#### 5 essential values for the DevOps mindset + +Conversations about IT problems and solutions often focus on the technology or the tools. But often, the people and processes are harder and more important to get right than the technology and tools. In [_5 essential values for the DevOps mindset_][2], Brent Aaron Reed and Willy-Peter Schaub outline the foundation for establishing the right processes and hiring the right people. + + * Create a continuous feedback loop with stakeholders (customers, business teams, partners, etc.). Ensure changes are being made for the right reasons and that they benefit all stakeholders. + * Processes should be continuously improved. Having a repeatable framework and process is good, but look for ways to make it better. + * Don't replace existing silos with new silos. Teamwork is essential; changing the name of a team or creating a new team does not help. You should be working to break down silos, not create new silos with new names. + * Your primary stakeholder is the customer. Every department in the organization needs to work together to make sure the customer's needs are met. + * Learning is infectious. When you learn something new, share it with others. + + + +#### The case for making the transition from sysadmin to DevOps engineer + +Making the leap from system administrator (sysadmin) to DevOps engineer requires shifting your mindset and learning new tools and technology. In [_The case for making the transition from sysadmin to DevOps engineer_][3], [Correspondent][4] Taz Brown covers this experience and the things you should do if you are considering taking on a DevOps engineer role. + + * Learn a scripting language like Python, Perl, Bash, or Powershell. You don't need to become an expert; learn the basics, and build up your skills over time. + * Think strategically and consider the business impact of your day-to-day tasks. + * Learn a programming language like Ruby, Go, or Python. + * Understand CI/CD pipelines and how and where to automate tasks within the pipeline. + * Become familiar with configuration and orchestration tools. + * Learn common Git commands as well as the fundamentals of version control. + + + +### Processes + +#### Don't test in production? Test in production! + +The notion of testing in production is a sticky subject, but Ann Marie Fred covers it well in [_Don't test in production? Test in production!_][5] Historically, development, test, and production systems were treated differently from the perspective of security, compliance, and risk management. The risks are much higher if data in production systems becomes corrupted than if it happens in a test environment. + +There are pros and cons to testing in production. The majority of the cons boil down to risk and compliance concerns like corrupted or leaked data, unintended side effects, and overloaded systems. Many of the pros can be lumped into two categories: improving the user experience (UX) and gaining new knowledge about your architecture. Improving UX includes things like usability testing, UX research, real-user monitoring, canary testing, and regression testing. Testing in production also enables you to learn more about your environment by running A/B tests, experimenting, chaos engineering, and failover testing. + +By testing in production, you gain feedback you would not otherwise get into quality, performance, availability, resiliency, user experience, and changes. Testing on real data can reveal things you would not see with mock or test data. You should test in production, but before you begin, put mechanisms in place to keep your systems safe and minimize risk. + + * Test all systems thoroughly with automated tests before you start testing in production. + * Review the risks associated with bug hunt days and put appropriate guardrails in place from the start. + * Follow the principles of chaos engineering: plan ahead; contain the blast radius; scale or squash. + + + +Yes, there are risks associated with testing in production, but you can minimize them with proper safeguards. + +#### 8 principles to achieve DevOps at scale + +Processes are a vital aspect of a successful DevOps initiative. The most important part is building processes suited to your organization rather than copying what worked somewhere else. The guidelines Matthieu Fronton lists in [_8 principles to achieve DevOps at scale_][6] ensure you will implement strategies focused on your business needs. + + * Teams create silos. Instead of building a DevOps team, create a DevOps task force of highly skilled and diverse members. Its objective is to help other projects and departments identify slow processes, automate processes, improve performance, and ensure effectiveness. + * Reduce overhead when collaborating and syncing on tasks. Make status updates and team availability publicly available, make work visible by putting everything in shared collaboration tools, and work on one task at a time to avoid context switching. + * Get outside help; hire an agile coach to be your advocate. + * Schedule regular team training on needed job skills, ranging from soft skills to how to use specific tools. + * Empower teams to make their own decisions and learn from their mistakes. + * Embrace uncertainty. Failures will happen, so run blameless post-mortems and determine how to improve and reduce uncertainty the next time around. + * DevOps is about people, processes, and tools. It is not just about the technical implementation of a product. + * Always be learning. Stay up to date on trends in the DevOps space. + + + +#### Small scale scrum vs. large scale scrum + +In [_Small scale scrum vs. large scale scrum_][7], Agnieszka Gancarczyk shares her analysis of 54 early responses to a survey on agile adoption. + + * 96% work in distributed teams, think scrum principles help them reduce development complexity, and believe agile contributes to the success of their projects. + * The most popular length of a sprint is three weeks (62%). + * Participants take on additional roles on their projects when needed, such as business analyst, project manager, and quality engineer. When changing roles, they lose an average of one to two hours. + * The majority of teams don't have a definition of "ready" to ensure that user stories are actionable, testable, and clear. + * Participants ask for help and mentoring when a task is complex. + + + +#### Scrum vs. kanban: Which agile framework is better? + +Agile is a process of iterative development and continuous feedback. While both scrum and kanban are classified as agile frameworks, they are not the same thing. In [_Scrum vs. kanban: Which agile framework is better?_][8] Taz Brown explores the differences. + +Kanban is an agile framework that utilizes a visual method for managing a project's creation through set steps, and the emphasis is on continuous flow through the steps. Tasks can be color-coded to identify different types of tasks. Work-in-progress limits can be used to restrict the maximum number of work items allowed in a single stage. The goal is to see progress and bottlenecks at a glance. Any team (not just software developers) can use the kanban methodology. + +The goal of scrum is to create a shippable product. Scrum involves daily standups, planning, reviews, retrospectives, and a two- to four-week cadence. Since its goal is to ship a product, scrum is primarily used by software development teams. + +Choosing which methodology is best for you depends on the state of your organization, the team, the people on the team, and the end product or service. + +### Tools + +#### Automate user acceptance testing with your DevOps pipeline + +User acceptance testing (UAT) determines whether a system satisfies user needs, business requirements, and authorized entity requirements. These tests need to be run whenever there is a new design in the application, which is why it's so valuable to automate them. In [_Automate user acceptance testing with your DevOps pipeline_][9], Daniel Oh shares how to skip manually validating test cases and automate them with Selenium. + +You can build WebDriver scripts with Selenium to execute test cases programmatically, then automate them by integrating the Selenium tool with your DevOps pipeline. + +#### A beginner's guide to building DevOps pipelines with open source tools + +Saving the best for last, Bryant Son's [_A beginner's guide to building DevOps pipelines with open source tools_][10] is a comprehensive overview of one critical category of DevOps tooling: continuous integration/continuous deployment (CI/CD) pipelines. The CI/CD pipeline is the process of taking code and configuration from a repository and moving it to production. + +Bryant describes some of the tools in a typical CI/CD pipeline. + + * A CI/CD tool like Jenkins talks to many different services and tools to configure and orchestrate them. + * Source control management (SCM) stores code in repositories, versions code, and facilitates collaboration with project members. (CI/CD can automate checking source code in and out among team members.) + * Build-automation tools compile and create a deployable package format from the source code. + * A web application server is the location where an executable will be deployed so the application can be used. + * Code testing coverage catches errors early on and ensures users are satisfied with the application. Code test frameworks help write the tests, and code-quality suggestion tools help improve the quality of the code. + + + +### More in 2020 + +Opensource.com's most widely read DevOps articles of 2019 covered a diverse range of topics under the umbrella of people, processes, and tools. We appreciate these writers for sharing their knowledge, and I look forward to reading more from them in 2020. + +What DevOps topics would you like us to cover in the coming months? Feel free to leave a comment or, better yet, [submit an article proposal][11]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/devops-resources + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devops_confusion_wall_questions.png?itok=zLS7K2JG (Brick wall between two people, a developer and an operations manager) +[2]: https://opensource.com/article/19/5/values-devops-mindset +[3]: https://opensource.com/article/19/7/devops-vs-sysadmin +[4]: https://opensource.com/correspondent-program +[5]: https://opensource.com/article/19/5/dont-test-production +[6]: https://opensource.com/article/19/4/principles-achieve-devops-scale +[7]: https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum +[8]: https://opensource.com/article/19/8/scrum-vs-kanban +[9]: https://opensource.com/article/19/4/devops-pipeline-acceptance-testing +[10]: https://opensource.com/article/19/4/devops-pipeline +[11]: https://opensource.com/how-submit-article From c9eb1a2820e678d78f6bcbd78db5047e36557bdb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 1 Jan 2020 01:11:16 +0800 Subject: [PATCH 355/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191227=202019:?= =?UTF-8?q?=20Year=20in=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191227 2019- Year in review.md --- sources/tech/20191227 2019- Year in review.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/tech/20191227 2019- Year in review.md diff --git a/sources/tech/20191227 2019- Year in review.md b/sources/tech/20191227 2019- Year in review.md new file mode 100644 index 0000000000..12b423b903 --- /dev/null +++ b/sources/tech/20191227 2019- Year in review.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (2019: Year in review) +[#]: via: (https://jvns.ca/blog/2019-year-in-review/) +[#]: author: (Julia Evans https://jvns.ca/) + +2019: Year in review +====== + +It’s the end of the year again! Here are a few things that happened in 2019. + +### I have a business instead of a job! + +The biggest change this year is that I left my job in August after working there for 5.5 years and now I don’t have a job! Now I have a [business][1] (wizard zines). + +This has been exciting (I can do anything I want with my time! No rules! Wow!) and also disorienting (I can do anything I… want? Wait, what do I want to do exactly?). Obviously this is a good problem to have but it’s a big adjustment from the structure I had when I had a job. + +My plan for now is to give myself a year (until August 2020) to see how this new way of existing goes and then reevaluate. + +I wanted to write some reflections on my 5 years at Stripe here but it’s been such a huge part of my life for so long that I couldn’t figure out how to summarize it. I was in a much worse place in my career 6 years ago before I started working there and it really changed everything for me. + +### !!Con + +2019 was [!!Con][2]’s 6th year! It’s a conference about the joy, excitement, and surprise of programming. And !!Con also expanded to the [west coast][3]!! I wasn’t part of organizing the west coast conference at all but I got to attend and it was wonderful. + +Running a conference is a ton of work and I feel really lucky to get to do it with such great co-organizers – there have been at least 20 people involved in organizing over the years and I only do a small part (right now I organize sponsorships for the east coast conference). + +This year we also incorporated the [Exclamation Foundation][4] which is the official entity which runs both conferences which is going to make organizing money things a lot easier. + +### I understand how the business works a little better + +Earlier this year I signed up for a business course called [30x500][5] by Amy Hoy and Alex Hillman. They’ve influenced me a lot this year. Basically I signed up for it because I had a business that had made $100,000 in revenue already but I didn’t really understand how the business _worked_ and it felt like it could just evaporate at any point. So $2000 (the cost at the time of 30x500) was worth it to help me understand what was going on. + +Amy and Alex both just the other day wrote 100-tweet threads that have some of the ideas that I learned this year in them: [Alex on creating sustainable businesses][6] and [Amy on design][7]. + +I was hoping to build a system for selling printed zines in 2019 and I didn’t get to it – that’s probably my one concrete business goal for 2020. I tried out Lulu for printing in the hopes that I could experiment with print-on-demand but the quality was awful so it’s going to be a bit more work. + +### blog posts and things + +In 2019 I: + + * wrote 29 blog posts + * published 2 [zines][8] (Bite Size Networking, HTTP: Learn Your Browser’s Language) and wrote most of a third + * published 1 box set of my zines ([Your Linux Toolbox][9], it’s in Real Physical Bookstores!!) + * did some experiments in interactive SQL/server exercises, which I’m excited about but are sort of on the back burner right now. Maybe I’ll go back to them in 2020! + * made the same business [revenue][1] as in 2018 (which I was thrilled about) + * gave 0 talks (which was a goal of mine) + + + +The blog post I’m happiest to have published this year is definitely [Get your work recognized: write a brag document][10]. I’ve seen quite a few people saying that it helped them track their work and it makes me really happy. A bunch of people at my old job adopted it and it’s one of the non-engineering projects I’m most proud of having done there. + +Publishing this post about my [business revenue][1] was also important to me – in the past I loved blogging, but I didn’t think it was possible to make a living by explaining computer things online. And I was totally wrong! It is possible! So I think it’s important to tell other people that it’s a possibility. + +Having a Real Traditionally Published Book out is also really cool, I could not have imagined [4 years ago][11] that I could go to an actual bookstore and buy the little 16-page zine I wrote about how much I love strace. + +### what went well + +some things that were good this year: + + * spending time understanding why the business works the way it does instead of just guessing + * collaborating with many great people on !!Con to do a big thing together + * I’m happy to have given myself the time/space to do whatever it is I want, even though it’s a big adjustment + * writing things that help people a little bit with their careers (the brag documents post) is nice + + + +some things that are harder: + + * I used to have a lot of really amazing coworkers at my job, and right now I’m working much more by myself. I definitely miss having so many great people right there to talk to all the time. + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019-year-in-review/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/blog/2019/10/01/zine-revenue-2019/ +[2]: https://bangbangcon.com +[3]: https://bangbangcon.com/west +[4]: https://exclamation.foundation/ +[5]: https://30x500.com/academy/ +[6]: https://twitter.com/alexhillman/status/1209252239501647874 +[7]: https://twitter.com/amyhoy/status/1209693440872603651 +[8]: https://wizardzines.com +[9]: https://jvns.ca/blog/2019/10/21/print-collection-of-my-first-7-zines/ +[10]: https://jvns.ca/blog/brag-documents/ +[11]: https://jvns.ca/blog/2015/04/14/strace-zine/ From 91354d964012d1a3cfe31e31b06180393c9235ad Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 1 Jan 2020 10:41:15 +0800 Subject: [PATCH 356/676] PRF @wxy --- ...o cohost GitHub and GitLab with Ansible.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md index 4d9193d930..41616cd282 100644 --- a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md +++ b/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to cohost GitHub and GitLab with Ansible) @@ -12,27 +12,27 @@ > 通过使用 Ansible 镜像 Git 存储库,保护对重要项目的访问。 -![Hands programming][1] +![](https://img.linux.net.cn/data/attachment/album/202001/01/104040fbdu68wosg8o99wg.jpg) -开源无处不在。它在家里的计算机上、在工作场所的计算机上、在互联网上,并且很多都由 [Git][2] 管理。由于 Git 是分布式的,因此许多人也将其视为一种众包的备份解决方案。从理论上讲,每当有人将 Git 存储库克隆到其本地计算机时,他们就是创建了项目源代码的备份。如果有 100 个人这样做,则存储库就有 100 个备份副本。 +开源无处不在。它在家里的计算机上、在工作场所的计算机上、在互联网上,并且很多都由 [Git][2] 管理。由于 Git 是分布式的,因此许多人也将其视为一种众包的备份解决方案。从理论上讲,每当有人将 Git 存储库克隆到其本地计算机时,他们就创建了该项目源代码的备份。如果有 100 个人这样做,则存储库就有 100 个备份副本。 -从理论上讲,这可以缓解“灾难”,例如项目维护者[突然决定删除存储库][3]或[莫名其妙地阻止所有流量][4],导致开发人员们无头苍蝇般地寻找谁拥有主分支的最新版本。类似的,整个代码托管站点也会消失。没有人会想到 Google Code、Microsoft CodePlex 或 Gitorious 会在鼎盛时期将被关闭。 +从理论上讲,这可以缓解“灾难”的影响,例如当项目维护者[突然决定删除存储库][3]或[莫名其妙地阻止所有流量][4],导致开发人员们无头苍蝇般地寻找谁拥有主分支的最新版本。类似的,整个代码托管站点也会消失。没有人会想到 Google Code、Microsoft CodePlex 或 Gitorious 会在鼎盛时期将被关闭。 简而言之,如果在过去的几十年中互联网教给了我们一些东西,那就是依靠互联网神奇地创建备份并不是冗余的最可靠途径。 -此外,对于许多人来说,很多开源项目都托管在 GitHub 上是个问题,而 GitHub 不是开放平台。许多开发人员和用户都希望支持诸如 GitLab 之类的堆栈并与之交互,它具有开源社区版本。 +此外,对于许多人来说,很多开源项目都托管在 GitHub 上是个问题 —— GitHub 并不是开放平台。许多开发人员和用户都希望支持诸如 GitLab 之类的堆栈并与之交互,它具有开源社区版本。 ### 使用 Ansible 管理 Git Git 的去中心方式对于解决这个问题很有用。使用纯 Git,你可以使用一个 `push` 命令轻松地将其推到两个或多个存储库。但是,为了使其在发生意外故障时有用,你必须经常与 Git 存储库进行交互(特别是推送)。此外,即使你可能永远不会自己推送或拉出代码,也可能有一些要备份的存储库。 -但是,使用 Ansible,你可以自动执行项目主分支(或其他任何分支)的 Git 拉取,然后自动存储库到“异地”镜像的 Git 推送。换句话说,你可以让你的计算机定期从 GitHub 拉取并推送到 GitLab 或 [Gitolite][5] 或 Gitea(或你喜欢的任何 Git 主机)。 +但是,使用 Ansible,你可以自动执行项目主分支(或其他任何分支)的 Git 拉取,然后自动进行存储库到“异地”镜像的 Git 推送。换句话说,你可以让你的计算机定期从 GitHub 拉取并推送到 GitLab 或 [Gitolite][5] 或 Gitea(或你喜欢的任何 Git 托管主机)。 ### Ansible 模块 -如果 Ansible 并不是因为其出色的模块集合,那么它就没那么出色。像 Python 的第三方库或 Linux 的应用程序一样,这个技术驱动器有用而令人惊讶的简单技巧是,Ansible 以其他人贡献的组件而闻名。因为本文正在研究如何有效和可靠地备份 Git 存储库,所以这里使用的模块是 [Git 模块][6]和 [ini_file][7] 模块。 +如果不是因其出色的模块集合,那么 Ansible 就没那么出色。像 Python 的第三方库或 Linux 的应用程序一样,这个技术引擎的一个有用而令人惊讶的简单技巧是,Ansible 以其他人贡献的组件而闻名。因为本文正在研究如何有效和可靠地备份 Git 存储库,所以这里使用的模块是 [Git 模块][6]和 [ini_file][7] 模块。 -首先,创建一个名为 `mirror.yaml` 的文件作为剧本playbook。你可以像通常使用 Ansible 一样,从 `name` 和 `task` 条目开始。本示例将 `localhost` 添加到 `hosts` 列表中,以便在控制器计算机(你现在坐在前面的计算机)上运行动作play,但是在现实生活中,你可能会在特定的主机或一组网络上的主机上运行。 +首先,创建一个名为 `mirror.yaml` 的文件作为剧本playbook。你可以像通常使用 Ansible 一样,从 `name` 和 `task` 条目开始。本示例将 `localhost` 添加到 `hosts` 列表中,以便在控制器计算机(你现在坐在前面的计算机)上运行动作play,但是在现实生活中,你可能会在特定的主机或一组网络上的主机上运行它。 ``` --- @@ -43,7 +43,7 @@ Git 的去中心方式对于解决这个问题很有用。使用纯 Git,你可 ### Git 拉取和克隆 -如果要进行备份,则需要最新代码的副本。在 Git 仓库中实现这一目标的明显方法是执行 `git pull`。 但是,`pull` 会假定克隆已经存在,而写得很好的 Ansible 动作(Ansible 脚本)则尽可能少的假定。 最好先告诉 Ansible `clone` 存储库。 +如果要进行备份,则需要最新代码的副本。明显,在 Git 仓库中实现这一目标的方法是执行 `git pull`。 但是,`pull` 会假定克隆已经存在,而写得很好的 Ansible 动作(Ansible 脚本)则尽可能少的假定。最好告诉 Ansible 先克隆存储库。 将你的第一个任务添加到剧本: @@ -63,7 +63,7 @@ Git 的去中心方式对于解决这个问题很有用。使用纯 Git,你可 update: yes ``` -这个例子使用了开源的,类似于 Unix 的操作系统 soso 作为我要镜像的存储库。这是一个完全任意的选择,绝不意味着对该存储库的未来缺乏信心。它还使用变量来引用目标文件夹 `/tmp/soso.git`,这很方便,并且如果以后你希望将它扩展为一个通用的镜像脚本也会受益。在现实生活中,你的工作机上可能会比 `/tmp` 具有更永久的位置,例如 `/home/gitmirrors/soso.git` 或 `/opt/gitmirrors/soso.git`。 +这个例子使用了开源的、类似于 Unix 的操作系统 soso 作为我要镜像的存储库。这是一个完全任意的选择,绝不意味着我对该存储库的未来缺乏信心。它还使用变量来引用目标文件夹 `/tmp/soso.git`,这很方便,并且如果以后你希望将它扩展为一个通用的镜像脚本也会受益。在现实生活中,你的工作机上可能会比 `/tmp` 具有更永久的位置,例如 `/home/gitmirrors/soso.git` 或 `/opt/gitmirrors/soso.git`。 运行你的剧本: @@ -150,7 +150,7 @@ via: https://opensource.com/article/19/11/how-host-github-gitlab-ansible 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6b20f939ee1b8ba5a1afc8601d38a786b7bd90e1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 1 Jan 2020 10:41:49 +0800 Subject: [PATCH 357/676] PUB @wxy https://linux.cn/article-11735-1.html --- .../20191113 How to cohost GitHub and GitLab with Ansible.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191113 How to cohost GitHub and GitLab with Ansible.md (99%) diff --git a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/published/20191113 How to cohost GitHub and GitLab with Ansible.md similarity index 99% rename from translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md rename to published/20191113 How to cohost GitHub and GitLab with Ansible.md index 41616cd282..c9a05d6b40 100644 --- a/translated/tech/20191113 How to cohost GitHub and GitLab with Ansible.md +++ b/published/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11735-1.html) [#]: subject: (How to cohost GitHub and GitLab with Ansible) [#]: via: (https://opensource.com/article/19/11/how-host-github-gitlab-ansible) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 4f1536686af91606a711bcbf4b0e7fa1495735e9 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 1 Jan 2020 15:09:25 +0800 Subject: [PATCH 358/676] translated --- .../tech/20191017 Intro to the Linux useradd command.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191017 Intro to the Linux useradd command.md (100%) diff --git a/sources/tech/20191017 Intro to the Linux useradd command.md b/translated/tech/20191017 Intro to the Linux useradd command.md similarity index 100% rename from sources/tech/20191017 Intro to the Linux useradd command.md rename to translated/tech/20191017 Intro to the Linux useradd command.md From d3a447dcf81bd16100590b5eef613b7960558e3a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 1 Jan 2020 20:51:51 +0800 Subject: [PATCH 359/676] Rename sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md to sources/talk/20191231 How to be a better organization- Top 10 reads for leaders.md --- ...1 How to be a better organization- Top 10 reads for leaders.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191231 How to be a better organization- Top 10 reads for leaders.md (100%) diff --git a/sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md b/sources/talk/20191231 How to be a better organization- Top 10 reads for leaders.md similarity index 100% rename from sources/tech/20191231 How to be a better organization- Top 10 reads for leaders.md rename to sources/talk/20191231 How to be a better organization- Top 10 reads for leaders.md From 99ee33155dcf69405729aa26c01afe369d485440 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 1 Jan 2020 22:14:17 +0800 Subject: [PATCH 360/676] APL --- ...0191231 12 programming resources for coders of all levels.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191231 12 programming resources for coders of all levels.md b/sources/tech/20191231 12 programming resources for coders of all levels.md index 5da5148542..669615585c 100644 --- a/sources/tech/20191231 12 programming resources for coders of all levels.md +++ b/sources/tech/20191231 12 programming resources for coders of all levels.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f782f892a97d4cf7da8bec47d50afc56806ca7a4 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 1 Jan 2020 23:00:27 +0800 Subject: [PATCH 361/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Python interfaces using zope.interface.md | 132 ------------------ ... Python interfaces using zope.interface.md | 125 +++++++++++++++++ 2 files changed, 125 insertions(+), 132 deletions(-) delete mode 100644 sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md create mode 100644 translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md diff --git a/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md deleted file mode 100644 index aa984555d8..0000000000 --- a/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md +++ /dev/null @@ -1,132 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An advanced look at Python interfaces using zope.interface) -[#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package) -[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg) - -An advanced look at Python interfaces using zope.interface -====== -Zope.interface helps declare what interfaces exist, which objects -provide them, and how to query for that information. -![Snake charmer cartoon with a yellow snake and a blue snake][1] - -The **zope.interface** library is a way to overcome ambiguity in Python interface design. Let's take a look at it. - -### Implicit interfaces are not zen - -The [Zen of Python][2] is loose enough and contradicts itself enough that you can prove anything from it. Let's meditate upon one of its most famous principles: "Explicit is better than implicit." - -One thing that traditionally has been implicit in Python is the expected interface. Functions have been documented to expect a "file-like object" or a "sequence." But what is a file-like object? Does it support **.writelines**? What about **.seek**? What is a "sequence"? Does it support step-slicing, such as **a[1:10:2]**? - -Originally, Python's answer was the so-called "duck-typing," taken from the phrase "if it walks like a duck and quacks like a duck, it's probably a duck." In other words, "try it and see," which is possibly the most implicit you could possibly get. - -In order to make those things explicit, you need a way to express expected interfaces. One of the first big systems written in Python was the [Zope][3] web framework, and it needed those things desperately to make it obvious what rendering code, for example, expected from a "user-like object." - -Enter **zope.interface**, which is developed by Zope but published as a separate Python package. **Zope.interface** helps declare what interfaces exist, which objects provide them, and how to query for that information. - -Imagine writing a simple 2D game that needs various things to support a "sprite" interface; e.g., indicate a bounding box, but also indicate when the object intersects with a box. Unlike some other languages, in Python, attribute access as part of the public interface is a common practice, instead of implementing getters and setters. The bounding box should be an attribute, not a method. - -A method that renders the list of sprites might look like: - - -``` -def render_sprites(render_surface, sprites): -    """ -    sprites should be a list of objects complying with the Sprite interface: -    * An attribute "bounding_box", containing the bounding box. -    * A method called "intersects", that accepts a box and returns -      True or False -    """ -    pass # some code that would actually render -``` - -The game will have many functions that deal with sprites. In each of them, you would have to specify the expected contract in a docstring. - -Additionally, some functions might expect a more sophisticated sprite object, maybe one that has a Z-order. We would have to keep track of which methods expect a Sprite object, and which expect a SpriteWithZ object. - -Wouldn't it be nice to be able to make what a sprite is explicit and obvious so that methods could declare "I need a sprite" and have that interface strictly defined? Enter **zope.interface**. - - -``` -from zope import interface - -class ISprite(interface.Interface): - -    bounding_box = interface.Attribute( -        "The bounding box" -    ) - -    def intersects(box): -        "Does this intersect with a box" -``` - -This code looks a bit strange at first glance. The methods do not include a **self**, which is a common practice, and it has an **Attribute** thing. This is the way to declare interfaces in **zope.interface**. It looks strange because most people are not used to strictly declaring interfaces. - -The reason for this practice is that the interface shows how the method will be called, not how it is defined. Because interfaces are not superclasses, they can be used to declare data attributes. - -One possible implementation of the interface can be with a circular sprite: - - -``` -@implementer(ISprite) -@attr.s(auto_attribs=True) -class CircleSprite: -    x: float -    y: float -    radius: float - -    @property -    def bounding_box(self): -        return ( -            self.x - self.radius, -            self.y - self.radius, -            self.x + self.radius, -            self.y + self.radius, -        ) - -    def intersects(self, box): -        # A box intersects a circle if and only if -        # at least one corner is inside the circle. -        top_left, bottom_right = box[:2], box[2:] -        for choose_x_from (top_left, bottom_right): -            for choose_y_from (top_left, bottom_right): -                x = choose_x_from[0] -                y = choose_y_from[1] -                if (((x - self.x) ** 2 + (y - self.y) ** 2) <= -                    self.radius ** 2): -                     return True -        return False -``` - -This _explicitly_ declares that the **CircleSprite** class implements the interface. It even enables us to verify that the class implements it properly: - - -``` -from zope.interface import verify - -def test_implementation(): -    sprite = CircleSprite(x=0, y=0, radius=1) -    verify.verifyObject(ISprite, sprite) -``` - -This is something that can be run by **pytest**, **nose**, or another test runner, and it will verify that the sprite created complies with the interface. The test is often partial: it will not test anything only mentioned in the documentation, and it will not even test that the methods can be called without exceptions! However, it does check that the right methods and attributes exist. This is a nice addition to the unit test suite and—at a minimum—prevents simple misspellings from passing the tests. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/9/zopeinterface-python-package - -作者:[Moshe Zadka][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) -[2]: https://en.wikipedia.org/wiki/Zen_of_Python -[3]: http://zope.org diff --git a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md new file mode 100644 index 0000000000..9827cb9b28 --- /dev/null +++ b/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An advanced look at Python interfaces using zope.interface) +[#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package) +[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg) + +借助 zope.interface 深入了解 Python 接口 +====== +Zope.interface 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 +![Snake charmer cartoon with a yellow snake and a blue snake][1] + +**zope.interface** 库可以克服 Python 接口设计中的歧义性。让我们来研究一下。 + +### 隐式接口不是 Python 之禅 + +[Python 之禅][2] 很宽松,但是有点自相矛盾,你可以从中证明一切。让我们来思考其中最著名的原则之一:“显示胜于隐式”。 + +在 Python 中会隐含的一件事是预期的接口。比如函数已经记录了它期望一个“类文件对象”或“序列”。但是什么是类文件对象呢?它支持 **.writelines** 和 **.seek** 吗?什么是一个“序列”?是否支持分步切片,例如 **a[1:10:2]**? + +最初,Python 的答案是所谓的“鸭子类型”,取自短语“如果它像鸭子一样行走,像鸭子一样嘎嘎叫,那么它可能就是鸭子”。换句话说,“试试看”,这可能是你能得到的最含蓄的表达。 + +为了使这些内容显式地表达出来,你需要一种方法来表达期望的接口。最早用 Python 编写的大型系统之一是 [Zope][3] Web 框架,它迫切需要这些东西来明确地呈现代码,例如,期望从“类似用户的对象”获得什么。 + +**zope.interface** 由 Zope 开发,但作为单独的 Python 包发布。**Zope.interface** 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 + +想象编写一个简单的 2D 游戏,它需要各种东西来支持 sprite 接口(to 校正:这里不知道如何翻译)。例如,表示一个边界框,但也表示对象何时与一个框相交。与一些其他语言不同,在 Python 中,将属性访问作为公共接口一部分是一种常见的做法,而不是实现 getter 和 setter。边界框应该是一个属性,而不是一个方法。 + +呈现外观列表的方法可能类似于: + +``` +def render_sprites(render_surface, sprites): +    """ +    sprites 应该是符合 Sprite 接口的对象列表: +    * 一个属性 "bounding_box",包含了边界框 +    * "intersects" 方法,它接受一个 box 并返回 True 或 False +    """ +    pass # 一些代码会渲染 +``` + +游戏将具有许多处理 sprite 的功能(函数)。在每个功能(函数)中,你都必须在文档中指定预期。 + +此外,某些功能可能期望使用更复杂的 Sprite 对象,例如具有 Z-order 的对象。我们必须跟踪哪些方法需要 Sprite 对象,哪些方法需要 SpriteWithZ 对象。 + +如果能够使 sprite 的内容显式出来,这样方法就可以声明“我需要一个 sprite”,并严格定义接口,这不是很好吗?来看看 **zope.interface**。 + +``` +from zope import interface + +class ISprite(interface.Interface): + +    bounding_box = interface.Attribute( +        "The bounding box" +    ) + +    def intersects(box): +        "它和一个框相交吗?" +``` + +乍看起来,这段代码有点奇怪。这些方法不包括 "self",而包含 "self" 是一种常见的做法,并且它有一个属性。这是在 zope.interface 中声明接口的方法。这看起来很奇怪,因为大多数人不习惯严格声明接口。 + +这样做的原因是接口显示了如何调用方法,而不是如何定义方法。因为接口不是超类,所以它们可以用来声明数据属性。 + +下面是一个可能的接口实现: + +``` +@implementer(ISprite) +@attr.s(auto_attribs=True) +class CircleSprite: +    x: float +    y: float +    radius: float + +    @property +    def bounding_box(self): +        return ( +            self.x - self.radius, +            self.y - self.radius, +            self.x + self.radius, +            self.y + self.radius, +        ) + +    def intersects(self, box): +        # 当且仅当至少一个角在圆内时,方框与圆相交 +        top_left, bottom_right = box[:2], box[2:] +        for choose_x_from (top_left, bottom_right): +            for choose_y_from (top_left, bottom_right): +                x = choose_x_from[0] +                y = choose_y_from[1] +                if (((x - self.x) ** 2 + (y - self.y) ** 2) <= +                    self.radius ** 2): +                     return True +        return False +``` + +这 _显式_ 声明了 **CircleSprite** 类实现接口。它甚至能让我们验证该类是否正确实现了接口: + +``` +from zope.interface import verify + +def test_implementation(): +    sprite = CircleSprite(x=0, y=0, radius=1) +    verify.verifyObject(ISprite, sprite) +``` + +这可以由 **pytest**、**nose** 或其他测试框架运行,它将验证创建的 sprite 是否符合接口。测试通常是局部的:它不会测试文档中没有提及的内容,甚至不会测试方法是否可以在没有异常的情况下被调用!但是,它会检查是否存在正确的方法和属性。这是对单元测试套件一个很好的补充,至少可以防止简单的拼写错误通过测试。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/zopeinterface-python-package + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) +[2]: https://en.wikipedia.org/wiki/Zen_of_Python +[3]: http://zope.org From 5e25ae70948471e49dac7ce10c2418302ff67002 Mon Sep 17 00:00:00 2001 From: nacyro Date: Wed, 1 Jan 2020 23:13:50 +0800 Subject: [PATCH 362/676] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87=20?= =?UTF-8?q?(#16873)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文章: tech/10 articles to enhance your security aptitude 译者: nacyro --- .../20191230 10 articles to enhance your security aptitude.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191230 10 articles to enhance your security aptitude.md b/sources/tech/20191230 10 articles to enhance your security aptitude.md index 7c4314b7ad..ae6c1a9aaf 100644 --- a/sources/tech/20191230 10 articles to enhance your security aptitude.md +++ b/sources/tech/20191230 10 articles to enhance your security aptitude.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (nacyro) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d37d615ed10774676fb269d50674c251b870c996 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 1 Jan 2020 23:42:11 +0800 Subject: [PATCH 363/676] TSL --- ...ming resources for coders of all levels.md | 85 ------------------- ...ming resources for coders of all levels.md | 79 +++++++++++++++++ 2 files changed, 79 insertions(+), 85 deletions(-) delete mode 100644 sources/tech/20191231 12 programming resources for coders of all levels.md create mode 100644 translated/tech/20191231 12 programming resources for coders of all levels.md diff --git a/sources/tech/20191231 12 programming resources for coders of all levels.md b/sources/tech/20191231 12 programming resources for coders of all levels.md deleted file mode 100644 index 669615585c..0000000000 --- a/sources/tech/20191231 12 programming resources for coders of all levels.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (12 programming resources for coders of all levels) -[#]: via: (https://opensource.com/article/19/12/programming-resources) -[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) - -12 programming resources for coders of all levels -====== -No matter where you are in your programming journey, there are things -for you to learn in Opensource.com's top 12 programming articles from -2019. -![Woman sitting in front of her computer][1] - -> "The best time to learn computer programming was 20 years ago. The second best time is now." -> — A computer science proverb, maybe. - -Are you a new programmer, an experienced web dev, a backend wizard, a grizzled system programmer, or some other yet-to-be-discovered species of computer geek? Wherever you land in the vast ecosystem of software developers, the only constant in our field is the need to learn about new technologies and how to apply them. Here is an ensemble of the most-read Opensource.com articles from the past year that inform and entertain, and I'm excited to share them with you here. - -### For the noble newbie - -Whatever your skillset or interests, learning how to write computer programs turns that domain-specific knowledge into a superpower. Unfortunately, it isn't possible to learn how to program from the bite of a radioactive computer, at least not yet. Until that's a thing, I recommend these excellent articles to help bootstrap your programming skills. They address important questions like which languages to consider learning and different ways to get started. - - * [Which programming languages should you learn?][2] - * [A dozen ways to learn Python][3] - * [Three popular programming languages you can learn with Raspberry Pi][4] - * [Introducing kids to computational thinking with Python][5] - - - -### Keeping up with emerging technologies - -Experienced programmers know that the only thing harder than learning to program is keeping your skills and knowledge up to date. But we are an [autodidactic][6] breed, always looking to level up our expertise and understanding. Even if we don't anticipate using a new technology, we know that eventually, someone will ask about it. These articles on Rust, WebAssembly, and Podman are great places to start learning about just a few of the upcoming trends in software technology. - - * [Why should you use Rust in WebAssembly?][7] - * [Level up command-line playgrounds with WebAssembly][8] - * [How does rootless Podman work?][9] - * [Why to choose Rust as your next programming language][10] - - - -### Old programs never die - -Despite the never-ending cascade of new technologies, it never hurts to look back to help you look forward. Today's amazing technologies are built on top of yesterday's tools, and it will serve us well to understand the abilities and limitations of those tools, even if we never write a line of code in these languages of legend. This collection of articles focuses on the C language, a practical application written in AWK, and an interesting discussion of computer languages that are declining in popularity, but perhaps not dead yet. - - * [The monumental impact of C][11] - * [How to write a good C main function][12] - * [Drinking coffee with AWK][13] - * [What's your favorite "dead" language?][14] - - - -### Keep on learning - -No matter where you are in your programming journey, there will always be more to learn. I hope these top resources from 2019 will get you ready for 2020. Thanks to the authors and you, the reader. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/programming-resources - -作者:[Erik O'Shaughnessy][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jnyjny -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_3.png?itok=qw2A18BM (Woman sitting in front of her computer) -[2]: https://opensource.com/article/19/2/which-programming-languages-should-you-learn -[3]: https://opensource.com/article/19/8/dozen-ways-learn-python -[4]: https://opensource.com/article/19/3/programming-languages-raspberry-pi -[5]: https://opensource.com/article/19/2/break-down-stereotypes-python -[6]: https://en.wikipedia.org/wiki/Autodidacticism -[7]: https://opensource.com/article/19/2/why-use-rust-webassembly -[8]: https://opensource.com/article/19/4/command-line-playgrounds-webassembly -[9]: https://opensource.com/article/19/2/how-does-rootless-podman-work -[10]: https://opensource.com/article/19/10/choose-rust-programming-language -[11]: https://opensource.com/article/19/10/command-line-heroes-c -[12]: https://opensource.com/article/19/5/how-write-good-c-main-function -[13]: https://opensource.com/article/19/2/drinking-coffee-awk -[14]: https://opensource.com/article/19/6/favorite-dead-language diff --git a/translated/tech/20191231 12 programming resources for coders of all levels.md b/translated/tech/20191231 12 programming resources for coders of all levels.md new file mode 100644 index 0000000000..c3687187b3 --- /dev/null +++ b/translated/tech/20191231 12 programming resources for coders of all levels.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (12 programming resources for coders of all levels) +[#]: via: (https://opensource.com/article/19/12/programming-resources) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +12 个给码农们的编程资源 +====== + +> 无论你身处编程旅程中的何处,这 12 篇编程文章都有你需要学习一些东西。 + +![Woman sitting in front of her computer][1] + +> “学习计算机编程的最佳时间是 20 年前,其次是现在。” +> — (也许是)计算机科学的谚语 + +你是新程序员、经验丰富的 Web 开发人员、后端大师、头发花白的系统程序员,还是其他神秘物种的计算机极客?无论你身处广阔的软件开发人员生态系统中的何处,在我们领域中唯一不变的就是需要了解新技术及其应用方法。这是过去一年来阅读量最大的 Opensource.com 文章的集合,我很高兴在这里与你分享它们。 + +### 好好学习 + +无论你的技能或兴趣是什么,学习如何编写计算机程序都可以将特定领域的知识变成一种超能力。不幸的是,至少从现在开始,还不可能通过坐在计算机前面接受电磁辐射就能学会如何编程。在这之前,我推荐这些出色的文章来帮助激发你的编程技能。它们解决了一些重要的问题,例如考虑学习哪种语言以及不同的入门方式。 + +* [你应该学习哪种编程语言?][2] +* [学习 Python 的 12 个方式][3] +* [你可以使用树莓派学习的三种流行编程语言][4] +* [利用 Python 引导孩子的计算机思维][5] + +### 天天向上 + +经验丰富的程序员知道,与学习编程相比,唯一更难的就是使你的技能和知识保持最新。但是我们是[自学成才][6]的一族,总是希望提高我们的专业知识和理解力。即使我们不期望使用新技术,我们也知道总会有人问起它们。这些有关 Rust、WebAssembly 和 Podman 的文章是开始学习软件技术一些即将出现的趋势的好地方。 + +* [为什么要在 WebAssembly 中使用 Rust?][7] +* [使用 WebAssembly 提升命令行游乐场][8] +* [免 root 的 Podman 如何工作?][9] +* [为什么选择 Rust 作为你的下一种编程语言][10] + +### 老兵不死 + +尽管新技术层出不穷,但回顾过去可以帮助你前进。当今惊人的技术是建立在昨天的工具之上的,即使我们从未使用这些传奇语言编写过代码,它也将使我们很好地理解这些工具的功能和局限性。这一系列文章集中于 C 语言、用 AWK 编写的实际应用程序,以及对流行度下降但也许还没有消亡的计算机语言的有趣讨论。 + +* [C 的巨大影响] [11] +* [如何写好 C main 函数][12] +* [用 AWK 喝咖啡][13] +* [你最喜欢的“死”语言是什么?][14] + +### 学习不止 + +无论你在编程过程中处于何处,总有更多东西需要学习。我希望这些来自 2019 年的顶级资源能帮助你为 2020 年做好准备。感谢作者们和你——读者。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/programming-resources + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_3.png?itok=qw2A18BM (Woman sitting in front of her computer) +[2]: https://linux.cn/article-10769-1.html +[3]: https://linux.cn/article-11280-1.html +[4]: https://linux.cn/article-10661-1.html +[5]: https://linux.cn/article-11116-1.html +[6]: https://en.wikipedia.org/wiki/Autodidacticism +[7]: https://opensource.com/article/19/2/why-use-rust-webassembly +[8]: https://opensource.com/article/19/4/command-line-playgrounds-webassembly +[9]: https://opensource.com/article/19/2/how-does-rootless-podman-work +[10]: https://opensource.com/article/19/10/choose-rust-programming-language +[11]: https://opensource.com/article/19/10/command-line-heroes-c +[12]: https://linux.cn/article-10949-1.html +[13]: https://linux.cn/article-10555-1.html +[14]: https://opensource.com/article/19/6/favorite-dead-language From 3d87a18a7839b10621d87ed1685b4138899f337d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 2 Jan 2020 00:53:37 +0800 Subject: [PATCH 364/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200101=205=20pr?= =?UTF-8?q?edictions=20for=20Kubernetes=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200101 5 predictions for Kubernetes in 2020.md --- ...01 5 predictions for Kubernetes in 2020.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20200101 5 predictions for Kubernetes in 2020.md diff --git a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md new file mode 100644 index 0000000000..2032983b78 --- /dev/null +++ b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 predictions for Kubernetes in 2020) +[#]: via: (https://opensource.com/article/20/1/kubernetes-2020) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +5 predictions for Kubernetes in 2020 +====== +Plus, a look back at the most popular Kubernetes articles on the site in +2019. +![Person drinking a hat drink at the computer][1] + +How do you track a wildly popular project like Kubernetes? How do you figure out where it’s going? If you are contributing to the project or participating in Special Interest Groups (SIGs), you might gain insight by osmosis, but for those of you with day jobs that don’t include contributing to Kubernetes, you might like a little help reading the tea leaves. With a fast-moving project like Kubernetes, the end of the year is an excellent time to take a look at the past year to gain insight into the next one. + +This year, Kubernetes made a lot of progress. Aside from inspecting code, documentation, and meeting notes, another good source is blog entries. To gain some insights, I took a look at the top ten Kubernetes articles on Opensource.com. These articles give us insight into what topics people are interested in reading, but just as importantly, what articles people are interested in writing. Let’s dig in! + +(Get the full list of top 10 Kubernetes articles from 2019 at the end.) + +First, I would point out that five of these articles tackle the expansion of workloads and where they can run. This expansion of workloads includes data science, PostgreSQL, InfluxDB, and Grafana (as a workload, not just to monitor the cluster itself) and Edge. Historically, Kubernetes and containers in general have mostly run on top of virtual machines, especially when run on infrastructure provided by cloud providers. With this interest in Kubernetes at the edge, it’s another sign that end users are genuinely interested in Kubernetes on bare metal (see also [Kubernetes on metal with OpenShift][2]). + +Next, there seems to be a lot of hunger for operational knowledge and best practices with Kubernetes. From [Kubernetes Operators][3], to [Kubernetes Controllers][4], from [Secrets][5] to [ConfigMaps][6], developers and operators alike are looking for best practices and ways to simplify workload deployment and management. Often we get caught up in the actual configuration example, or how people do it, and don’t take a step back to realize that all of these fall into the bucket of how to operationalize the deployment of applications (not how to install or run Kubernetes itself). + +Finally, people seem to be really interested in getting started. In fact, there is so much information on how to build Kubernetes that it intimidates people and gets them down the wrong path. A couple of the top articles focus on why you should learn to run applications on Kubernetes instead of concentrating on installing it. Like best practices, people often don’t take a step back to analyze where they should invest their time when getting started. I have always advocated for, where possible, spending limited time and money on using technology instead of building it. + +### 5 predictions for Kubernetes in 2020 + +So, looking back at those themes from 2019, what does this tell us about where 2020 is going? Well, combining insight from these articles with my own broad purview, I want to share my thoughts for 2020 and beyond: + + 1. Expansion of workloads. I would keep my eye on high-performance computing, AI/ML, and stateful workloads using Operators. + + 2. More concrete best practices, especially around mature standards like PCI, HIPAA, NIST, etc. + + 3. Increased security around rootless and higher security [runtimes classes][7] (like [gVisor][8], [Kata Containers][9], etc.) + + 4. Better standardization on Kubernetes manifests as the core artifact for deployment in development and sharing applications between developers. Things like [podman generate kube][10], [podman play kube][11], and all in one Kubernetes environments like [CodeReady Containers (CRC)][12] + + 5. An ever-wider ecosystem of network, storage and specialized hardware (GPUs, etc.) vendors creating best of breed solutions for Kubernetes (in free software, we believe that open ecosystems are better than vertically integrated solutions) + + + + +I'm looking forward to another great year in Kubernetes! + +**Top 10 Kubernetes articles for 2019** + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/kubernetes-2020 + +作者:[Scott McCarty][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://blog.openshift.com/kubernetes-on-metal-with-openshift/ +[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ +[4]: https://kubernetes.io/docs/concepts/architecture/controller/ +[5]: https://kubernetes.io/docs/concepts/configuration/secret/ +[6]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/ +[7]: https://kubernetes.io/docs/concepts/containers/runtime-class/ +[8]: https://gvisor.dev/ +[9]: https://katacontainers.io/ +[10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ +[11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities +[12]: https://developers.redhat.com/products/codeready-containers/overview From 7c36acbcaa8d6a52a508740e7d17d62796bf81dd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 2 Jan 2020 00:54:08 +0800 Subject: [PATCH 365/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200101=20How=20?= =?UTF-8?q?to=20get=20started=20with=20open=20source=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200101 How to get started with open source in 2020.md --- ...to get started with open source in 2020.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20200101 How to get started with open source in 2020.md diff --git a/sources/tech/20200101 How to get started with open source in 2020.md b/sources/tech/20200101 How to get started with open source in 2020.md new file mode 100644 index 0000000000..35f67c3d28 --- /dev/null +++ b/sources/tech/20200101 How to get started with open source in 2020.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to get started with open source in 2020) +[#]: via: (https://opensource.com/article/20/1/getting-started-open-source) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +How to get started with open source in 2020 +====== +New to open source? Opensource.com's top 10 articles for newcomers will +get you on the right pathway quickly in the new year. +![pipe in a building][1] + +When Opensource.com launched in 2010, Red Hat CEO Jim Whitehurst said the site "is one of the ways in which Red Hat gives something back to the open source community." And that community has always included the growing number of people who are new to open source. + +In 2019, we published many articles about the open source way of thinking, choosing hardware, the contribution process, and other topics geared toward newbies. If you're new to open source, this list of Opensource.com's top 10 articles from 2019 about getting started with open source should put you on the right path. + +### Why I made the switch from Mac to Linux + +Have you ever considered trying out Linux but were not sure how to start? You are not alone! Trying something new is usually a little scary and involves a learning curve. In [_Why I made the switch from Mac to Linux_][2], Matthew Broberg shares his story about adopting Linux and how his initial nervousness was transformed into an awesome feeling of accomplishment. + +### Getting started with Git: Terminology 101 + +Although there are many ways to contribute to open source (including writing about it, like I'm doing here), the most notable contributions come from the developers who provide source code to projects. They usually make their source code contributions to GitHub and GitLab repositories using the Git tool. Matthew Broberg's guide to [_Getting started with Git: Terminology 101_][3] explains how to get started with Git so you can make your first commit to your favorite open source project. + +### Buying a Linux-ready laptop + +Most people who want to try Linux are already familiar with Microsoft Windows or Apple MacOS, and they may know they can install Linux on their existing computer, for example, by using a virtual machine, partitioning their drive to install Linux alongside Windows or Mac, reformatting their drive to erase their old operating system and install Linux, or putting Linux on a second drive. But many may not know they can buy a Linux-by-default laptop from companies like System76, Slimbook, and Tuxedo. In [_Buying a Linux-ready laptop_][4], Richardo Berlasso shares his experience of ordering, receiving, and using a Linux-ready Tuxedo laptop. + +### Getting started with Vim: The basics + +Vim is an improved version of the vi text editor. It's is available by default on most Linux operating systems and competes with Emacs, another popular Linux text editor. Knowing how to use Vim can give you an edge in creating, modifying, and managing text-based files, whether they are programming files or simple words on a screen. In [_Getting started with Vim: The basics_][5], I walk through how to start learning Vim to simplify your open source journey. + +### How to create a pull request in GitHub + +Pull request, often shortened to PR, is a Git term that means something is available to be merged into another branch. Pull requests are an essential part of the open source contribution process: to contribute to an open source project, people fork or clone a branch to work on it, and the PR process is how they later merge their work back to the parent branch. [_How to create a pull request in GitHub_][6] by Kedar Vijay Kulkarni will give you a good foundation of knowledge to make your first pull request. + +### Bash vs. Python: Which language should you use? + +Of the many programming languages out there, Python is definitely one of the hottest, driven mostly by the growth of data science. But for automation engineers, Bash always has been the primary script language to get the job done. So, what can Python do that Bash cannot? What are some Bash tasks that Python can't replace? Learn the differences by reading [_Bash vs. Python: Which language should you use?_][7] by Archit Modi. + +### How to use Ansible to document procedures + +Ansible is a very popular and powerful infrastructure-as-code tool. Many enterprises rely on it to automate tasks in their cloud platforms. Among the countless things Ansible can do, one of the least obvious is the one Marco Bravo explains: [_How to use Ansible to document procedures_][8]. + +### A dozen ways to learn Python + +Learning a programming language is always a daunting task. But Python has a number of features that make the learning process easy. Contributor Don Watkins offers [_A dozen ways to learn Python_][9] to take some of the stress out of the journey from getting started to becoming a Python expert. + +### What's the best Linux distribution for beginners? + +Everyone has probably heard of Android, the most widely used Linux-based mobile operating system. And many have heard of Red Hat Enterprise Linux (RHEL) and Ubuntu. Picking a Linux operating system can be difficult, but Lauren Pritchett's poll [_What's the best Linux distribution for beginners?_][10] might help you pick the right one based on the community's input. By the way, while you're there, make sure to vote for your favorite Linux distro. + +### My first contribution to open source: Impostor Syndrome + +Contributing to open source can change your life in positive ways, but you can't ignore the technical challenges around it. Have you ever heard someone say, "Hey, starting with open source is a piece of cake? Everyone can do it!" Probably not, since it's not exactly true. Galen Corey shares some of the challenges he confronted in [_My first contribution to open source: Impostor Syndrome_][11]. + +### What else do you need to get started? + +There are a lot of topics related to getting started with open source, which also means there are a lot of opportunities for Opensource.com to give back to new users by publishing articles to help them. Do you have ideas for other articles we should cover in 2020? Please share your suggestions in the comments, or even consider [writing an article][12] about your own open source journey. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/getting-started-open-source + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_pipe_red_hat_tower_building.png?itok=8ho3yi7L (pipe in a building) +[2]: https://opensource.com/article/19/10/why-switch-mac-linux +[3]: https://opensource.com/article/19/2/git-terminology +[4]: https://opensource.com/article/19/7/linux-laptop +[5]: https://opensource.com/article/19/3/getting-started-vim +[6]: https://opensource.com/article/19/7/create-pull-request-github +[7]: https://opensource.com/article/19/4/bash-vs-python +[8]: https://opensource.com/article/19/4/ansible-procedures +[9]: https://opensource.com/article/19/8/dozen-ways-learn-python +[10]: https://opensource.com/article/19/10/linux-distribution-beginners +[11]: https://opensource.com/article/19/11/my-first-open-source-contribution-impostor-syndrome +[12]: https://opensource.com/how-submit-article From 2a6dfeb2fa9796231196f4725847e447fe4652b1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 2 Jan 2020 00:54:44 +0800 Subject: [PATCH 366/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200101=209=20ch?= =?UTF-8?q?eat=20sheets=20and=20guides=20to=20enhance=20your=20tech=20skil?= =?UTF-8?q?ls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md --- ... and guides to enhance your tech skills.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md diff --git a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md new file mode 100644 index 0000000000..fb9d954ab5 --- /dev/null +++ b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (9 cheat sheets and guides to enhance your tech skills) +[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +9 cheat sheets and guides to enhance your tech skills +====== +Kick off the new year with our latest programming cheat sheets and +guides for people of all skill levels. Take our poll to let us know what +you'd like to see next! +![a checklist for a team][1] + +Cheat sheets are perfect for the new coder just starting out on the command line. However, even the most experienced programmers need to lean on references every once in a while. If that pesky keyboard shortcut is just at the tip of your finger, a cheat sheet is perfect to have nearby. Here’s a roundup of our downloadable guides that will set you up for success in 2020. + +### Cheat sheets + +#### [Markdown][2] + +Markdown is not just for coders. Anyone can use it to help bring syntax and structure to a plain text document. This cheat sheet provides Markdown foundations using the CommonMark specification. It also includes syntax for GitHub and GitLab.  + +#### [Linux permissions and users][3] + +Keep commands for managing users close at hand with this Linux cheat sheet. Quickly learn how to add users, delete users, show history, and set permissions. + +#### [Bash][4] + +Once you know Bash, the possibilities at the command line are endless. Our Bash cheat sheet helps you become more efficient with keyboard shortcuts. Before you know it, you'll be running scripts in your sleep (literally).   + +#### [Linux common commands][5] + +It's no wonder that our cheat sheet for common Linux commands is so popular. This cheat sheet is packed with the essentials to get started with installing software and navigating file systems. Print this one out for yourself and your colleagues. + +#### [Microservices][6] + +It seems like everyone is talking about microservices and for good reason. Microservices make applications modular so that they are easier to build and maintain. It's no longer just a buzzword with this cheat sheet. Get to know important terms and learn more about the fundamentals of microservices in [A guide to open source for microservices][7]. + +#### [Java][8] + +This cheat sheet is ideal for beginner and intermediate Java programmers. It includes important context along with code for handling imports, variables, classes, and more. + +#### [pip][9] + +Programmers love using pip commands to help install, manage, and use Python software packages. However, pip can do much more than that. This cheat sheet will teach you how to build wheels and record packages. + +### Guides + +#### [7 essential PyPI libraries][10] + +This collection of Python tutorials will help you learn how to write extensions faster, format your code, automate tests, ensure code consistency, and more using PyPI libraries.  + +#### [Getting started with Kubernetes][11] + +In this approachable guide, author [Scott McCarty][12] uses an unexpected analogy to explain the value of Kubernetes and the steps to get started.  + +* * * + +We'd like to hear from you: Do you have an idea for a new cheat sheet or guide? Take our poll and choose from one of the options, or let us know in the comments. Check out all of our downloads [here][13]. Get alerts about new cheat sheets by [signing up][14] for our email newsletter. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cheat-sheets-guides + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://opensource.com/downloads/cheat-sheet-markdown +[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet +[4]: https://opensource.com/downloads/bash-cheat-sheet +[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[6]: https://opensource.com/downloads/microservices-cheat-sheet +[7]: https://opensource.com/article/19/11/microservices-cheat-sheet +[8]: https://opensource.com/downloads/java-cheat-sheet +[9]: https://opensource.com/downloads/pip-cheat-sheet +[10]: https://opensource.com/downloads/7-essential-pypi-libraries +[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook +[12]: https://opensource.com/users/fatherlinux +[13]: https://opensource.com/downloads/cheat-sheets +[14]: https://opensource.com/email-newsletter From 255f8986cce56ee11ddf7619fc2d4fc2c8b40b88 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 2 Jan 2020 08:43:13 +0800 Subject: [PATCH 367/676] translated --- ...leased With GUI Rework and New Features.md | 112 ------------------ ...leased With GUI Rework and New Features.md | 111 +++++++++++++++++ 2 files changed, 111 insertions(+), 112 deletions(-) delete mode 100644 sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md create mode 100644 translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md diff --git a/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md deleted file mode 100644 index 665f5f585a..0000000000 --- a/sources/news/20191226 Darktable 3 Released With GUI Rework and New Features.md +++ /dev/null @@ -1,112 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Darktable 3 Released With GUI Rework and New Features) -[#]: via: (https://itsfoss.com/darktable-3-release/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Darktable 3 Released With GUI Rework and New Features -====== - -Here’s the Christmas gift for the photography enthusiasts. Darktable 3.0 has just released. - -[Darktable][1] is one of the [best applications for editing RAW images on Linux][2]. You can consider it as a [free and open source alternative to Adobe Lightroom][3]. - -Darktable 3 is a major new release with tons of feature improvements and a complete rework of the user interface. The GUI is now completely controlled by GTK+ CSS rules, which makes the whole GUI themable. There are eight themes available by default. - -With the help of over 3000 commits and 553 pull requests, the new release has fixed 66 bugs and added many new features. - -Let’s see what features this new release brings. - -### New features in Darktable 3.0 - -![Darktable 3.0 Screenshot][4] - -Here are the highlighted new features: - - * Reworked UI - * A new module for handling 3D RGB Lut transformations - * Many improvements to the ‘denoise (profiled)’ module - * A new ‘culling’ mode and timeline view added - * Many improvements to the ‘denoise (profiled)’ module - * New tone equalizer’ basic and filmic RGB modules - * Better 4K/5K display support - * Undo/redo support for more operations - * Many code optimizations for CPU and SSE paths - * Support for exporting to Google Photos - * More camera support, white balance presets, and noise profiles - * Plenty of bug fixes and feature improvements - - - -You can read about all the changes in the [release notes on GitHub][5]. - -### Installing Darktable 3.0 on Linux - -Let’s see how to get the latest Darktable release. - -#### Installing Darktable 3.0 on Ubuntu-based distributions - -Darktable is available in Ubuntu but you won’t get the latest release immediately. For the LTS version, it may take months before you have this version update. - -Worry not! Darktable provides its [own PPA][6] to install the latest release on Ubuntu-based distributions. - -Unfortuntaley, That Darktable PPA has not been updated with the new release. - -Worry not (again)! Thanks to our friend [Ji M of Ubuntu Handbook][7], we have an unofficial PPA for easily installing Darktable 3.0 on Ubuntu and other Ubuntu based distributions. - -Open a terminal and use these commands one by one: - -``` -sudo add-apt-repository ppa:ubuntuhandbook1/darktable -sudo apt update -sudo apt install darktable -``` - -#### Uninstall Darktable 3 - -To remove Darktable installed via this PPA, you can first uninstall the application: - -``` -sudo apt remove darktable -``` - -And then [remove the PPA][8] as well: - -``` -sudo add-apt-repository -r ppa:ubuntuhandbook1/darktable -``` - -#### Installing Darktable on other Linux distributions - -You may wait for your distribution to provide this new release through the software manager. - -You may also download the tarball or the entire source code from the GitHub release page (it’s at the bottom of the page). - -[Download Darktable 3.0][5] - -With Darktable 3, you can edit your holiday pictures better :) - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/darktable-3-release/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://www.darktable.org/ -[2]: https://itsfoss.com/raw-image-tools-linux/ -[3]: https://itsfoss.com/open-source-photoshop-alternatives/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/darktable_3_screenshot.jpg?ssl=1 -[5]: https://github.com/darktable-org/darktable/releases/tag/release-3.0.0 -[6]: https://launchpad.net/~pmjdebruijn/+archive/ubuntu/darktable-release -[7]: http://ubuntuhandbook.org/index.php/2019/12/install-darktable-3-0-0-ubuntu-18-04-19-10/ -[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ diff --git a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md new file mode 100644 index 0000000000..d49467438d --- /dev/null +++ b/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Darktable 3 Released With GUI Rework and New Features) +[#]: via: (https://itsfoss.com/darktable-3-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Darktable 3 发布,带来重做的 GUI 及新的功能 +====== + +这是给摄影爱好者的圣诞节礼物。Darktable 3.0 刚刚发布了。 + +[Darktable][1] 是[在 Linux 上编辑 RAW 图像的最佳应用之一] [2]。你可以将其视为 [Adobe Lightroom 的免费开源替代品][3]。 + +Darktable 3 是一个主版本更新,它有许多功能改进和对用户界面的重做。现在,GUI 完全由 GTK+ CSS 规则控制,这使得整个 GUI 都可定制主题。默认它有八个主题。 + +借助 3000 多个提交和 553 个拉取请求,新版本修复了 66 个 bug 并添加了许多新功能。 + +让我们看看这个新版本带来了什么功能。 + +### Darktable 3.0 的新功能 + +![Darktable 3.0 Screenshot][4] + +以下是重要的新功能: + + *重做的 UI +  * 用于处理 3D RGB Lut 变换的新模块 +  * 对“降噪(轮廓化)”模块进行了许多改进 +  * 添加了新的“剔除”模式和时间轴视图 +  * 对“降噪(轮廓化)”模块进行了许多改进 +  * 新色调均衡器的基本和电影 RGB 模块 +  * 更好的 4K/5K 显示支持 +  * 撤消/重做支持更多操作 +  * 针对 CPU 和 SSE 路径的许多代码优化 +  * 支持导出到 Google 相册 +  * 更多的相机支持,白平衡预设和噪点配置 +  * 大量的 bug 修复和功能改进 + + +你可以在 [GitHub 发行说明][5]中了解所有更改。 + +### 在 Linux 上安装 Darktable 3.0 + +让我们看看如何获​​取最新的 Darktable 版本。 + +#### 在基于 Ubuntu 的发行版上安装 Darktable 3.0 + +Ubuntu 仓库中有 Darktable,但你不能得到最新的版本。对于 LTS 版本,它的更新可能需要几个月的时间。 + +不用担心!Darktable 提供了[自己的 PPA][6],来在基于 Ubuntu 的发行版上安装最新版本。 + +不幸的是,此 Darktable PPA 尚未随新版本更新。 + +不用担心了!多亏了我们的朋友 [Ubuntu Handbook 的 Ji M][7],我们有一个非正式的 PPA,可以轻松地在 Ubuntu 和其他基于 Ubuntu 的发行版上安装 Darktable 3.0。 + +打开终端,并使用这些命令: + +``` +sudo add-apt-repository ppa:ubuntuhandbook1/darktable +sudo apt update +sudo apt install darktable +``` + +#### 卸载 Darktable 3 + +要删除通过此 PPA 安装的 Darktable,你可以先卸载该应用: + +``` +sudo apt remove darktable +``` + +接着[删除 PPA][8]: + +``` +sudo add-apt-repository -r ppa:ubuntuhandbook1/darktable +``` + +#### 在其他 Linux 发行版上安装 Darktable + +你可以等待到你的发行版的软件管理器提供新版本。 + +你也可以从 GitHub 发布页面(位于页面底部)下载 tarball 或所有源代码。 + +[Download Darktable 3.0][5] + +使用 Darktable 3,你可以更好地编辑自己的假期照片:) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/darktable-3-release/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.darktable.org/ +[2]: https://itsfoss.com/raw-image-tools-linux/ +[3]: https://itsfoss.com/open-source-photoshop-alternatives/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/darktable_3_screenshot.jpg?ssl=1 +[5]: https://github.com/darktable-org/darktable/releases/tag/release-3.0.0 +[6]: https://launchpad.net/~pmjdebruijn/+archive/ubuntu/darktable-release +[7]: http://ubuntuhandbook.org/index.php/2019/12/install-darktable-3-0-0-ubuntu-18-04-19-10/ +[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ From abcc2e9b79882bca422e20936f7a0caa3681cd07 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 2 Jan 2020 08:52:12 +0800 Subject: [PATCH 368/676] translating --- .../20200101 Signal- A Secure, Open Source Messaging App.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md index 4dd4037627..fbb741b9f5 100644 --- a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md +++ b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 00ba46b1be03c83e253938630ab30d9b0260a8fa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 2 Jan 2020 09:24:31 +0800 Subject: [PATCH 369/676] Rename sources/tech/20200101 How to get started with open source in 2020.md to sources/talk/20200101 How to get started with open source in 2020.md --- .../20200101 How to get started with open source in 2020.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200101 How to get started with open source in 2020.md (100%) diff --git a/sources/tech/20200101 How to get started with open source in 2020.md b/sources/talk/20200101 How to get started with open source in 2020.md similarity index 100% rename from sources/tech/20200101 How to get started with open source in 2020.md rename to sources/talk/20200101 How to get started with open source in 2020.md From 92a023f51b15e6d41814794fc7360de6694c6289 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 09:40:06 +0800 Subject: [PATCH 370/676] PRF @wxy --- ...27 10 resources to boost your Git skills.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20191227 10 resources to boost your Git skills.md b/translated/tech/20191227 10 resources to boost your Git skills.md index eee2be8848..66f23f3e4e 100644 --- a/translated/tech/20191227 10 resources to boost your Git skills.md +++ b/translated/tech/20191227 10 resources to boost your Git skills.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (10 resources to boost your Git skills) @@ -10,22 +10,22 @@ 10 个提高 Git 技能的资源 ====== -> 年末总结一下 Git 的最佳表现。以下是在新的一年中以新奇的方式使用 Git 的十篇文章。 +> 年末总结一下 Git 的最佳表现。以下是告诉你可以在新的一年中以新奇的方式使用 Git 的十篇文章。 -![open source button on keyboard][1] +![](https://img.linux.net.cn/data/attachment/album/202001/02/093934q5ifu46u4nuq4lgi.jpg) -快到 2019 年底了,是时候回顾一下我们今年发表的有关 Git 的前 10 篇文章了。 +2019 年过去了,是时候回顾一下我们(opensource.com)今年发表的有关 Git 的前 10 篇文章了。 这些文章包括从用例和教程到一些非常有趣的(甚至有些非常规的)使用 Git 的方法。所有这些文章都可以帮助你提高 Git 技能,但是,如果你确实需要 Git 入门介绍,请务必查看我们的《[Git 入门:术语入门][2]》文章,并下载我们的 [Git 备忘单][3]。 -1. Molly de Blanc 写的《[GNOME 如何使用 Git][4]》考察了 GNOME 项目采用的自托管 GitLab 实例的做法,该实例作为 GNOME 项目集中保存为 GNOME 做出的贡献的位置。De Blanc 从事于非编码职位,因此她的文章还探讨了切换到 GitLab 如何使主要角色不是编写代码的贡献者受益。 +1. Molly de Blanc 写的《[GNOME 项目如何使用 Git][4]》考察了 GNOME 项目采用的自托管 GitLab 实例的做法,该实例作为 GNOME 项目集中保存对 GNOME 做出的贡献的位置。De Blanc 从事于非编码职位,因此她的文章还探讨了切换到 GitLab 如何使主要角色不是编写代码的贡献者受益。 2. Ahmad Awais 写的《[Emoji-Log:编写 Git 提交信息的新方法][5]》解释了如何使用 Emoji-Log(一种直白的、开源的 Git 提交日志标准)来编写更好、更用户友好的 Git 提交消息。本文概述了 Emoji-Log 背后的理论以及可添加到 `.bashrc`、`.zshrc` 或 `.gitconfig` 中的配置示例,以便你快速开始使用 Emoji-Log。 3. 在《[用 Git 管理你的每日行程][6]》中,Seth Kenlon 解释了如何使用 Git 来管理日历。通过结合 Org 模式、Git 和其他一些工具,Kenlon 描述了如何创建可在设备之间同步的基于 Git 的日历工作流。 4. 《[用 Git 作为聊天应用的后端][7]》,Seth Kenlon 探索了另一种使用 Git 的非常规方式。在本文中,他探讨了 GIC,这是一个用 Node.js 编写的聊天客户端,其中 Git 用作后端数据库。GIC 是一个概念验证模型,不是供产品环境使用的东西,但是它提供了一个有趣的示例,说明了使用 Git 的真正独特方法。 5. Alan Formy-Duval 的《[Git 学习实用练习][8]》是一份他为提高 Git 技能而努力的编年史。他分享了自己的经验,以使其他人受益于他所学,而 Git 新手将从这篇对 Git 核心功能的出色概述中受益匪浅。 -6. 《[用 Git 帮助写作者更好地完成工作][9]》的作者 Seth Kenlon 着眼于写作者如何从基于 Git 的工作流中受益。本文介绍了如何使用 Git 和 Atom 利用 Markdown 进行书写。通过遵循本文中的示例,写作者可以轻松地将复杂的修订控制系统添加到其编写工作流中。 -7. Sachin Patil 在《[如何使用 Magit 管理 Git 项目][10]》中,解释了如何使用 Emacs 的 Magit 扩展来管理 Git 存储库。本文提供了有关如何在 Emacs 中执行一系列关键 Git 任务的清晰示例。这些示例由说明各种任务的屏幕截图支持。 -8. 《[把“点文件”放到版本控制中][11]》的作者 Matthew Broberg 演示了如何使用 Git 存储放在主目录中的点文件。将你的点文件存储在 Git 存储库中,可以更轻松地在计算机之间共享系统配置,并且,如果你愿意的话,也可以与其他人共享配置。这篇文章也有什么不要共享的警告,因为共享错误的点文件会暴露给其他人。 +6. 《[用 Git 帮助写作者更好地完成工作][9]》的作者 Seth Kenlon 着眼于写作者如何从基于 Git 的工作流中受益。本文介绍了如何使用 Git 和 Atom 利用 Markdown 进行书写。通过遵循本文中的示例,写作者可以轻松地将复杂的版本控制系统添加到其编写工作流中。 +7. Sachin Patil 在《[如何使用 Magit 管理 Git 项目][10]》中,解释了如何使用 Emacs 的 Magit 扩展来管理 Git 存储库。本文提供了有关如何在 Emacs 中执行一系列关键 Git 任务的清晰示例。这些示例带有说明各种任务的屏幕截图。 +8. 《[把“点文件”放到版本控制中][11]》的作者 Matthew Broberg 演示了如何使用 Git 存储放在主目录中的点文件。将你的点文件存储在 Git 存储库中,可以更轻松地在计算机之间共享系统配置,并且,如果你愿意的话,也可以与其他人共享配置。这篇文章也有不要共享哪些文件的警告,因为共享错误的点文件会将其暴露给其他人。 9. Austin Dewey 的《[4 种用于 Git 加密的机密管理工具][12]》在本文中比较了 Git-crypt、BlackBox、SOPS 和 Transcrypt,研究了在 Git 中存储机密的工具。本文涵盖四个主要领域:支持的加密类型、每个项目的目标、项目的工作流和差异以及其他功能。 10. Seth Kenlon 的《[使用 Git 管理 Git 服务器][13]》解释了如何使用 Gitolite 管理 Git 服务器。Gitolite 是使用 Git 来管理 Git 服务器的“管理杂项的后端应用程序”。本文演示了如何安装、配置和使用 Gitolite,并提供了清晰的示例详细说明了该过程的每个步骤。 @@ -36,7 +36,7 @@ via: https://opensource.com/article/19/12/git-resources 作者:[Joshua Allen Holm][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c4bb1456b9281b4b79bf269c88c276c1f3e9bdc4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 09:40:56 +0800 Subject: [PATCH 371/676] PUB @wxy https://linux.cn/article-11737-1.html --- .../tech/20191227 10 resources to boost your Git skills.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20191227 10 resources to boost your Git skills.md b/translated/tech/20191227 10 resources to boost your Git skills.md index 66f23f3e4e..8dc63c18bf 100644 --- a/translated/tech/20191227 10 resources to boost your Git skills.md +++ b/translated/tech/20191227 10 resources to boost your Git skills.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11737-1.html) [#]: subject: (10 resources to boost your Git skills) [#]: via: (https://opensource.com/article/19/12/git-resources) [#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) From 2cb00c83640323ac3f982963c3e3f39b4b30c657 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 10:30:40 +0800 Subject: [PATCH 372/676] PRF @robsean --- ... chapter template in LibreOffice Writer.md | 64 +++++++++---------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md index c73f774162..be6ce008f5 100644 --- a/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md +++ b/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md @@ -1,31 +1,33 @@ 如何在 LibreOffice Writer 中创建一个电子书章节模板 ====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_colorbooks.png?itok=vNhsYYyC) -对于很多人来说,使用 word 程序来写和发布一本电子书是一种最好的,最容易的,最熟悉的方法。但是,启动你的 word 程序和打字是不够的--你需要遵循一种格式。 +> 将电子书分成几章,创建电子书会更容易。这是设置模板的分步指南。 -这就是模板的来源。一个模板确保你的电子书有一个一致的外观和体验。幸运的是,创建一个模板是快速和容易的,并你在其上花费的时间和努力将给你一本更好感官的书。 +![](https://img.linux.net.cn/data/attachment/album/202001/02/102817vmflleeemehetblt.jpg) -在这片文章中,我将陪伴你走过如何使用 LibreOffice Writer 创建一个简单的用于写一本电子书的各个章节的模板。你可以将这个模板用于 PDF 和 EPUB 书籍,并假以修改来满足你的需要。 +对于很多人来说,使用 word 程序来撰写和发布一本电子书是一种最好的、最容易的、最熟悉的方法。但是,启动你的 word 程序和打字是不够的 —— 你需要遵循一种格式。 + +这就是模板的来源。一个模板确保你的电子书有一个一致的外观和体验。幸运的是,创建模板是快速和容易的,并你在其上花费的时间和努力将带给你一本更好感观的书。 + +在这篇文章中,我将陪伴你走过如何使用 LibreOffice Writer 创建一个简单的模板,可以用于一本电子书的各个章节。你可以将这个模板用于 PDF 和 EPUB 书籍,并加以修改来满足你的需要。 ### 我的方法 -为什么我聚焦于为一个章节创建一个模板,而不是为一整本书创建一个模板?因为编写和管理单独的章节比编写和管理单个庞大而僵化的文档更容易。 +为什么我着重于为一个章节创建一个模板,而不是为一整本书创建一个模板?因为编写和管理单独的章节比编写和管理单个庞大而僵化的文档更容易。 -通过聚焦于单独的章节,你可以聚焦于你需要编写的东西。你可以容易地向各处移动这些章节,给审阅者发单独一章节比发你完整的原稿更简单而高效。当你写完一章后,你可以简单地把你的章节拼凑在一起来出版这本书(我将在下面讨论如何做到这一点)。但是不要觉得你被这种方法所束缚 --如果你更喜欢在单个文件中编写,简单地调整在这篇文章中描述的步骤来做做成这样。 +通过关注于单独的章节,你可以专心于你需要编写的东西。你可以很容易地四处移动这些章节,给审阅者发单独一章节比发送你的完整原稿更简单而高效。当你写完一章后,你可以简单地把你的章节拼凑在一起来出版这本书(我将在下面讨论如何做到这一点)。但是不要觉得你被这种方法所束缚 —— 如果你更喜欢在单个文件中编写,简单地调整在这篇文章中描述的步骤就行。 让我们开始吧。 ### 设置页面 -仅当你计划发布你的电子书为一本 PDF 书时,这是很重要的。设置页面意味着你的书将不包含大量的穿越屏幕的让眼睛疲劳的文本。 +仅当你计划发布你的电子书为一本 PDF 书时,这是很重要的。设置页面意味着你的书将不包含大量的跨越屏幕的让眼睛疲劳的文本。 -选择 **格式 > 页面** 来打开 **页面样式** 窗口。我的 PDF 电子书通常是 5x8 英寸高(大约 13x20cm ,对于我们这些生活在米制世界的人来说)。我也设置页边距为半英寸(约 1.25 cm)。这些是我较喜欢的尺寸;使用任何适合你的尺寸。 +选择 **格式 > 页面** 来打开 **页面样式** 窗口。我的 PDF 电子书通常是 5x8 英寸高(大约 13x20cm ,对于我们这些生活在米制世界的人来说)。我也设置页边距为半英寸(约 1.25 cm)。这些是我较喜欢的尺寸;你可以使用任何适合你的尺寸。 ![LibreOffice Page Style window][2] - -在 LibreOffice Writer 中的页面样式窗口让你设置页边距和页格式。 +*在 LibreOffice Writer 中的页面样式窗口让你设置页边距和页格式。* 接下来,添加页脚以显示页码。保持页面样式窗口打开着,并单击 **页脚** 选项卡。选择 **在页脚上** 并单击 **确定** 。 @@ -33,15 +35,13 @@ ### 设置你的样式 -像模板本身一样,样式为你的文档提供一种一致的外观和体验。如果你想更改一个标题的字体或大小,例如,你只需要在一个地方完成它,而不是手动应用格式化到每个标题。 - -标准化的 LibreOffice 模板带有许多样式,你可以调整它们以适应你的需要。为此,按 **F11** 来打开 **样式和格式** 窗口。 +像模板本身一样,样式为你的文档提供一种一致的外观和体验。如果你想更改一个标题的字体或大小,例如,你只需要在一个地方完成它,而不是手动应用格式化到每个标题。 +标准化的 LibreOffice 模板带有许多样式,你可以调整它们以适应你的需要。为此,按 `F11` 来打开 **样式和格式** 窗口。 ![LibreOffice styles and formatting][4] - -使用样式和格式窗口更改字体和其它细节。 +*使用样式和格式窗口更改字体和其它细节。* 在一个样式上右键单击,并选择 **修改** 来编辑它。 这里是我在每本中使用的主要样式: @@ -56,51 +56,45 @@ ![LibreOffice styles in action][6] +*这是当我们应用到电子书内容时的一个选择的样式外观。* -这是当我们应用到电子书内容时的一个选择的样式外观。 +对于大多数书来说,这通常是最小要求。可以随便更改字体和空格来适应你的要求。 -对于大多数书来说,这通常是最小量要求。可以随便更改字体和空格来适应你的要求。 - -根据你正在编写书的类型,你可能也想创建或修改项目符合样式,以及数字列表,引号、代码示例,数字符号等等。只需要记住始终如一地使用字体以及其大小。 +根据你正在编写书的类型,你可能也想创建或修改项目符合样式,以及数字列表、引号、代码示例、数字符号等等。只需要记住始终如一地使用字体以及其大小。 ### 保存你的模板 -选择 **文件 > 另存为** 。在保持对话框中,从格式列表中选择 _ODF 文本文档模板 (.ott)_ 。这将保存模板为一个模板,以后你可以快速调用该模板。 +选择 **文件 > 另存为** 。在保持对话框中,从格式列表中选择 “ODF 文本文档模板 (.ott)” 。这将保存模板为一个模板,以后你可以快速调用该模板。 -保存模板的最佳位置是 LibreOffice 模板文件夹。例如,在 Linux 中,那是在你的 **/home** 目录下,在 . **config/libreoffice/4/user/template** 下。 +保存模板的最佳位置是 LibreOffice 模板文件夹。例如,在 Linux 中,那是在你的家目录下,在 `.config/libreoffice/4/user/template` 下。 ### 编写你的书 -在你开始编写前,在你的计算机上创建一个文件夹,它将为你的书保存所有的文件--章节,图像,笔记等等。 +在你开始编写前,在你的计算机上创建一个文件夹,它将为你的书保存所有的文件 —— 章节、图像、笔记等等。 当你准备编写时,启动 LibreOffice Writer 并选择 **文件 > 新建 > 模板** 。然后从列表中选择你的模板,并单击 **打开**。 - ![LibreOffice Writer template list][8] - -从你在 LibreOffice Writer 中设置的列表中选择你的模板,并开始编写。 +*从你在 LibreOffice Writer 中设置的列表中选择你的模板,并开始编写。* 然后用一个描述性名称保存文档。 -建议使用像 _章节 1_ 和 _章节 2_ 这样的惯例--在某些时候,你可能决定重新编排你的章节,当你尝试管理这些章节时,它可能会变得混乱。然而,你可以在文件名称中放置章节数字,像 _章节 1_ 或 _Ch1 。很容易重命名一个文件,_ 。如果你完成重新排版书的章节,像这样重命名更容易。 +建议使用像 “第 1 章” 和 “第 2 章” 这样的惯例 —— 在某些时候,你可能决定重新编排你的章节,当你尝试管理这些章节时,它可能会变得混乱。然而,你可以在文件名称中放置章节数字,像 “第 1 章” 或 “一” 。如果你最后要重新排列全书的章节,像这样重命名更容易。 -别再碍事,开始编写。记住在模板中使用样式来格式化文本--这就是为什么你要创建模板,对吧? +无需赘言,开始编写吧。记住在模板中使用样式来格式化文本 —— 这就是为什么你要创建模板,对吧? ### 发布你的电子书 -在完成编写一堆章节后,并准备发布它们时,创建一个主控文档。把一个主控文档作为你所编写章节的一个容器。使用一个主控文档,你可以快速地组装你的书,并任意重新排序你的章节。LibreOffice 帮助提供使用[主控文档][9]的详细信息。 +在完成编写一堆章节后,并准备发布它们时,创建一个主控文档。把一个主控文档作为你所编写章节的一个容器。使用一个主控文档,你可以快速地组装你的书,并任意重新排序你的章节。LibreOffice 的帮助提供了使用[主控文档][9]的详细信息。 -假设你想生成一个 PDF ,不要只是单击**直接导出到 PDF** 按钮。这将创建一个相当不错的 PDF ,但是你可能想优化它。为此,选择 **文件 > 导出为 PDF** ,并在 PDF 窗口中轻微调整。你可以在 [LibreOffice Writer 文档][10] 中学到更多东西。 +假设你想生成一个 PDF ,不要只是单击**直接导出到 PDF** 按钮。这将创建一个相当不错的 PDF ,但是你可能想优化它。为此,选择 **文件 > 导出为 PDF** ,并在 PDF 选项窗口中轻微调整。你可以在这篇 [LibreOffice Writer 文档][10] 中学到更多东西。 -如果你想创建一个 EPUB 而不是 一个PDF ,或者除了一个 PDF 以外,另外创建一个 EPUB,安装 [Writer2EPUB][11] 扩展。Opensource.com 的 Bryan Behrenshausen 为这个扩展[分享一些有用的说明][12] 。 +如果你想创建一个 EPUB 而不是一个 PDF,或者除了一个 PDF 以外,另外创建一个 EPUB,请安装 [Writer2EPUB][11] 扩展。Opensource.com 的 Bryan Behrenshausen 为这个扩展[分享了一些有用的说明][12] 。 ### 结束语 -我们在这里创建的模板是极简单的,但是你将其用于一本简单的书,或者作为构建一个复杂模板的起点。不管怎样,这个模板都会让你快速地开始编写和发布你的电子书。 - -### 关于作者About The Author -Scott Nesbitt ;我是一个长期使用自由开放源码软件的人;写各种东西都是为了玩;盈利。我不太看重我自己;我做我自己的特效。你可以在网上的一些高质量的大型组装找到我的踪迹。 +我们在这里创建的模板是极简单的,但是你可以将其用于一本简单的书,或者作为构建一个复杂模板的起点。不管怎样,这个模板都会让你快速地开始编写和发布你的电子书。 -------------------------------------------------------------------------------- @@ -108,7 +102,7 @@ via: https://opensource.com/article/17/10/creating-ebook-chapter-template-libreo 作者:[Scott Nesbitt][a] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 26114119df3e2a5ed4823c1060b9263ee2b4da91 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 10:33:56 +0800 Subject: [PATCH 373/676] PUB @robsean https://linux.cn/article-11738-1.html --- ... to create an e-book chapter template in LibreOffice Writer.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171018 How to create an e-book chapter template in LibreOffice Writer.md (100%) diff --git a/translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md b/published/20171018 How to create an e-book chapter template in LibreOffice Writer.md similarity index 100% rename from translated/tech/20171018 How to create an e-book chapter template in LibreOffice Writer.md rename to published/20171018 How to create an e-book chapter template in LibreOffice Writer.md From 52ca2c8a035834c86f048ef314f6bc937173d100 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 22:24:00 +0800 Subject: [PATCH 374/676] PRF @geekpi --- ...leased With GUI Rework and New Features.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md index d49467438d..3ae5c19e01 100644 --- a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md +++ b/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Darktable 3 Released With GUI Rework and New Features) [#]: via: (https://itsfoss.com/darktable-3-release/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Darktable 3 发布,带来重做的 GUI 及新的功能 +Darktable 3 发布,带来重新打造的 UI 及新的功能 ====== -这是给摄影爱好者的圣诞节礼物。Darktable 3.0 刚刚发布了。 +> 这是给摄影爱好者的圣诞节礼物。Darktable 3.0 刚刚发布了。 -[Darktable][1] 是[在 Linux 上编辑 RAW 图像的最佳应用之一] [2]。你可以将其视为 [Adobe Lightroom 的免费开源替代品][3]。 +[Darktable][1] 是[在 Linux 上编辑 RAW 图像的最佳应用之一][2]。你可以将其视为 [Adobe Lightroom 的自由开源替代品][3]。 -Darktable 3 是一个主版本更新,它有许多功能改进和对用户界面的重做。现在,GUI 完全由 GTK+ CSS 规则控制,这使得整个 GUI 都可定制主题。默认它有八个主题。 +Darktable 3 是一个主版本更新,它带来了大量的功能改进和重新打造的用户界面。现在,GUI 完全由 GTK+ CSS 规则所控制,这使得整个 GUI 都可定制主题。它默认有八个主题。 借助 3000 多个提交和 553 个拉取请求,新版本修复了 66 个 bug 并添加了许多新功能。 @@ -26,19 +26,18 @@ Darktable 3 是一个主版本更新,它有许多功能改进和对用户界 以下是重要的新功能: - *重做的 UI -  * 用于处理 3D RGB Lut 变换的新模块 -  * 对“降噪(轮廓化)”模块进行了许多改进 -  * 添加了新的“剔除”模式和时间轴视图 -  * 对“降噪(轮廓化)”模块进行了许多改进 -  * 新色调均衡器的基本和电影 RGB 模块 -  * 更好的 4K/5K 显示支持 -  * 撤消/重做支持更多操作 -  * 针对 CPU 和 SSE 路径的许多代码优化 -  * 支持导出到 Google 相册 -  * 更多的相机支持,白平衡预设和噪点配置 -  * 大量的 bug 修复和功能改进 - +* 重新打造的 UI +* 用于处理 3D RGB Lut 变换的新模块 +* 对“降噪(轮廓化)”模块进行了许多改进 +* 添加了新的“剔除”模式和时间轴视图 +* 对“降噪(轮廓化)”模块进行了许多改进 +* 新色调均衡器的基本和电影 RGB 模块 +* 更好的 4K/5K 显示支持 +* 撤消/重做支持更多操作 +* 针对 CPU 和 SSE 路径的许多代码优化 +* 支持导出到 Google 相册 +* 支持更多的相机,白平衡预设和噪点配置 +* 大量的 bug 修复和功能改进 你可以在 [GitHub 发行说明][5]中了解所有更改。 @@ -48,9 +47,9 @@ Darktable 3 是一个主版本更新,它有许多功能改进和对用户界 #### 在基于 Ubuntu 的发行版上安装 Darktable 3.0 -Ubuntu 仓库中有 Darktable,但你不能得到最新的版本。对于 LTS 版本,它的更新可能需要几个月的时间。 +Ubuntu 仓库中有 Darktable,但你不能得到马上最新的版本。对于 LTS 版本,它的更新可能需要几个月的时间。 -不用担心!Darktable 提供了[自己的 PPA][6],来在基于 Ubuntu 的发行版上安装最新版本。 +不用担心!Darktable 提供了[自己的 PPA][6] 来在基于 Ubuntu 的发行版上安装最新版本。 不幸的是,此 Darktable PPA 尚未随新版本更新。 @@ -84,7 +83,7 @@ sudo add-apt-repository -r ppa:ubuntuhandbook1/darktable 你也可以从 GitHub 发布页面(位于页面底部)下载 tarball 或所有源代码。 -[Download Darktable 3.0][5] +- [下载 Darktable 3.0][5] 使用 Darktable 3,你可以更好地编辑自己的假期照片:) @@ -95,7 +94,7 @@ via: https://itsfoss.com/darktable-3-release/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5fdaaa1d3fa3a703208db55ac2d262a91ac55f6f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 2 Jan 2020 22:27:42 +0800 Subject: [PATCH 375/676] PUB @geekpi https://linux.cn/article-11741-1.html --- ...6 Darktable 3 Released With GUI Rework and New Features.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191226 Darktable 3 Released With GUI Rework and New Features.md (98%) diff --git a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md b/published/20191226 Darktable 3 Released With GUI Rework and New Features.md similarity index 98% rename from translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md rename to published/20191226 Darktable 3 Released With GUI Rework and New Features.md index 3ae5c19e01..b7c6b53cbb 100644 --- a/translated/news/20191226 Darktable 3 Released With GUI Rework and New Features.md +++ b/published/20191226 Darktable 3 Released With GUI Rework and New Features.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11741-1.html) [#]: subject: (Darktable 3 Released With GUI Rework and New Features) [#]: via: (https://itsfoss.com/darktable-3-release/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From b4c1425446b4f16db2531876f3a2168bcad759c4 Mon Sep 17 00:00:00 2001 From: nacyro Date: Thu, 2 Jan 2020 22:33:17 +0800 Subject: [PATCH 376/676] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...icles to enhance your security aptitude.md | 92 ------------------- ...icles to enhance your security aptitude.md | 91 ++++++++++++++++++ 2 files changed, 91 insertions(+), 92 deletions(-) delete mode 100644 sources/tech/20191230 10 articles to enhance your security aptitude.md create mode 100644 translated/tech/20191230 10 articles to enhance your security aptitude.md diff --git a/sources/tech/20191230 10 articles to enhance your security aptitude.md b/sources/tech/20191230 10 articles to enhance your security aptitude.md deleted file mode 100644 index ae6c1a9aaf..0000000000 --- a/sources/tech/20191230 10 articles to enhance your security aptitude.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (nacyro) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 articles to enhance your security aptitude) -[#]: via: (https://opensource.com/article/19/12/security-resources) -[#]: author: (Ben Cotton https://opensource.com/users/bcotton) - -10 articles to enhance your security aptitude -====== -Whether you're learning the first steps or looking to add to your -skills, there's something for you in Opensource.com's top 10 security -articles of 2019. -![A secure lock.][1] - -If security is a process (and it is), then it stands to reason that different projects (and contributors) are in different places. Some applications have years of security testing, with design done by people who have worked in information security for decades. Others are brand new projects by developers working on their first open source project. It comes as no surprise that Opensource.com's top security articles of 2019 represent this range of experience. We have articles that introduce basic security practices as well as deep dives into more advanced topics. - -Whether you're learning the first steps or looking to add to your skills acquired over a storied career, there's something for you in the top 10 security articles of 2019. - -### 7 steps to securing your Linux server - -Security is like a house: if the foundation is bad, the rest is at risk. Patrick H. Mullins' excellent _[7 steps to securing your Linux server][2]_ gets you started with basic security steps for Linux servers. Even if you have a lot of experience administering servers, this article provides a good checklist to make sure you have the basics covered. From there, you can begin adding additional layers of security. - -### Make Linux stronger with firewalls - -One of the seven steps to securing your server is enabling a firewall. But what _is_ a firewall, and how does it work? Seth Kenlon answers these questions and then describes in detail how to configure your firewall for better security in _[Make Linux stronger with firewalls][3]_. Using firewalld and Network Manager, you can set different firewall configurations for different networks. This allows you to have a trusting configuration on your home network, for example, and a more paranoid configuration on your favorite coffee shop's WiFi network. - -### Reducing security risks with centralized logging - -Once you've secured your system, you're not done: security is a process, not a state. Part of _keeping_ systems secure is keeping an eye on what goes on. One way to do that, especially with multiple systems, is to centralize your logging. In _[Reducing security risks with centralized logging][4]_, Hannah Suarez shares how to get started (she based this article on her lightning talk at FOSDEM '19). - -### Using GPG keys for SSH - -Most people who use key-based authentication for SSH use SSH keys. And why wouldn't you? It's right there in the name. These are perfectly fine from a security standpoint, but if you want to make some forms of key distribution and backup easier, there's another way. Brian Exelbierd's three-part series walks through _[How to enable SSH access with a GPG subkey][5]_, _[How to import existing SSH keys][6]_, and _[How to reduce your backup needs to a single key file][7]_. - -### Graphically manage SSH keys with Seahorse - -Using GPG for SSH keys isn't everyone's cup of tea, but that doesn't mean you're out of luck when it comes to key management. Seahorse is a graphical tool for managing SSH keys (and other authentication methods) that is included in the GNOME desktop. Alan Formy-Duval's [_Graphically manage SSH keys with Seahorse_][8], is particularly helpful to the novice user. - -### Security scanning your DevOps pipeline - -Containers are everywhere these days. But what's in them? Knowing that containers meet your security policies is an important part of staying secure. Fortunately, you can use open source tools to help automate compliance checking. Jessica Cherry's (formly Repka) [_Security scanning your DevOps pipeline_][9] is a step-by-step tutorial that shows you how to use the Jenkins build system and the Anchore inspection service to create a scanning pipeline for container images and registries. - -### 4 open source cloud security tools - -One of the great things about cloud services is that your data can be accessed from anywhere. One of the downsides to cloud services is that your data can be accessed from anywhere. If you're using "-as-a-Service" offerings, you want to make sure they're securely configured. Anderson Silva, Alison Naylor, Travis McPeak, and Rich Monk join forces to introduce [_4 open source cloud security tools_][10] to help improve security when using GitHub and AWS. If you're looking for accidentally committed secrets—or trying to prevent them from being committed in the first place—this article has tools you can use. - -### How to use OpenSSL: hashes, digital signatures, and more - -Much of information security is based on math: specifically, the cryptographic functions used to encrypt data and authenticate users or file contents. After providing an introduction in [_Getting started with OpenSSL: Cryptography basics_][11], Marty Kalin digs deeper into the details of _[How to use OpenSSL: Hashes, digital signatures, and more][12]_, explaining how to use the OpenSSL utility to explore these commonly used but uncommonly understood concepts. - -### Learn about computer security with the Raspberry Pi and Kali Linux - -Cheap hardware and open source software make a great combination, especially for people looking to learn by doing. In this article, Anderson Silva introduces the security-oriented Kali Linux distribution in _[Learn about computer security with the Raspberry Pi and Kali Linux][13]_. It's a short article, but it's full of useful links to documentation and security-related projects that you can use with your own Raspberry Pi. - -### Will quantum computing break security? - -Has the rest of this article been a waste? Will quantum computing render everything we know about security obsolete? The good news is that the answer is "no," but quantum computing can still have a profound impact on security and the computing world more broadly. In _[Will quantum computing break security?][14]_ Mike Bursell examines its potential impacts—both the good news and the bad. And of course, quantum computing may make it easier to break encryption, but that doesn't matter if the baddies can't get your data in the first place. - -### Looking to 2020 - -Security will always be important, and (as the quantum computing article suggests) the next few years will be an interesting time in the field. In 2020, Opensource.com articles will look at the leading edge of open source security and help explain the basics to the ever-growing open source community. If you have a topic you want us to cover, please share it in the comments, or—better yet— if you have an article in mind, [write for us][15]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/security-resources - -作者:[Ben Cotton][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bcotton -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko (A secure lock.) -[2]: https://opensource.com/article/19/10/linux-server-security -[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls -[4]: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging -[5]: https://opensource.com/article/19/4/gpg-subkeys-ssh -[6]: https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples -[7]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage -[8]: https://opensource.com/article/19/4/ssh-keys-seahorse -[9]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline -[10]: https://opensource.com/article/19/9/open-source-cloud-security -[11]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 -[12]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 -[13]: https://opensource.com/article/19/3/computer-security-raspberry-pi -[14]: https://opensource.com/article/19/1/will-quantum-computing-break-security -[15]: https://opensource.com/how-submit-article diff --git a/translated/tech/20191230 10 articles to enhance your security aptitude.md b/translated/tech/20191230 10 articles to enhance your security aptitude.md new file mode 100644 index 0000000000..3a86ffc6a0 --- /dev/null +++ b/translated/tech/20191230 10 articles to enhance your security aptitude.md @@ -0,0 +1,91 @@ +[#]: collector: "lujun9972" +[#]: translator: "nacyro" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "10 articles to enhance your security aptitude" +[#]: via: "https://opensource.com/article/19/12/security-resources" +[#]: author: "Ben Cotton https://opensource.com/users/bcotton" + +10 篇文章强化你的安全能力 +====== +无论你是新手还是想要增加技能,Opensource.com 2019 年十大安全文章中都有适合你的内容。 + +![A secure lock.][1] + +如果安全是一个过程(确实如此),那么理所当然的,不同的项目(及其贡献者)情况各有不同。有些应用程序经历了多年的安全测试,由在信息安全领域工作了几十年的人员所设计。其他的则是由开发人员在他们的第一个开源项目中开发的全新项目。毫不奇怪,Opensource.com 2019 年十大安全文章囊括了代表这一范围的经验。我们有介绍基本安全实践的文章,也有深入探讨更高级主题的文章。 + +无论你是新手还是想要增加你在传奇职业生涯中获得的技能,2019 年十大安全文章中都有适合你的内容。 + +### 《七步捍卫你的 Linux 服务器(7 steps to securing your Linux server)》 + +安全如舍,地基不牢,房屋不稳。Patrick H. Mullins 的杰作《[七步捍卫你的 Linux 服务器(7 steps to securing your Linux server)][2]》让您从Linux服务器的基本安全步骤开始。即使您有很多管理服务器的经验,本文也提供了一个很好的清单以确保您掌握了基础知识。在此基础上,您可以开始添加额外的安全层。 + +### 《用防火墙使 Linux 更健壮(Make Linux stronger with firewalls)》 + +七步捍卫你的 Linux 服务器中的一步即是启用防火墙。但什么**是**防火墙,它是如何工作的呢? Seth Kenlon 在《[用防火墙使 Linux 更健壮(Make Linux stronger with firewalls)][3]》一文中回答了这些问题,然后详细描述了为了更好的安全性应如何配置你的防火墙。使用 `firewalld` 与 `Network Manager`,您可以为不同的网络设置不同的防火墙配置。例如,这允许您在您的家庭网络上进行信任配置,并在您最喜欢的咖啡店的 WiFi 网络上进行更多疑的配置。 + +### 《减少集中日志的安全风险(Reducing security risks with centralized logging)》 + +保护系统安全,只有开始,没有结束:安全是一个过程而不是状态。**保持**系统安全工作的一部分即是密切关注所发生的事情。集中化日志是实现这一点的一种方法,尤其是在管理多系统时。在《[减少集中日志的安全风险(Reducing security risks with centralized logging)][4]》中 Hannah Suarez 分享了要如何开始(她这篇文章基于她在 FOSDEM'19 (自由及开源软件开发者欧洲会议) 中的闪电演讲) + +### 《为 SSH 使用 GPG 密钥(Using GPG keys for SSH)》 + +大多数人都会为 `SSH` 的密钥认证使用 `SSH 密钥`。为什么不呢?毕竟就在名字里。从安全的角度来看,这些方法非常好。但若想简化某些形式的密钥分发与备份还有另一种方法,Brian Exelbierd 的三部曲系列介绍了《[如何启用使用 GPG 子钥的 SSH 访问(How to enable SSH access with a GPG subkey)][5]》、《[如何导入现有 SSH 密钥(How to import existing SSH keys)][6]》、《[如何将备份量减少到单个密钥文件(How to reduce your backup needs to a single key file)][7]》 + +### 《使用 `Seahorse` 图形化管理 SSH 密钥(Graphically manage SSH keys with Seahorse)》 + +并不是所有人都喜欢用 `GPG` 作为 `SSH 密钥`,但这并不意味着您在密钥管理上会不顺。`Seahorse` 是一个在 `GNOME` 桌面中用于管理 `SSH 密钥` 及其他身份验证方法的图形化工具。Alan Formy-Duval 的《[使用 `Seahorse` 图形化管理 SSH 密钥(Graphically manage SSH keys with Seahorse)][8]》对新手用户特别有帮助。 + +### 《安全扫描你的 DevOps 管线(Security scanning your DevOps pipeline)》 + +如今到处都是容器。但它们容纳着什么?了解容器满足您的安全策略是保持安全性的重要部分。幸运的是,您可以使用开源工具来帮助自动化符合性检查。Jessica Cherry (原名: Repka) 的《[安全扫描你的 DevOps 管线(Security scanning your DevOps pipeline)][9]》是一个循序渐进的教程,向您展示了如何使用 `Jenkins` 构建系统和 `Anchore` 检查服务为容器镜像和 `registries` 创建扫描管线。 + +### 《四个开源云安全工具(4 open source cloud security tools)》 + +云服务的一大优点是你的数据可以从任何地方访问。云服务的一个缺点是你的数据可以从任何地方访问。如果您使用的是 `"-as-a-Service" (译注: IaaS, PaaS, SaaS)` 产品,那么您需要确保它们是经过安全配置的。Anderson Silva、Alison Naylor、Travis McPeak 和 Rich Monk 联合推出《[四个开源云安全工具(4 open source cloud security tools)][10]》以帮助在使用 `GitHub` 和 `AWS` 时提高安全性。如果你正在寻找被不小心提交的秘密,或尝试从一开始就阻止这些秘密被提交,这篇文章提供了工具。 + +### 《如何使用OpenSSL:哈希,数字签名,等等(How to use OpenSSL: hashes, digital signatures, and more)》 + +许多信息安全是基于数学的:特别是用于加密数据和验证用户或文件内容的加密函数。在《[开始使用 OpenSSL:密码学基础(Getting started with OpenSSL: Cryptography basics)][11]》中进行介绍后,Marty Kalin 深入讨论了《[如何使用 OpenSSL:哈希,数字签名,等等(How to use OpenSSL: hashes, digital signatures, and more)][12]》的细节,解释了如何使用 `OpenSSL` 实用程序来探索这些常用但不常被理解的概念。 + +### 《使用树莓派和 Kali Linux 学习计算机安全(Learn about computer security with the Raspberry Pi and Kali Linux)》 + +廉价硬件与开源软件构成了一个很好的组合,特别是对于那些希望边做边学的人来说。在《[使用树莓派和 Kali Linux 学习计算机安全(Learn about computer security with the Raspberry Pi and Kali Linux)][13]》这篇文章中,Anderson Silva 介绍了面向安全的 `Kali Linux` 发行版。这是一篇短文,但它满是关于文档和安全相关项目的有用的链接,您可以在自己的树莓派上使用它们。 + +### 《量子计算会破坏安全吗?(Will quantum computing break security?)》 + +这篇文章的余下部分是浪费吗?量子计算会让我们对安全的所知变得过时吗?好消息是:回答是否定的,但是量子计算仍然可以在更广泛的范围内对安全和计算世界产生深远的影响。在《[量子计算会破坏安全吗?(Will quantum computing break security?)][14]》一文中,Mike Bursell 剖析了它好坏两方面的影响,当然,量子计算可能会让加密的破解变得更容易,但如果坏人一开始就无法获得你的数据,那也没有关系。 + +### 《展望 2020(Looking to 2020)》 + +安全永远是重要的,(正如那篇量子计算文章所建议的) 未来几年将是该领域的一个有趣时期。在 2020 年,Opensource.com 的文章将着眼于开源安全的前沿,并帮助向不断增长的开源社区解释基础知识。如果你有一个你想要我们报导的主题,请在评论中分享它,或者更进一步 —— 如果你想写一篇文章,就写给我们吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/security-resources + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[nacyro](https://github.com/nacyro) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko "A secure lock." +[2]: https://opensource.com/article/19/10/linux-server-security +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging +[5]: https://opensource.com/article/19/4/gpg-subkeys-ssh +[6]: https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples +[7]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage +[8]: https://opensource.com/article/19/4/ssh-keys-seahorse +[9]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[10]: https://opensource.com/article/19/9/open-source-cloud-security +[11]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 +[12]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 +[13]: https://opensource.com/article/19/3/computer-security-raspberry-pi +[14]: https://opensource.com/article/19/1/will-quantum-computing-break-security +[15]: https://opensource.com/how-submit-article From 604cb2366eecb2b1a284bf16ce9cdae63fef29b7 Mon Sep 17 00:00:00 2001 From: nacyro Date: Thu, 2 Jan 2020 22:59:14 +0800 Subject: [PATCH 377/676] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...101 9 cheat sheets and guides to enhance your tech skills.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md index fb9d954ab5..7e9e984b63 100644 --- a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md +++ b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (nacyro) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 243e8f0246e21f8fa22a0f64b4bad49743ab5a2c Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Thu, 2 Jan 2020 23:31:04 +0800 Subject: [PATCH 378/676] translated --- ...1017 Intro to the Linux useradd command.md | 131 ++++++++---------- 1 file changed, 58 insertions(+), 73 deletions(-) diff --git a/translated/tech/20191017 Intro to the Linux useradd command.md b/translated/tech/20191017 Intro to the Linux useradd command.md index ab23c72db5..ffebd61d47 100644 --- a/translated/tech/20191017 Intro to the Linux useradd command.md +++ b/translated/tech/20191017 Intro to the Linux useradd command.md @@ -7,59 +7,55 @@ [#]: via: (https://opensource.com/article/19/10/linux-useradd-command) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) -Intro to the Linux useradd command +Linux useradd 命令介绍 ====== -Add users (and customize their accounts as needed) with the useradd -command. +使用 useradd 命令来添加用户(并且根据需要修改账号)。 ![people in different locations who are part of the same team][1] -Adding a user is one of the most fundamental exercises on any computer system; this article focuses on how to do it on a Linux system. +任何计算机系统中,添加用户都是最重要的事之一;本文着重介绍如何在 Linux 系统中添加用户。 -Before getting started, I want to mention three fundamentals to keep in mind. First, like with most operating systems, Linux users need an account to be able to log in. This article specifically covers local accounts, not network accounts such as LDAP. Second, accounts have both a name (called a username) and a number (called a user ID). Third, users are typically placed into a group. Groups also have a name and group ID. - -As you'd expect, Linux includes a command-line utility for adding users; it's called **useradd**. You may also find the command **adduser**. Many distributions have added this symbolic link to the **useradd** command as a matter of convenience. +正式开始之前,我先提三个概念。首先,跟大多数操作系统一样,Linux 用户也需要一个账号才能登录。本文只介绍本地账号,不涉及网络账号,如 LDAP。其次,每个账号都有一个名字(username)和一个对应的数字(用户 ID)。最后,每个用户通常都在一个组内,每个组都有一个名字和一个组 ID。 +你可能已经想到了,Linux 提供了添加用户的命令行工具,就是 `useradd` 命令。有些版本也叫 `adduser`。为了方便使用,很多发行版上这个命令是一个指向 `useradd` 命令的符号链接。 ``` $ file `which adduser` /usr/sbin/adduser: symbolic link to useradd ``` -Let's take a look at **useradd**. +来看一下 `useradd`。 -> Note: The defaults described in this article reflect those in Red Hat Enterprise Linux 8.0. You may find subtle differences in these files and certain defaults on other Linux distributions or other Unix operating systems such as FreeBSD or Solaris. +> 注意:本文描述的默认环境是 Red Hat Enterprise Linux 8.0。你可能会发现本文描述的这些文件和某些默认值与某些 Linux 发行版或其他 Unix 操作系统(FreeBSD 或 Solaris)偶尔会有差异。 -### Default behavior +### 默认处理 -The basic usage of **useradd** is quite simple: A user can be added just by providing their username. +`useradd` 的基本用法相当简单:通过一个用户名就可以添加一个用户 - -``` -`$ sudo useradd sonny` +```bash +$ sudo useradd sonny ``` -In this example, the **useradd** command creates an account called _sonny_. A group with the same name is also created, and _sonny_ is placed in it to be used as the primary group. There are other parameters, such as language and shell, that are applied according to defaults and values set in the configuration files **/etc/default/useradd** and **/etc/login.defs**. This is generally sufficient for a single, personal system or a small, one-server business environment. +在本例中,`useradd` 命令创建了一个名为 *sonny* 的账号。此命令同时创建了一个同名的组,*sonny* 被放进了这个组,这个组也是 *sonny* 账号的主组。命令执行时,根据配置文件 `/etc/default/useradd` 和 `/etc/login.defs` 中的不同设置,也会有其他的参数处理,如语言和 shell。对于一个私人系统或微小的单服务商业环境,这些参数已经足够了。 -While the two files above govern the behavior of **useradd**, user information is stored in other files found in the **/etc** directory, which I will refer to throughout this article. +上面两个文件控制 `useradd` 的处理,用户的信息保存在 `/etc` 目录下的一些其他文件中,关于这些信息的讲解会贯穿全文。 -File | Description | Fields (bold—set by useradd) ----|---|--- -passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** -shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused -group | Stores group details | **groupname**:unused:**gid**:**members** +| 文件 | 描述 | 域 (加粗的表示由 useradd 命令设置) | +| ------ | ------------------------------------ | ------------------------------------------------------------ | +| passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** | +| shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused | +| group | Stores group details | **groupname**:unused:**gid**:**members** | -### Customizable behavior +### 自定义处理 -The command line allows customization for times when an administrator needs finer control, such as to specify a user's ID number. +当管理员需要更好地控制账号时,可以使用命令行来自定义,如指定一个用户的 ID。 -#### User and group ID numbers +#### 用户和组 ID -By default, **useradd** tries to use the same number for the user ID (UID) and primary group ID (GID), but there are no guarantees. Although it's not necessary for the UID and GID to match, it's easier for administrators to manage them when they do. +`useradd` 默认主组 ID(GID)与用户 ID(UID)相同,但也不完全是。虽然 UID 与 GID 相同不是必须的,但如果相同,会更方便管理员管理。 -I have just the scenario to explain. Suppose I add another account, this time for Timmy. Comparing the two users, _sonny_ and _timmy_, shows that both users and their respective primary groups were created by using the **getent** command. +下面的场景就是一个 GID 与 UID 不同的 例子。现在我添加另一账号,名为 Timmy。通过使用 `getent` 命令来比较 *sonny* 和 *timmy* 两个账号,显示两个用户和对应的主组。 - -``` +```bash $ getent passwd sonny timmy sonny❌1001:1002:Sonny:/home/sonny:/bin/bash timmy❌1002:1003::/home/timmy:/bin/bash @@ -69,18 +65,16 @@ sonny❌1002: timmy❌1003: ``` -Unfortunately, neither users' UID nor primary GID match. This is because the default behavior is to assign the next available UID to the user and then attempt to assign the same number to the primary group. However, if that number is already used, the next available GID is assigned to the group. To explain what happened, I hypothesize that a group with GID 1001 already exists and enter a command to confirm. +不幸的是,两者的 UID 和 GID 都不相同。因为默认的处理是,创建用户时,把下一个可用的 UID 赋给用户,然后把同一个数字作为主组 ID 赋给它。然而,当要使用的 ID 已经被使用时,就再把下一个可用的 GID 赋给它。为了弄清细节,我猜想 1001 这个 GID 已经被使用了,用一个命令确认了一下。 - -``` +```bash $ getent group 1001 book❌1001:alan ``` -The group _book_ with the ID _1001_ has caused the GIDs to be off by one. This is an example where a system administrator would need to take more control of the user-creation process. To resolve this issue, I must first determine the next available user and group ID that will match. The commands **getent group** and **getent passwd** will be helpful in determining the next available number. This number can be passed with the **-u** argument. +*book* 的 ID 是 *1001*,因此新创建的用户的 GID 都有偏移量 1。这就是为什么系统管理员在用户创建过程中需要多设置一些值的一个实例。为了解决这个问题,我必须先确定下一个可用的 UID 和 GID 是否相同。确定下一个可用值时,可以使用 `getent group` 和 `getent passwd` 命令,通过 `-u` 参数传递要确认的值。 - -``` +```bash $ sudo useradd -u 1004 bobby $ getent passwd bobby; getent group bobby @@ -88,64 +82,59 @@ bobby❌1004:1004::/home/bobby:/bin/bash bobby❌1004: ``` -Another good reason to specify the ID is for users that will be accessing files on a remote system using the Network File System (NFS). NFS is easier to administer when all client and server systems have the same ID configured for a given user. I cover this in a bit more detail in my article on [using autofs to mount NFS shares][2]. +另一个需要指定 ID 的场景是,通过 NFS 访问远程系统上的文件时。对于一个给定的用户,当 NFS 所有客户端和服务系统的 ID 都一样时,管理员更容易控制。在我的文章 [使用 autofs 挂载 NFS][2] 中有详细介绍。 -### More customization +### 更多自定义 -Very often though, other account parameters need to be specified for a user. Here are brief examples of the most common customizations you may need to use. +一些其他的指定用户信息的参数也用得比较频繁。这里是一些你会经常用到的参数的概括例子。 -#### Comment +#### 注释 -The comment option is a plain-text field for providing a short description or other information using the **-c** argument. +注释选项是通过 `-c` 参数指定的一个解释文本字段,可以提供一段简短的描述或其他信息。 - -``` +```bash $ sudo useradd -c "Bailey is cool" bailey $ getent passwd bailey bailey❌1011:1011:Bailey is cool:/home/bailey:/bin/bash ``` -#### Groups +#### 组 -A user can be assigned one primary group and multiple secondary groups. The **-g** argument specifies the name or GID of the primary group. If it's not specified, **useradd** creates a primary group with the user's same name (as demonstrated above). The **-G** (uppercase) argument is used to pass a comma-separated list of groups that the user will be placed into; these are known as secondary groups. +一个用户可以被指定一个主组和多个次组。 `-g` 参数指定主组名称或 GID。如果不指定,`useradd` 会以用户名创建一个主组(前面演示过)。`-G`(大写)参数用一个逗号分隔的组列表来指定此用户所属的组,这些组就是次组。 - -``` +```bash $ sudo useradd -G tgroup,fgroup,libvirt milly $ id milly uid=1012(milly) gid=1012(milly) groups=1012(milly),981(libvirt),4000(fgroup),3000(tgroup) ``` -#### Home directory +#### 家目录 -The default behavior of **useradd** is to create the user's home directory in **/home**. However, different aspects of the home directory can be overridden with the following arguments. The **-b** sets another directory where user homes can be placed. For example, **/home2** instead of the default **/home**. +`useradd` 的默认处理是,在 `/home` 目录下创建用户的家目录。然而,下面的参数可以改写家目录的 base 目录。`-b` 设置另一个可以创建家目录的 base 目录。例如 指定 `/home2` 而不是 `/home`。 - -``` +```bash $ sudo useradd -b /home2 vicky $ getent passwd vicky vicky❌1013:1013::/home2/vicky:/bin/bash ``` -The **-d** lets you specify a home directory with a different name from the user. +`-d` 参数可以指定一个与用户名不同的家目录。 - -``` +```bash $ sudo useradd -d /home/ben jerry $ getent passwd jerry jerry❌1014:1014::/home/ben:/bin/bash ``` -#### The skeleton directory +#### skeleton 目录 -The **-k** instructs the new user's new home directory to be populated with any files in the **/etc/skel** directory. These are usually shell configuration files, but they can be anything that a system administrator would like to make available to all new users. +`-k` 参数指定创建新用户时,会复制 `/etc/skel` 目录下的所有文件到家目录中。这些文件通常是 shell 配置文件,当然也可以是系统管理员想在新建用户时使用的任何文件。 #### Shell -The **-s** argument can be used to specify the shell. The default is used if nothing else is specified. For example, in the following, shell **bash** is defined in the default configuration file, but Wally has requested **zsh**. +`-s` 参数可以指定 shell。如果不指定,则使用默认的 shell。例如,下面的例子中 ,配置文件中定义的 shell 是 `bash`,但 `Wally` 这个用户指定的是 `zsh`。 - -``` +```bash $ grep SHELL /etc/default/useradd SHELL=/bin/bash @@ -154,42 +143,38 @@ $ getent passwd wally wally❌1004:1004::/home/wally:/usr/bin/zsh ``` -#### Security +#### 安全 -Security is an essential part of user management, so there are several options available with the **useradd** command. A user account can be given an expiration date, in the form YYYY-MM-DD, using the **-e** argument. +安全是用户管理的重中之重,因此 `useradd` 命令也提供了很多关于安全的选项。可以使用 `-e` 参数,以 YYYY-MM-DD 的格式指定一个用户的过期时间。 - -``` +```bash $ sudo useradd -e 20191231 sammy $ sudo getent shadow sammy sammy:!!:18171:0:99999:7::20191231: ``` -An account can also be disabled automatically if the password expires. The **-f** argument will set the number of days after the password expires before the account is disabled. Zero is immediate. +当密码过期时,一个账号也可以自动失效。`-f` 参数指定密码过期后经过几天账号失效。如果设为 0,则立即失效。 - -``` +```bash $ sudo useradd -f 30 willy $ sudo getent shadow willy willy:!!:18171:0:99999:7:30:: ``` -### A real-world example +### 实例 -In practice, several of these arguments may be used when creating a new user account. For example, if I need to create an account for Perry, I might use the following command: +生产中,创建一个用户账号时会用到多个参数。例如,我要创建一个 Perry 账号,可能会用下面的命令: - -``` +```bash $ sudo useradd -u 1020 -c "Perry Example" \ -G tgroup -b /home2 \ -s /usr/bin/zsh \ -e 20201201 -f 5 perry ``` -Refer to the sections above to understand each option. Verify the results with: +查看前面的内容来理解每个选项。用下面的命令确认结果: - -``` +```bash $ getent passwd perry; getent group perry; getent shadow perry; id perry perry❌1020:1020:Perry Example:/home2/perry:/usr/bin/zsh perry❌1020: @@ -197,9 +182,9 @@ perry:!!:18171:0:99999:7:5:20201201: uid=1020(perry) gid=1020(perry) groups=1020(perry),3000(tgroup) ``` -### Some final advice +### 一点小建议 -The **useradd** command is a "must-know" for any Unix (not just Linux) administrator. It is important to understand all of its options since user creation is something that you want to get right the first time. This means having a well-thought-out naming convention that includes a dedicated UID/GID range reserved for your users across your enterprise, not just on a single system—particularly when you're working in a growing organization. +`useradd` 命令是所有 Unix(不仅仅是 Linux)系统管理员都必知必会的命令。由于用户创建不能出错,需要第一次就正确,所以理解它的每一个选项很重要。这意味着你需要有一套深思熟虑的命名约定,包括为整个企业环境而不仅仅是一个单系统预留一个专用的 UID/GID 范围,尤其是你为一个成长中的组织工作时。 -------------------------------------------------------------------------------- From a067016b3d77e9bfdace19660e58e95989f8bdf1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 00:45:18 +0800 Subject: [PATCH 379/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @nacyro 恭喜你完成了第一篇翻译! --- ...icles to enhance your security aptitude.md | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/translated/tech/20191230 10 articles to enhance your security aptitude.md b/translated/tech/20191230 10 articles to enhance your security aptitude.md index 3a86ffc6a0..bd488182d4 100644 --- a/translated/tech/20191230 10 articles to enhance your security aptitude.md +++ b/translated/tech/20191230 10 articles to enhance your security aptitude.md @@ -1,65 +1,66 @@ [#]: collector: "lujun9972" [#]: translator: "nacyro" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "10 articles to enhance your security aptitude" [#]: via: "https://opensource.com/article/19/12/security-resources" [#]: author: "Ben Cotton https://opensource.com/users/bcotton" -10 篇文章强化你的安全能力 +10 篇强化你的安全能力的文章 ====== -无论你是新手还是想要增加技能,Opensource.com 2019 年十大安全文章中都有适合你的内容。 -![A secure lock.][1] +> 无论你是新手还是想要增加技能,这十篇安全文章中都有适合你的内容。 -如果安全是一个过程(确实如此),那么理所当然的,不同的项目(及其贡献者)情况各有不同。有些应用程序经历了多年的安全测试,由在信息安全领域工作了几十年的人员所设计。其他的则是由开发人员在他们的第一个开源项目中开发的全新项目。毫不奇怪,Opensource.com 2019 年十大安全文章囊括了代表这一范围的经验。我们有介绍基本安全实践的文章,也有深入探讨更高级主题的文章。 +![](https://img.linux.net.cn/data/attachment/album/202001/03/004344rco51cnc153ns1zz.jpg) + +如果安全是一个过程(确实如此),那么理所当然的,不同的项目(及其贡献者)的情况各有不同。有些应用程序经历了多年的安全测试,由在信息安全领域工作了几十年的人员所设计。而另外一些则是由开发人员在他们的第一个开源项目中开发的全新项目。毫不奇怪,这十大安全文章囊括了代表这一范围的经验。我们有介绍基本安全实践的文章,也有深入探讨更高级主题的文章。 无论你是新手还是想要增加你在传奇职业生涯中获得的技能,2019 年十大安全文章中都有适合你的内容。 -### 《七步捍卫你的 Linux 服务器(7 steps to securing your Linux server)》 +### 《安全强化你的 Linux 服务器的七个步骤》 -安全如舍,地基不牢,房屋不稳。Patrick H. Mullins 的杰作《[七步捍卫你的 Linux 服务器(7 steps to securing your Linux server)][2]》让您从Linux服务器的基本安全步骤开始。即使您有很多管理服务器的经验,本文也提供了一个很好的清单以确保您掌握了基础知识。在此基础上,您可以开始添加额外的安全层。 +安全如舍,地基不牢,房屋不稳。Patrick H. Mullins 的杰作《[安全强化你的 Linux 服务器的七个步骤][2]》让你从 Linux 服务器的基本安全步骤开始。即使你有很多管理服务器的经验,本文也提供了一个很好的清单以确保你掌握了基础知识。在此基础上,你可以开始添加额外的安全层。 -### 《用防火墙使 Linux 更健壮(Make Linux stronger with firewalls)》 +### 《使用防火墙让你的 Linux 更加强大》 -七步捍卫你的 Linux 服务器中的一步即是启用防火墙。但什么**是**防火墙,它是如何工作的呢? Seth Kenlon 在《[用防火墙使 Linux 更健壮(Make Linux stronger with firewalls)][3]》一文中回答了这些问题,然后详细描述了为了更好的安全性应如何配置你的防火墙。使用 `firewalld` 与 `Network Manager`,您可以为不同的网络设置不同的防火墙配置。例如,这允许您在您的家庭网络上进行信任配置,并在您最喜欢的咖啡店的 WiFi 网络上进行更多疑的配置。 +七步捍卫你的 Linux 服务器中的一步即是启用防火墙。但什么**是**防火墙,它是如何工作的呢? Seth Kenlon 在《[使用防火墙让你的 Linux 更加强大][3]》一文中回答了这些问题,然后详细描述了为了更好的安全性应如何配置你的防火墙。使用 firewalld 与 Network Manager,你可以为不同的网络设置不同的防火墙配置。例如,这允许你在家庭网络上进行信任配置,并在你最喜欢的咖啡店的 WiFi 网络上进行更多疑的配置。 -### 《减少集中日志的安全风险(Reducing security risks with centralized logging)》 +### 《用集中日志减少安全风险》 -保护系统安全,只有开始,没有结束:安全是一个过程而不是状态。**保持**系统安全工作的一部分即是密切关注所发生的事情。集中化日志是实现这一点的一种方法,尤其是在管理多系统时。在《[减少集中日志的安全风险(Reducing security risks with centralized logging)][4]》中 Hannah Suarez 分享了要如何开始(她这篇文章基于她在 FOSDEM'19 (自由及开源软件开发者欧洲会议) 中的闪电演讲) +保护系统安全,只有开始,没有结束:安全是一个过程而不是状态。**保持**系统安全工作的一部分即是密切关注所发生的事情。集中化日志是实现这一点的一种方法,尤其是在管理多系统时。在《[减少集中日志的安全风险][4]》中 Hannah Suarez 分享了要如何开始(她这篇文章基于她在 FOSDEM'19 [自由及开源软件开发者欧洲会议] 中的闪电演讲)。 -### 《为 SSH 使用 GPG 密钥(Using GPG keys for SSH)》 +### 《在 SSH 中使用 GPG 密钥》 -大多数人都会为 `SSH` 的密钥认证使用 `SSH 密钥`。为什么不呢?毕竟就在名字里。从安全的角度来看,这些方法非常好。但若想简化某些形式的密钥分发与备份还有另一种方法,Brian Exelbierd 的三部曲系列介绍了《[如何启用使用 GPG 子钥的 SSH 访问(How to enable SSH access with a GPG subkey)][5]》、《[如何导入现有 SSH 密钥(How to import existing SSH keys)][6]》、《[如何将备份量减少到单个密钥文件(How to reduce your backup needs to a single key file)][7]》 +大多数人都会为 SSH 的密钥认证使用 SSH 密钥。为什么不呢?毕竟 SSH 就在名字里。从安全的角度来看,这些方法非常好。但若想简化某些形式的密钥分发与备份还有另一种方法,Brian Exelbierd 的三部曲系列介绍了《[如何启用使用 GPG 子钥的 SSH 访问][5]》、《[如何导入现有 SSH 密钥][6]》、《[如何将备份量减少到单个密钥文件][7]》 -### 《使用 `Seahorse` 图形化管理 SSH 密钥(Graphically manage SSH keys with Seahorse)》 +### 《使用 Seahorse 图形化管理 SSH 密钥》 -并不是所有人都喜欢用 `GPG` 作为 `SSH 密钥`,但这并不意味着您在密钥管理上会不顺。`Seahorse` 是一个在 `GNOME` 桌面中用于管理 `SSH 密钥` 及其他身份验证方法的图形化工具。Alan Formy-Duval 的《[使用 `Seahorse` 图形化管理 SSH 密钥(Graphically manage SSH keys with Seahorse)][8]》对新手用户特别有帮助。 +并不是所有人都喜欢用 GPG 作为 SSH 密钥,但这并不意味着你在密钥管理上会不顺利。Seahorse 是一个在 GNOME 桌面中用于管理 SSH 密钥及其他身份验证方法的图形化工具。Alan Formy-Duval 的《[使用 Seahorse 图形化管理 SSH 密钥》对新手用户特别有帮助。 -### 《安全扫描你的 DevOps 管线(Security scanning your DevOps pipeline)》 +### 《安全扫描你的 DevOps 流程》 -如今到处都是容器。但它们容纳着什么?了解容器满足您的安全策略是保持安全性的重要部分。幸运的是,您可以使用开源工具来帮助自动化符合性检查。Jessica Cherry (原名: Repka) 的《[安全扫描你的 DevOps 管线(Security scanning your DevOps pipeline)][9]》是一个循序渐进的教程,向您展示了如何使用 `Jenkins` 构建系统和 `Anchore` 检查服务为容器镜像和 `registries` 创建扫描管线。 +如今到处都是容器。但它们容纳着什么?了解容器满足你的安全策略是保持安全性的重要部分。幸运的是,你可以使用开源工具来帮助自动化合规检查。Jessica Cherry(原名: Repka)的《[安全扫描你的 DevOps 流程][9]》是一个循序渐进的教程,向你展示了如何使用 Jenkins 构建系统和 Anchore 检查服务为容器镜像和注册库创建扫描流程。 -### 《四个开源云安全工具(4 open source cloud security tools)》 +### 《4 种开源云安全工具》 -云服务的一大优点是你的数据可以从任何地方访问。云服务的一个缺点是你的数据可以从任何地方访问。如果您使用的是 `"-as-a-Service" (译注: IaaS, PaaS, SaaS)` 产品,那么您需要确保它们是经过安全配置的。Anderson Silva、Alison Naylor、Travis McPeak 和 Rich Monk 联合推出《[四个开源云安全工具(4 open source cloud security tools)][10]》以帮助在使用 `GitHub` 和 `AWS` 时提高安全性。如果你正在寻找被不小心提交的秘密,或尝试从一开始就阻止这些秘密被提交,这篇文章提供了工具。 +云服务的一大优点是你的数据可以从任何地方访问。云服务的一个缺点是你的数据可以从任何地方访问。如果你使用的是 “-as-a-Service”(LCTT 译注: 某某即服务,如 IaaS、PaaS、Saa)产品,那么你需要确保它们是经过安全配置的。Anderson Silva、Alison Naylor、Travis McPeak 和 Rich Monk 联合推出《[4 种开源云安全工具][10]》以帮助在使用 GitHub 和 AWS 时提高安全性。如果你正在寻找被不小心提交的机密信息,或尝试从一开始就阻止这些机密信息被提交,这篇文章提供了工具。 -### 《如何使用OpenSSL:哈希,数字签名,等等(How to use OpenSSL: hashes, digital signatures, and more)》 +### 《如何使用 OpenSSL:哈希、数字签名等》 -许多信息安全是基于数学的:特别是用于加密数据和验证用户或文件内容的加密函数。在《[开始使用 OpenSSL:密码学基础(Getting started with OpenSSL: Cryptography basics)][11]》中进行介绍后,Marty Kalin 深入讨论了《[如何使用 OpenSSL:哈希,数字签名,等等(How to use OpenSSL: hashes, digital signatures, and more)][12]》的细节,解释了如何使用 `OpenSSL` 实用程序来探索这些常用但不常被理解的概念。 +许多信息安全是基于数学的:特别是用于加密数据和验证用户或文件内容的加密函数。在《[开始使用 OpenSSL:密码学基础][11]》中进行介绍后,Marty Kalin 深入讨论了《[如何使用 OpenSSL:哈希、数字签名等][12]》的细节,解释了如何使用 OpenSSL 实用程序来探索这些常用但不常被理解的概念。 -### 《使用树莓派和 Kali Linux 学习计算机安全(Learn about computer security with the Raspberry Pi and Kali Linux)》 +### 《使用树莓派和 Kali Linux 学习计算机安全》 -廉价硬件与开源软件构成了一个很好的组合,特别是对于那些希望边做边学的人来说。在《[使用树莓派和 Kali Linux 学习计算机安全(Learn about computer security with the Raspberry Pi and Kali Linux)][13]》这篇文章中,Anderson Silva 介绍了面向安全的 `Kali Linux` 发行版。这是一篇短文,但它满是关于文档和安全相关项目的有用的链接,您可以在自己的树莓派上使用它们。 +廉价硬件与开源软件构成了一个很好的组合,特别是对于那些希望边做边学的人来说。在《[使用树莓派和 Kali Linux 学习计算机安全][13]》这篇文章中,Anderson Silva 介绍了面向安全的 Kali Linux 发行版。这是一篇短文,但它满是关于文档和安全相关项目的有用的链接,你可以在自己的树莓派上使用它们。 -### 《量子计算会破坏安全吗?(Will quantum computing break security?)》 +### 《量子计算会打破现有的安全体系吗?》 -这篇文章的余下部分是浪费吗?量子计算会让我们对安全的所知变得过时吗?好消息是:回答是否定的,但是量子计算仍然可以在更广泛的范围内对安全和计算世界产生深远的影响。在《[量子计算会破坏安全吗?(Will quantum computing break security?)][14]》一文中,Mike Bursell 剖析了它好坏两方面的影响,当然,量子计算可能会让加密的破解变得更容易,但如果坏人一开始就无法获得你的数据,那也没有关系。 +这篇文章的余下部分是浪费吗?量子计算会让我们对安全的所知变得过时吗?好消息是:回答是否定的,但是量子计算仍然可以在更广泛的范围内对安全和计算世界产生深远的影响。在《[量子计算会打破现有的安全体系吗?][14]》一文中,Mike Bursell 剖析了它好坏两方面的影响,当然,量子计算可能会让加密的破解变得更容易,但如果坏人一开始就无法获得你的数据,那也没有关系。 -### 《展望 2020(Looking to 2020)》 +### 展望 2020 -安全永远是重要的,(正如那篇量子计算文章所建议的) 未来几年将是该领域的一个有趣时期。在 2020 年,Opensource.com 的文章将着眼于开源安全的前沿,并帮助向不断增长的开源社区解释基础知识。如果你有一个你想要我们报导的主题,请在评论中分享它,或者更进一步 —— 如果你想写一篇文章,就写给我们吧。 +安全永远是重要的,(正如那篇量子计算文章所建议的)未来几年将是该领域的一个有趣时期。在 2020 年,我们的文章将着眼于开源安全的前沿,并帮助向不断增长的开源社区解释基础知识。如果你有一个你想要我们报导的主题,请在评论中分享它,或者更进一步 —— 如果你想写一篇文章,就写给我们吧。 -------------------------------------------------------------------------------- @@ -68,24 +69,24 @@ via: https://opensource.com/article/19/12/security-resources 作者:[Ben Cotton][a] 选题:[lujun9972][b] 译者:[nacyro](https://github.com/nacyro) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/bcotton [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko "A secure lock." -[2]: https://opensource.com/article/19/10/linux-server-security -[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[2]: https://linux.cn/article-11444-1.html +[3]: https://linux.cn/article-11093-1.html [4]: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging [5]: https://opensource.com/article/19/4/gpg-subkeys-ssh [6]: https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples [7]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage [8]: https://opensource.com/article/19/4/ssh-keys-seahorse [9]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline -[10]: https://opensource.com/article/19/9/open-source-cloud-security +[10]: https://linux.cn/article-11432-1.html [11]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 [12]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 [13]: https://opensource.com/article/19/3/computer-security-raspberry-pi -[14]: https://opensource.com/article/19/1/will-quantum-computing-break-security +[14]: https://linux.cn/article-10566-1.html [15]: https://opensource.com/how-submit-article From a45011051057696c1ade6b077fbd42371b1c11ab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 00:46:25 +0800 Subject: [PATCH 380/676] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @nacyro 本文首发地址: https://linux.cn/article-11742-1.html 你的 LCTT 专页地址: https://linux.cn/lctt/nacyro 请注册以领取 LCCN: https://lctt.linux.cn/ --- .../20191230 10 articles to enhance your security aptitude.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191230 10 articles to enhance your security aptitude.md (99%) diff --git a/translated/tech/20191230 10 articles to enhance your security aptitude.md b/published/20191230 10 articles to enhance your security aptitude.md similarity index 99% rename from translated/tech/20191230 10 articles to enhance your security aptitude.md rename to published/20191230 10 articles to enhance your security aptitude.md index bd488182d4..4f55e44590 100644 --- a/translated/tech/20191230 10 articles to enhance your security aptitude.md +++ b/published/20191230 10 articles to enhance your security aptitude.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "nacyro" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11742-1.html" [#]: subject: "10 articles to enhance your security aptitude" [#]: via: "https://opensource.com/article/19/12/security-resources" [#]: author: "Ben Cotton https://opensource.com/users/bcotton" From 791826ef8316669fd7eb28a9ced6a6307cb2483f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 3 Jan 2020 00:52:53 +0800 Subject: [PATCH 381/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20GNOME?= =?UTF-8?q?=20has=20a=20=E2=80=98Secret=E2=80=99=20Screen=20Recorder.=20He?= =?UTF-8?q?re=E2=80=99s=20How=20to=20Use=20it!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md --- ...et- Screen Recorder. Here-s How to Use it.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md diff --git a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md new file mode 100644 index 0000000000..96de8997fa --- /dev/null +++ b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) +[#]: via: (https://itsfoss.com/gnome-screen-recorder/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it! +====== + +[GNOME][1] is one of the [most popular desktop environments][2] and for good reasons. It has a modern UI and it comes with a number of GNOME-specific applications that blend well with the overall desktop appearance. + +You can [tweak GNOME][3] to your liking as much as you want but I am not here to discuss that. GNOME desktop has some hidden features that you probably are not aware of. + +One of such not-so-obvious feature is a built in screen recorder. + +Yes, you read that right. If you are using GNOME desktop, you don’t necessarily need to install other [screen recorders in Linux][4]. You just need to know the correct keyboard shortcut. + +### Instantly record your screen with GNOME Screen Recorder + +To quickly access the GNOME screen recorder, you have to press this [keyboard shortcut in Ubuntu][5] or other distributions using GNOME desktop: + +``` +Ctrl + Alt + Shift + R +``` + +This will immediately start recording your desktop. You can tell that the screen recording is in progress by looking at the red dot in the system tray area of the top panel: + +![The red dot in the system tray area indicates that screen recording is in progress][6] + +#### Increase the screencast duration + +The default maximum record time is just 30 seconds. It can be increased though. + +Open a terminal and use the following command: + +``` +gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300 +``` + +In the above command, I have increased the maximum length of the recording to 300 seconds (i.e. 5 minutes). You can change it to any other value but it should be in seconds. + +If you **don’t want any limit on the maximum recording time, set it to 0** and then the recording won’t stop until you manually stop it or your disk runs out of space. + +#### Stop the screen recording + +As I mentioned, your desktop recording will stop automatically after it reaches the maximum time limit. + +To stop the recording before that, you can press the same key combination: + +``` +Ctrl + Alt + Shift + R +``` + +Your recordings are saved in [webm][7] format in the Videos folder of your Home directory. + +#### Limitations + +While it might be handy to record your desktop quickly with this handy little tool, it has its several limitations when compared to a full-fledged screen recording tool like [Simple Screen Recorder][8]. + + * There is no time delay option before the recording starts + * There is no pause and play option + * It records the entire screen. No option to record only an application window or a ceratin area or a certain monitor (if you have a multi-monitor setup). + * Videos are saved in webm format in the user’s Videos directory. You cannot change it. You’ll have to use a tool like [HandBrake to convert the videos to other format][9]. + + + +As you can see, the secret GNOME screen recorder is no where near to the features provided by the likes of [Kazam][10] or other such tools. + +But it doesn’t try to be a full-fledged screen recorder. It just provides you a quick way of recording a small screencast. That’s it. + +GNOME is a versatile modern desktop environments. You can [tweak GNOME][3] extensively. The [GNOME Extensions][11] provide another dimension to the desktop customization. + +This screen recorder is one of the hidden features of GNOME like the suspend option that you won’t easily find on your own. + +_How do you like it? Do you know some other hidden GNOME features that you would like to share with us? The comment section is all yours._ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-screen-recorder/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://gnome.org/ +[2]: https://itsfoss.com/best-linux-desktop-environments/ +[3]: https://itsfoss.com/gnome-tweak-tool/ +[4]: https://itsfoss.com/best-linux-screen-recorders/ +[5]: https://itsfoss.com/ubuntu-shortcuts/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/gnome_screen_recording.jpg?ssl=1 +[7]: https://www.webmproject.org/about/ +[8]: https://itsfoss.com/record-screen-ubuntu-simplescreenrecorder/ +[9]: https://itsfoss.com/handbrake/ +[10]: https://itsfoss.com/kazam-screen-recorder/ +[11]: https://itsfoss.com/best-gnome-extensions/ From 1b5cb52623e7d72de8e53710f9f6c8be135530e0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 3 Jan 2020 00:54:04 +0800 Subject: [PATCH 382/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200102=20Data?= =?UTF-8?q?=20streaming=20and=20functional=20programming=20in=20Java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200102 Data streaming and functional programming in Java.md --- ...ming and functional programming in Java.md | 496 ++++++++++++++++++ 1 file changed, 496 insertions(+) create mode 100644 sources/tech/20200102 Data streaming and functional programming in Java.md diff --git a/sources/tech/20200102 Data streaming and functional programming in Java.md b/sources/tech/20200102 Data streaming and functional programming in Java.md new file mode 100644 index 0000000000..0349de9072 --- /dev/null +++ b/sources/tech/20200102 Data streaming and functional programming in Java.md @@ -0,0 +1,496 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data streaming and functional programming in Java) +[#]: via: (https://opensource.com/article/20/1/javastream) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +Data streaming and functional programming in Java +====== +Learn how to use the stream API and functional programming constructs in +Java 8. +![computer screen ][1] + +When Java SE 8 (aka core Java 8) was introduced in 2014, it introduced changes that fundamentally impact programming in it. The changes have two closely linked parts: the stream API and the functional programming constructs. This article uses code examples, from the basics through advanced features, to introduce each part and illustrate the interplay between them. + +### The basics + +The stream API is a concise and high-level way to iterate over the elements in a data sequence. The packages **java.util.stream** and **java.util.function** house the new libraries for the stream API and related functional programming constructs. Of course, a code example is worth a thousand words. + +The code segment below populates a **List** with about 2,000 random integer values: + + +``` +[Random][2] rand = new [Random][2](); +List<Integer> list = new ArrayList<Integer>();           // empty list +for (int i = 0; i < 2048; i++) list.add(rand.nextInt()); // populate it +``` + +Another **for** loop could be used to iterate over the populated list to collect the even values into another list. The stream API is a cleaner way to do the same: + + +``` +[List][3] <Integer> evens = list +   .stream()                      // streamify the list +   .filter(n -> (n & 0x1) == 0)   // filter out odd values +   .collect(Collectors.toList()); // collect even values +``` + +The example has three functions from the stream API: + + * The **stream** function can turn a **Collection** into a stream, which is a conveyor belt of values accessible one at a time. The streamification is lazy (and therefore efficient) in that the values are produced as needed rather than all at once. + + * The **filter** function determines which streamed values, if any, get through to the next stage in the processing pipeline, the **collect** stage. The **filter** function is _higher-order_ in that its argument is a function—in this example, a lambda, which is an unnamed function and at the center of Java's new functional programming constructs. + +The lambda syntax departs radically from traditional Java: + + +``` +`n -> (n & 0x1) == 0` +``` + +The arrow (a minus sign followed immediately by a greater-than sign) separates the argument list on the left from the function's body on the right. The argument **n** is not explicitly typed, although it could be; in any case, the compiler figures out that **n** is an **Integer**. If there were multiple arguments, these would be enclosed in parentheses and separated by commas. + +The body, in this example, checks whether an integer's lowest-order (rightmost) bit is a zero, which indicates an even value. A filter should return a boolean value. There is no explicit **return** in the function's body, although there could be. If the body has no explicit **return**, then the body's last expression is the returned value. In this example, written in the spirit of lambda programming, the body consists of the single, simple boolean expression **(n & 0x1) == 0**. + + * The **collect** function gathers the even values into a list whose reference is **evens**. As an example below illustrates, the **collect** function is thread-safe and, therefore, would work correctly even if the filtering operation was shared among multiple threads. + + + + +### Convenience functions and easy multi-threading + +In a production environment, a data stream might have a file or a network connection as its source. For learning the stream API, Java provides types such as **IntStream**, which can generate streams with elements of various types. Here is an **IntStream** example: + + +``` +IntStream                         // integer stream +   .range(1, 2048)                // generate a stream of ints in this range +   .parallel()                    // partition the data for multiple threads +   .filter(i -> ((i & 0x1) > 0))  // odd parity? pass through only odds +   .forEach([System][4].out::println); // print each +``` + +The **IntStream** type includes a **range** function that generates a stream of integer values within a specified range, in this case, from 1 through 2,048, with increments of 1. The **parallel** function automatically partitions the work to be done among multiple threads, each of which does the filtering and printing. (The number of threads typically matches the number of CPUs on the host system.) The argument to the **forEach** function is a _method reference_, in this case, a reference to the **println** method encapsulated in **System.out**, which is of type **PrintStream**. The syntax for method and constructor references will be discussed shortly. + +Because of the multi-threading, the integer values are printed in an arbitrary order overall but in sequence within a given thread. For example, if thread T1 prints 409 and 411, then T1 does so in the order 409–411, but some other thread might print 2,045 beforehand. The threads behind the **parallel** call execute concurrently, and the order of their output is therefore indeterminate. + +### The map/reduce pattern + +The _map/reduce_ pattern has become popular in processing large datasets. A map/reduce macro operation is built from two micro-operations. The data first are scattered (_mapped_) among various workers, and the separate results then are gathered together—perhaps as a single value, which would be the _reduction_. Reduction can take different forms, as the following examples illustrate. + +Instances of the **Number** class below represent integer values with either **EVEN** or **ODD** parity: + + +``` +public class [Number][5] { +    enum Parity { EVEN, ODD } +    private int value; +    public [Number][5](int n) { setValue(n); } +    public void setValue(int value) { this.value = value; } +    public int getValue() { return this.value; } +    public Parity getParity() { +        return ((value & 0x1) == 0) ? Parity.EVEN : Parity.ODD; +    } +    public void dump() { +        [System][4].out.format("Value: %2d (parity: %s)\n", getValue(), +                          (getParity() == Parity.ODD ? "odd" : "even")); +    } +} +``` + +The following code illustrates map/reduce with a **Number** stream, thereby showing that the stream API can handle not only primitive types such as **int** and **float** but programmer-defined class types as well. + +In the code segment below, a list of random integer values is streamified using the **parallelStream** rather than the **stream** function. The **parallelStream** variant, like the **parallel** function introduced earlier, does automatic multithreading. + + +``` +final int howMany = 200; +[Random][2] r = new [Random][2](); +[Number][5][ ] nums = new [Number][5][howMany]; +for (int i = 0; i < howMany; i++) nums[i] = new [Number][5](r.nextInt(100)); +List<Number> listOfNums = [Arrays][6].asList(nums);  // listify the array + +[Integer][7] sum4All = listOfNums +   .parallelStream()           // automatic multi-threading +   .mapToInt([Number][5]::getValue) // method reference rather than lambda +   .sum();                     // reduce streamed values to a single value +[System][4].out.println("The sum of the randomly generated values is: " + sum4All); +``` + +The higher-order **mapToInt** function could take a lambda as an argument, but in this case, it takes a method reference instead, which is **Number::getValue**. The **getValue** method expects no arguments and returns its **int** value for a given **Number** instance. The syntax is uncomplicated: the class name **Number** followed by a double colon and the method's name. Recall the earlier **System.out::println** example, which has the double colon after the **static** field **out** in the **System** class. + +The method reference **Number::getValue** could be replaced by the lambda below. The argument **n** is one of the **Number** instances in the stream: + + +``` +`mapToInt(n -> n.getValue())` +``` + +In general, lambdas and method references are interchangeable: if a higher-order function such as **mapToInt** can take one form as an argument, then this function could take the other as well. The two functional programming constructs have the same purpose—to perform some customized operation on data passed in as arguments. Choosing between the two is often a matter of convenience. For example, a lambda can be written without an encapsulating class, whereas a method cannot. My habit is to use a lambda unless the appropriate encapsulated method is already at hand. + +The **sum** function at the end of the current example does the reduction in a thread-safe manner by combining the partial sums from the **parallelStream** threads. However, the programmer is responsible for ensuring that, in the course of the multi-threading induced by the **parallelStream** call, the programmer's own function calls (in this case, to **getValue**) are thread-safe. + +The last point deserves emphasis. Lambda syntax encourages the writing of _pure functions_, which are functions whose return values depend only on the arguments, if any, passed in; a pure function has no side effects such as updating a **static** field in a class. Pure functions are thereby thread-safe, and the stream API works best if the functional arguments passed to higher-order functions, such as **filter** and **map**, are pure functions. + +For finer-grained control, there is another stream API function, named **reduce**, that could be used for summing the values in the **Number** stream: + + +``` +[Integer][7] sum4AllHarder = listOfNums +   .parallelStream()                           // multi-threading +   .map([Number][5]::getValue)                      // value per Number +   .reduce(0, (sofar, next) -> sofar + next);  // reduction to a sum +``` + +This version of the **reduce** function takes two arguments, the second of which is a function: + + * The first argument (in this case, zero) is the _identity_ value, which serves as the initial value for the reduction operation and as the default value should the stream run dry during the reduction. + * The second argument is the _accumulator_, in this case, a lambda with two arguments: the first argument (**sofar**) is the running sum, and the second argument (**next**) is the next value from the stream. The running sum and next value then are added to update the accumulator. Keep in mind that both the **map** and the **reduce** functions now execute in a multi-threaded context because of the **parallelStream** call at the start. + + + +In the examples so far, stream values are collected and then reduced, but, in general, the **Collectors** in the stream API can accumulate values without reducing them to a single value. The collection activity can produce arbitrarily rich data structures, as the next code segment illustrates. The example uses the same **listOfNums** as the preceding examples: + + +``` +Map<[Number][5].Parity, List<Number>> numMap = listOfNums +   .parallelStream() +   .collect(Collectors.groupingBy([Number][5]::getParity)); + +List<Number> evens = numMap.get([Number][5].Parity.EVEN); +List<Number> odds = numMap.get([Number][5].Parity.ODD); +``` + +The **numMap** in the first line refers to a **Map** whose key is a **Number** parity (**ODD** or **EVEN**) and whose value is a **List** of **Number** instances with values having the designated parity. Once again, the processing is multi-threaded through the **parallelStream** call, and the **collect** call then assembles (in a thread-safe manner) the partial results into the single **Map** to which **numMap** refers. The **get** method then is called twice on the **numMap**, once to get the **evens** and a second time to get the **odds**. + +The utility function **dumpList** again uses the higher-order **forEach** function from the stream API: + + +``` +private void dumpList([String][8] msg, List<Number> list) { +   [System][4].out.println("\n" + msg); +   list.stream().forEach(n -> n.dump()); // or: forEach(Number::dump) +} +``` + +Here is a slice of the program's output from a sample run: + + +``` +The sum of the randomly generated values is: 3322 +The sum again, using a different method:     3322 + +Evens: + +Value: 72 (parity: even) +Value: 54 (parity: even) +... +Value: 92 (parity: even) + +Odds: + +Value: 35 (parity: odd) +Value: 37 (parity: odd) +... +Value: 41 (parity: odd) +``` + +### Functional constructs for code simplification + +Functional constructs, such as method references and lambdas, fit nicely into the stream API. These constructs represent a major simplification of higher-order functions in Java. Even in the bad old days, Java technically supported higher-order functions through the **Method** and **Constructor** types, instances of which could be passed as arguments to other functions. These types were used—but rarely in production-grade Java precisely because of their complexity. Invoking a **Method**, for example, requires either an object reference (if the method is non-**static**) or at least a class identifier (if the method is **static**). The arguments for the invoked **Method** then are passed to it as **Object** instances, which may require explicit downcasting if polymorphism (another complexity!) is not in play. By contrast, lambdas and method references are easy to pass as arguments to other functions. + +The new functional constructs have uses beyond the stream API, however. Consider a Java GUI program with a button for the user to push, for example, to get the current time. The event handler for the button push might be written as follows: + + +``` +[JButton][9] updateCurrentTime = new [JButton][9]("Update current time"); +updateCurrentTime.addActionListener(new [ActionListener][10]() { +   @Override +   public void actionPerformed([ActionEvent][11] e) { +      currentTime.setText(new [Date][12]().toString()); +   } +}); +``` + +This short code segment is a challenge to explain. Consider the second line in which the argument to the method **addActionListener** begins as follows: + + +``` +`new ActionListener() {` +``` + +This seems wrong in that **ActionListener** is an **abstract** interface, and **abstract** types cannot be instantiated with a call to **new**. However, it turns out that something else entirely is being instantiated: an unnamed inner class that implements this interface. If the code above were encapsulated in a class named **OldJava**, then this unnamed inner class would be compiled as **OldJava$1.class**. The **actionPerformed** method is overridden in the unnamed inner class. + +Now consider this refreshing change with the new functional constructs: + + +``` +`updateCurrentTime.addActionListener(e -> currentTime.setText(new Date().toString()));` +``` + +The argument **e** in the lambda is an **ActionEvent** instance, and the lambda's body is a simple call to **setText** on the button. + +### Functional interfaces and composition + +The lambdas used so far have been written in place. For convenience, however, there can be references to lambdas just as there are to encapsulated methods. The following series of short examples illustrate this. + +Consider this interface definition: + + +``` +@FunctionalInterface // optional, usually omitted +interface BinaryIntOp { +    abstract int compute(int arg1, int arg2); // abstract could be dropped +} +``` + +The annotation **@FunctionalInterface** applies to any interface that declares a _single_ abstract method; in this case, **compute**. Several standard interfaces (e.g., the **Runnable** interface with its single declared method, **run**) fit the bill. In this example, **compute** is the declared method. The interface can be used as the target type in a reference declaration: + + +``` +BinaryIntOp div = (arg1, arg2) -> arg1 / arg2; +div.compute(12, 3); // 4 +``` + +The package **java.util.function** provides various functional interfaces. Some examples follow. + +The code segment below introduces the parameterized **Predicate** functional interface. In this example, the type **Predicate<String>** with parameter **String** can refer to either a lambda with a **String** argument or a **String** method such as **isEmpty**. In general, a _predicate_ is a function that returns a boolean value. + + +``` +Predicate<String> pred = [String][8]::isEmpty; // predicate for a String method +[String][8][ ] strings = {"one", "two", "", "three", "four"}; +[Arrays][6].asList(strings) +   .stream() +   .filter(pred)                  // filter out non-empty strings +   .forEach([System][4].out::println); // only the empty string is printed +``` + +The **isEmpty** predicate evaluates to **true** just in case a string's length is zero; hence, only the empty string makes it through to the **forEach** stage in the pipeline. + +The next code segments illustrate how simple lambdas or method references can be composed into richer ones. Consider this series of assignments to references of the **IntUnaryOperator** type, which takes an integer argument and returns an integer value: + + +``` +IntUnaryOperator doubled = n -> n * 2; +IntUnaryOperator tripled = n -> n * 3; +IntUnaryOperator squared = n -> n * n; +``` + +**IntUnaryOperator** is a **FunctionalInterface** whose single declared method is **applyAsInt**. The three references **doubled**, **tripled**, and **squared** now can be used standalone or in various compositions: + + +``` +int arg = 5; +doubled.applyAsInt(arg); // 10 +tripled.applyAsInt(arg); // 15 +squared.applyAsInt(arg); // 25 +``` + +Here are some sample compositions: + + +``` +int arg = 5; +doubled.compose(squared).applyAsInt(arg); // doubled-the-squared: 50 +tripled.compose(doubled).applyAsInt(arg); // tripled-the-doubled: 30 +doubled.andThen(squared).applyAsInt(arg); // doubled-andThen-squared: 100 +squared.andThen(tripled).applyAsInt(arg); // squared-andThen-tripled: 75 +``` + +Compositions could be done with in-place lambdas, but the references make the code cleaner. + +### Constructor references + +Constructor references are yet another of the functional programming constructs, but these references are useful in more subtle contexts than lambdas and method references. Once again, a code example seems the best way to clarify. + +Consider this [POJO][13] class: + + +``` +public class BedRocker { // resident of Bedrock +    private [String][8] name; +    public BedRocker([String][8] name) { this.name = name; } +    public [String][8] getName() { return this.name; } +    public void dump() { [System][4].out.println(getName()); } +} +``` + +The class has a single constructor, which requires a **String** argument. Given an array of names, the goal is to generate an array of **BedRocker** elements, one per name. Here is the code segment that uses functional constructs to do so: + + +``` +[String][8][ ] names = {"Fred", "Wilma", "Peebles", "Dino", "Baby Puss"}; + +Stream<BedRocker> bedrockers = [Arrays][6].asList(names).stream().map(BedRocker::new); +BedRocker[ ] arrayBR = bedrockers.toArray(BedRocker[]::new); + +[Arrays][6].asList(arrayBR).stream().forEach(BedRocker::dump); +``` + +At a high level, this code segment transforms names into **BedRocker** array elements. In detail, the code works as follows. The **Stream** interface (in the package **java.util.stream**) can be parameterized, in this case, to generate a stream of **BedRocker** items named **bedrockers**. + +The **Arrays.asList** utility again is used to streamify an array, **names**, with each stream item then passed to the **map** function whose argument now is the constructor reference **BedRocker::new**. This constructor reference acts as an object factory by generating and initializing, on each call, a **BedRocker** instance. After the second line executes, the stream named **bedrockers** consists of five **BedRocker** items. + +The example can be clarified further by focusing on the higher-order **map** function. In a typical case, a mapping transforms a value of one type (e.g., an **int**) into a different value of the _same_ type (e.g., an integer's successor): + + +``` +`map(n -> n + 1) // map n to its successor` +``` + +In the **BedRocker** example, however, the transformation is more dramatic because a value of one type (a **String** representing a name) is mapped to a value of a _different_ type, in this case, a **BedRocker** instance with the string as its name. The transformation is done through a constructor call, which is enabled by the constructor reference: + + +``` +`map(BedRocker::new) // map a String to a BedRocker` +``` + +The value passed to the constructor is one of the names in the **names** array. + +The second line of this code example also illustrates the by-now-familiar transformation of an array first into a **List** and then into a **Stream**: + + +``` +`Stream bedrockers = Arrays.asList(names).stream().map(BedRocker::new);` +``` + +The third line goes the other way—the stream **bedrockers** is transformed into an array by invoking the **toArray** method with the _array_ constructor reference **BedRocker[]::new**: + + +``` +`BedRocker[ ] arrayBR = bedrockers.toArray(BedRocker[]::new);` +``` + +This constructor reference does not create a single **BedRocker** instance, but rather an entire array of these: the constructor reference is now **BedRocker[]::new** rather than **BedRocker::new**. For confirmation, the **arrayBR** is transformed into a **List**, which again is streamified so that **forEach** can be used to print the **BedRocker** names: + + +``` +Fred +Wilma +Peebles +Dino +Baby Puss +``` + +The example's subtle transformations of data structures are done with but few lines of code, underscoring the power of various higher-order functions that can take a lambda, a method reference, or a constructor reference as an argument + +### Currying + +To _curry_ a function is to reduce (typically by one) the number of explicit arguments required for whatever work the function does. (The term honors the logician Haskell Curry.) In general, functions are easier to call and are more robust if they have fewer arguments. (Recall some nightmarish function that expects a half-dozen or so arguments!) Accordingly, currying should be seen as an effort to simplify a function call. The interface types in the **java.util.function** package are suited for currying, as the next example shows. + +References of the **IntBinaryOperator** interface type are for functions that take two integer arguments and return an integer value: + + +``` +IntBinaryOperator mult2 = (n1, n2) -> n1 * n2; +mult2.applyAsInt(10, 20); // 200 +mult2.applyAsInt(10, 30); // 300 +``` + +The reference name **mult2** underscores that two explicit arguments are required, in this example, 10 and 20. + +The previously introduced **IntUnaryOperator** is simpler than an **IntBinaryOperator** because the former requires just one argument, whereas the latter requires two arguments. Both return an integer value. The goal, therefore, is to curry the two-argument **IntBinraryOperator** named **mult2** into a one-argument **IntUnaryOperator** version **curriedMult2**. + +Consider the type **IntFunction<R>**. A function of this type takes an integer argument and returns a result of type **R**, which could be another function—indeed, an **IntBinaryOperator**. Having a lambda return another lambda is straightforward: + + +``` +`arg1 -> (arg2 -> arg1 * arg2) // parentheses could be omitted` +``` + +The full lambda starts with **arg1,** and this lambda's body—and returned value—is another lambda, which starts with **arg2**. The returned lambda takes just one argument (**arg2**) but returns the product of two numbers (**arg1** and **arg2**). The following overview, followed by the code, should clarify. + +Here is an overview of how **mult2** can be curried: + + * A lambda of type **IntFunction<IntUnaryOperator>** is written and called with an integer value such as 10. The returned **IntUnaryOperator** caches the value 10 and thereby becomes the curried version of **mult2**, in this example, **curriedMult2**. + * The **curriedMult2** function then is called with a single explicit argument (e.g., 20), which is multiplied with the cached argument (in this case, 10) to produce the product returned. + + + +Here are the details in code: + + +``` +// Create a function that takes one argument n1 and returns a one-argument +// function n2 -> n1 * n2 that returns an int (the product n1 * n2). +IntFunction<IntUnaryOperator> curriedMult2Maker = n1 -> (n2 -> n1 * n2); +``` + +Calling the **curriedMult2Maker** generates the desired **IntUnaryOperator** function: + + +``` +// Use the curriedMult2Maker to get a curried version of mult2. +// The argument 10 is n1 from the lambda above. +IntUnaryOperator curriedMult2 = curriedMult2Maker2.apply(10); +``` + +The value 10 is now cached in the **curriedMult2** function so that the explicit integer argument in a **curriedMult2** call will be multiplied by 10: + + +``` +curriedMult2.applyAsInt(20); // 200 = 10 * 20 +curriedMult2.applyAsInt(80); // 800 = 10 * 80 +``` + +The cached value can be changed at will: + + +``` +curriedMult2 = curriedMult2Maker.apply(50); // cache 50 +curriedMult2.applyAsInt(101);               // 5050 = 101 * 50 +``` + +Of course, multiple curried versions of **mult2**, each an **IntUnaryOperator**, can be created in this way. + +Currying takes advantage of a powerful feature about lambdas: a lambda is easily written to return whatever type of value is needed, including another lambda. + +### Wrapping up + +Java remains a class-based object-oriented programming language. But with the stream API and its supporting functional constructs, Java takes a decisive (and welcomed) step toward functional languages such as Lisp. The result is a Java better suited to process the massive data streams so common in modern programming. This step in the functional direction also makes it easier to write clear, concise Java in the pipeline style highlighted in previous code examples: + + +``` +dataStream +   .parallelStream() // multi-threaded for efficiency +   .filter(...)      // stage 1 +   .map(...)         // stage 2 +   .filter(...)      // stage 3 +   ... +   .collect(...);    // or, perhaps, reduce: stage N +``` + +The automatic multi-threading, illustrated with the **parallel** and **parallelStream** calls, is built upon Java's fork/join framework, which supports _task stealing_ for efficiency. Suppose that the thread pool behind a **parallelStream** call consists of eight threads and that the **dataStream** is partitioned eight ways. Some thread (e.g., T1) might work faster than another (e.g., T7), which means that some of T7's tasks ought to be moved into T1's work queue. This happens automatically at runtime. + +The programmer's chief responsibility in this easy multi-threading world is to write thread-safe functions passed as arguments to the higher-order functions that dominate in the stream API. Lambdas, in particular, encourage the writing of pure—and, therefore, thread-safe—functions. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/javastream + +作者:[Marty Kalin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mkalindepauledu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/features_solutions_command_data.png?itok=4_VQN3RK (computer screen ) +[2]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random +[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+list +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+number +[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+arrays +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+jbutton +[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionlistener +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent +[12]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+date +[13]: https://en.wikipedia.org/wiki/Plain_old_Java_object From b5334c946f9a92e9c46f0eda85f9f8ee4678fb1c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 3 Jan 2020 00:54:51 +0800 Subject: [PATCH 383/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200102=2010=20o?= =?UTF-8?q?pen=20source=20software=20alternatives=20for=20the=20new=20year?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200102 10 open source software alternatives for the new year.md --- ... software alternatives for the new year.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20200102 10 open source software alternatives for the new year.md diff --git a/sources/tech/20200102 10 open source software alternatives for the new year.md b/sources/tech/20200102 10 open source software alternatives for the new year.md new file mode 100644 index 0000000000..59d7f4067e --- /dev/null +++ b/sources/tech/20200102 10 open source software alternatives for the new year.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 open source software alternatives for the new year) +[#]: via: (https://opensource.com/article/20/1/open-source-alternatives) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +10 open source software alternatives for the new year +====== +Open source software can help you become better organized, more +productive, more secure, and even healthier. +![Multi-colored and directional network computer cables][1] + +Open source isn't just for techies. On your desktop (regardless of your operating system), on your phone, and in your business, open source software can help you become better organized, more productive, more secure, and healthier. Best of all, you don't need to worry about the shackles of proprietary licenses. + +Throughout 2019, Opensource.com's team of [Correspondents][2] and community of writers have highlighted top-notch open source alternatives to proprietary software. Take a quick look at the best 10 of those articles. + +In _[Intro to Corteza, an open source alternative to Salesforce][3]_, Dennis Arh introduces us to Corteza, a powerful and flexible customer relationship management (CRM) system. Dennis outlines what Corteza has to offer, then walks us through how to install and configure the system. While Corteza might not pack all the features of the bigger closed source CRM systems, it's more than enough for the majority of users. + +Opensource.com Correspondent Chris Hermansen whips up an overview of a half-dozen instant messaging apps for mobile devices in _[Choosing an open messenger client: Alternatives to WhatsApp][4]_. While each of the six apps has its strengths, Chris recommends Signal for "its open-by-design approach, its serious and ongoing privacy and security stance, and having a Signal app on our GNOME (and Windows) desktops." + +In _[5 social media alternatives to protect your privacy][5]_, privacy advocate Dan Arel walks through several open source replacements for Twitter, Facebook, Instagram, WhatsApp, and Facebook Messenger. Dan also shares how he cut his ties with those privacy-crushing services without losing touch with the people who matter. His approach might work for you, too. + +You don't need an expensive application like Adobe Acrobat to work with PDF files on the Linux desktop, as I show in _[Two graphical tools for manipulating PDFs on the Linux desktop][6]_. These tools are simple, but they pack a lot of punch and take care of most of your PDF manipulation needs. + +In _[How to create an automated calendar with Google Apps Script with open source on top][7]_, Correspondent Dan Barker explores how to manage conference submissions by stitching together a Google Sheet with Google Calendar using a script he wrote. OK, the services Dan's script interacts with aren't open source, but you can grab that script from [Dan's GitLab repository][8] and modify it to your heart's content. + +In _[4 open source apps for plant-based diets][9]_, Correspondent Joshua Allen Holm uncovers some mobile apps that can help you plan meatless meals, shop more effectively for the ingredients for those meals, and find vegan and vegetarian restaurants nearby. As someone who's shifting to a more plant-based diet, I can see myself using a couple of these apps in the near future. And that they're available on [F-Droid][10] is a bonus. + +I dive into a very useful spreadsheet editor that's built for collaboration in _[Get going with EtherCalc, a web-based alternative to Google Sheets][11]_. If you're of a technical bent, you can run your own instance; otherwise, you can use one of several hosted editions. EtherCalc does take a bit of getting used to, but if your needs are simple, you'll find (as I did) that it's a flexible tool. + +Opensource.com's Seth Kenlon examines _[CBZ and DjVu: Open source alternatives to PDFs][12]_. This pair of digital archive formats can do everything PDF can do but are easier to manipulate. Seth also shows how to use command-line tools to create archives in the CBZ and DjVu formats and, with DjVu files, offers some advanced tips and tricks. + +I explain how a good open source application can exist quite nicely in a proprietary environment in _[Organize your information on the Mac desktop with nvALT][13]_. In this article, I discuss how to how to manage notes and more with this _very_ useful tool. What makes nvALT all the more attractive to me is that [plain text][14] is at its core, so it's a solid fit for my workflow whenever I'm working in MacOS. + +In _[Getting started with Pimcore: An open source alternative for product information management][15]_, Dietmar Rietsch introduces a tool for businesses of all sizes to manage, mold, and share data about their products. In the past, I worked for a company or two that specialized in this type of software. It's great to see an open source alternative that's as flexible, polished, and easy to use as its closed source cousins. + +These articles give you a taste of the open source alternatives to proprietary software that are out there. Are there any substitutes for proprietary software that you think we should cover in the coming months? Feel free to leave a comment or, better yet, [submit an article proposal][16]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-alternatives + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: https://opensource.com/correspondent-program +[3]: https://opensource.com/article/19/8/corteza-open-source-alternative-salesforce +[4]: https://opensource.com/article/19/3/open-messenger-client +[5]: https://opensource.com/article/19/1/open-source-social-media-alternatives +[6]: https://opensource.com/article/19/2/manipulating-pdfs-linux +[7]: https://opensource.com/article/19/1/automate-calendar +[8]: https://gitlab.com/barkerd427/conference-scripts +[9]: https://opensource.com/article/19/4/apps-plant-based-diets +[10]: https://f-droid.org/ +[11]: https://opensource.com/article/19/7/get-going-ethercalc +[12]: https://opensource.com/article/19/3/comic-book-archive-djvu +[13]: https://opensource.com/article/19/1/nvalt +[14]: https://plaintextproject.online/ +[15]: https://opensource.com/article/19/11/pimcore-alternative-product-information-management +[16]: https://opensource.com/how-submit-article From a81ef337e2355038184c6b6f016acceb4b3c5118 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 3 Jan 2020 00:55:22 +0800 Subject: [PATCH 384/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200102=20Put=20?= =?UTF-8?q?some=20loot=20in=20your=20Python=20platformer=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200102 Put some loot in your Python platformer game.md --- ...ome loot in your Python platformer game.md | 535 ++++++++++++++++++ 1 file changed, 535 insertions(+) create mode 100644 sources/tech/20200102 Put some loot in your Python platformer game.md diff --git a/sources/tech/20200102 Put some loot in your Python platformer game.md b/sources/tech/20200102 Put some loot in your Python platformer game.md new file mode 100644 index 0000000000..678fb69516 --- /dev/null +++ b/sources/tech/20200102 Put some loot in your Python platformer game.md @@ -0,0 +1,535 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Put some loot in your Python platformer game) +[#]: via: (https://opensource.com/article/20/1/loot-python-platformer-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Put some loot in your Python platformer game +====== +Give your players some treasures to collect and boost their score in +this installment on programming video games with Python's Pygame module. +![Hearts, stars, and dollar signs][1] + +This is part 9 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: + + * [Learn how to program in Python by building a simple dice game][4] + * [Build a game framework with Python using the Pygame module][5] + * [How to add a player to your Python game][6] + * [Using Pygame to move your game character around][7] + * [What's a hero without a villain? How to add one to your Python game][8] + * [Simulate gravity in your Python game][9] + * [Add jumping to your Python platformer game][10] + * [Enable your Python game player to run forward and backward][11] + + + +If you've followed along with the previous articles in this series, then you know all the basics of programming video game mechanics. You can build upon these basics to create a fully functional video game all your own. Following a "recipe" like the code samples in this series is helpful when you're first learning, but eventually, the recipe becomes a constraint. It's time to use the principles you've learned and apply them in new ways. + +If that sounds easier said than done, this article demonstrates an example of how to leverage what you already know for new purposes. Specifically, it covers how to implement a looting system + +using what you have already learned about platforms from previous lessons. + +In most video games, you have the opportunity to "loot," or collect treasures and other items within the game world. Loot usually increases your score or your health or provides information leading to your next quest. + +Including loot in your game is similar to programming platforms. Like platforms, loot has no user controls, scrolls with the game world, and must check for collisions with the player sprite. + +### Creating the loot function + +Loot is so similar to platforms that you don't even need a Loot class. You can just reuse the **Platform** class and call the results loot. + +Since loot type and placement probably differ from level to level, create a new function called **loot** in your **Level** class, if you don't already have one. Since loot items are not platforms, you must also create a new **loot_list** group and then add loot objects to it. As with platforms, ground, and enemies, this group is used when checking for collisions: + + +``` +    def loot(lvl,lloc): +        if lvl == 1: +            loot_list = pygame.sprite.Group() +            loot = Platform(300,ty*7,tx,ty, 'loot_1.png') +            loot_list.add(loot) + +        if lvl == 2: +            print(lvl) + +        return loot_list +``` + +You can add as many loot objects as you like; just remember to add each one to your loot list. The arguments for the **Platform** class are the X position, the Y position, the width and height of the loot sprite (it's usually easiest to keep your loot sprite the same size as all other tiles), and the image you want to use as loot. Placement of loot can be just as complex as mapping platforms, so use the level design document you created when creating the level. + +Call your new loot function in the **Setup** section of your script. In the following code, the first three lines are for context, so just add the fourth: + + +``` +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) +loot_list = Level.loot(1,tx,ty) +``` + +As you know by now, the loot won't get drawn to the screen unless you include it in your main loop. Add the final line from the following code sample to your loop: + + +``` +    enemy_list.draw(world) +    ground_list.draw(world) +    plat_list.draw(world) +    loot_list.draw(world) +``` + +Launch your game to see what happens. + +![Loot in Python platformer][12] + +Your loot objects are spawned, but they don't do anything when your player runs into them, nor do they scroll when your player runs past them. Fix these issues next. + +### Scrolling loot + +Like platforms, loot has to scroll when the player moves through the game world. The logic is identical to platform scrolling. To scroll the loot forward, add the last two lines: + + +``` +        for e in enemy_list: +            e.rect.x -= scroll +        for l in loot_list: +            l.rect.x -= scroll +``` + +To scroll it backward, add the last two lines: + + +``` +        for e in enemy_list: +            e.rect.x += scroll +        for l in loot_list: +            l.rect.x += scroll +``` + +Launch your game again to see that your loot objects now act like they're _in_ the game world instead of just painted on top of it. + +### Detecting collisions + +As with platforms and enemies, you can check for collisions between loot and your player. The logic is the same as other collisions, except that a hit doesn't (necessarily) affect gravity or health. Instead, a hit causes the loot to disappear and increment the player's score. + +When your player touches a loot object, you can remove that object from the **loot_list**. This means that when your main loop redraws all loot items in **loot_list**, it won't redraw that particular object, so it will look like the player has grabbed the loot. + +Add the following code above the platform collision detection in the **update** function of your **Player** class (the last line is just for context): + + +``` +                loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) +                for loot in loot_hit_list: +                        loot_list.remove(loot) +                        self.score += 1 +                print(self.score) +  +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +``` + +Not only do you remove the loot object from its group when a collision happens, but you also award your player a bump in score. You haven't created a score variable yet, so add that to your player's properties, created in the **__init__** function of the **Player** class. In the following code, the first two lines are for context, so just add the score variable: + + +``` +        self.frame = 0 +        self.health = 10 +        self.score = 0 +``` + +When calling the **update** function in your main loop, include the **loot_list**: + + +``` +        player.gravity() +        player.update() +``` + +As you can see, you've got all the basics. All you have to do now is use what you know in new ways. + +There are a few more tips in the next article, but in the meantime, use what you've learned to make a few simple, single-level games. Limiting the scope of what you are trying to create is important so that you don't overwhelm yourself. It also makes it easier to end up with a finished product that looks and feels finished. + +Here's all the code you've written for this Python platformer so far: + + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform +# add gravity +# add jumping +# add scrolling + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os + +''' +Objects +''' + +class Platform(pygame.sprite.Sprite): +    # x location, y location, img width, img height, img file     +    def __init__(self,xloc,yloc,imgw,imgh,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)).convert() +        self.image.convert_alpha() +        self.rect = self.image.get_rect() +        self.rect.y = yloc +        self.rect.x = xloc + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 +        self.movey = 0 +        self.frame = 0 +        self.health = 10 +        self.collide_delta = 0 +        self.jump_delta = 6 +        self.score = 1 +        self.images = [] +        for i in range(1,9): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha() +            img.set_colorkey(ALPHA) +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() + +    def jump(self,platform_list): +        self.jump_delta = 0 + +    def gravity(self): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty +        +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +        +    def update(self): +        ''' +        Update sprite position +        ''' +        +        self.rect.x = self.rect.x + self.movex +        self.rect.y = self.rect.y + self.movey + +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        for enemy in enemy_hit_list: +            self.health -= 1 +            #print(self.health) + +        loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) +        for loot in loot_hit_list: +            loot_list.remove(loot) +            self.score += 1 +            print(self.score) + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.collide_delta = 0 # stop jumping +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty +            +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.movey = 0 +            self.rect.y = worldy-ty-ty +            self.collide_delta = 0 # stop jumping +            if self.rect.y > g.rect.y: +                self.health -=1 +                print(self.health) +                +        if self.collide_delta < 6 and self.jump_delta < 6: +            self.jump_delta = 6*2 +            self.movey -= 33  # how high to jump +            self.collide_delta += 6 +            self.jump_delta    += 6 +            +class Enemy(pygame.sprite.Sprite): +    ''' +    Spawn an enemy +    ''' +    def __init__(self,x,y,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)) +        self.movey = 0 +        #self.image.convert_alpha() +        #self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.counter = 0 + +                +    def move(self): +        ''' +        enemy movement +        ''' +        distance = 80 +        speed = 8 + +        self.movey += 3.2 +        +        if self.counter >= 0 and self.counter <= distance: +            self.rect.x += speed +        elif self.counter >= distance and self.counter <= distance*2: +            self.rect.x -= speed +        else: +            self.counter = 0 +        +        self.counter += 1 + +        if not self.rect.y >= worldy-ty-ty: +            self.rect.y += self.movey + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.rect.y = worldy-ty-ty + +        +class Level(): +    def bad(lvl,eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list.add(enemy)              # add enemy to group +            +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return enemy_list + +    def loot(lvl,tx,ty): +        if lvl == 1: +            loot_list = pygame.sprite.Group() +            loot = Platform(200,ty*7,tx,ty, 'loot_1.png') +            loot_list.add(loot) + +        if lvl == 2: +            print(lvl) + +        return loot_list + +    def ground(lvl,gloc,tx,ty): +        ground_list = pygame.sprite.Group() +        i=0 +        if lvl == 1: +            while i < len(gloc): +                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') +                ground_list.add(ground) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return ground_list + +    def platform(lvl,tx,ty): +        plat_list = pygame.sprite.Group() +        ploc = [] +        i=0 +        if lvl == 1: +            ploc.append((20,worldy-ty-128,3)) +            ploc.append((300,worldy-ty-256,3)) +            ploc.append((500,worldy-ty-128,4)) + +            while i < len(ploc): +                j=0 +                while j <= ploc[i][2]: +                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') +                    plat_list.add(plat) +                    j=j+1 +                print('run' + str(i) + str(ploc[i])) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return plat_list + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4  # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +ALPHA = (0,255,0) + +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +forwardx = 600 +backwardx = 230 + +eloc = [] +eloc = [200,20] +gloc = [] +#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] +tx = 64 #tile size +ty = 64 #tile size + +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) +loot_list = Level.loot(1,tx,ty) + +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print("LEFT") +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print("RIGHT") +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                player.jump(plat_list) + +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +        for l in loot_list: +            l.rect.x -= scroll +                +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll +        for l in loot_list: +            l.rect.x += scroll + +    world.blit(backdrop, backdropbox)     +    player.gravity() # check gravity +    player.update() +    player_list.draw(world) #refresh player position +    enemy_list.draw(world)  # refresh enemies +    ground_list.draw(world)  # refresh enemies +    plat_list.draw(world)   # refresh platforms +    loot_list.draw(world)   # refresh loot + +    for e in enemy_list: +        e.move() +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/loot-python-platformer-game + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_lovemoneyglory2.png?itok=AvneLxFp (Hearts, stars, and dollar signs) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://opensource.com/article/17/10/python-101 +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: https://opensource.com/article/17/12/game-python-add-a-player +[7]: https://opensource.com/article/17/12/game-python-moving-player +[8]: https://opensource.com/article/18/5/pygame-enemy +[9]: https://opensource.com/article/19/11/simulate-gravity-python +[10]: https://opensource.com/article/19/12/jumping-python-platformer-game +[11]: https://opensource.com/article/19/12/python-platformer-game-run +[12]: https://opensource.com/sites/default/files/uploads/pygame-loot.jpg (Loot in Python platformer) From 710ae3242d3bc3c45b19f90796510493bac3029c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 08:38:04 +0800 Subject: [PATCH 385/676] PRF @wxy --- ... Pop-_OS vs Ubuntu- Which One is Better.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md index 3693d00e22..292ce90348 100644 --- a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md +++ b/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?) @@ -12,7 +12,7 @@ Pop!_OS 与 Ubuntu:哪个更棒? 好吧,你可能会发现从[最佳 Linux 发行版][1]列表中选择一个发行版很容易,但是,将两个类似的 Linux 发行版进行比较通常会令人困惑,就像 Pop!_OS 与 Ubuntu 一样。 -有趣的是,Pop!\_OS 基于 [Ubuntu][2]。那么,Pop!\_OS 和 Ubuntu 之间有什么区别呢?为什么要从中选择一个呢? +有趣的是,Pop!\_OS 是基于 [Ubuntu][2] 的。那么,Pop!\_OS 和 Ubuntu 之间有什么区别呢?为什么要从中选择一个呢? 在本文中,我将比较 Pop!_OS 和 Ubuntu(两者都是我的最爱)。 @@ -24,7 +24,7 @@ Pop!_OS 与 Ubuntu:哪个更棒? 发现相似之处可帮助你区分其他差异之处。因此,让我们从一些明显的相似之处开始。 -就像我提到的,Pop!\_OS 是基于 Ubuntu 之上的 Linux 发行版。因此,当你使用 Pop!_OS 时,你将获得使用 Ubuntu 的所有好处(从技术上说,其核心是一样的)。 +就像我提到的,Pop!\_OS 是基于 Ubuntu 之上的 Linux 发行版。因此,当你使用 Pop!\_OS 时,你将获得使用 Ubuntu 的所有好处(从技术上说,其核心是一样的)。 它们都默认带有 [GNOME 桌面环境][4],因此它们具有相似的用户界面(UI)。 @@ -42,7 +42,7 @@ Pop!_OS 与 Ubuntu:哪个更棒? 除了外观之外,[Ubuntu 还通过添加程序坞和其他一些小花巧来定制了 GNOME 的体验][6]。如果你喜欢定制的 GNOME 体验,可能会发现它更好。 -但是,如果你更喜欢纯粹的 GNOME 体验,默认情况下 Pop!_OS 会为你提供。 +但是,如果你更喜欢纯粹的 GNOME 体验,Pop!_OS 默认情况下为你提供的就是这样。 在你亲自尝试之前,我无法说服你。但是,Pop!_OS 中的总体配色方案、图标和主题可以说是令人愉悦的高级用户体验。 @@ -60,7 +60,7 @@ Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数 我为什么要说这个呢? -因为 Pop!_OS 具有其[自己的官方 PPA][8],并在默认情况下已启用。你会在此处找到一些有用的应用程序,例如 Android Studio、TensorFlow。无需下载 Android Studio 的 1GB 大的 Snap 程序包。只需使用 [apt-get install][9]就可以了。 +因为 Pop!_OS 具有其[自己的官方 PPA][8],并已默认启用。你会在此处找到一些有用的应用程序,例如 Android Studio、TensorFlow。无需下载 Android Studio 的 1GB 大的 Snap 程序包。只需使用 [apt-get install][9]就可以了。 #### 预装应用 @@ -76,13 +76,13 @@ Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数 ![][11] -对于熟悉 Snap 程序包的用户来说,Ubuntu 的软件中心是比 Pop!_OS 商店更好的解决方案,因为你可以在软件中心中列出快照程序包。 +对于熟悉 Snap 程序包的用户来说,Ubuntu 的软件中心是比 Pop!_OS 商店更好的解决方案,因为你可以在软件中心中列出 Snap 程序包。 -你无法在软件中心中过滤快照包,但是当你在软件中心中发现一个 Snap 包(查看应用程序来源的详细信息为“ Snap store ”/“Snapcraft”)时安装它就更容易了。 +你无法在软件中心中过滤 Snap 软件包,但是当你在软件中心中发现一个 Snap 软件包(查看应用程序来源的详细信息为 “Snap store”/“Snapcraft”)时安装它就更容易了。 -如果你感到困惑,Pop!\_OS 也确实支持快照包。但是,你不会在 Pop!_OS 商店中找到它们,这是唯一的区别。 +可能你会感到困惑,Pop!\_OS 也确实支持 Snap 软件包。但是,你不会在 Pop!\_OS 商店中找到它们,这是唯一的区别。 -如果不确定什么是 Snap 软件包及其功能,可以查看我们的文章[在 Linux 上安装 Snap 应用][12]。 +如果不确定什么是 Snap 软件包及其功能,可以查看我们的文章《[在 Linux 上安装 Snap 应用][12]》。 #### 单独的 NVIDIA/AMD ISO 文件 @@ -96,9 +96,9 @@ Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数 #### 可靠性与问题 -毫无疑问,这两个[发行版都适合初学者][14],并且相当可靠。如果你想要更好的可靠性和更少的问题,则可能希望一直用长期支持(LTS)版本。 +毫无疑问,这两个[发行版都适合初学者][14],并且相当可靠。如果你想要更好的可靠性和更少的问题,则可能希望一直使用长期支持(LTS)版本。 -当出现新版本的 Ubuntu 时,Pop!_OS 将在其上开发,并有可能解决用户在 Ubuntu 原始发行版上遇到的问题,然后再进行新的升级。这给他们带来了一点优势,但这没什么实质性的不同,因为这些修复最终都可以运用于 Ubuntu。 +当出现新版本的 Ubuntu 时,Pop!_OS 将在其上开发,并有可能解决用户在 Ubuntu 原始发行版上遇到的问题,然后再进行新的升级。这给它们带来了一点优势,但这没什么实质性的不同,因为这些修复最终都可以运用于 Ubuntu。 #### 性能 @@ -110,7 +110,7 @@ Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数 当然,你可以手动进行一些优化调整以满足要求——无论它们中的哪个不满足你的硬件配置。 -但是,如果你想使用 System76 笔记本电脑,那么 Pop!\_OS 将可以证明自己是 [Linux 领域的苹果][15],因为 Pop!_OS 是针对其硬件量身定制的,与 Ubuntu 有所不同。 +但是,如果你想使用 System76 笔记本电脑,那么 Pop!\_OS 将可以证明自己是 [Linux 领域的苹果][15],因为 Pop!\_OS 是针对其硬件量身定制的,与 Ubuntu 有所不同。 #### 硬件兼容性 @@ -131,7 +131,7 @@ via: https://itsfoss.com/pop-os-vs-ubuntu/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 20ec23ed537d76f5fa3f0ca936b662d398c1a21e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 08:53:40 +0800 Subject: [PATCH 386/676] PUB @wxy https://linux.cn/article-11744-1.html --- .../20191221 Pop-_OS vs Ubuntu- Which One is Better.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191221 Pop-_OS vs Ubuntu- Which One is Better.md (99%) diff --git a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md b/published/20191221 Pop-_OS vs Ubuntu- Which One is Better.md similarity index 99% rename from translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md rename to published/20191221 Pop-_OS vs Ubuntu- Which One is Better.md index 292ce90348..dd86eb3196 100644 --- a/translated/tech/20191221 Pop-_OS vs Ubuntu- Which One is Better.md +++ b/published/20191221 Pop-_OS vs Ubuntu- Which One is Better.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11744-1.html) [#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?) [#]: via: (https://itsfoss.com/pop-os-vs-ubuntu/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From bcba764d318f9d0cce44b30c8c449028246540d0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 3 Jan 2020 08:59:00 +0800 Subject: [PATCH 387/676] translated --- ...nable to Open the MRL- Error -Quick Tip.md | 102 ------------------ ...nable to Open the MRL- Error -Quick Tip.md | 101 +++++++++++++++++ 2 files changed, 101 insertions(+), 102 deletions(-) delete mode 100644 sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md create mode 100644 translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md diff --git a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md deleted file mode 100644 index b8314533cf..0000000000 --- a/sources/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) -[#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Fixing “VLC is Unable to Open the MRL” Error [Quick Tip] -====== - -One of the [VLC tips][1] is to play YouTube and other online videos with [VLC][2]. This could help you [watch online videos with subtitles][3]. - -But things may not always be simple because at times you’ll encounter this error when trying to open YouTube video with VLC: - -**Your input can’t be opened: -VLC is unable to open the MRL ‘. Check the log for details.** - -![VLC error while playing YouTube videos][4] - -The thing here is that Google doesn’t want you to use any third party application for watching YouTube because then they cannot collect data properly. - -So, they keep changing stuff from their side to make it harder for third party devs to work with YouTube. - -Take [youtube-dl][5] for example. You’ll notice that you cannot [download YouTube videos][6] with it all of a sudden and the simplest solution is to have the latest version of youtube-dl installed. - -Same goes for VLC. If you [install the latest VLC in Ubuntu][7] or whichever operating system you are using, you probably won’t see this error. - -### Fixing “VLC is unable to open the MRL” error - -Let me show you the steps to fix this problem for YouTube at least. - -Go to this page and use Ctrl+S to save the file from the official GitHub repository of VLC media player: - -[Download youtube.lua file][8] - -Now, what you need to do is to replace the youtube.luac (mind the ‘c’ in luac) in lib/vlc/lua/playlist directory with this downloaded file. - -#### Steps for Linux - -If you are using Linux, open the terminal and use the [locate command][9] to find the exact location of youtube.luac file: - -``` -locate youtube.luac -``` - -When you get the path of the file, you just replace that file with your downloaded file. I trust you to handle this simple task. - -For me, it showed the path of the file here: - -``` -[email protected]:~$ locate youtube.lua -/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac -``` - -So all I did was to move the downloaded file to this location and replace the content of the file: - -``` -sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac -``` - -You should be able to play the YouTube videos in VLC now. - -#### Steps for Windows - -If you are using Windows, you should follow these steps: - - * Rename the downloaded youtube.lua file to youtube.luac - * Now copy this file and paste it to C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\ - - - -That’s it. - -If you have trouble with Dailymotion or other video streaming websites, you can download their respective lua files from the VLC repository [here][10] and replace the existing one in your VLC install. - -I hope this quick tip fixed the problem with VLC unable to play YouTube videos for you. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/simple-vlc-tips/ -[2]: https://www.videolan.org/index.html -[3]: https://itsfoss.com/penguin-subtitle-player/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc_error_input_cant_be_played.png?ssl=1 -[5]: https://itsfoss.com/download-youtube-linux/ -[6]: https://itsfoss.com/download-youtube-videos-ubuntu/ -[7]: https://itsfoss.com/install-latest-vlc/ -[8]: https://raw.githubusercontent.com/videolan/vlc/master/share/lua/playlist/youtube.lua -[9]: https://linuxhandbook.com/locate-command/ -[10]: https://github.com/videolan/vlc/tree/master/share/lua/playlist diff --git a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md new file mode 100644 index 0000000000..004f300c56 --- /dev/null +++ b/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) +[#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +修复 “VLC is Unable to Open the MRL” 错误 +====== + +一个使用 [VLC 的技巧][1]是使用 [VLC] [2] 播放 YouTube 和其他在线视频。这可以帮助你[观看带有字幕的在线视频][3]。 + +但是事情并不总是这么简单,因为有时使用 VLC 打开 YouTube 视频时会遇到此错误: + +**Your input can’t be opened: VLC is unable to open the MRL ‘. Check the log for details.** + +![VLC error while playing YouTube videos][4] + +这是因为 Google 不想让你使用任何第三方应用观看 YouTube,因为这样他们就无法正常收集数据。 + +因此,他们不断修改服务端,以使第三发开发更难与 Youtube 集成。 + +以 [youtube-dl][5] 为例。你会发现自己无法突然[下载 YouTube 视频] [6],最简单的方案是安装最新版本的 youtube-dl。 + +对于 VLC 也是如此。如果你[在 Ubuntu 或任何你用的系统中安装了最新的 VLC][7],那么可能不会看到此错误。 + +### 修复 ”VLC is unable to open the MRL“ 错误 + +让我向你展示对于 YouTube 的修复步骤。 + +进入 VLC 媒体播放器的官方 Github 仓库页面,并使用 Ctrl+S 保存文件: + +[Download youtube.lua file][8] + +现在,你需要做的是用此下载文件替换 lib/vlc/lua/playlist 目录中的 youtube.luac(注意 luac 中的 “c”)。 + +#### Linux 中的步骤 + +如果你使用的是 Linux,请打开终端并使用 [locate 命令][9]查找 youtube.luac 文件的确切位置: + +``` +locate youtube.luac +``` + +当你得到文件的路径时,只需将该文件替换为下载的文件即可。我相信你可以完成这项简单的任务。 + +对我而言,以下是文件路径: + +``` +[email protected]:~$ locate youtube.lua +/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac +``` + +因此,我要做的就是将下载的文件移到该位置并替换它的内容: + +``` +sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac +``` + +你现在应该可以在 VLC 中播放 YouTube 视频了。 + +#### Windows 中的步骤 + +如果你使用的是 Windows,那么应遵循以下步骤: + + * 将下载的 youtube.lua 文件重命名为 youtube.luac + * 复制此文件并将其粘贴到 C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\ + + + +就是这些了。 + +如果你在 Dailymotion 或其他视频流网站上遇到问题,那么可以从 VLC 仓库的[此处][10]下载它们各自的 lua 文件,并替换 VLC 安装中的现有 lua 文件。 + +我希望这个快速提示可以解决 VLC 无法为你播放 YouTube 视频的问题。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/simple-vlc-tips/ +[2]: https://www.videolan.org/index.html +[3]: https://itsfoss.com/penguin-subtitle-player/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc_error_input_cant_be_played.png?ssl=1 +[5]: https://itsfoss.com/download-youtube-linux/ +[6]: https://itsfoss.com/download-youtube-videos-ubuntu/ +[7]: https://itsfoss.com/install-latest-vlc/ +[8]: https://raw.githubusercontent.com/videolan/vlc/master/share/lua/playlist/youtube.lua +[9]: https://linuxhandbook.com/locate-command/ +[10]: https://github.com/videolan/vlc/tree/master/share/lua/playlist From 00d722679c20875a9ce34b4ab40ee0e24331468d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 3 Jan 2020 09:05:16 +0800 Subject: [PATCH 388/676] translating --- ...NOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md index 96de8997fa..f761c28dd1 100644 --- a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md +++ b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 44468cd7fbf184224c9354c16e1c588596230d9a Mon Sep 17 00:00:00 2001 From: BrunoJu Date: Fri, 3 Jan 2020 10:56:16 +0800 Subject: [PATCH 389/676] Update 20191231 10 Ansible resources to accelerate your automation skills.md --- ...10 Ansible resources to accelerate your automation skills.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md index a522f0c869..5a1dc5dccf 100644 --- a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md +++ b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (BrunoJu) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5e91314ff78ea596911f56572f0dba9a49f55790 Mon Sep 17 00:00:00 2001 From: nacyro Date: Fri, 3 Jan 2020 15:59:02 +0800 Subject: [PATCH 390/676] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... and guides to enhance your tech skills.md | 89 ------------------- ... and guides to enhance your tech skills.md | 88 ++++++++++++++++++ 2 files changed, 88 insertions(+), 89 deletions(-) delete mode 100644 sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md create mode 100644 translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md diff --git a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md deleted file mode 100644 index 7e9e984b63..0000000000 --- a/sources/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (nacyro) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 cheat sheets and guides to enhance your tech skills) -[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) -[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) - -9 cheat sheets and guides to enhance your tech skills -====== -Kick off the new year with our latest programming cheat sheets and -guides for people of all skill levels. Take our poll to let us know what -you'd like to see next! -![a checklist for a team][1] - -Cheat sheets are perfect for the new coder just starting out on the command line. However, even the most experienced programmers need to lean on references every once in a while. If that pesky keyboard shortcut is just at the tip of your finger, a cheat sheet is perfect to have nearby. Here’s a roundup of our downloadable guides that will set you up for success in 2020. - -### Cheat sheets - -#### [Markdown][2] - -Markdown is not just for coders. Anyone can use it to help bring syntax and structure to a plain text document. This cheat sheet provides Markdown foundations using the CommonMark specification. It also includes syntax for GitHub and GitLab.  - -#### [Linux permissions and users][3] - -Keep commands for managing users close at hand with this Linux cheat sheet. Quickly learn how to add users, delete users, show history, and set permissions. - -#### [Bash][4] - -Once you know Bash, the possibilities at the command line are endless. Our Bash cheat sheet helps you become more efficient with keyboard shortcuts. Before you know it, you'll be running scripts in your sleep (literally).   - -#### [Linux common commands][5] - -It's no wonder that our cheat sheet for common Linux commands is so popular. This cheat sheet is packed with the essentials to get started with installing software and navigating file systems. Print this one out for yourself and your colleagues. - -#### [Microservices][6] - -It seems like everyone is talking about microservices and for good reason. Microservices make applications modular so that they are easier to build and maintain. It's no longer just a buzzword with this cheat sheet. Get to know important terms and learn more about the fundamentals of microservices in [A guide to open source for microservices][7]. - -#### [Java][8] - -This cheat sheet is ideal for beginner and intermediate Java programmers. It includes important context along with code for handling imports, variables, classes, and more. - -#### [pip][9] - -Programmers love using pip commands to help install, manage, and use Python software packages. However, pip can do much more than that. This cheat sheet will teach you how to build wheels and record packages. - -### Guides - -#### [7 essential PyPI libraries][10] - -This collection of Python tutorials will help you learn how to write extensions faster, format your code, automate tests, ensure code consistency, and more using PyPI libraries.  - -#### [Getting started with Kubernetes][11] - -In this approachable guide, author [Scott McCarty][12] uses an unexpected analogy to explain the value of Kubernetes and the steps to get started.  - -* * * - -We'd like to hear from you: Do you have an idea for a new cheat sheet or guide? Take our poll and choose from one of the options, or let us know in the comments. Check out all of our downloads [here][13]. Get alerts about new cheat sheets by [signing up][14] for our email newsletter. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/cheat-sheets-guides - -作者:[Lauren Pritchett][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/lauren-pritchett -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) -[2]: https://opensource.com/downloads/cheat-sheet-markdown -[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet -[4]: https://opensource.com/downloads/bash-cheat-sheet -[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet -[6]: https://opensource.com/downloads/microservices-cheat-sheet -[7]: https://opensource.com/article/19/11/microservices-cheat-sheet -[8]: https://opensource.com/downloads/java-cheat-sheet -[9]: https://opensource.com/downloads/pip-cheat-sheet -[10]: https://opensource.com/downloads/7-essential-pypi-libraries -[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook -[12]: https://opensource.com/users/fatherlinux -[13]: https://opensource.com/downloads/cheat-sheets -[14]: https://opensource.com/email-newsletter diff --git a/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md new file mode 100644 index 0000000000..15c10736ed --- /dev/null +++ b/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (nacyro) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (9 cheat sheets and guides to enhance your tech skills) +[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +九个提升你技术技能的备忘单和指南 +====== +用我们最新的编程备忘单和指南来为新年开局,它适合所有技能水平的人。来参加我们的投票,让我们知道你接下来想看什么! + +![a checklist for a team][1] + +对刚接触命令行的新程序员来说备忘单是完美的。然而,即便是最有经验的程序员也需要时不时地依靠参考资料。假如你刚好敲不出那个讨厌的快捷键,那么手边有个备忘单就很赞了。这是一份我们可供下载指南的综述,它将助你在 2020 年取得成功。 + +### 备忘单 + +#### [Markdown][2] + +Markdown 不仅针对程序员,任何人都可以借助它为纯文本文档增添语法和结构。此备忘单提供了使用 CommonMark 规范的 Markdown 要点。它还包括 GitHub 和 GitLab 的语法。 + +#### [Linux 权限和用户][3] + +用这个 Linux 备忘单把用户管理命令放在手边。快速学习如何增删用户、查看历史以及设置权限。 + +#### [Bash][4] + +一旦您了解了 Bash,在命令行中就蕴含了无限可能。我们的 Bash 备忘单可以帮助您更有效地使用键盘快捷键。不知不觉间,您就能易如反掌地运行脚本。 + +#### [Linux 常用命令][5] + +毫不奇怪,我们的 Linux 常用命令备忘单是如此受欢迎。这个备忘单包含了开始安装软件和导览文件系统的要点。为自己和你的同事打印出来吧。 + +#### [微服务][6] + +似乎每个人都在谈论微服务,而且理由很充分。微服务使应用程序模块化,因此更容易构建和维护。它不再只是这个备忘单上的流行语。在 [微服务开源指南][7] 中了解重要的术语并学习更多关于微服务的基础知识。 + +#### [Java][8] + +此备忘单非常适合初级和中级 Java 程序员。它包括重要的上下文以及处理导入、变量、类等的代码。 + +#### [pip][9] + +程序员爱用 pip 命令来帮助安装、管理和使用 Python 软件包。然而,pip 可以做的远不止这些。这个备忘单将教你如何构建 wheels 和 record 包。 + +### 指南 + +#### [七个不可或缺的 PyPI 库][10] + +这组 Python 教程将帮助您学习如何更快地编写扩展、格式化代码、自动化测试、确保代码一致性,以及更多使用 PyPI 库的方法。 + +#### [开始学习 Kubernetes][11] + +在这份平易近人的指南中,作者 [Scott McCarty][12] 用了一个出人意料的类比来解释 Kubernetes 的价值和上手步骤。 + +* * * + +我们想听听你的意见:你对新的备忘单或指南有什么高见?参加我们的投票,从选项中选择一个,或者在评论中告诉我们。点击 [这里][13] 查看我们所有的下载。通过 [注册][14] 我们的电子邮件通讯获得关于新备忘单的提醒。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cheat-sheets-guides + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[nacyro](https://github.com/nacyro) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://opensource.com/downloads/cheat-sheet-markdown +[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet +[4]: https://opensource.com/downloads/bash-cheat-sheet +[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[6]: https://opensource.com/downloads/microservices-cheat-sheet +[7]: https://opensource.com/article/19/11/microservices-cheat-sheet +[8]: https://opensource.com/downloads/java-cheat-sheet +[9]: https://opensource.com/downloads/pip-cheat-sheet +[10]: https://opensource.com/downloads/7-essential-pypi-libraries +[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook +[12]: https://opensource.com/users/fatherlinux +[13]: https://opensource.com/downloads/cheat-sheets +[14]: https://opensource.com/email-newsletter From 8eeac9210007c607f9b6f694d7195421fd93d1b1 Mon Sep 17 00:00:00 2001 From: nacyro Date: Fri, 3 Jan 2020 16:50:55 +0800 Subject: [PATCH 391/676] =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20191031 Advance your awk skills with two easy tutorials.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md index f84e4ebe3a..76f7a54e5f 100644 --- a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md +++ b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (nacyro) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ecf018d5142d2ccf3daf2dee7d58360c6059fef6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 17:44:07 +0800 Subject: [PATCH 392/676] PRF @geekpi --- ...h the Linux Equinox Desktop Environment.md | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md index cfa8489c40..84c9ed2b1e 100644 --- a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md +++ b/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Chill out with the Linux Equinox Desktop Environment) @@ -9,20 +9,20 @@ 轻松使用 Linux Equinox 桌面环境 ====== -本文是 24 天 Linux 桌面特别系列的一部分。EDE 不是最迷人、最小或效率最高的桌面。但它的柔和、静音让人平静,它让人感到熟悉舒缓,它的图标主题有趣。 -![Linux penguin at the north pole beside an igloo][1] -我还没有认真用过 Fast Light Toolkit([FLTK] [2]),但我是 C++ GUI 工具箱的粉丝,它非常易于学习,并且即使跨更新时也很可靠。当我发现有一个用 FLTK 构建的桌面环境时,我很想尝试一下,并且我很快为我的决定感到高兴。[Equinox 桌面环境(EDE)][3] 是用 C++ 和 FLTK 为 Unix 桌面编写的快速、简单的桌面。它使用通用的桌面约定,因此外观和感觉都非常熟悉,并且在使用几天后,我发现它的简单性提供了我所喜欢的最低限度的优雅。 +> 本文是 24 天 Linux 桌面特别系列的一部分。EDE 不是最迷人、最小或效率最高的桌面。但它的柔和、安宁让人平静,它让人感到熟悉舒缓,它的图标主题也很有趣。 + +我还没有认真用过 Fast Light Toolkit([FLTK] [2]),但我是 C++ GUI 工具箱的粉丝,它非常易于学习,并且即使进行更新也很可靠。当我发现有一个用 FLTK 构建的桌面环境时,我很想尝试一下,并且我很快为我的决定感到高兴。[Equinox 桌面环境(EDE)][3] 是用 C++ 和 FLTK 为 Unix 桌面编写的快速、简单的桌面环境。它使用通用的桌面约定,因此外观和感觉都非常熟悉,并且在使用几天后,我发现它的简单性提供了我所喜欢的最低限度的优雅。 ![EDE desktop][4] ### 安装 EDE -你可能会发现 EDE 包含在发行版的软件仓库中,但你也可以在它的 [SourceForge 仓库][5]中找到它。如果你已经在运行其他桌面,你可以安全地在同一系统上安装 EDE,因为它仅带来了一些额外的应用,这些应用程序特定于 EDE,因此它们不会妨碍你的其他桌面。 +你可能会发现 EDE 包含在发行版的软件仓库中,但你也可以在它的 [SourceForge 仓库][5]中找到它。如果你已经在运行其他桌面环境,你可以安全地在同一系统上安装 EDE,因为它仅带来了一些额外的应用,这些应用程序特定于 EDE,因此它们不会妨碍你的其他桌面。 -EDE 只是桌面,它使用 [Pekwm][6] 窗口管理器来处理布局。 +EDE 只是桌面环境,它使用 [Pekwm][6] 窗口管理器来处理布局。 -安装 EDE 之后,注销当前的桌面会话,以便你可以登录到新的会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面,因此你必须在登录之前覆盖该桌面。 +安装 EDE 之后,注销当前的桌面会话,以便你可以登录到新的会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,取决于你的设置)将继续登录到以前的桌面环境,因此你必须在登录之前覆盖该桌面环境。 在 GDM 中: @@ -48,14 +48,12 @@ EDE 的布局恰恰是大多数人在桌面上所期望的布局:左侧的应 EDE 有一个小的配置应用,可用于设置一些简单的选项: - * 背景和图标设置 -  * 屏幕保护程序设置 -  * 时间和时钟 -  * 系统铃声 -  * 键盘 -  * 偏好应用 - - +* 背景和图标设置 +* 屏幕保护程序设置 +* 时间和时钟 +* 系统铃声 +* 键盘 +* 偏好应用 ![EDE Configuration Place][10] @@ -63,7 +61,7 @@ EDE 的功能不多。没有文件管理器、文本编辑器、绘画程序或 ### EDE 总结 -我发现 EDE 至少作为一种”假日“桌面而言,它的简单性令人舒适。它值得一看。它不是最迷人的桌面,也不是最小的、也不是最高效的。但它的柔和、静音让人平静,它让人感到熟悉舒缓,并且它的图标主题充满乐趣和生气。EDE 是一个以其缓慢而稳定的步调而自豪的桌面。 +我发现 EDE 至少作为一种“假日”桌面而言,它的简单性令人舒适。它值得一看。它不是最迷人的桌面,也不是最精简的、也不是最高效的。但它的柔和、安宁让人平静,它让人感到熟悉舒缓,并且它的图标主题充满乐趣和生气。EDE 是一个以其缓慢而稳定的步调而自豪的桌面。 如果你想放松心情使用一个干净和令人愉悦的界面,请试试 EDE。 @@ -74,7 +72,7 @@ via: https://opensource.com/article/19/12/ede-linux-desktop 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ebdcc4000c43d02a6b15df7922461277b0433027 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 17:44:37 +0800 Subject: [PATCH 393/676] PUB @geekpi https://linux.cn/article-11745-1.html --- ...24 Chill out with the Linux Equinox Desktop Environment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191224 Chill out with the Linux Equinox Desktop Environment.md (98%) diff --git a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md b/published/20191224 Chill out with the Linux Equinox Desktop Environment.md similarity index 98% rename from translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md rename to published/20191224 Chill out with the Linux Equinox Desktop Environment.md index 84c9ed2b1e..c6a96672d7 100644 --- a/translated/tech/20191224 Chill out with the Linux Equinox Desktop Environment.md +++ b/published/20191224 Chill out with the Linux Equinox Desktop Environment.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11745-1.html) [#]: subject: (Chill out with the Linux Equinox Desktop Environment) [#]: via: (https://opensource.com/article/19/12/ede-linux-desktop) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 965419e2bece4108bb02ca647ec930b4da6bc229 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Fri, 3 Jan 2020 22:08:52 +0800 Subject: [PATCH 394/676] translating by lxbwolf --- sources/tech/20200101 5 predictions for Kubernetes in 2020.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md index 2032983b78..99723632b8 100644 --- a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md +++ b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 09736cf9fdd2ade647f8c89c1399dfa439912f4c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 3 Jan 2020 23:30:13 +0800 Subject: [PATCH 395/676] PUB --- .../20191227 10 resources to boost your Git skills.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20191227 10 resources to boost your Git skills.md (100%) diff --git a/translated/tech/20191227 10 resources to boost your Git skills.md b/published/20191227 10 resources to boost your Git skills.md similarity index 100% rename from translated/tech/20191227 10 resources to boost your Git skills.md rename to published/20191227 10 resources to boost your Git skills.md From d99886fd6152b9885d359aaa2322db2e15faf2f8 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Fri, 3 Jan 2020 23:31:14 +0800 Subject: [PATCH 396/676] Translating by MjSeven --- .../tech/20191129 How to write a Python web API with Django.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191129 How to write a Python web API with Django.md b/sources/tech/20191129 How to write a Python web API with Django.md index ed16fc40f8..38acb243cd 100644 --- a/sources/tech/20191129 How to write a Python web API with Django.md +++ b/sources/tech/20191129 How to write a Python web API with Django.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 461886a295a1e4ba1f9d14777053ca22e48d0a0e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:55:34 +0800 Subject: [PATCH 397/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20Tracki?= =?UTF-8?q?ng=20Translations=20with=20Transtats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 Tracking Translations with Transtats.md --- ...03 Tracking Translations with Transtats.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20200103 Tracking Translations with Transtats.md diff --git a/sources/tech/20200103 Tracking Translations with Transtats.md b/sources/tech/20200103 Tracking Translations with Transtats.md new file mode 100644 index 0000000000..b11a56be66 --- /dev/null +++ b/sources/tech/20200103 Tracking Translations with Transtats.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tracking Translations with Transtats) +[#]: via: (https://fedoramagazine.org/tracking-translations-with-transtats/) +[#]: author: (Sundeep Anand https://fedoramagazine.org/author/suanand/) + +Tracking Translations with Transtats +====== + +![][1] + +Translation is an important step in software localization which helps make software more popular globally, and impacts international user experience. In recent years, localization processes have been evolving worldwide to become more continuous, faster, efficient with automation. In Fedora, the development of the [Zanata][2] platform and its plugins, then [Transtats][3], and now the migration to the [Weblate][4] platform are part of this common ongoing goal. The localization of a desktop OS like Fedora is highly complex because it depends on many factors of the individual upstream projects which are packaged in Fedora. For example, different translation timelines, resources, and tooling. + +### What is Transtats? + +Transtats is a web application which tries to tie up upstream repositories, translation platforms, build system, and product release schedule together to solve problems of mismatch, out-of-sync conditions and to assist the timely packaging of quality translations. Actually, it collects translation data, analyzes them, and creates meaningful representations. + +Fedora Transtats is hosted at + +![][5] + +### How to see the translation status of my package? + +Just select **Packages** tab from left hand side navigation bar. This takes us to the packages list view. Then, search for the package and click on its name. + +![][6] + +For example _anaconda_. On package details page, locate following: + +![][7] + +Here, we have translation statistics from translation platform: [Zanata][8] and [Koji][9] build system. Syncs with the platform and build system are scheduled, which update differences periodically. Languages in red color indicate that there are translated strings remaining in the Translation Platform to be pulled and packaged, whereas, blue denote translated messages could not make 100% in the built package. + +### String breakage (or changes?) + +In translation of software packages, one of the challenges is to prevent string breakage. Package maintainers should strive to abide by the scheduled Fedora release String Freeze. However, in some circumstances it could be necessary to break the string freeze and to inform the translation team on the mailing list. As well as, to update latest translation template (POT) file in the translation platform. Just in case these actions seem missing – translators may get new strings to translate very late or the application may have some strings untranslated. In the worst case, an outdated translation string mismatch may result in a crash. Sync and automation pipelines are there to prevent this, nevertheless it depends on the push or pull methods followed by package developers or maintainers. + +To deal with the same context, we can use a job template in Transtats to detect this string change – particularly useful after string freeze in Fedora release schedule. This would be really helpful for the folks who look for packaging translations without string breakage, keeping translation template (POT) file in sync with translation platform, and testing localized form of the application for translation completeness to back trace. + +### How to detect string changes? + +One of the options in **Jobs** tab is ‘YML based Jobs’. Where we can see available job templates. + +![][10] + +The jobs framework executes all the tasks mentioned in the YAML, create appropriate logs and store results. Track String Change job basically: + + 1. Clones the source repository of respective package. + 2. Tries to generate translation template (POT) file. + 3. Downloads POT file from respective translation platform. + 4. And, finds differences between both the POT files. + + + +_Actually, Transtats maintains mapping of upstream repository, Translation Platform project and respective build tag for every package._ + +![][11] + +Let’s take a closer look into this YAML. We can provide value for %PACKAGE_NAME% and %RELEASE_SLUG% in the next step – **Set Values**! For example: _anaconda_ and _fedora-32_. Furthermore, a couple of things seek attention are: + + * In case the upstream software repository maintains separate git branch for fedora release, please edit ‘branch: master’ to ‘branch: <fedora-release-branch>’ + * In ‘generate’ block, mention the command to generate POT file. Default one should work for ‘intltool-update’ only, however, many packages do have their own. + * A few packages may have gettext domain name different than that of package name. If this is the case, mention the gettext domain too. + + + +As soon as the job is triggered, logs should be populated. If this is not a _scratch_ run, a unique URL shall also be created at the end. + +![][12] + +Left hand side is the input YAML and right hand side is respective log for each task. Here we can find the differences and figure out string mismatch. + +![][13] + +In [Transtats][14], we can create solutions to different problems in the form of job templates. And, scheduling of these jobs could be a step towards automation. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/tracking-translations-with-transtats/ + +作者:[Sundeep Anand][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/suanand/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/12/transtats-816x345.png +[2]: http://zanata.org/ +[3]: http://transtats.org/ +[4]: https://weblate.org/en/ +[5]: https://fedoramagazine.org/wp-content/uploads/2019/12/transtats-landing-1-1024x450.png +[6]: https://fedoramagazine.org/wp-content/uploads/2019/12/anaconda-pkg.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/12/anaconda-details.png +[8]: https://fedora.zanata.org/project/view/anaconda +[9]: https://koji.fedoraproject.org/koji +[10]: https://fedoramagazine.org/wp-content/uploads/2019/12/job-templates-1024x361.png +[11]: https://fedoramagazine.org/wp-content/uploads/2019/12/strchgjob.png +[12]: https://fedoramagazine.org/wp-content/uploads/2019/12/string-change-job-log-1024x478.png +[13]: https://fedoramagazine.org/wp-content/uploads/2019/12/string-change-1024x614.png +[14]: https://github.com/transtats/transtats From 647cd510fe8700b5219e8bfb6e3382026cf6f6b8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:57:40 +0800 Subject: [PATCH 398/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200104=20Shocki?= =?UTF-8?q?ng!=20EA=20is=20Permanently=20Banning=20Linux=20Gamers=20on=20B?= =?UTF-8?q?attlefield=20V?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md --- ...y Banning Linux Gamers on Battlefield V.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md diff --git a/sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md b/sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md new file mode 100644 index 0000000000..b0d8bb3874 --- /dev/null +++ b/sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Shocking! EA is Permanently Banning Linux Gamers on Battlefield V) +[#]: via: (https://itsfoss.com/ea-banning-linux-gamers/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Shocking! EA is Permanently Banning Linux Gamers on Battlefield V +====== + +Only when I thought that [EA][1] as a game company might be getting better after [its decision to make its games available on Steam][2] – but it looks like that isn’t the case. + +In a [Reddit thread][3], a lot of Linux players seem to complain about getting banned by FairFight (which is the server-side anti-cheat engine used for BF V) just because they chose to play Battlefield V (BF V) on [Linux using Wine][4]. + +![][5] + +### Is this a widespread issue? + +Unfortunately, it seems to be the case with a number of Linux players using Wine to play Battlefield V on Linux. + +You can also find users on [Lutris Gaming forums][6] and [Battlefield forums][7] talking about it. + +Of course, the userbase on Linux playing Battlefield V isn’t huge – but it still matters, right? + +### What’s exactly the issue here? + +It looks like EA’s anti-cheat tech considers [DXVK][8] (Vulkan-based implementation of DirectX which tries to solve compatibility issues) as cheating. + +So, basically, the compatibility layer that is being utilized to make it possible to run Battlefield V is being detected as a modified file through which you’re “**potentially**” cheating. + +![Battlefield V on Lutris][9] + +Even though this could be an innocent problem for the anti-cheat engine but EA does not seem to acknowledge that at all. + +Here’s what they respond with when one of the players wrote an email to EA in order to lift the ban: + +> After thoroughly investigating your account and concern, we found that your account was actioned correctly and will not remove this sanction from your account. + +Also, with all this going on, [Lutris Gaming][10] seems to be quite furious on EA’s behavior with the permanent bans: + +> It has come to our attention that several Battlefield 5 players have recently been banned for playing on Linux, and that EA has chosen not to revert these wrongful punishments. Due to this, we advise to refrain from playing any multiplayer games published by [@EA][11] in the future. +> +> — Lutris Gaming (@LutrisGaming) [January 2, 2020][12] + +### Not just Battlefield V, it’s the same with Destiny 2 + +As pointed by a Redditor in the same thread, Bungie also happens to consider Wine as an emulator (which is against their policy) and has banned players on Linux a while back. + +### EA needs to address the issue + +_We have reached out to EA for a comment on the issue_. _And, we’re still waiting for a response._ + +I shall update the article if we have an official response from EA. However, considering Blizzard as an example, they should actually work on fixing the issue and [reverse the bans on players using Linux][13]. + +I know that BF V does not offer native Linux support – but supporting the compatibility layer and not considering it as cheating would allow Linux users to experience the game which they rightfully own (or considering to purchase). + +What are your thoughts on this? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ea-banning-linux-gamers/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.ea.com/ +[2]: https://thenextweb.com/gaming/2019/10/29/ea-games-are-coming-back-to-steam-but-you-still-need-origin/ +[3]: https://www.reddit.com/r/linux/comments/ej3q2p/ea_is_permanently_banning_linux_players_on/ +[4]: https://itsfoss.com/install-latest-wine/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/reddit-thread-ea.jpg?ssl=1 +[6]: https://forums.lutris.net/t/ea-banning-dxvk-on-battlefield-v/7810 +[7]: https://forums.battlefield.com/en-us/discussion/197938/ea-banning-dxvk-on-battlefield-v-play-linux +[8]: https://github.com/doitsujin/dxvk +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/battlefield-v-lutris-gaming.png?ssl=1 +[10]: https://lutris.net/ +[11]: https://twitter.com/EA?ref_src=twsrc%5Etfw +[12]: https://twitter.com/LutrisGaming/status/1212827248430059520?ref_src=twsrc%5Etfw +[13]: https://www.altchar.com/game-news/blizzard-unbans-overwatch-players-who-used-linux-os-agF9y0G2gWjn From fd094955beb7b002093e38de46058c3b6730236e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:58:13 +0800 Subject: [PATCH 399/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20What?= =?UTF-8?q?=20you=20need=20to=20know=20about=20Rust=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 What you need to know about Rust in 2020.md --- ...hat you need to know about Rust in 2020.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20200103 What you need to know about Rust in 2020.md diff --git a/sources/tech/20200103 What you need to know about Rust in 2020.md b/sources/tech/20200103 What you need to know about Rust in 2020.md new file mode 100644 index 0000000000..ddb91f42ea --- /dev/null +++ b/sources/tech/20200103 What you need to know about Rust in 2020.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What you need to know about Rust in 2020) +[#]: via: (https://opensource.com/article/20/1/rust-resources) +[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) + +What you need to know about Rust in 2020 +====== +While many programmers have long used Rust for hobby projects, in 2019, +the language attracted support from major technology companies, as the +top Rust articles on Opensource.com explain. +![Person using a laptop][1] + +[Rust][2] has drawn plenty of attention from programmers on sites like Hacker News for a while. While many have long [loved using the language][3] for hobby projects, it didn't start catching on in industry until 2019, when this really started to change. + +Over the last year, many large companies, including [Microsoft][4], [Facebook][5], and [Intel][6], came out in support of Rust, and many [smaller ones][7] took notice. As the first emcee at [RustFest][8], the largest Rust conference in Europe, in 2016, I didn't meet a single person professionally using Rust who didn't work at Mozilla. Three years later, it seemed like every other person I talked to at RustFest 2019 was using Rust in their day job for another company, whether as a game developer, a backend engineer at a bank, a creator of developer tools, or something else. + +In 2019, Opensource.com also played a role by reporting on the growing interest in Rust. In case you missed them, here are the top articles about Rust on Opensource.com over the last year. + +### Building the virtualization stack of the future with rust-vmm + +Amazon's [Firecracker][9] is the virtualization technology that powers AWS Lambda and Fargate, and it is written completely in Rust. One of the technology's authors, Andreea Florescu, offers insight into Firecracker and its related technologies in [_**Building the virtualization stack of the future with rust-vmm**_][10]. + +Firecracker started life as a fork of Google's [CrosVM][11] but quickly diverged due to the differing needs of the two projects. Despite this, there are many common pieces that are best shared across the project and in any other virtual machine manager (VMM) written in Rust. With that in mind, the [rust-vmm][12] project started as a way for Amazon and Google, as well as Intel and Red Hat, to share common Rust "crates" (i.e., packages) with each other and the rest of the open source community. These include interfaces to KVM (Linux virtualization APIs), Virtio device support, and a kernel loader. + +It's truly amazing to see some of the titans of the software industry working together around a common technology stack written in Rust. Given this and other partnerships around [technology stacks written in Rust][13], I wouldn't be surprised to see more of this in 2020. + +### Why to choose Rust as your next programming language + +Adopting a new language, especially at a large company with a long-established technology stack, is no easy task. I had the pleasure of writing [_**Why to choose Rust as your next programming language**_][14] about how Microsoft is looking into adopting Rust when so many other interesting programming languages have not been considered. + +Choosing a programming language involves many different criteria—from technical to organizational to even emotional. Some of these criteria are easier to measure than others. For instance, it's easier to understand the costs of technical changes, like adapting build systems and building new tooling, than it is to understand organizational or emotional issues like how productive or happy developers will be using this new language. What's more, the easy-to-measure criteria are often cost-related, while the hard-to-measure criteria are often benefits-oriented. This often leads to costs getting more weight in the decision-making process, even though it's not necessarily true that the costs outweigh the benefits—it's just that they're easier to measure. This makes it unlikely for a company to adopt a new language. + +However, one of Rust's largest benefits is how easy it is to measure its ability to write secure yet performant systems software. Given that 70% of severe vulnerabilities at Microsoft are due to memory-safety issues that Rust is designed to prevent, and that these issues cost the company billions of dollars per year, it's easy to measure and understand the benefits of adopting the language. + +Whether full-scale adoption of Rust at Microsoft will happen remains to be seen, but Rust's future is bright if only for the fact that is has a clear and measurable benefit over existing technologies. + +### Rust in 2020 + +Rust is really starting to gain traction in industry. Although it still has a long way to go to reach the popularity of languages like C++. I expect more companies to start adopting Rust in 2020. The Rust community must now set its sights on welcoming people and companies into the community while ensuring that the things that have driven the language to this point remain in place. + +Rust is more than just a compiler and a set of libraries. It's a group of people who care about making systems programming easy, safe, and fun. The coming year will be critical in Rust's journey from a hobbyist language to one of the main languages used in the software industry. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/rust-resources + +作者:[Ryan Levick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ryanlevick +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: http://rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://youtu.be/o01QmYVluSw +[5]: https://youtu.be/kylqq8pEgRs +[6]: https://youtu.be/l9hM0h6IQDo +[7]: https://oxide.computer/blog/introducing-the-oxide-computer-company/ +[8]: https://rustfest.eu +[9]: https://firecracker-microvm.github.io/ +[10]: https://opensource.com/article/19/3/rust-virtual-machine +[11]: https://chromium.googlesource.com/chromiumos/platform/crosvm/ +[12]: https://github.com/rust-vmm +[13]: https://bytecodealliance.org/ +[14]: https://opensource.com/article/19/10/choose-rust-programming-language From 92e78b5fd087fa09872902c82ca0c0e62dd6defa Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:58:39 +0800 Subject: [PATCH 400/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20My=20R?= =?UTF-8?q?aspberry=20Pi=20retrospective:=206=20projects=20and=20more?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md --- ...y Pi retrospective- 6 projects and more.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md diff --git a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md new file mode 100644 index 0000000000..b68e15a924 --- /dev/null +++ b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Raspberry Pi retrospective: 6 projects and more) +[#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +My Raspberry Pi retrospective: 6 projects and more +====== +See what I've done with the fun, educational, and useful Raspberry Pi. +![Raspberry Pi 4 board, posterized filter][1] + +Historically and theoretically speaking, a decade, a century, or a millennium starts when the clock turns midnight on January 1 of the year one of its decimal order. For example, the 20th century started on January 1, 1901, not on January 1, 1900. The reason for this is simple: there is no year 0 in our modern calendar, so these periods of time start on year 1 (using the Gregorian calendar). But that's not how we refer to time periods colloquially and culturally; for example, when we mention '80s music or movies, we're talking about the period from 1980 to 1989. + +The recently passed 2010s, I could argue, was the decade of the cloud, social media, mobile technology, and the Internet of Things (IoT), which includes the [Raspberry Pi][2]. Recently, _Time_ magazine called the Raspberry Pi one of the [10 best gadgets of the past decade][3]. And I very much agree. + +The original Raspberry Pi launched in 2012, and it took me a couple of years to jump on the bandwagon and ride on the Pi-train. But since then, I have built many fun educational projects at home and even documented a few of them for Opensource.com. + +### The Christmas light trilogy + +I wrote three articles over three years that explored controlling Christmas lights with the Raspberry Pi and the open source project LightShowPi. The first article, [_Create your own musical light show with Raspberry Pi_][4], was a mix between a very basic introduction to electronics development and building a Christmas light show. The second article, [_SSH into your Christmas tree with Raspberry Pi_][5], went a little deeper into controlling the lights with things such as remote management and electronic buttons. The last chapter of the trilogy, [_Set the holiday mood with your Raspberry Pi_][6], reviewed changes introduced in the LightShowPi project in the prior year. + +### DIY projects + +Over the years, I've turned my Raspberry Pi into several useful devices. One time, I turned the Pi into a [music-playing device with the Pi MusicBox][7], which allows you to plug your favorite music streaming services into a common web interface and play your favorite tunes around the house. + +Making the Raspberry Pi into a [mobile video recording device][8] was another DIY project I put together. It required a few extra pieces of hardware, like a touchscreen, a Pi Camera, and a battery pack, but it worked. One of the biggest drawbacks of this setup was the small amount of memory available on the Pi at the time. I think the capabilities of this little portable camera could be a lot better if I re-did it on a Raspberry Pi 4 with 4GB of RAM. This may be a project to revisit in 2020. + +Another small project I built, a [digital clock for my living room][9], used the small Adafruit PiTFT screen. As simple as this project was, it probably was the one that I used the longest. That clock stood by my TV set for over a year, running 24 hours a day… until the day the screen burned out. + +### The Pi Day series + +Last but not least, in 2019, I contributed [14 articles in 14 days][10] leading up to Pi Day (March 14). This was by far the most challenging writing project I've ever done, but it allowed me to cover many different topics and hopefully expose readers to even more ideas about the versatility of the Raspberry Pi. + +### To infinity and beyond + +I don't know anyone in the Raspberry Pi Foundation, so I don't have any special access to its roadmaps and future plans. I could (but I won't) speculate on what the future holds for the brand and its devices that have allowed so many people of different social statuses around the world to expand their knowledge about computer science, electronics, and open source development. All I hope is for the foundation's management to stay true to its vision and mission and continue making affordable technology for people everywhere. + +The 2010s are over, and what a sweet decade it was. To me, it smelled like pie, raspberry pie. + +Having recently co-authored a book about building things with the Raspberry Pi ( Raspberry Pi Hacks... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/raspberry-pi-best + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi4_board_hardware.jpg?itok=KnFU7NvR (Raspberry Pi 4 board, posterized filter) +[2]: https://www.raspberrypi.org/ +[3]: https://time.com/5745302/best-gadgets-of-the-2010s-decade/?utm_source=reddit.com +[4]: https://opensource.com/life/15/2/music-light-show-with-raspberry-pi +[5]: https://opensource.com/life/15/12/ssh-your-christmas-tree-raspberry-pi +[6]: https://opensource.com/article/18/12/lightshowpi-raspberry-pi +[7]: https://opensource.com/life/15/3/pi-musicbox-guide +[8]: https://opensource.com/life/15/9/turning-raspberry-pi-portable-streaming-camera +[9]: https://opensource.com/article/17/7/raspberry-pi-clock +[10]: https://opensource.com/article/19/3/happy-pi-day From 1a8473c1a5c9b7fb65bf661589f5845ca0d8bce6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:59:05 +0800 Subject: [PATCH 401/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20Introd?= =?UTF-8?q?ucing=20the=20guide=20to=20inter-process=20communication=20in?= =?UTF-8?q?=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md --- ...to inter-process communication in Linux.md | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md diff --git a/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md b/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md new file mode 100644 index 0000000000..c0b7eee940 --- /dev/null +++ b/sources/tech/20200103 Introducing the guide to inter-process communication in Linux.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introducing the guide to inter-process communication in Linux) +[#]: via: (https://opensource.com/article/20/1/inter-process-communication-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Introducing the guide to inter-process communication in Linux +====== +This free eBook gives seasoned and occasional coders insight into the +core concepts and mechanisms of inter-process communication (IPC) in +Linux. +![Inter-process Communication in Linux][1] + +Getting one software process to talk to another software process is a delicate balancing act. It can be a vital function for an application, though, so it's a problem any programmer embarking on a complex project has to solve. Whether your application needs to kick off a job being handled by someone else's software; to monitor an action being performed by a peripheral or over a network; or to detect a signal from some other source, when your software relies on something outside of its own code to know what to do next or when to do it, you need to think about inter-process communication (IPC). + +The Unix operating system accounted for this long ago, possibly because of an early expectation that software would originate from diverse sources. In the same tradition, Linux provides many of the same interfaces for IPC and some new ones. The Linux kernel features several IPC methods, and the [util-linux package][2] contains the **ipcmk**, **ipcrm**, **ipcs**, and **lsipc** commands for monitoring and managing IPC messages. + +### Show IPC information + +Before experimenting with IPC, you should know what IPC facilities are already on your system. The **lsipc** command provides that information. + + +``` +RESOURCE DESCRIPTION               LIMIT  USED  USE% +MSGMNI   Number of message queues  32000     0 0.00% +MSGMAX   Max size of message (byt.. 8192     -     - +MSGMNB   Default max size of queue 16384     -     - +SHMMNI   Shared memory segments     4096    79 1.93% +SHMALL   Shared memory pages       184[...] 25452 0.00% +SHMMAX   Max size of shared memory 18446744073692774399 +SHMMIN   Min size of shared memory     1     -     - +SEMMNI   Number of semaphore ident 32000     0 0.00% +SEMMNS   Total number of semaphore 1024000.. 0 0.00% +SEMMSL   Max semaphores per semap  32000     -     - +SEMOPM   Max number of operations p  500     -     - +SEMVMX   Semaphore max value       32767     -     - +``` + +You may notice that this sample listing includes three different types of IPC mechanisms, each available in the Linux kernel: messages (MSG), shared memory (SHM), and semaphores (SEM). You can view current activity in each of those subsystems with the **ipcs** command: + + +``` +$ ipcs + +\------ Message Queues Creators/Owners --- +msqid     perms     cuid      cgid  [...] + +\------ Shared Memory Segment Creators/Owners +shmid     perms    cuid    cgid  [...] +557056    700      seth    users [...] +3571713   700      seth    users [...] +2654210   600      seth    users [...] +2457603   700      seth    users [...] + +\------ Semaphore Arrays Creators/Owners --- +semid     perms     cuid      cgid  [...] +``` + +This shows that there currently are no messages or semaphore arrays, but a number of shared memory segments are in use. + +There's a simple example you can perform on your system so you can see one of these systems at work. It involves some C code, so you must have build tools on your system. The names of the packages you must install to be able to build from source code vary depending on your distro, so refer to your documentation for specifics. For example, on Debian-based distributions, you can learn about build requirements on the [BuildingTutorial][3] section of the wiki, and on Fedora-based distributions, refer to the [Installing software from source][4] section of the docs. + +### Create a message queue + +Your system has a default message queue already, but you can create your own using the **ipcmk** command: + + +``` +$ ipcmk --queue +Message queue id: 32764 +``` + +Write a simple IPC message sender, hard-coding in the queue ID for simplicity: + + +``` +#include <sys/ipc.h> +#include <sys/msg.h> +#include <stdio.h> +#include <string.h> + +struct msgbuffer { +  char text[24]; +} message; + +int main() { +    int msqid = 32764; +    strcpy(message.text,"opensource.com"); +    msgsnd(msqid, &message, sizeof(message), 0); +    printf("Message: %s\n",message.text); +    printf("Queue: %d\n",msqid); +    return 0; +        } +``` + +Compile the application and run it: + + +``` +$ gcc msgsend.c -o msg.bin +$ ./msg.bin +Message: opensource.com +Queue: 32769 +``` + +You just sent a message to your message queue. You can verify that with the **ipcs** command, using the **\--queue** option to limit output to the message queue: + + +``` +$ ipcs -q + +\------ Message Queues -------- +key        msqid   owner  perms  used-bytes  messages +0x7b341ab9 0       seth   666    0          0 +0x72bd8410 32764   seth   644    24         1 +``` + +You can also retrieve those messages with: + + +``` +#include <sys/ipc.h> +#include <sys/msg.h> +#include <stdio.h> + +struct msgbuffer { +    char text[24]; +} message; + +int main() { +    int msqid = 32764; +    msgrcv(msqid, &message, sizeof(message),0,0); +    printf("\nQueue: %d\n",msqid); +    printf("Got this message: %s\n", message.text); +    msgctl(msqid,IPC_RMID,NULL); +    return 0; +``` + +Compile and run with: + + +``` +$ gcc get.c -o get.bin +$ ./get.bin + +Queue: 32764 +Got this message: opensource.com +``` + +### Download [the eBook][5] + +This is just one example of the lessons available in Marty Kalin's [A guide to inter-process communication in Linux][5], the latest free (and Creative Commons) downloadable eBook from Opensource.com. In just a few short lessons, you will learn about POSIX methods of IPC from message queues, shared memory and semaphores, sockets, signals, and much more. Sit down with Marty's book, and you'll emerge a better-informed programmer. But it isn't just for seasoned coders—if all you ever write are shell scripts, there's plenty of practical knowledge about pipes (named and unnamed) and shared files, as well as important concepts you need to know when you use a shared file or an external message queue. + +If you're interested in making great software that's written to be dynamic and system-aware, you need to know about IPC. Let [this book][5] be your guide. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/inter-process-communication-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_inter-process_communication_linux_520x292.png?itok=hPoen7oI (Inter-process Communication in Linux) +[2]: https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/ +[3]: https://wiki.debian.org/BuildingTutorial +[4]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html +[5]: https://opensource.com/downloads/guide-inter-process-communication-linux From 24abcbc7833e4a91ce122e8f552d5dd7d19314ec Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 4 Jan 2020 00:59:46 +0800 Subject: [PATCH 402/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200103=20Add=20?= =?UTF-8?q?scorekeeping=20to=20your=20Python=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200103 Add scorekeeping to your Python game.md --- ...03 Add scorekeeping to your Python game.md | 640 ++++++++++++++++++ 1 file changed, 640 insertions(+) create mode 100644 sources/tech/20200103 Add scorekeeping to your Python game.md diff --git a/sources/tech/20200103 Add scorekeeping to your Python game.md b/sources/tech/20200103 Add scorekeeping to your Python game.md new file mode 100644 index 0000000000..d2055cc067 --- /dev/null +++ b/sources/tech/20200103 Add scorekeeping to your Python game.md @@ -0,0 +1,640 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Add scorekeeping to your Python game) +[#]: via: (https://opensource.com/article/20/1/add-scorekeeping-your-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Add scorekeeping to your Python game +====== +In the tenth article in this series on programming with Python's Pygame +module, display your game player's score when they collect loot or take +damage. +![connecting yellow dots in a maze][1] + +This is part 10 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: + + * [Learn how to program in Python by building a simple dice game][4] + * [Build a game framework with Python using the Pygame module][5] + * [How to add a player to your Python game][6] + * [Using Pygame to move your game character around][7] + * [What's a hero without a villain? How to add one to your Python game][8] + * [Simulate gravity in your Python game][9] + * [Add jumping to your Python platformer game][10] + * [Enable your Python game player to run forward and backward][11] + * [Using Python to set up loot in Pygame][12] + + + +If you've followed along with this series, you've learned all the essential syntax and patterns you need to create a video game with Python. However, it still lacks one vital component. This component isn't important just for programming games in Python; it's something you must master no matter what branch of computing you explore: Learning new tricks as a programmer by reading a language's or library's documentation. + +Luckily, the fact that you're reading this article is a sign that you're comfortable with documentation. For the practical purpose of making your platform game more polished, in this article, you will add a score and health display to your game screen. But the not-so-secret agenda of this lesson is to teach you how to find out what a library offers and how you can use new features. + +### Displaying the score in Pygame + +Now that you have loot that your player can collect, there's every reason to keep score so that your player sees just how much loot they've collected. You can also track the player's health so that when they hit one of the enemies, it has a consequence. + +You already have variables that track score and health, but it all happens in the background. This article teaches you to display these statistics in a font of your choice on the game screen during gameplay. + +### Read the docs + +Most Python modules have documentation, and even those that do not can be minimally documented by Python's Help function. [Pygame's main page][13] links to its documentation. However, Pygame is a big module with a lot of documentation, and its docs aren't exactly written in the same approachable (and friendly and elucidating and helpful) narrative style as articles on Opensource.com. They're technical documents, and they list each class and function available in the module, what kind of inputs each expects, and so on. If you're not comfortable referring to descriptions of code components, this can be overwhelming. + +The first thing to do, before bothering with a library's documentation, is to think about what you are trying to achieve. In this case, you want to display the player's score and health on the screen. + +Once you've determined your desired outcome, think about what components are required for it. You can think of this in terms of variables and functions or, if that doesn't come naturally to you yet, you can think generically. You probably recognize that displaying a score requires some text, which you want Pygame to draw on the screen. If you think it through, you might realize that it's not very different from rendering a player or loot or a platform on screen. + +Technically, you _could_ use graphics of numbers and have Pygame display those. It's not the easiest way to achieve your goal, but if it's the only way you know, then it's a valid way. However, if you refer to Pygame's docs, you see that one of the modules listed is **font**, which is Pygame's method for making printing text on the screen as easy as typing. + +### Deciphering technical documentation + +The **font** documentation page starts with **pygame.font.init()**, which it lists as the function that is used to initialize the font module. It's called automatically by **pygame.init()**, which you already call in your code. Once again, you've reached a point that that's technically _good enough_. While you don't know _how_ yet, you know that you _can_ use the **pygame.font** functions to print text on the screen. + +If you read further, however, you find that there's yet an even better way to print fonts. The **pygame.freetype** module is described in the docs this way: + +> The pygame.freetype module is a replacement for pygame.fontpygame module for loading and rendering fonts. It has all of the functionality of the original, plus many new features. + +Further down the **pygame.freetype** documentation page, there's some sample code: + + +``` +import pygame +import pygame.freetype +``` + +Your code already imports Pygame, but modify your **import** statements to include the Freetype module: + + +``` +import pygame +import sys +import os +import pygame.freetype +``` + +### Using a font in Pygame + +From the description of the font modules, it's clear that Pygame uses a font, whether it's one you provide or a default font built into Pygame, to render text on the screen. Scroll through the **pygame.freetype** documentation to find the **pygame.freetype.Font** function: + + +``` +pygame.freetype.Font +Create a new Font instance from a supported font file. + +Font(file, size=0, font_index=0, resolution=0, ucs4=False) -> Font + +pygame.freetype.Font.name +  Proper font name. + +pygame.freetype.Font.path +  Font file path + +pygame.freetype.Font.size +  The default point size used in rendering +``` + +This describes how to construct a font "object" in Pygame. It may not feel natural to you to think of a simple object onscreen as the combination of several code attributes, but it's very similar to how you built your hero and enemy sprites. Instead of an image file, you need a font file. Once you have a font file, you can create a font object in your code with the **pygame.freetype.Font** function and then use that object to render text on the screen. + +Because not everyone in the world has the exact same fonts on their computers, it's important to bundle your chosen font with your game. To bundle a font, first create a new directory in your game folder, right along with the directory you created for your images. Call it **fonts**. + +Even though several fonts come with your computer, it's not legal to give those fonts away. It seems strange, but that's how the law works. If you want to ship a font with your game, you must find an open source or Creative Commons font that permits you to give the font away along with your game. + +Sites that specialize in free and legal fonts include: + + * [Font Library][14] + * [Font Squirrel][15] + * [League of Moveable Type][16] + + + +When you find a font that you like, download it. Extract the ZIP or [TAR][17] file and move the **.ttf** or **.otf** file into the **fonts** folder in your game project directory. + +You aren't installing the font on your computer. You're just placing it in your game's **fonts** folder so that Pygame can use it. You _can_ install the font on your computer if you want, but it's not necessary. The important thing is to have it in your game directory, so Pygame can "trace" it onto the screen. + +If the font file has a complicated name with spaces or special characters, just rename it. The filename is completely arbitrary, and the simpler it is, the easier it is for you to type into your code. + +Now tell Pygame about your font. From the documentation, you know that you'll get a font object in return when you provide at least the path to a font file to **pygame.freetype.Font** (the docs state explicitly that all remaining attributes are optional): + + +``` +`Font(file, size=0, font_index=0, resolution=0, ucs4=False) -> Font` +``` + +Create a new variable called **myfont** to serve as your font in the game, and place the results of the **Font** function into that variable. This example uses the **amazdoom.ttf** font, but you can use whatever font you want. Place this code in your Setup section: + + +``` +font_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"fonts","amazdoom.ttf") +font_size = tx +myfont = pygame.freetype.Font(font_path, font_size) +``` + +### Displaying text in Pygame + +Now that you've created a font object, you need a function to draw the text you want onto the screen. This is the same principle you used to draw the background and platforms in your game. + +First, create a function, and use the **myfont** object to create some text, setting the color to some RGB value. This must be a global function; it does not belong to any specific class: + + +``` +def stats(score,health): +    myfont.render_to(world, (4, 4), "Score:"+str(score), WHITE, None, size=64) +    myfont.render_to(world, (4, 72), "Health:"+str(health), WHITE, None, size=64) +``` + +Of course, you know by now that nothing happens in your game if it's not in the Main loop, so add a call to your **stats** function near the bottom of the file: + + +``` +    for e in enemy_list: +        e.move() +    stats(player.score,player.health) # draw text +    pygame.display.flip() +``` + +Try your game. + +When the player collects loot, the score goes up. When the player gets hit by an enemy, health goes down. Success! + +![Keeping score in Pygame][18] + +There is one problem, though. When a player gets hit by an enemy, health goes _way_ down, and that's not fair. You have just discovered a non-fatal bug. Non-fatal bugs are those little problems in applications that don't keep the application from starting up or even from working (mostly), but they either don't make sense, or they annoy the user. Here's how to fix this one. + +### Fixing the health counter + +The problem with the current health point system is that health is subtracted for every tick of the Pygame clock that the enemy is touching the player. That means that a slow-moving enemy can take a player down to –200 health in just one encounter, and that's not fair. You could, of course, just give your player a starting health score of 10,000 and not worry about it; that would work, and possibly no one would mind. But there is a better way. + +Currently, your code detects when a player and an enemy collide. The fix for the health-point problem is to detect _two_ separate events: when the player and enemy collide and, once they have collided, when they _stop_ colliding. + +First, in your Player class, create a variable to represent when a player and enemy have collided: + + +``` +        self.frame = 0 +        self.health = 10 +        self.damage = 0 +``` + +In the update function of your Player class, _remove_ this block of code: + + +``` +        for enemy in enemy_hit_list: +            self.health -= 1 +            #print(self.health) +``` + +And in its place, check for collision as long as the player is not currently being hit: + + +``` +        if self.damage == 0: +            for enemy in enemy_hit_list: +                if not self.rect.contains(enemy): +                    self.damage = self.rect.colliderect(enemy) +``` + +You might see similarities between the block you deleted and the one you just added. They're both doing the same job, but the new code is more complex. Most importantly, the new code runs only if the player is not _currently_ being hit. That means that this code runs once when a player and enemy collide and not constantly for as long as the collision happens, the way it used to. + +The new code uses two new Pygame functions. The **self.rect.contains** function checks to see if an enemy is currently within the player's bounding box, and **self.rect.colliderect** sets your new **self.damage** variable to one when it is true, no matter how many times it is true. + +Now even three seconds of getting hit by an enemy still looks like one hit to Pygame. + +I discovered these functions by reading through Pygame's documentation. You don't have to read all the docs at once, and you don't have to read every word of each function. However, it's important to spend time with the documentation of a new library or module that you're using; otherwise, you run a high risk of reinventing the wheel. Don't spend an afternoon trying to hack together a solution to something that's already been solved by the framework you're using. Read the docs, find the functions, and benefit from the work of others! + +Finally, add another block of code to detect when the player and the enemy are no longer touching. Then and only then, subtract one point of health from the player. + + +``` +        if self.damage == 1: +            idx = self.rect.collidelist(enemy_hit_list) +            if idx == -1: +                self.damage = 0   # set damage back to 0 +                self.health -= 1  # subtract 1 hp +``` + +Notice that this new code gets triggered _only_ if the player has been hit. That means this code doesn't run while your player is running around your game world exploring or collecting loot. It only runs when the **self.damage** variable gets activated. + +When the code runs, it uses **self.rect.collidelist** to see whether or not the player is _still_ touching an enemy in your enemy list (**collidelist** returns negative one when it detects no collision). Once it is not touching an enemy, it's time to pay the **self.damage** debt: deactivate the **self.damage** variable by setting it back to zero and subtract one point of health. + +Try your game now. + +### Score reaction + +Now that you have a way for your player to know their score and health, you can make certain events occur when your player reaches certain milestones. For instance, maybe there's a special loot item that restores some health points. And maybe a player who reaches zero health points has to start back at the beginning of a level. + +You can check for these events in your code and manipulate your game world accordingly. You already know how, so go skim the documentation for new tricks and try them out on your own. + +Here's all the code so far: + + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform +# add gravity +# add jumping +# add scrolling +# add loot +# add score + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os +import pygame.freetype + +''' +Objects +''' +        +class Platform(pygame.sprite.Sprite): +    # x location, y location, img width, img height, img file     +    def __init__(self,xloc,yloc,imgw,imgh,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)).convert() +        self.image.convert_alpha() +        self.rect = self.image.get_rect() +        self.rect.y = yloc +        self.rect.x = xloc + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 +        self.movey = 0 +        self.frame = 0 +        self.health = 10 +        self.damage = 0 +        self.collide_delta = 0 +        self.jump_delta = 6 +        self.score = 1 +        self.images = [] +        for i in range(1,9): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha() +            img.set_colorkey(ALPHA) +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() + +    def jump(self,platform_list): +        self.jump_delta = 0 + +    def gravity(self): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty +        +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +        +    def update(self): +        ''' +        Update sprite position +        ''' +        +        self.rect.x = self.rect.x + self.movex +        self.rect.y = self.rect.y + self.movey + +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        if self.damage == 0: +            for enemy in enemy_hit_list: +                if not self.rect.contains(enemy): +                    self.damage = self.rect.colliderect(enemy) + +        if self.damage == 1: +            idx = self.rect.collidelist(enemy_hit_list) +            if idx == -1: +                self.damage = 0   # set damage back to 0 +                self.health -= 1  # subtract 1 hp + +        loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) +        for loot in loot_hit_list: +            loot_list.remove(loot) +            self.score += 1 +            print(self.score) + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.collide_delta = 0 # stop jumping +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty +            +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.movey = 0 +            self.rect.y = worldy-ty-ty +            self.collide_delta = 0 # stop jumping +            if self.rect.y > g.rect.y: +                self.health -=1 +                print(self.health) +                +        if self.collide_delta < 6 and self.jump_delta < 6: +            self.jump_delta = 6*2 +            self.movey -= 33  # how high to jump +            self.collide_delta += 6 +            self.jump_delta    += 6 +            +class Enemy(pygame.sprite.Sprite): +    ''' +    Spawn an enemy +    ''' +    def __init__(self,x,y,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)) +        self.movey = 0 +        #self.image.convert_alpha() +        #self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.counter = 0 + +                +    def move(self): +        ''' +        enemy movement +        ''' +        distance = 80 +        speed = 8 + +        self.movey += 3.2 +        +        if self.counter >= 0 and self.counter <= distance: +            self.rect.x += speed +        elif self.counter >= distance and self.counter <= distance*2: +            self.rect.x -= speed +        else: +            self.counter = 0 +        +        self.counter += 1 + +        if not self.rect.y >= worldy-ty-ty: +            self.rect.y += self.movey + +        plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) +        for p in plat_hit_list: +            self.movey = 0 +            if self.rect.y > p.rect.y: +                self.rect.y = p.rect.y+ty +            else: +                self.rect.y = p.rect.y-ty + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.rect.y = worldy-ty-ty + +        +class Level(): +    def bad(lvl,eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list.add(enemy)              # add enemy to group +            +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return enemy_list + +    def loot(lvl,tx,ty): +        if lvl == 1: +            loot_list = pygame.sprite.Group() +            loot = Platform(200,ty*7,tx,ty, 'loot_1.png') +            loot_list.add(loot) + +        if lvl == 2: +            print(lvl) + +        return loot_list + +    def ground(lvl,gloc,tx,ty): +        ground_list = pygame.sprite.Group() +        i=0 +        if lvl == 1: +            while i < len(gloc): +                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') +                ground_list.add(ground) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return ground_list + +    def platform(lvl,tx,ty): +        plat_list = pygame.sprite.Group() +        ploc = [] +        i=0 +        if lvl == 1: +            ploc.append((20,worldy-ty-128,3)) +            ploc.append((300,worldy-ty-256,3)) +            ploc.append((500,worldy-ty-128,4)) + +            while i < len(ploc): +                j=0 +                while j <= ploc[i][2]: +                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') +                    plat_list.add(plat) +                    j=j+1 +                print('run' + str(i) + str(ploc[i])) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return plat_list + +def stats(score,health): +    myfont.render_to(world, (4, 4), "Score:"+str(score), SNOWGRAY, None, size=64) +    myfont.render_to(world, (4, 72), "Health:"+str(health), SNOWGRAY, None, size=64) + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4  # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +SNOWGRAY = (137,164,166) +ALPHA = (0,255,0) +    +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +forwardx = 600 +backwardx = 230 + +eloc = [] +eloc = [200,20] +gloc = [] +tx = 64 #tile size +ty = 64 #tile size + +font_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"fonts","amazdoom.ttf") +font_size = tx +myfont = pygame.freetype.Font(font_path, font_size) +    +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) +loot_list = Level.loot(1,tx,ty) + +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print("LEFT") +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print("RIGHT") +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                player.jump(plat_list) + +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +    # scroll the world forward +    if player.rect.x >= forwardx: +        scroll = player.rect.x - forwardx +        player.rect.x = forwardx +        for p in plat_list: +            p.rect.x -= scroll +        for e in enemy_list: +            e.rect.x -= scroll +        for l in loot_list: + +            l.rect.x -= scroll +                +    # scroll the world backward +    if player.rect.x <= backwardx: +        scroll = backwardx - player.rect.x +        player.rect.x = backwardx +        for p in plat_list: +            p.rect.x += scroll +        for e in enemy_list: +            e.rect.x += scroll +        for l in loot_list: +            l.rect.x += scroll + +    world.blit(backdrop, backdropbox) +    player.gravity() # check gravity +    player.update() +    player_list.draw(world) #refresh player position +    enemy_list.draw(world)  # refresh enemies +    ground_list.draw(world)  # refresh enemies +    plat_list.draw(world)   # refresh platforms +    loot_list.draw(world)   # refresh loot +    for e in enemy_list: +        e.move() +    stats(player.score,player.health) # draw text +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/add-scorekeeping-your-python-game + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_maze.png?itok=mZ5LP4-X (connecting yellow dots in a maze) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://opensource.com/article/17/10/python-101 +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: https://opensource.com/article/17/12/game-python-add-a-player +[7]: https://opensource.com/article/17/12/game-python-moving-player +[8]: https://opensource.com/article/18/5/pygame-enemy +[9]: https://opensource.com/article/19/11/simulate-gravity-python +[10]: https://opensource.com/article/19/12/jumping-python-platformer-game +[11]: https://opensource.com/article/19/12/python-platformer-game-run +[12]: https://opensource.com/article/19/12/loot-python-platformer-game +[13]: http://pygame.org/news +[14]: https://fontlibrary.org/ +[15]: https://www.fontsquirrel.com/ +[16]: https://www.theleagueofmoveabletype.com/ +[17]: https://opensource.com/article/17/7/how-unzip-targz-file +[18]: https://opensource.com/sites/default/files/uploads/pygame-score.jpg (Keeping score in Pygame) From b3182a7127a88ff8399d719ea871aa3a8eec5c7c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 4 Jan 2020 06:40:45 +0800 Subject: [PATCH 403/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @chen-ni 翻译的很棒! --- ...ow to make an old computer useful again.md | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/translated/tech/20190724 How to make an old computer useful again.md b/translated/tech/20190724 How to make an old computer useful again.md index 1df6d5fabd..60497a12b2 100644 --- a/translated/tech/20190724 How to make an old computer useful again.md +++ b/translated/tech/20190724 How to make an old computer useful again.md @@ -1,18 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to make an old computer useful again) [#]: via: (https://opensource.com/article/19/7/how-make-old-computer-useful-again) -[#]: author: (Howard Fosdick https://opensource.com/users/howtechhttps://opensource.com/users/don-watkinshttps://opensource.com/users/suehlehttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/dragonbitehttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/seth) +[#]: author: (Howard Fosdick https://opensource.com/users/howtech) 如何把你的老爷机重新利用起来 ====== -按照下面各个步骤,让你的老爷机焕然一新 -![Person typing on a 1980's computer][1] -你的地下室里有一台用来落灰的旧电脑?为什么不把它利用起来呢?如果你常用的电脑坏了,又想用一个比手机更大的屏幕上网,这时候一台备用电脑可能就派上用场了。或者,它也可以充当一台全家人共用的廉价辅助电脑,甚至还可以改造为一台复古游戏机。 +> 按照下面各个步骤,让你的老爷机焕然一新。 + +![](https://img.linux.net.cn/data/attachment/album/202001/04/064017ztl28cn6jjhnjnaj.jpg) + +你的地下室里是不是有一台用来落灰的旧电脑?为什么不把它利用起来呢?如果你常用的电脑坏了,又想用一个比手机更大的屏幕上网,这时候一台备用电脑可能就派上用场了。或者,它也可以充当一台全家人共用的廉价备用电脑,甚至还可以改造为一台复古游戏机。 哪怕是一台有十余年历史的老爷机,只要选对了软件,也可以胜任很多新电脑能够完成的任务。其中的关键在于,要使用开源软件。 @@ -22,7 +24,7 @@ 第一步是检查硬件是否运转正常。如果在这个环节忽略了一个问题,后面可能会让你非常头疼。 -灰尘是电子器件的天敌,所以第一件事应该是打开机箱,清除灰尘。[压缩空气设备][2]这时候可能会派上用场。请注意,进行任何接触电脑的操作时,都应该确保你是[触地][3]的。此外,_避免_ 清洁布与任何物体发生摩擦。即使是一次小到你无法察觉的静电放电,也可能会导致电路损毁。 +灰尘是电子器件的天敌,所以第一件事应该是打开机箱,清除灰尘。[压缩空气设备][2]这时候可能会派上用场。请注意,进行任何接触电脑的操作时,都应该确保[接地][3]。此外,**不要**用清洁布擦拭任何东西。即使是一次小到你无法察觉的静电放电,也可能会导致电路损毁。 清洁工作完成之后,关闭机箱,检查是否所有硬件都可以正常工作。需要测试的项目包括: @@ -31,23 +33,23 @@ * 主板 * 外围设备(DVD 驱动器、USB 接口、声卡,等等) -首先,将计算机启动面板([UEFI][4] 或者是 [BIOS][5]面板)上的诊断测试依次运行一遍。如果不知道按哪个程序功能按键进入你电脑的启动面板,可以参考 [这份列表][6]。 +首先,将计算机启动界面([UEFI][4] 或者是 [BIOS][5] 界面)上的诊断测试依次运行一遍。如果不知道按哪个功能键进入你电脑的启动界面,可以参考 [这份列表][6]。 -此外,也可以使用诸如 [Hirens BootCD][7] 和 [Ultimate Boot CD][8] 之类的免费资源工具包,进行启动面板覆盖不到的测试。这些资源工具包涵盖了数百个测试程序,并且都是免费的,尽管不都开源。运行这些工具包无需安装任何软件,因为它们都是从 U 盘或者 DVD 驱动器启动的。 +此外,也可以使用诸如 [Hirens BootCD][7] 和 [Ultimate Boot CD][8] 之类的免费资源工具包,进行启动界面覆盖不到的测试。这些资源工具包涵盖了数百个测试程序,并且都是免费的,尽管不都开源。运行这些工具包无需安装任何软件,因为它们都是从 U 盘或者 DVD 驱动器启动的。 测试一定要彻底!对于内存和硬盘来说,基础测试还不够,应该运行深度测试,哪怕是运行一整夜也无妨。只有这样,才能够查出那些不易发现的瞬时故障。 -如果发现了问题,可以参考我的[硬件故障排除快速指南][9],帮你解决最常见的硬件问题。 +如果发现了问题,可以参考我的[硬件故障排除快速指南][9],可以帮你解决最常见的硬件问题。 ### 选择软件 电脑翻新的关键在于,根据手头的硬件资源,恰如其分地安装软件。最核心的三种硬件资源分别是: -1. 处理器(核数、速度) +1. 处理器(内核数、速度) 2. 内存 3. 显存 -可以在启动时的 UEFI/BIOS 面板上,弄清楚你电脑的硬件资源。记得抄下数据,以免遗忘。接下来,可以在 [CPU Benchmark][10] 网站上查看你的处理器,该网站除了提供 CPU 的背景资料,还提供一个 CPU 的性能分数。 +可以在启动时的 UEFI/BIOS 界面上,弄清楚你电脑的硬件资源。记得抄下数据,以免遗忘。接下来,可以在 [CPU Benchmark][10] 网站上查看你的处理器,该网站除了提供 CPU 的背景资料,还提供一个 CPU 的性能分数。 了解了硬件性能之后,就可以选择能够在硬件上高效运行的软件了。软件的选择涉及四个重要的层面: @@ -56,19 +58,19 @@ 3. 浏览器 4. 应用 -一个优秀的 Linux 发行版可以满足全部四个层面。不要试图使用已经停止维护的 Windows 版本,例如 Windows 8、Vista 或者 XP,哪怕已经安装在电脑上了。恶意软件的 [风险][11] 你是承受不起的。明智的做法是,使用一个更抗病毒的最新版本操作系统。 +一个优秀的 Linux 发行版可以满足上述全部四个层面。不要试图使用已经停止维护的 Windows 版本,例如 Windows 8、Vista 或者 XP,哪怕已经安装在电脑上了。恶意软件的[风险][11]你是承受不起的。明智的做法是,使用一个更抗病毒的最新版本操作系统。 -那 Windows 7 呢?[维护宽限期][12] 至 2020 年 1 月 14 日结束,也就是说,在此日期之前你还可以获得安全补丁,之后就想都别想了。现在正是迁出 Windows 7 的绝佳时机。 +那 Windows 7 呢?[维护宽限期][12]至 2020 年 1 月 14 日结束,也就是说,在此日期之前你还可以获得安全补丁,之后就想都别想了。现在正是迁出 Windows 7 的绝佳时机。 Linux 的巨大优势在于,有许多专门为过时硬件设计的[发行版][13]。此外,[桌面环境][14]和操作系统在 Linux 的设计中是分开的,你可以自行选择搭配。这一点非常重要,因为桌面环境对低端系统的性能有很大影响。(对于 Windows 和 MacOS 来说,你选择的操作系统版本决定了桌面环境,没得可选。) -Linux 的另一个好处是,拥有数以千计免费且开源的应用,不需要担心激活或者许可的问题。此外,Linux 是可移植的,可以在不同的分区、硬盘、设备或计算机之间,对操作系统和应用进行复制、移动或克隆。(Windows 则不然,使用注册表将系统捆绑在了所安装的计算机上。) +Linux 的另一个好处是,拥有数以千计自由且开源的应用,不需要担心激活或者许可的问题。此外,Linux 是可移植的,可以在不同的分区、硬盘、设备或计算机之间,对操作系统和应用进行复制、移动或克隆。(Windows 则不然,使用注册表将系统捆绑在了所安装的计算机上。) ### 翻新后的电脑能够做什么? 这里讨论的是大约在 2006 年到 2013 年之间生产的双核计算机,尤其是装载了 [Intel 酷睿 2][15] CPU 或 [AMD 速龙 64 X2][16] 系列处理器的计算机。它们的 [CPU 分数][10] 大多在 1000 到 4000 分之间。这种电脑卖不了几个钱,但用在运行轻量级 Linux 软件上,性能还是足够的。 -有一点需要注意:你的电脑应该至少拥有 2 GB 内存,如果不够就进行升级。就我翻新过的电脑来说,使用者用到的内存(不包括数据缓存)一般在 0.5 到 2 GB 之间,很少超过 2 GB。如果将内存升级到 2GB,系统就不至于进行 _swap_,即将硬盘当做内存使用。如果想要获得良好性能,这一点十分关键。 +有一点需要注意:你的电脑应该至少拥有 2 GB 内存,如果不够就进行升级。就我翻新过的电脑来说,使用者用到的内存(不包括数据缓存)一般在 0.5 到 2 GB 之间,很少超过 2 GB。如果将内存升级到 2GB,系统就不至于进行**内存交换**,即将硬盘当做内存使用。如果想要获得良好性能,这一点十分关键。 以我自己为例,我用来写作这篇文章的是一台有十年机龄的翻新电脑。取下 1 GB 内存条之后,它只剩下了 1 GB 内存,然后就慢得像一只乌龟。用它浏览网页,或者是做类似的事情,都让人感到灰心,甚至痛苦。一旦把内存条重新装回去,有了 2 GB 内存,它就立马回到了可以使用的状态。 @@ -76,19 +78,19 @@ Linux 的另一个好处是,拥有数以千计免费且开源的应用,不 ### 翻新电脑的局限 -那么,这些老爷机又有什么局限呢?由于它们的并发比不上最先进的计算机,所以应该使用轻量级浏览器,同时拦截广告(广告正是让网页加载变慢的罪魁祸首)。如果可以使用虚拟专用网络(VPN)拦截广告,为处理器免除广告加载的负荷,那就再好不过。此外,还需要禁用视频自动播放、Flash 以及网页动效;将浏览器上的标签页控制在少数几个,不要同时打开 20 个;以及下载可以开启/禁用 JavaScript 的浏览器扩展。 +那么,这些老爷机又有什么局限呢?由于它们的并发性能比不上最先进的计算机,所以应该使用轻量级浏览器,同时拦截广告(广告正是让网页加载变慢的罪魁祸首)。如果可以使用虚拟专用网络(VPN)拦截广告,为处理器免除加载广告的负荷,那就再好不过。此外,还需要禁用视频自动播放、Flash 以及网页动画效果;将浏览器上的标签页控制在少数几个,不要同时打开 20 个;以及下载可以开启/禁用 JavaScript 的浏览器扩展。 让处理器专注于你目前正在做的事情吧,不要同时打开一堆应用,也不要在后台运行很多程序。图像编辑和视频编辑的高级工具可能会很慢;至于运行虚拟机,还是别想了吧。 -那游戏呢?开源软件仓库提供了数以千计的游戏。这就是我为什么将显存列为三种核心硬件资源之一。如果你的电脑没有显卡,那很可能只有 32 或者 64 MB 的显存。可以增加一张显卡,将显存提升到 256 或者 512 MB,这样一来,处理器密集型的游戏就会顺畅很多了。如果不确定你的电脑有多少显存,可以参考[这里][17]。请注意,需要确保显卡与电脑的[显卡插槽][18](AGP、PCI-Express 或者 PCI)相匹配,同时使用正确的[连接线][19](VGA、DVI 或者 HDMI)。 +那游戏呢?开源软件仓库提供了数以千计的游戏。这就是我为什么将显存列为三种核心硬件资源之一。如果你的电脑没有独立显卡,那很可能只有 32 或者 64 MB 的显存。可以增加一张显卡,将显存提升到 256 或者 512 MB,这样一来,处理器密集型的游戏就会顺畅很多了。如果不确定你的电脑有多少显存,可以参考[这里][17]。请注意,需要确保显卡与电脑的[显卡插槽][18](AGP、PCI-Express 或者 PCI)相匹配,同时使用正确的[连接线][19](VGA、DVI 或者 HDMI)。 #### 与 Windows 系统的兼容性如何? -许多人关心 Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 的替代版本][20]。 +许多人关心 Linux 与 Windows 系统的兼容性如何。首先,对于任何一个 Windows 程序,都有一个 [Linux 版本的替代品][20]。 退一步说,即使你真的必须要运行某个特定的 Windows 程序,通常也可以借助 [Wine][21] 在 Linux 上运行。可以在 [Wine 数据库][22] 里查找一下你的应用,看看是否可以在 Wine 上运行,顺便学一些特殊安装技巧。[Winetricks][23] 和 [PlayOnLinux][24] 这两个辅助工具可以帮助你进行安装和配置。 -Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP、ME/98/95 和 3.1。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。借助 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 +Wine 的另一个优势是可以运行旧版本 Windows(例如 Vista、XP、ME/98/95 和 3.1)上的程序。我认识一个家伙,搭建了一台特别赞的游戏电脑,然后用来玩 XP 上的老游戏。借助 [DOSBox][26],你甚至还可以运行数以千计的[免费 DOS 程序][25]。但是有一点需要注意,如果 Windows 程序可以运行,那么 Windows [病毒][27]也同样可以。你需要保护 Linux 上的 Wine 环境,正如保护任何其他 Windows 环境一样。 对了,与 Microsoft Office 的兼容性又如何呢?我使用的是 LibreOffice,经常编辑并交换 Word 和 Excel 文件,完全没有问题。不过,你应该避免使用隐晦或者过于专业的功能。 @@ -96,7 +98,7 @@ Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP 假设选择了 Linux 作为操作系统,那么你还需要选择桌面环境、浏览器和各种应用。最简单的方法是,安装一个包含了你所需要的一切的发行版。 -通过从 [live USB][28] U 盘或者 DVD 启动,你无需安装任何程序,就可以尝试不同的发行版。关于在 Linux 或 Windows 上创建可启动的 Linux 的方法,可以参考 [这里][29]。 +通过从 [live USB][28] U 盘或者 DVD 启动,你无需安装任何程序,就可以尝试不同的发行版。关于在 Linux 或 Windows 上创建可启动的 Linux 的方法,可以参考[这里][29]。 我进行电脑翻新的目的是做慈善,所以无法指望电脑使用者具备任何相应知识。我需要的发行版应该具有以下特性: @@ -110,11 +112,11 @@ Wine 的另一个优势是可以运行 Windows 的老版本,例如 Vista、XP * 更重视可靠性,而不是尖端功能 * 可以通过图形化用户界面进行设置,而不是只能通过文本文件进行设置 -许多发行版都能够满足上面的要求。我曾经尝试成功的有 [Mint/Xfce][30]、[Xubuntu,][31] 和 [Lubuntu][32]。前两个发行版使用 Xfce 桌面环境,第三个使用 LXQt。相比 GNOME、Unity、KDE、MATE 和 Cinnamon 这些桌面环境,运行上面这两种桌面环境只需要[更少][33]的处理器和内存资源。 +许多发行版都能够满足上面的要求。我曾经尝试成功的有 [Mint/Xfce][30]、[Xubuntu][31] 和 [Lubuntu][32]。前两个发行版使用 Xfce 桌面环境,第三个使用 LXQt。相比 GNOME、Unity、KDE、MATE 和 Cinnamon 这些桌面环境,运行上面这两种桌面环境只需要[更少][33]的处理器和内存资源。 Xfce 和 LXQt 用起来非常简单,我的客户们之前从未见过 Linux,但是都可以自如使用这些简单的、菜单驱动的用户界面。 -对于旧电脑来说,运行最快速、最高效的浏览器是一件非常重要的事情。[很多人觉得][34] Chromium 是最好的浏览器;此外,我还安装了 Firefox Quantum,因为大家比较熟悉它,并且[它的性能][35]可以和 [Chromium 的性能][36]媲美。我还加上了 Opera,因为它速度快,而且有一些独特功能,比如内置的广告拦截,以及免费的 [虚拟专用网络][37]。Opera 是免费的,但并非开源。 +对于旧电脑来说,运行最快速、最高效的浏览器是一件非常重要的事情。[很多人觉得][34] Chromium 是最好的浏览器;此外,我还安装了 Firefox Quantum,因为大家比较熟悉它,并且[它的性能][35]可以和 [Chromium 的性能][36]媲美。我还加上了 Opera,因为它速度快,而且有一些独特功能,比如内置的广告拦截,以及免费的[虚拟专用网络][37]。Opera 是免费的,但并非开源。 无论你使用什么浏览器,一定要拦截广告和追踪器,尽量降低浏览器的负荷。此外,除非得到你的明确批准,否则视频和 Flash 都不应该被允许运行。 @@ -122,7 +124,7 @@ Xfce 和 LXQt 用起来非常简单,我的客户们之前从未见过 Linux, ### 行动起来吧 -你是否会对翻新后的电脑感到满意呢?就我来说,我所使用的两台电脑的机龄都已经超过十年了,其中一个装载的是 Intel 双核处理器([eMachines T5274a][38]),另一个装载的是 AMD 速龙 64 x2 处理器([HP dc5750][39]),两台电脑都有 2 GB 内存。它们和我的另一台具备四核 i5 处理器和 16 GB 内存 的电脑一样,完全能够胜任我的办公工作。如果说有什么功能是这两台电脑缺失的,那就是运行虚拟机了。 +你是否会对翻新后的电脑感到满意呢?就我来说,我所使用的两台电脑的机龄都已经超过十年了,其中一个装载的是 Intel 双核处理器([eMachines T5274a][38]),另一个装载的是 AMD 速龙 64 x2 处理器([HP dc5750][39]),两台电脑都有 2 GB 内存。它们和我的另一台具备四核 i5 处理器和 16 GB 内存的电脑一样,完全能够胜任我的办公工作。如果说有什么功能是这两台电脑缺失的,那就是运行虚拟机了。 我们生活在一个非常神奇的年代。只需要付出一点努力,就可以将一台机龄在 5 到 12 年之间的旧电脑,翻新为一台具备实用价值的机器。还有什么比这更有趣吗? @@ -133,11 +135,11 @@ via: https://opensource.com/article/19/7/how-make-old-computer-useful-again 作者:[Howard Fosdick][a] 选题:[lujun9972][b] 译者:[chen-ni](https://github.com/chen-ni) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]: https://opensource.com/users/howtechhttps://opensource.com/users/don-watkinshttps://opensource.com/users/suehlehttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/dragonbitehttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/seth +[a]: https://opensource.com/users/howtech [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) [2]: https://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=compressed+air+for+computers&rh=i%3Aaps%2Ck%3Acompressed+air+for+computers From 5d8cd4cc24adb26cc85a9d42d60913d2e70529ae Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 4 Jan 2020 06:41:56 +0800 Subject: [PATCH 404/676] PUB @chen-ni https://linux.cn/article-11746-1.html --- .../20190724 How to make an old computer useful again.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190724 How to make an old computer useful again.md (99%) diff --git a/translated/tech/20190724 How to make an old computer useful again.md b/published/20190724 How to make an old computer useful again.md similarity index 99% rename from translated/tech/20190724 How to make an old computer useful again.md rename to published/20190724 How to make an old computer useful again.md index 60497a12b2..726436a18a 100644 --- a/translated/tech/20190724 How to make an old computer useful again.md +++ b/published/20190724 How to make an old computer useful again.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11746-1.html) [#]: subject: (How to make an old computer useful again) [#]: via: (https://opensource.com/article/19/7/how-make-old-computer-useful-again) [#]: author: (Howard Fosdick https://opensource.com/users/howtech) From 3b9e205119021823c081167b846c92e8c91f12fd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 4 Jan 2020 07:24:32 +0800 Subject: [PATCH 405/676] Rename sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md to sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md --- ...ng- EA is Permanently Banning Linux Gamers on Battlefield V.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md (100%) diff --git a/sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md b/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md similarity index 100% rename from sources/tech/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md rename to sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md From a631c447635fe5f90954201d1cd1761d26ed0b81 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 4 Jan 2020 07:26:42 +0800 Subject: [PATCH 406/676] Rename sources/tech/20200103 What you need to know about Rust in 2020.md to sources/talk/20200103 What you need to know about Rust in 2020.md --- .../20200103 What you need to know about Rust in 2020.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200103 What you need to know about Rust in 2020.md (100%) diff --git a/sources/tech/20200103 What you need to know about Rust in 2020.md b/sources/talk/20200103 What you need to know about Rust in 2020.md similarity index 100% rename from sources/tech/20200103 What you need to know about Rust in 2020.md rename to sources/talk/20200103 What you need to know about Rust in 2020.md From eac7d5f5049f0ff08489f2bb365972e881a2e02f Mon Sep 17 00:00:00 2001 From: BrunoJu Date: Sat, 4 Jan 2020 09:24:29 +0800 Subject: [PATCH 407/676] Update article Update article: 10 Ansible resources to accelerate your automation skills --- ...es to accelerate your automation skills.md | 70 ------------------- ...es to accelerate your automation skills.md | 65 +++++++++++++++++ 2 files changed, 65 insertions(+), 70 deletions(-) delete mode 100644 sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md create mode 100644 translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md diff --git a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md deleted file mode 100644 index 5a1dc5dccf..0000000000 --- a/sources/tech/20191231 10 Ansible resources to accelerate your automation skills.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (BrunoJu) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 Ansible resources to accelerate your automation skills) -[#]: via: (https://opensource.com/article/19/12/ansible-resources) -[#]: author: (James Farrell https://opensource.com/users/jamesf) - -10 Ansible resources to accelerate your automation skills -====== -Gear up and get crackin' with awesome Ansible automation skills this -year. -![Gears above purple clouds][1] - -This year saw a wide range of really helpful Ansible articles. Whether you are just starting out with Ansible or a seasoned pro, there is something for everyone here to learn from. - -A good number of these articles are worthy of your bookmarking and perhaps a cron (or maybe a Tower/AWX job) reminder to reread them periodically. - -If you are new to Ansible, start with the following articles: - - * [_A quickstart guide to Ansible_][2] has some good starter information as well as deeper dives into more advanced topics - * [_10 Ansible modules you need to know_][3] and [_5 ops tasks to do with Ansible_][4] review some of the more fundamental functions that every Ansible admin should be familiar with - * [_How to use Ansible to document procedures_][5] also presents a survey of additional topics you might find it interesting to follow up on - - - -The remainder of these articles cover more advanced topics like Windows management, testing, hardware, cloud, and containers—and even a case study in managing the demands of tech-curious children. - -I hope you enjoyed this Ansible year as much as I did. Never stop learning! - - 1. _[How Ansible brought peace to my home][6]_ is a whimsical case study in applying Ansible skills to quickly provision new (or rather old) laptops for my children. - 2. _[Ansible for the Windows admin][7]_ by Taz Brown and Abner Malivert: Did you know Ansible can manage Windows nodes as well? This piece reviews basic Ansible server and Windows client setups with an example on how to deploy an IIS server. - 3. _[10 Ansible modules you need to know][3]_ by Shashank Hegde is a great place to start for some of the most common and basic Ansible modules all admins should know. Running commands, installing packages, and handling files are the basis for many useful automation plays. - 4. _[How to use Ansible to document procedures][5]_ by Marco Bravo: Ansible’s YAML files make for easy reading, so much so that they can be used to document the manual steps needed to accomplish a task. This makes your work easier to debug and extend later on. Also contained in this article are pointers on related topics like testing and analysis. - 5. _[Using Testinfra with Ansible to verify server state][8]_ by Clement Verna: Testing is an integral part of any CI/CD DevOps pipeline, so why not test Ansible’s results as well? This primer on Testinfra can be used to help check the configuration results you need. - 6. _[Hardware bootstrapping with Ansible][9]_ by Mark Phillips: Not all the world is containers and virtual machines. Many of us sysadmins still have significant hardware deployments to manage. With a little PXE dust and DHCP magic (among other tidbits), you can create a convenient framework using Ansible to get real hardware up and running easily. - 7. _[What you need to know about Ansible modules][10]_ by Jairo da Silva Junior: Modules bring real power to Ansible. Many modules are already available, but when there is none, you may need to roll your own. Read this article to look a bit deeper into how modules are made. - 8. _[5 ops tasks to do with Ansible][4]_ by Mark Phillips: This is another more basic review of Ansible use to manage common system operations tasks. The draw here is the list of examples given in Tower (or AWX) instead of the old familiar command line. - 9. _[A quickstart guide to Ansible][2]_ by Chris Short is a great PDF download that you should keep on hand and reread from time to time. It begins with a great primer to get started in Ansible. It also covers other areas of interest including Molecule testing, sysadmin tasks, and Kubernetes object management, to name a few. - 10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ by Mark Phillips: This is a monthly round-up article full of interesting links to follow. Topics span Ansible basics, managing Netapp E-Series storage, debugging, patching, and more. Videos are included here as well as some pointers to Ansible meetup groups. Check it out! - - - -Let us know if you had a favorite Ansible article this year and why in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/ansible-resources - -作者:[James Farrell][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jamesf -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) -[2]: https://opensource.com/article/19/2/quickstart-guide-ansible -[3]: https://opensource.com/article/19/9/must-know-ansible-modules -[4]: https://opensource.com/article/19/8/ops-tasks-ansible -[5]: https://opensource.com/article/19/4/ansible-procedures -[6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops -[7]: https://opensource.com/article/19/2/ansible-windows-admin -[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state -[9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible -[10]: https://opensource.com/article/19/3/developing-ansible-modules -[11]: https://opensource.com/article/19/7/ansible-news-edition-one diff --git a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md new file mode 100644 index 0000000000..f50180a6d7 --- /dev/null +++ b/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (BrunoJu) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Ansible resources to accelerate your automation skills) +[#]: via: (https://opensource.com/article/19/12/ansible-resources) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +提升自动化技巧的10大Ansible资源 +====== +今年,准备好,用出色的Ansible自动化技能装备自己的技能包吧。 + +![Gears above purple clouds][1] + +今年我关注了大量关于Ansible的文章,以下这些内容都值得每个人学习,无论是否是Ansible的新手。 + +这些文章值得大家标记为书签,或者设置个计划任务(亦或者是设置一个Tower/AWX job),用来提醒自己常读常新。 +如果你是Ansible的新手,那么就从这些文章开始着手吧: + * [_A quickstart guide to Ansible_][2] 拥有一些对新手非常有用的信息,同时还有一些更高级的话题。 + * [_10 Ansible modules you need to know_][3] 和 [_5 ops tasks to do with Ansible_][4] 这篇文章有每一位Ansible的管理者都应该熟悉并认真研习的一些最基础的Ansible功能 + * [_How to use Ansible to document procedures_][5] 这篇文章是对一些额外话题的纵览,我猜你一定会感到很有趣。 + + +剩余的这些文章包含了更多高级的话题,比如Windows管理,测试、硬件、云和容器,甚至包括了一个案例研究,如何管理那些对技术有兴趣的孩子的需求。 + +我希望你能像我一样好好享受Ansible带来的乐趣。不要停止学习哦! + 1. _[How Ansible brought peace to my home][6]_ 这个异想天开的案例,你能看到如何利用Ansible为孩子们快速部署一个新的笔记本(或者重装旧笔记本) + 2. _[Ansible for the Windows admin][7]_ 你知道Ansible也可以管理Windows的节点吗?这篇文章以部署一个IIS为案例,阐述了基础的Ansible服务器和Windows客户端的安装。 + 3. _[10 Ansible modules you need to know][3]_ 这是个学习你最应该知道的那些最常见最基础Ansible模块的好文章。执行命令、安装系统包和操作文件是许多有用的自动化工作的基础。 + 4. _[How to use Ansible to document procedures][5]_  Ansible的YAML文件易于阅读,因此它们可以被用于记录完成任务所需的手动步骤。这一特性可以帮助你调试与扩展,这令工作变得异常轻松。同时,这篇文章还包含关于测试和分析等Ansible相关主题的指导。 + 5. _[Using Testinfra with Ansible to verify server state][8]_ 测试环节是任何一个 CI/CD 开发型运维场景不可或缺的一部分。所以为什么不把测试Ansible的运行结果也纳入其中呢?这个有关于Ansible测试架构的入门级文章可以被用来帮助你配置。 + 6. _[Hardware bootstrapping with Ansible][9]_ 这个世界并不是完全已经被容器和虚拟机所占据。许多系统管理员仍然需要管理众多硬件资源。通过Ansible与PXE、DHCP以及其他一些技术的结合,你可以创建一个简单的管理框架,对硬件实施控制。 + 7. _[What you need to know about Ansible modules][10]_ 模块给Ansible带来了巨大的潜力,许多模块我们已经可以拿来利用。但如果没有你所需的模块,那你可以尝试给自己造一个。看看这篇文章吧,它能让你了解如何从零开始打造自己所需的模块。 + 8. _[5 ops tasks to do with Ansible][4]_ 这是另一个有关于如何使用Ansible来管理常见的系统操作任务的文章。这里描述了一系列可以取代命令行操作的Tower(AWX)的案例。 + 9. _[A quickstart guide to Ansible][2]_ 这篇文章是个可以下载的PDF文档。它可以作为一本随时拿来翻阅的手册。这篇文章的开头有助于初学者入门。同时,还包括了一些其他的研究领域,比如模块测试、系统管理任务和针对K8S对象的管理。 + 10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ 这是一篇每月进行总结更新的文章,充满了有趣的链接。话题包括了Ansible的基础内容、管理Netapp的E系列存储产品、调试、打补丁包和其他一些相关内容。文章中还包括了一些视频以及指导性文章的链接。击这里查看详情! + + +如果你也有一些你喜爱的Ansible文章,那请留言告诉我们吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ansible-resources + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/BrunoJu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) +[2]: https://opensource.com/article/19/2/quickstart-guide-ansible +[3]: https://opensource.com/article/19/9/must-know-ansible-modules +[4]: https://opensource.com/article/19/8/ops-tasks-ansible +[5]: https://opensource.com/article/19/4/ansible-procedures +[6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops +[7]: https://opensource.com/article/19/2/ansible-windows-admin +[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state +[9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible +[10]: https://opensource.com/article/19/3/developing-ansible-modules +[11]: https://opensource.com/article/19/7/ansible-news-edition-one From 0e26c268164396e4dbbc564da69aa03285207db4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 4 Jan 2020 21:20:02 +0800 Subject: [PATCH 408/676] APL --- sources/tech/20190405 File sharing with Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190405 File sharing with Git.md b/sources/tech/20190405 File sharing with Git.md index 13f95b8287..7f135cc3ca 100644 --- a/sources/tech/20190405 File sharing with Git.md +++ b/sources/tech/20190405 File sharing with Git.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6cab90062f2eb3d2f5d8d4f48325a71ea5cd6961 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 4 Jan 2020 23:03:01 +0800 Subject: [PATCH 409/676] TSL --- .../tech/20190405 File sharing with Git.md | 234 ------------------ .../tech/20190405 File sharing with Git.md | 231 +++++++++++++++++ 2 files changed, 231 insertions(+), 234 deletions(-) delete mode 100644 sources/tech/20190405 File sharing with Git.md create mode 100644 translated/tech/20190405 File sharing with Git.md diff --git a/sources/tech/20190405 File sharing with Git.md b/sources/tech/20190405 File sharing with Git.md deleted file mode 100644 index 7f135cc3ca..0000000000 --- a/sources/tech/20190405 File sharing with Git.md +++ /dev/null @@ -1,234 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (File sharing with Git) -[#]: via: (https://opensource.com/article/19/4/file-sharing-git) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -File sharing with Git -====== -SparkleShare is an open source, Git-based, Dropbox-style file sharing -application. Learn more in our series about little-known uses of Git. -![][1] - -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at SparkleShare, which uses Git as the backbone for file sharing. - -### Git for file sharing - -One of the nice things about Git is that it's inherently distributed. It's built to share. Even if you're sharing a repository just with other computers on your own network, Git brings transparency to the act of getting files from a shared location. - -As interfaces go, Git is pretty simple. It varies from user to user, but the common incantation when sitting down to get some work done is just **git pull** or maybe the slightly more complex **git pull && git checkout -b my-branch**. Still, for some people, the idea of _entering a command_ into their computer at all is confusing or bothersome. Computers are meant to make life easy, and computers are good at repetitious tasks, and so there are easier ways to share files with Git. - -### SparkleShare - -The [SparkleShare][3] project is a cross-platform, open source, Dropbox-style file sharing application based on Git. It automates all Git commands, triggering the add, commit, push, and pull processes with the simple act of dragging-and-dropping a file into a specially designated SparkleShare directory. Because it is based on Git, you get fast, diff-based pushes and pulls, and you inherit all the benefits of Git version control and backend infrastructure (like Git hooks). It can be entirely self-hosted, or you can use it with Git hosting services like [GitLab][4], GitHub, Bitbucket, and others. Furthermore, because it's basically just a frontend to Git, you can access your SparkleShare files on devices that may not have a SparkleShare client but do have Git clients. - -Just as you get all the benefits of Git, you also get all the usual Git restrictions: It's impractical to use SparkleShare to store hundreds of photos and music and videos because Git is designed and optimized for text. Git certainly has the capability to store large files of binary data but it is designed to track history, so once a file is added to it, it's nearly impossible to completely remove it. This somewhat limits the usefulness of SparkleShare for some people, but it makes it ideal for many workflows, including [calendaring][5]. - -#### Installing SparkleShare - -SparkleShare is cross-platform, with installers for Windows and Mac available from its [website][6]. For Linux, there's a [Flatpak][7] in your software installer, or you can run these commands in a terminal: - - -``` -$ sudo flatpak remote-add flathub -$ sudo flatpak install flathub org.sparkleshare.SparkleShare -``` - -### Creating a Git repository - -SparkleShare isn't software-as-a-service (SaaS). You run SparkleShare on your computer to communicate with a Git repository—SparkleShare doesn't store your data. If you don't have a Git repository to sync a folder with yet, you must create one before launching SparkleShare. You have three options: hosted Git, self-hosted Git, or self-hosted SparkleShare. - -#### Git hosting - -SparkleShare can use any Git repository you can access for storage, so if you have or create an account with GitLab or any other hosting service, it can become the backend for your SparkleShare. For example, the open source [Notabug.org][8] service is a Git hosting service like GitHub and GitLab, but unique enough to prove SparkleShare's flexibility. Creating a new repository differs from host to host depending on the user interface, but all of the major ones follow the same general model. - -First, locate the button in your hosting service to create a new project or repository and click on it to begin. Then step through the repository creation process, providing a name for your repository, privacy level (repositories often default to being public), and whether or not to initialize the repository with a README file. Whether you need a README or not, enable an initial README file. Starting a repository with a file isn't strictly necessary, but it forces the Git host to instantiate a **master** branch in the repository, which helps ensure that frontend applications like SparkleShare have a branch to commit and push to. It's also useful for you to see a file, even if it's an almost empty README file, to confirm that you have connected. - -![Creating a Git repository][9] - -Once you've created a repository, obtain the URL it uses for SSH clones. You can get this URL the same way anyone gets any URL for a Git project: navigate to the page of the repository and look for the **Clone** button or field. - -![Cloning a URL on GitHub][10] - -Cloning a GitHub URL. - -![Cloning a URL on GitLab][11] - -Cloning a GitLab URL. - -This is the address SparkleShare uses to reach your data, so make note of it. Your Git repository is now configured. - -#### Self-hosted Git - -You can use SparkleShare to access a Git repository on any computer you have access to. No special setup is required, aside from a bare Git repository. However, if you want to give access to your Git repository to anyone else, then you should run a Git manager like [Gitolite][12] or SparkleShare's own Dazzle server to help you manage SSH keys and accounts. At the very least, create a user specific to Git so that users with access to your Git repository don't also automatically gain access to the rest of your server. - -Log into your server as the Git user (or yourself, if you're very good at managing user and group permissions) and create a repository: - - -``` -$ mkdir ~/sparkly.git -$ cd ~/sparkly.git -$ git init --bare . -``` - -Your Git repository is now configured. - -#### Dazzle - -SparkleShare's developers provide a Git management system called [Dazzle][13] to help you self-host Git repositories. - -On your server, download the Dazzle application to some location in your path: - - -``` -$ curl \ -\--output ~/bin/dazzle -$ chmod +x ~/bin/dazzle -``` - -Dazzle sets up a user specific to Git and SparkleShare and also implements access rights based on keys generated by the SparkleShare application. For now, just set up a project: - - -``` -`$ dazzle create sparkly` -``` - -Your server is now configured as a SparkleShare host. - -### Configuring SparkleShare - -When you launch SparkleShare for the first time, you are prompted to configure what server you want SparkleShare to use for storage. This process may feel like a first-run setup wizard, but it's actually the usual process for setting up a new shared location within SparkleShare. Unlike many shared drive applications, with SparkleShare you can have several locations configured at once. The first shared location you configure isn't any more significant than any shared location you may set up later, and you're not signing up with SparkleShare or any other service. You're just pointing SparkleShare at a Git repository so that it knows what to keep your first SparkleShare folder in sync with. - -On the first screen, identify yourself by whatever means you want on record in the Git commits that SparkleShare makes on your behalf. You can use anything, even fake information that resolves to nothing. It's purely for the commit messages, which you may never even see if you have no interest in reviewing the Git backend processes. - -The next screen prompts you to choose your hosting type. If you are using GitLab, GitHub, Planio, or Bitbucket, then select the appropriate one. For anything else, select **Own server**. - -![Choosing a Sparkleshare host][14] - -At the bottom of this screen, you must enter the SSH clone URL. If you're self-hosting, the address is something like **** and the remote path is the absolute path to the Git repository you created for this purpose. - -Based on my self-hosted examples above, the address to my imaginary server is **** (the **:22122** indicates a nonstandard SSH port) and the remote path is **/home/git/sparkly.git**. - -If I use my Notabug.org account instead, the address from the example above is **[git@notabug.org][15]** and the path is **seth/sparkly.git**. - -SparkleShare will fail the first time it attempts to connect to the host because you have not yet copied the SparkleShare client ID (an SSH key specific to the SparkleShare application) to the Git host. This is expected, so don't cancel the process. Leave the SparkleShare setup window open and obtain the client ID from the SparkleShare icon in your system tray. Then copy the client ID to your clipboard so you can add it to your Git host. - -![Getting the client ID from Sparkleshare][16] - -#### Adding your client ID to a hosted Git account - -Minor UI differences aside, adding an SSH key (which is all the client ID is) is basically the same process on any hosting service. In your Git host's web dashboard, navigate to your user settings and find the **SSH Keys** category. Click the **Add New Key** button (or similar) and paste the contents of your SparkleShare client ID. - -![Adding an SSH key][17] - -Save the key. If you want someone else, such as collaborators or family members, to be able to access this same repository, they must provide you with their SparkleShare client ID so you can add it to your account. - -#### Adding your client ID to a self-hosted Git account - -A SparkleShare client ID is just an SSH key, so copy and paste it into your Git user's **~/.ssh/authorized_keys** file. - -#### Adding your client ID with Dazzle - -If you are using Dazzle to manage your SparkleShare projects, add a client ID with this command: - - -``` -`$ dazzle link` -``` - -When Dazzle prompts you for the ID, paste in the client ID found in the SparkleShare menu. - -### Using SparkleShare - -Once you've added your client ID to your Git host, click the **Retry** button in the SparkleShare window to finish setup. When it's finished cloning your repository, you can close the SparkleShare setup window, and you'll find a new **SparkleShare** folder in your home directory. If you set up a Git repository with a hosting service and chose to include a README or license file, you can see them in your SparkleShare directory. - -![Sparkleshare file manager][18] - -Otherwise, there are some hidden directories, which you can see by revealing hidden directories in your file manager. - -![Showing hidden files in GNOME][19] - -You use SparkleShare the same way you use any directory on your computer: you put files into it. Anytime a file or directory is placed into a SparkleShare folder, it's copied in the background to your Git repository. - -#### Excluding certain files - -Since Git is designed to remember _everything_ , you may want to exclude specific file types from ever being recorded. There are a few reasons to manage excluded files. By defining files that are off limits for SparkleShare, you can avoid accidental copying of large files. You can also design a scheme for yourself that enables you to store files that logically belong together (MIDI files with their **.flac** exports, for instance) in one directory, but manually back up the large files yourself while letting SparkleShare back up the text-based files. - -If you can't see hidden files in your system's file manager, then reveal them. Navigate to your SparkleShare folder, then to the directory representing your repository, locate a file called **.gitignore** , and open it in a text editor. You can enter file extensions or file names, one per line, into **.gitignore** , and any file matching what you list will be (as the file name suggests) ignored. - - -``` -Thumbs.db -$RECYCLE.BIN/ -.DS_Store -._* -.fseventsd -.Spotlight-V100 -.Trashes -.directory -.Trash-* -*.wav -*.ogg -*.flac -*.mp3 -*.m4a -*.opus -*.jpg -*.png -*.mp4 -*.mov -*.mkv -*.avi -*.pdf -*.djvu -*.epub -*.od{s,t} -*.cbz -``` - -You know the types of files you encounter most often, so concentrate on the ones most likely to sneak their way into your SparkleShare directory. If you want to exercise a little overkill, you can find good collections of **.gitignore** files on Notabug.org and also on the internet at large. - -With those entries in your **.gitignore** file, you can place large files that you don't want sent to your Git host in your SparkleShare directory, and SparkleShare will ignore them entirely. Of course, that means it's up to you to make sure they get onto a backup or distributed to your SparkleShare collaborators through some other means. - -### Automation - -[Automation][20] is part of the silent agreement we have with computers: they do the repetitious, boring stuff that we humans either aren't very good at doing or aren't very good at remembering. SparkleShare is a nice, simple way to automate the routine distribution of data. It isn't right for every Git repository, by any means. It doesn't have an interface for advanced Git functions; it doesn't have a pause button or a manual override. And that's OK because its scope is intentionally limited. SparkleShare does what SparkleShare sets out to do, it does it well, and it's one Git repository you won't have to think about. - -If you have a use for that kind of steady, invisible automation, give SparkleShare a try. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/file-sharing-git - -作者:[Seth Kenlon (Red Hat, Community Moderator)][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO -[2]: https://git-scm.com/ -[3]: http://www.sparkleshare.org/ -[4]: http://gitlab.com -[5]: https://opensource.com/article/19/4/calendar-git -[6]: http://sparkleshare.org -[7]: /business/16/8/flatpak -[8]: http://notabug.org -[9]: https://opensource.com/sites/default/files/uploads/git-new-repo.jpg (Creating a Git repository) -[10]: https://opensource.com/sites/default/files/uploads/github-clone-url.jpg (Cloning a URL on GitHub) -[11]: https://opensource.com/sites/default/files/uploads/gitlab-clone-url.jpg (Cloning a URL on GitLab) -[12]: http://gitolite.org -[13]: https://github.com/hbons/Dazzle -[14]: https://opensource.com/sites/default/files/uploads/sparkleshare-host.jpg (Choosing a Sparkleshare host) -[15]: mailto:git@notabug.org -[16]: https://opensource.com/sites/default/files/uploads/sparkleshare-clientid.jpg (Getting the client ID from Sparkleshare) -[17]: https://opensource.com/sites/default/files/uploads/git-ssh-key.jpg (Adding an SSH key) -[18]: https://opensource.com/sites/default/files/uploads/sparkleshare-file-manager.jpg (Sparkleshare file manager) -[19]: https://opensource.com/sites/default/files/uploads/gnome-show-hidden-files.jpg (Showing hidden files in GNOME) -[20]: /downloads/ansible-quickstart diff --git a/translated/tech/20190405 File sharing with Git.md b/translated/tech/20190405 File sharing with Git.md new file mode 100644 index 0000000000..a1ad1bc228 --- /dev/null +++ b/translated/tech/20190405 File sharing with Git.md @@ -0,0 +1,231 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (File sharing with Git) +[#]: via: (https://opensource.com/article/19/4/file-sharing-git) +[#]: author: (Seth Kenlon) + +用 Git 共享文件 +====== + +> SparkleShare 是一个开源的基于 Git、Dropbox 风格的文件共享应用程序。在我们的系列文章中了解有关 Git 鲜为人知的用法。 + +![][1] + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +今天,我们将看看 SparkleShare,它使用 Git 作为文件共享的基础。 + +### 用于文件共享的 Git + +Git 的优点之一是它具有固有的分发能力。它可用来建立共享。即使你只是与自己网络上的其他计算机共享资源库,Git 也会为从共享位置获取文件的行为带来透明性。 + +随着其界面的发展,Git 变得非常简单。虽然因用户而异,他们坐下来完成一些工作时的共同点仅仅是 `git pull` 或稍微复杂一点的 `git pull && git checkout -b my-branch`。但是,对于某些人来说,将*命令输入*到他们的计算机中的做法完全是令人困惑或烦恼的。计算机旨在使生活变得轻松,计算机擅长重复性工作,因此有更简便的方法可以与 Git 共享文件。 + +### SparkleShare + +[SparkleShare][3] 项目是一个基于 Git 的跨平台的开源的 Dropbox 式的文件共享应用程序。它通过将文件拖放到专门指定的 SparkleShare 目录中的简单操作,自动执行所有 Git 命令,触发添加、提交、推送和拉取过程。因为它基于 Git,所以你可以获得基于差异(diff)的快速推送和拉取,并且继承了 Git 版本控制和后端基础设施(如 Git 挂钩)的所有优点。它可以完全自托管,也可以将其与 [GitLab][4]、GitHub、Bitbucket 等 Git 托管服务一起使用。此外,由于它基本上只是一个 Git 的前端,因此你可以在可能没有 SparkleShare 客户端但有 Git 客户端的设备上访问 SparkleShare 中的文件。 + +正如你获得 Git 的所有好处一样,你也会受到所有常见的 Git 限制:使用 SparkleShare 存储数百张照片、音乐和视频是不切实际的,因为 Git 是为文本而设计和优化的。Git 当然可以存储二进制文件的大文件,但是因为它可以跟踪历史记录,因此一旦将文件添加到其中,几乎就不可能完全删除它。这在某种程度上限制了 SparkleShare 对某些人的实用性,但使其非常适合许多工作流程,包括 [日程安排][5]。 + +#### 安装 SparkleShare + +SparkleShare 是跨平台的,可从[网站][6]获得适用于 Windows 和 Mac 的安装程序。对于 Linux,有一个 [Flatpak][7] 安装包,或者你可以在终端中运行以下命令: + +``` +$ sudo flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo +$ sudo flatpak install flathub org.sparkleshare.SparkleShare +``` + +### 创建一个 Git 存储库 + +SparkleShare 并不是软件即服务(SaaS)。你在计算机上运行 SparkleShare 以与 Git 存储库进行通信,而 SparkleShare 并不存储你的数据。如果你还没有与文件夹同步的 Git 存储库,则必须在启动 SparkleShare 之前创建一个文件夹。你有三个选择:托管的 Git、自托管 Git 或自托管 SparkleShare。 + +#### 托管的 Git + +SparkleShare 可以使用你可以访问的任何 Git 存储库进行存储,因此,如果你拥有(或可在其中创建的)GitLab 或任何其他托管服务的帐户,则它可以成为 SparkleShare 的后端。例如,开源 [Notabug.org][8] 服务是一个类似于 GitHub 和 GitLab 的 Git 托管服务,但其独特性足以证明 SparkleShare 的灵活性。根据用户界面的不同,不同的托管服务创建新存储库的方法也有所不同,但是所有主要存储库都遵循相同的通用模型。 + +首先,在托管服务中找到创建一个新项目或存储库的按钮,单击它以开始。然后逐步完成存储库的创建过程,为存储库提供名称、隐私级别(存储库通常默认为公共),以及是否使用 `README` 文件初始化存储库。无论你是否需要个 `README` 文件,请初始化建立一个。使用一个文件创立存储库不是绝对必要的,但是它会强制 Git 主机实例化存储库中的 `master` 分支,这有助于确保前端应用程序(例如 SparkleShare)具有要提交并推送的分支。即使文件几乎是空的 `README` 文件,也可以用来查看该文件以确认你已连接成功。 + +![Creating a Git repository][9] + +创建存储库后,获取其用于 SSH 克隆的 URL。你可以像获取任何人从 Git 项目获得其 URL 一样获得此 URL:导航至存储库页面并查找 “Clone” 按钮或字段。 + +![Cloning a URL on GitHub][10] + +*GitHub 的克隆 URL。* + +![Cloning a URL on GitLab][11] + +*GitLab 的克隆 URL。* + +这是 SparkleShare 用于获取数据的地址,因此请记下它。你的 Git 存储库现已配置好。 + + +#### 自托管的 Git + +你可以使用 SparkleShare 访问你有权访问的任何计算机上的 Git 存储库。除了一个 Git 裸存储库外,无需任何特殊设置。但是,如果你想将对 Git 存储库的访问权授予其他任何人,则应运行 [Gitolite][12] 之类的 Git 管理器或 SparkleShare 自己的 Dazzle 服务器来帮助你管理 SSH 密钥和帐户。至少,创建一个特定于 Git 的用户,以便有权访问你的 Git 存储库的用户不会自动获得对服务器其余部分的访问权限。 + +以 Git 用户身份登录服务器(如果你非常擅长管理用户和组权限,则可以以自己的用户登录)并创建存储库: + +``` +$ mkdir ~/sparkly.git +$ cd ~/sparkly.git +$ git init --bare . +``` + +你的 Git 存储库现已配置好。 + +#### Dazzle + +SparkleShare 的开发人员提供了一个名为 [Dazzle][13] 的 Git 管理系统,以帮助你自托管 Git 存储库。 + +在你的服务器上,将 Dazzle 应用程序下载到你的路径中的某个位置: + +``` +$ curl https://raw.githubusercontent.com/hbons/Dazzle/master/dazzle.sh --output ~/bin/dazzle +$ chmod +x ~/bin/dazzle +``` + +Dazzle 设置了一个特定于 Git 和 SparkleShare 的用户,并且还基于 SparkleShare 应用程序生成的密钥实现了访问权限。现在,只需设置一个项目: + +``` +$ dazzle create sparkly +``` + +你的服务器现在已经配置好,可以用作 SparkleShare 托管了。 + +### 配置 SparkleShare + +首次启动 SparkleShare 时,系统会提示你配置要让 SparkleShare 用于存储的服务器。这个过程可能看起来像一个首次运行的安装向导,但实际上是在 SparkleShare 中设置新共享位置的通常过程。与许多共享驱动器应用程序不同,使用 SparkleShare 可以一次配置多个位置。你配置的第一个共享位置并不比你以后可以设置的任何共享位置重要,并且你也没有注册 SparkleShare 或任何其他服务。你只是将 SparkleShare 指向 Git 存储库,以便它知道如何使第一个 SparkleShare 文件夹保持同步。 + +在第一个屏幕上,给出一个身份,SparkleShare 将在代表你进行的 Git 提交记录中使用这些信息。你可以使用任何内容,甚至可以不代表任何意义的伪造信息。它仅用于提交消息,如果你对审查 Git 后端进程没有兴趣,你可能甚至看不到它们。 + +下一个屏幕提示你选择主机类型。如果你使用的是 GitLab、GitHub、Planio 或 Bitbucket,则可以选择一个适当的。否则,请选择“自己的服务器”。 + +![Choosing a Sparkleshare host][14] + +在此屏幕底部,您必须输入 SSH 的克隆 URL。如果你是自托管的 Git,则地址类似于 ``,而远程路径是为此目的而创建的 Git 存储库的绝对路径。 + +根据上面的自托管示例,我虚构的服务器的地址为 `ssh://git@example.com:22122`(`:22122` 表示非标准的 SSH 端口),远程路径为 `/home/git/sparkly.git`。 + +如果我改用 Notabug.org 帐户,则上例中的地址为 `ssh://git@notabug.org`,路径为 `seth/sparkly.git`。 + +SparkleShare 首次尝试连接到主机时将失败,因为你尚未将 SparkleShare 客户端 ID(特定于 SparkleShare 应用程序的 SSH 密钥)复制到 Git 主机。这是预料之中的,所以不要取消该过程。将 SparkleShare 设置窗口保持打开状态,并从系统任务栏中的 SparkleShare 图标处获取客户端 ID。然后将客户端 ID 复制到剪贴板,以便可以将其添加到 Git 主机。 + +![Getting the client ID from Sparkleshare][16] + +#### 将你的客户端 ID 添加到托管的 Git 帐户 + +除了较小的 UI 差异外,在任何托管服务上添加 SSH 密钥(所有客户端 ID 都是这样)的过程基本上是相同的。在你的 Git 主机的 Web 仪表板中,导航到你的用户设置,然后找到 “SSH 密钥”类别。单击“添加新密钥”按钮(或类似按钮),然后粘贴你的 SparkleShare 客户端 ID 的内容。 + +![Adding an SSH key][17] + +保存密钥。如果你希望其他人(例如协作者或家庭成员)能够访问同一存储库,则他们必须向你提供其 SparkleShare 客户端 ID,以便你可以将其添加到帐户中。 + +#### 将你的客户端 ID 添加到自托管的 Git 帐户 + +SparkleShare 客户端 ID 只是一个 SSH 密钥,因此将其复制并粘贴到 Git 用户的 `~/.ssh/authorized_keys`文件中。 + +#### 使用 Dazzle 添加你的客户 ID + +如果你使用 Dazzle 管理 SparkleShare 项目,请使用以下命令添加客户端 ID: + +``` +$ dazzle link +``` + +当 Dazzle 提示你输入该 ID 时,请粘贴在 SparkleShare 菜单中找到的客户端 ID。 + +### 使用 SparkleShare + +将客户端 ID 添加到 Git 主机后,在 SparkleShare 窗口中单击“重试”按钮以完成设置。克隆存储库完成后,你可以关闭 SparkleShare 设置窗口,并在你的家目录中找到一个新的 `SparkleShare` 文件夹。如果你设置了带有托管服务的 Git 存储库,并选择包括 `README` 文件或许可证文件,则可以在 SparkleShare 目录中看到它们。 + +![Sparkleshare file manager][18] + +此外,有一些隐藏目录,你可以通过在文件管理器中显示隐藏目录来查看。 + +![Showing hidden files in GNOME][19] + +使用 SparkleShare 的方式与使用计算机上任何目录的方式相同:将文件放入其中。每当将文件或目录放入 SparkleShare 文件夹时,它都会在后台复制到你的 Git 存储库。 + +#### 排除某些文件 + +由于 Git 从设计上就是要记住*一切*,因此你可能希望从记录中排除特定的文件类型。排除一些文件是有原因的。通过定义摆脱 SparkleShare 限制的文件,可以避免意外复制大文件。你还可以为自己设计一种方案,使你可以将存储在一个目录中的逻辑上属于同一文件(例如,MIDI 文件及其 .flac 导出文件),但是可以自己手动备份大文件,而同时让 SparkleShare 备份基于文本的文件。 + +如果在系统的文件管理器中看不到隐藏的文件,请显示它们。导航到你的 SparkleShare 文件夹,然后到代表你的存储库的目录,找到一个名为 `.gitignore` 的文件,然后在文本编辑器中将其打开。你可以在 `.gitignore` 中输入文件扩展名或文件名(每行一个),任何与你列出的文件匹配的文件都会被忽略(如文件名所示)。 + +``` +Thumbs.db +$RECYCLE.BIN/ +.DS_Store +._* +.fseventsd +.Spotlight-V100 +.Trashes +.directory +.Trash-* +*.wav +*.ogg +*.flac +*.mp3 +*.m4a +*.opus +*.jpg +*.png +*.mp4 +*.mov +*.mkv +*.avi +*.pdf +*.djvu +*.epub +*.od{s,t} +*.cbz +``` + +你知道最经常遇到哪些文件类型,因此请集中精力处理最有可能潜入你的 SparkleShare 目录的文件。如果您想稍微矫枉过正一些,可以在 Notabug.org 以及整个网上找到 `.gitignore` 文件的好集合。 + +通过将这些条目保存在 `.gitignore` 文件中,你可以将不需要发送到 Git 主机的大文件放在 SparkleShare 目录中,SparkleShare 将完全忽略它们。当然,这意味着您需要确保它们可以备份或通过其他方式分发给你的 SparkleShare 合作者。 + +### 自动化 + +[自动化][20] 是我们与计算机达成的默契之一:计算机执行重复的、无聊的工作,而我们人类要么不擅长做这些,要么不擅长记忆这些。SparkleShare 是一种很好的、简单的自动执行例行数据分发的方法。无论如何,这并不适合每个 Git 存储库。它没有用于高级 Git 功能的接口,它没有暂停按钮或手动管理的操作。没关系,因为它的范围是有意限制的。SparkleShare 可以完成 SparkleShare 计划要做的事情,它做得很好,而且它是你无需关心的一个 Git 存储库。 + +如果你想使用这种稳定的、看不见的自动化,请尝试一下 SparkleShare。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/file-sharing-git + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO +[2]: https://git-scm.com/ +[3]: http://www.sparkleshare.org/ +[4]: http://gitlab.com +[5]: https://opensource.com/article/19/4/calendar-git +[6]: http://sparkleshare.org +[7]: /business/16/8/flatpak +[8]: http://notabug.org +[9]: https://opensource.com/sites/default/files/uploads/git-new-repo.jpg (Creating a Git repository) +[10]: https://opensource.com/sites/default/files/uploads/github-clone-url.jpg (Cloning a URL on GitHub) +[11]: https://opensource.com/sites/default/files/uploads/gitlab-clone-url.jpg (Cloning a URL on GitLab) +[12]: http://gitolite.org +[13]: https://github.com/hbons/Dazzle +[14]: https://opensource.com/sites/default/files/uploads/sparkleshare-host.jpg (Choosing a Sparkleshare host) +[15]: mailto:git@notabug.org +[16]: https://opensource.com/sites/default/files/uploads/sparkleshare-clientid.jpg (Getting the client ID from Sparkleshare) +[17]: https://opensource.com/sites/default/files/uploads/git-ssh-key.jpg (Adding an SSH key) +[18]: https://opensource.com/sites/default/files/uploads/sparkleshare-file-manager.jpg (Sparkleshare file manager) +[19]: https://opensource.com/sites/default/files/uploads/gnome-show-hidden-files.jpg (Showing hidden files in GNOME) +[20]: /downloads/ansible-quickstart From 40b7e0a32be7ea0cee4b184d3080d6ebae11f25d Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sun, 5 Jan 2020 00:37:29 +0800 Subject: [PATCH 410/676] translated 20200101 5 predictions for Kubernetes in 2020.md --- ...01 5 predictions for Kubernetes in 2020.md | 73 ------------------- ...01 5 predictions for Kubernetes in 2020.md | 67 +++++++++++++++++ 2 files changed, 67 insertions(+), 73 deletions(-) delete mode 100644 sources/tech/20200101 5 predictions for Kubernetes in 2020.md create mode 100644 translated/tech/20200101 5 predictions for Kubernetes in 2020.md diff --git a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md b/sources/tech/20200101 5 predictions for Kubernetes in 2020.md deleted file mode 100644 index 99723632b8..0000000000 --- a/sources/tech/20200101 5 predictions for Kubernetes in 2020.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 predictions for Kubernetes in 2020) -[#]: via: (https://opensource.com/article/20/1/kubernetes-2020) -[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) - -5 predictions for Kubernetes in 2020 -====== -Plus, a look back at the most popular Kubernetes articles on the site in -2019. -![Person drinking a hat drink at the computer][1] - -How do you track a wildly popular project like Kubernetes? How do you figure out where it’s going? If you are contributing to the project or participating in Special Interest Groups (SIGs), you might gain insight by osmosis, but for those of you with day jobs that don’t include contributing to Kubernetes, you might like a little help reading the tea leaves. With a fast-moving project like Kubernetes, the end of the year is an excellent time to take a look at the past year to gain insight into the next one. - -This year, Kubernetes made a lot of progress. Aside from inspecting code, documentation, and meeting notes, another good source is blog entries. To gain some insights, I took a look at the top ten Kubernetes articles on Opensource.com. These articles give us insight into what topics people are interested in reading, but just as importantly, what articles people are interested in writing. Let’s dig in! - -(Get the full list of top 10 Kubernetes articles from 2019 at the end.) - -First, I would point out that five of these articles tackle the expansion of workloads and where they can run. This expansion of workloads includes data science, PostgreSQL, InfluxDB, and Grafana (as a workload, not just to monitor the cluster itself) and Edge. Historically, Kubernetes and containers in general have mostly run on top of virtual machines, especially when run on infrastructure provided by cloud providers. With this interest in Kubernetes at the edge, it’s another sign that end users are genuinely interested in Kubernetes on bare metal (see also [Kubernetes on metal with OpenShift][2]). - -Next, there seems to be a lot of hunger for operational knowledge and best practices with Kubernetes. From [Kubernetes Operators][3], to [Kubernetes Controllers][4], from [Secrets][5] to [ConfigMaps][6], developers and operators alike are looking for best practices and ways to simplify workload deployment and management. Often we get caught up in the actual configuration example, or how people do it, and don’t take a step back to realize that all of these fall into the bucket of how to operationalize the deployment of applications (not how to install or run Kubernetes itself). - -Finally, people seem to be really interested in getting started. In fact, there is so much information on how to build Kubernetes that it intimidates people and gets them down the wrong path. A couple of the top articles focus on why you should learn to run applications on Kubernetes instead of concentrating on installing it. Like best practices, people often don’t take a step back to analyze where they should invest their time when getting started. I have always advocated for, where possible, spending limited time and money on using technology instead of building it. - -### 5 predictions for Kubernetes in 2020 - -So, looking back at those themes from 2019, what does this tell us about where 2020 is going? Well, combining insight from these articles with my own broad purview, I want to share my thoughts for 2020 and beyond: - - 1. Expansion of workloads. I would keep my eye on high-performance computing, AI/ML, and stateful workloads using Operators. - - 2. More concrete best practices, especially around mature standards like PCI, HIPAA, NIST, etc. - - 3. Increased security around rootless and higher security [runtimes classes][7] (like [gVisor][8], [Kata Containers][9], etc.) - - 4. Better standardization on Kubernetes manifests as the core artifact for deployment in development and sharing applications between developers. Things like [podman generate kube][10], [podman play kube][11], and all in one Kubernetes environments like [CodeReady Containers (CRC)][12] - - 5. An ever-wider ecosystem of network, storage and specialized hardware (GPUs, etc.) vendors creating best of breed solutions for Kubernetes (in free software, we believe that open ecosystems are better than vertically integrated solutions) - - - - -I'm looking forward to another great year in Kubernetes! - -**Top 10 Kubernetes articles for 2019** - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/kubernetes-2020 - -作者:[Scott McCarty][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/fatherlinux -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) -[2]: https://blog.openshift.com/kubernetes-on-metal-with-openshift/ -[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ -[4]: https://kubernetes.io/docs/concepts/architecture/controller/ -[5]: https://kubernetes.io/docs/concepts/configuration/secret/ -[6]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/ -[7]: https://kubernetes.io/docs/concepts/containers/runtime-class/ -[8]: https://gvisor.dev/ -[9]: https://katacontainers.io/ -[10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ -[11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities -[12]: https://developers.redhat.com/products/codeready-containers/overview diff --git a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md new file mode 100644 index 0000000000..32868982f8 --- /dev/null +++ b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: "lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 predictions for Kubernetes in 2020) +[#]: via: (https://opensource.com/article/20/1/kubernetes-2020) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +2020 年对 Kubernetes 的 5 项预测 +====== +请先回顾下 2019 年网站上最受欢迎的 Kubernetes 的文章。 +![Person drinking a hat drink at the computer][1] + +你怎么追踪一个广受欢迎的项目(如 Kubernetes)的发展轨迹?你怎么能了解它发展到什么程度了?如果你在为这个项目作贡献或加入了 SIG(Special Interest Group),可能你会在潜移默化中了解到它的发展轨迹,但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。 + +今年,Kubernetes 取得了很大的进展。除了去查看源码、文档、会议笔记,你也可以去浏览博客。为了深入了解,我在 Opensource.com 上看了 Kubernetes 的 top 10 文章。通过这些文章,我们能了解开发者们更喜欢读和写哪些话题的文章。我们开始吧! + +(2019 年末获取 Kubernetes 文章的 top 10。) + +首先,我要指明这些文章中有 5 篇是关于 Kubernetes 工作负载的扩展以及它们可以运行在什么场景。这些工作负载涵盖数据科学、PostgreSQL、InfluxDB、Grafana(不仅仅监控集群本身)和 Edge。从历史角度看,Kubernetes 和容器都是在虚拟机上运行的,尤其是运行在由云提供的基础设施上时。抛开对于 Kubernetes 的兴趣因素,这也表明了终端用户们极度希望在裸机上安装 Kubernetes(参照[OpenShift 环境安装 Kubernetes][2])。 + +其次,也有很多开发者希望了解操作相关的知识以及 Kubernetes 的最佳实践。从 [Kubernetes 操作][3] 到 [Kubernetes 控制器][4],从 [Secrets][5] 到 [ConfigMaps][6],开发者和运维人员都希望能找到简化部署和管理工作的最佳实践。我们经常纠结在怎么去修改配置文件或别人会怎么配置,而不去回头想想这些配置是怎么让应用部署运转的(不是怎么安装,也不是怎么运行 Kubernetes)。 + +最后,人们似乎对入门教程真的感兴趣。事实上,构建 Kubernetes 所需了解的信息太多了,以至于让人们望而却步,也使他们走了错误的路。流行度高的文章中有几篇讲述了为什么你需要了解用 Kubernetes 运行应用程序,而不仅仅是安装它。就是最佳实践类的文章一样,人们也通常不会回头分析在入门时他们应该在什么地方花费时间。我一直秉持的理念是,把有限的时间和金钱投入到如何使用某项技术上,而不是如何构建它。 + +### 2020 年对 Kubernetes 的 5 项预测 + +回顾下 2019 年的相关主题,这些主题告诉我们 2020 年将如何发展?结合这些文章中的观点,加上我自己的看法,我来分享下我对于 2020 年以及未来发展趋势的想法: + + 1. 工作负载扩展。我会关注高性能计算,AI/ML 以及使用 Operator 的有状态工作负载。 + + 2. 更多的生产中的最佳实践,尤其是跟一些成熟的标准相关的,像 PCI,HIPAA,NIST 等等. + + 3. rootless 相关的更好的安全性和 [runtimes classes][7](如 [gVisor][8],[Kata Containers][9] 等等)更高的安全性。 + + 4. 在部署和开发者们共享应用时,把 Kubernetes 清单的更好的规范标准作为部署的核心要素。如 [podman generate kube][10], [podman play kube][11], 还有多合一 Kubernetes 环境,如 [CodeReady Containers (CRC)][12] + + 5. 一个前所未有的网络、存储和专业硬件(如 GPU 等等)供应商的生态系统,为 Kubernetes 提供 BoB(译注:best of breed,单项最佳品牌)解决方案(在免费软件中,我们相信开放的生态系统好过垂直整合的解决方案)。 + +期待 Kubernetes 在新的一年里再创辉煌! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/kubernetes-2020 + +作者:[Scott McCarty][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://blog.openshift.com/kubernetes-on-metal-with-openshift/ +[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ +[4]: https://kubernetes.io/docs/concepts/architecture/controller/ +[5]: https://kubernetes.io/docs/concepts/configuration/secret/ +[6]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/ +[7]: https://kubernetes.io/docs/concepts/containers/runtime-class/ +[8]: https://gvisor.dev/ +[9]: https://katacontainers.io/ +[10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ +[11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities +[12]: https://developers.redhat.com/products/codeready-containers/overview From 2651b99b8bbe0469d249ea617acd7f06125babcf Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sun, 5 Jan 2020 00:46:37 +0800 Subject: [PATCH 411/676] modify md --- .../tech/20200101 5 predictions for Kubernetes in 2020.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md index 32868982f8..f760fcfe4a 100644 --- a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md +++ b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: "lxbwolf) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2277c19e205a701b72b7620276efb9c6750e83f0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 5 Jan 2020 00:59:21 +0800 Subject: [PATCH 412/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200104=20DevOps?= =?UTF-8?q?=20is=20a=20solution=20to=20burnout=20worth=20investing=20in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200104 DevOps is a solution to burnout worth investing in.md --- ... solution to burnout worth investing in.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/tech/20200104 DevOps is a solution to burnout worth investing in.md diff --git a/sources/tech/20200104 DevOps is a solution to burnout worth investing in.md b/sources/tech/20200104 DevOps is a solution to burnout worth investing in.md new file mode 100644 index 0000000000..59d27c605e --- /dev/null +++ b/sources/tech/20200104 DevOps is a solution to burnout worth investing in.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevOps is a solution to burnout worth investing in) +[#]: via: (https://opensource.com/article/20/1/devops-burnout-solution) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +DevOps is a solution to burnout worth investing in +====== +Instead of treating burnout once it kicks in, we need to do more to +prevent it in the first place. Here is a reminder of the cause and a +look at solutions. +![A person choosing between several different incentives][1] + +Not a day goes by that I don't see a tweet or hear somebody talking about burnout. Burnout is becoming a pervasive part of our lives, especially in tech and open source communities. In [_What you need to know about burnout in open source communities_,][2] I defined burnout and explored its causes, symptoms, and potential treatments. But a better question is about prevention: How do we change the underlying processes, cultures, and tools to prevent burnout from occurring in the first place? + +### Burnout's catalyst is unplanned work + +Let's start by reviewing what's known about the cause of burnout. In 2019, PagerDuty published [_Unplanned work: The human impact of an always-on world_][3]. More than 35% of the study's respondents are considering leaving their jobs due to stress and work/life balance issues, also known as burnout. Companies that utilize automation and have documented response plans have fewer unplanned incidents and less stressed employees. + +Modern software organizations use automation and documented response plans to move faster. Moving faster is necessary to stay competitive. We are in this endless cycle where customers expect more, which puts more pressure on companies to deliver more and deliver it faster, which in turn creates pressure on employees. + +However, it is possible to move fast while having protections to prevent unplanned work and burnout. The Accelerate State of DevOps Report has been tracking trends in DevOps for six years. It allows teams to benchmark against others in the industry as low, medium, high, or elite performers. One of the findings from the [2019 State of DevOps report][4] was: "Productivity can drive improvements in work/life balance and reductions in burnout, and organizations can make smart investments to support it." + +Productivity means more work gets done. Therefore, more value is delivered. The catch to productivity is balance: Don't do more work in the short term at the expense of burning out your people. Processes and tooling need to be in place to prevent people from feeling overworked and overwhelmed. + +To support productivity that does not lead to burnout, organizations need to make smart investments in tooling and reduce technical debt. Investing in tooling means purchasing useful and easy-to-use solutions. The preference for building rather than buying may lead productivity to decrease and burnout to emerge. How? Instead of focusing on building features that are competitive differentiators and help the company achieve key business objectives, the developers spend countless hours trying to build something that a vendor could have quickly provided. + +As developers spend time building non-core solutions, technical debt accrues, and features are pushed out. Instead of building all the things, buy the tooling that supports the business but is not strategic, and build the things that are core to your business strategy. You wouldn't use development resources to build your own email program, so treat other tooling the same way. Twenty percent of tools used by low-performing teams are developed primarily in-house and proprietary to the organization, compared to 5% to 6% in medium, high, and elite teams. + +### Worthwhile solutions to burnout + +If you want to prevent burnout, here are some areas to invest in. It's no coincidence they overlap with frequent discussions [in DevOps articles][5]. + +#### Communication and collaboration + +Communication is at the heart of everything we do. [Laurie Barth][6] sums it up nicely: "Over time, I've learned that the biggest source of failure is often due to people and teams. A lack of communication and coordination can cause serious problems." Use tools like videoconferencing, Confluence, and Slack to ensure communication and collaboration happen. + +But create rules around the use of these tools. Make sure to turn off Slack notifications during off-hours. I disable my notifications from 6pm to 8am. + +Define what type of communication is best for which situations. Slack is useful for real-time, ephemeral communication, but it can lead to people feeling the need to always be on. If they're not online, they may miss an important conversation. If major or minor decisions are made in a Slack thread, document those in a longer-living system of record, giving all team members access to the necessary information. + +Trying to debug an incident? Communicate via Slack. Need to write up a post-incident review? Post that to Confluence or a wiki. + +Videoconferencing tools like Zoom or BlueJeans help enable remote work. Having the ability to work remotely, part-time or full-time, can reduce the stress of commuting or relocating. Videoconferences make it easy to stay connected with distributed teams because sometimes it is easier to hash things out in a face-to-face conversation than over email or Slack. + +These tools should not be used to encourage people to work while on vacation. Time off means time away from work to rest, recover, and recharge. + +#### Releases and deploys + +According to the 2019 State of DevOps report, elite teams deploy code 208 times more frequently than low performers, and their lead time from committing code to deployment is 106 times faster. It may seem that the more deploys you do, the greater the likelihood of burnout, but that isn't necessarily the case. Teams that utilize continuous delivery have processes in place to deploy safely. + +First, separate releases from deploys—just because you deployed code doesn't mean that all users should have access to it. Ring deploys make features available to a small group of people, like internal employees or beta customers. These users can help you identify bugs or provide feedback to fine-tune a feature before releasing it widely. + +Next, create feedback loops regarding the quality of a deployment. Things don't always go as planned when deploying your code. You need the ability to rapidly stop when things go wrong. Feedback loops include implementing monitoring and observability tools. By using telemetry data along with kill switches, you can quickly turn off a poorly behaving feature rather than rolling back an entire deployment. + +Finally, run A/B tests and experiments to learn what customers respond to. A metrics-based approach provides insight into what works and what doesn't and can help you validate a hypothesis. Instead of creating technical debt with a partial feature, collect data to see if the feature provides the expected conversions early on. If it doesn't, don't release it. + +#### Incident resolution + +Part of resolving incidents means knowing what to do when something breaks. And constantly putting out fires can lead to burnout. We can't prevent all incidents from happening, but we can be better prepared. Running chaos experiments or game days with tools like Gremlin can help companies prepare for the unexpected. + +With chaos experiments, you can learn how your systems, services, and applications respond under specific scenarios. Knowing how things behave when they're broken can shorten incident-resolution times. They can also help you identify and fix vulnerabilities before an incident occurs. + +What can you automate to reduce toil during incident resolution? For example, when you're actively working on an incident, can a Slack channel dedicated to the incident be automatically generated? Or can you create [feature flags][7] with a solution like LaunchDarkly (full disclosure: I work there) to perform common tasks during incident resolution? These could include: + + * Dynamic configuration changes, like automatically adjusting logging levels to collect more information when an alert is triggered + * Load-shedding to disable non-critical elements when systems are under heavy load to ensure essential tasks complete + * Kill switches or circuit breakers to turn off features when they are impacting your service reliability + + + +### It's not magic + +There is no magic bullet to resolve burnout; it requires having the right people, processes, and tools. The people help create an environment of psychological safety where people are free to ask questions, experiment, make mistakes, and be creative. Think about what is most important to your organization, and invest in the right tools to support those goals and the people working towards them. + +This month we look at ways to balance your workload, gracefully say "no," and avoid burnout. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/devops-burnout-solution + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_incentives.png?itok=IhIL1xyT (A person choosing between several different incentives) +[2]: https://opensource.com/article/19/11/burnout-open-source-communities +[3]: https://www.pagerduty.com/resources/reports/unplanned-work/ +[4]: https://services.google.com/fh/files/misc/state-of-devops-2019.pdf +[5]: https://opensource.com/tags/devops +[6]: https://laurieontech.com/ +[7]: https://martinfowler.com/articles/feature-toggles.html From fe36b54e08223dff6886b4540c2379977e4a952c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 5 Jan 2020 01:00:19 +0800 Subject: [PATCH 413/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200104=20Indust?= =?UTF-8?q?rial=20Internet=20Consortium=20teams=20up=20with=20blockchain-f?= =?UTF-8?q?ocused=20security=20group?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md --- ... with blockchain-focused security group.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md diff --git a/sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md b/sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md new file mode 100644 index 0000000000..cd5f8f23c2 --- /dev/null +++ b/sources/talk/20200104 Industrial Internet Consortium teams up with blockchain-focused security group.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Industrial Internet Consortium teams up with blockchain-focused security group) +[#]: via: (https://www.networkworld.com/article/3512062/industrial-internet-consortium-teams-up-with-blockchain-focused-security-group.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Industrial Internet Consortium teams up with blockchain-focused security group +====== +A merger between a prominent industrial-IoT umbrella group and a blockchain-centered corporate memebership program highlights a new focus on bringing finished IoT solutions to market. +Leo Wolfert / Getty Images + +The Industrial Internet Consortium and the Trusted IoT Alliance announced today that they would merge memberships, in an effort to drive more collaborative approaches to [industrial IoT][1] and help create more market-ready products. + +The Trusted IoT Alliance will now operate under the aegis of the IIC, a long-standing umbrella group for vendors operating in the IIoT market. The idea is to help create more standardized approaches to common use cases in IIoT, enabling companies to get solutions to market more quickly. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“This consolidation will strengthen the ability of the IIC to provide guidance and advance best practices on the uses of distributed-ledger technology across industries, and boost the commercialization of these products and services,” said 451 Research senior [blockchain][3] and DLT analyst Csilla Zsigri in a statement. + +Gartner vice president and analyst Al Velosa said that it’s possible the move to team up with TIoTA was driven in part by a new urgency to reach potential customers. Where other players in the IoT marketplace, like the major cloud vendors, have raked in billions of dollars in revenue, the IIoT vendors themselves haven’t been as quick to hit their sales targets. “This approach is them trying to explore new vectors for revenue that they haven’t before,” Velosa said in an interview. + +The IIC, whose founding members include Cisco, IBM, Intel, AT&T and GE, features 19 different working groups, covering everything from IIoT technology itself to security to marketing to strategy. Adding TIoTA’s blockchain focus to the mix could help answer questions about security, which are centrally important to the continued success of enterprise and industrial IoT products. + +Indeed, research from Gartner released late last year shows that IoT users are already gravitating toward blockchain and other distributed-ledger technologies. Fully three-quarters of IoT technology adopters in the U.S. have either brought that type of technology into their stack already or are planning to do so by the end of 2020. While almost two-thirds of respondents to the survey cited security and trust as the biggest drivers of their embrace of blockchain, almost as many noted that the technology had allowed them to increase business efficiency and lower costs. + +**[ Also see [What is edge computing?][4] and [How edge networking and IoT will reshape data centers][5].]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3512062/industrial-internet-consortium-teams-up-with-blockchain-focused-security-group.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3243928/what-is-the-industrial-internet-of-things-essentials-of-iiot.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html +[4]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html +[5]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From dba8b36c0b6facb3de8fc99e07ebcc18011331ed Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 5 Jan 2020 08:34:56 +0800 Subject: [PATCH 414/676] Rename sources/tech/20200104 DevOps is a solution to burnout worth investing in.md to sources/talk/20200104 DevOps is a solution to burnout worth investing in.md --- ...20200104 DevOps is a solution to burnout worth investing in.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200104 DevOps is a solution to burnout worth investing in.md (100%) diff --git a/sources/tech/20200104 DevOps is a solution to burnout worth investing in.md b/sources/talk/20200104 DevOps is a solution to burnout worth investing in.md similarity index 100% rename from sources/tech/20200104 DevOps is a solution to burnout worth investing in.md rename to sources/talk/20200104 DevOps is a solution to burnout worth investing in.md From 4182d564cf9b7fcc1e6a2a241a24b4e41b2e8c54 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 08:41:54 +0800 Subject: [PATCH 415/676] PRF @geekpi --- ...nable to Open the MRL- Error -Quick Tip.md | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md index 004f300c56..c94e4cdf2f 100644 --- a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md +++ b/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) @@ -10,11 +10,13 @@ 修复 “VLC is Unable to Open the MRL” 错误 ====== +![](https://img.linux.net.cn/data/attachment/album/202001/05/084139mzlt1lfivilnnbkl.jpg) + 一个使用 [VLC 的技巧][1]是使用 [VLC] [2] 播放 YouTube 和其他在线视频。这可以帮助你[观看带有字幕的在线视频][3]。 但是事情并不总是这么简单,因为有时使用 VLC 打开 YouTube 视频时会遇到此错误: -**Your input can’t be opened: VLC is unable to open the MRL ‘. Check the log for details.** +> Your input can’t be opened: VLC is unable to open the MRL ‘. Check the log for details. ![VLC error while playing YouTube videos][4] @@ -26,19 +28,17 @@ 对于 VLC 也是如此。如果你[在 Ubuntu 或任何你用的系统中安装了最新的 VLC][7],那么可能不会看到此错误。 -### 修复 ”VLC is unable to open the MRL“ 错误 +### 修复 “VLC is unable to open the MRL” 错误 让我向你展示对于 YouTube 的修复步骤。 -进入 VLC 媒体播放器的官方 Github 仓库页面,并使用 Ctrl+S 保存文件: +进入 VLC 媒体播放器的官方 Github 仓库页面的[这个页面][8],并使用 `Ctrl+S` 保存文件: -[Download youtube.lua file][8] - -现在,你需要做的是用此下载文件替换 lib/vlc/lua/playlist 目录中的 youtube.luac(注意 luac 中的 “c”)。 +现在,你需要做的是用此下载文件替换 `lib/vlc/lua/playlist` 目录中的 `youtube.luac`(注意 luac 中的 “c”)。 #### Linux 中的步骤 -如果你使用的是 Linux,请打开终端并使用 [locate 命令][9]查找 youtube.luac 文件的确切位置: +如果你使用的是 Linux,请打开终端并使用 [locate 命令][9]查找 `youtube.luac` 文件的确切位置: ``` locate youtube.luac @@ -49,7 +49,7 @@ locate youtube.luac 对我而言,以下是文件路径: ``` -[email protected]:~$ locate youtube.lua +abhishek@itsfoss:~$ locate youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac ``` @@ -65,10 +65,8 @@ sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtu 如果你使用的是 Windows,那么应遵循以下步骤: - * 将下载的 youtube.lua 文件重命名为 youtube.luac - * 复制此文件并将其粘贴到 C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\ - - + * 将下载的 `youtube.lua` 文件重命名为 `youtube.luac` + * 复制此文件并将其粘贴到 `C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\` 就是这些了。 @@ -83,7 +81,7 @@ via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b99de9587e8b5cea0a576dbfe5e166a479ebe3d7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 08:42:46 +0800 Subject: [PATCH 416/676] PUB @geekpi https://linux.cn/article-11748-1.html --- ...xing -VLC is Unable to Open the MRL- Error -Quick Tip.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md (95%) diff --git a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md b/published/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md similarity index 95% rename from translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md rename to published/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md index c94e4cdf2f..51b076d906 100644 --- a/translated/tech/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md +++ b/published/20191230 Fixing -VLC is Unable to Open the MRL- Error -Quick Tip.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11748-1.html) [#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]) [#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) @@ -16,7 +16,7 @@ 但是事情并不总是这么简单,因为有时使用 VLC 打开 YouTube 视频时会遇到此错误: -> Your input can’t be opened: VLC is unable to open the MRL ‘. Check the log for details. +> Your input can’t be opened: VLC is unable to open the MRL ''. Check the log for details. ![VLC error while playing YouTube videos][4] From 21ab432f7d8164af90f6f712f40783c3f70a05ff Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 09:46:12 +0800 Subject: [PATCH 417/676] PRF @lxbwolf --- ...219 Kubernetes namespaces for beginners.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/translated/tech/20191219 Kubernetes namespaces for beginners.md b/translated/tech/20191219 Kubernetes namespaces for beginners.md index 5c1f6267b0..06a5c4bf50 100644 --- a/translated/tech/20191219 Kubernetes namespaces for beginners.md +++ b/translated/tech/20191219 Kubernetes namespaces for beginners.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Kubernetes namespaces for beginners) @@ -9,42 +9,44 @@ Kubernetes 命名空间入门 ====== -命名空间是什么?你为什么需要它? -![Ship captain sailing the Kubernetes seas][1] -kubernetes 命名空间是什么?Shakespeare 以前写过,我们声称的命名空间,或者任何其他名字,仍是一个虚拟集群。命名空间,意味着 kubernetes 可以在单个集群上提供多个 kubernetes 的集群,类似一个对其主机进行抽象的虚拟机。[kubernetes 文档][2] 中的解释: +> 命名空间是什么?你为什么需要它? + +![](https://img.linux.net.cn/data/attachment/album/202001/05/094542qnq3qc3nrkkrjanh.jpg) + +kubernetes 命名空间namespace是什么?正如 Shakespeare 以前写过的,我们所谓的命名空间,或者任何其他名字,就是虚拟集群。通过虚拟集群,意味着 kubernetes 可以在单个集群上提供多个 kubernetes 的集群,类似一个在其主机抽象出来的虚拟机。[kubernetes 文档][2] 中的解释: > kubernetes 在一个物理集群上提供了多个虚拟集群。这些虚拟集群被称为命名空间。 -你为什么需要命名空间?一句话概括:隔离。 +你为什么需要命名空间?一言以蔽之:隔离。 -隔离有很多优点,如它提供了安全和干净的环境。如果你是基础设施的所属者,并且为开发者提供环境,隔离就相当重要。你最不需要的就是,一个不熟悉你集群是如何搭建的人去修改系统配置 — 这可能导致所有人都无法登录。 +隔离有很多优点,如它提供了安全和干净的环境。如果你是基础设施的所属者,并且要为开发者提供环境,隔离就相当重要。你最不需要的就是,一个不熟悉你集群是如何搭建的人去修改系统配置 —— 这可能导致所有人都无法登录。 ### 初始命名空间 - 一个集群的三个初始命名空间:**default**、**kube-system** 和 **kube-public**。虽然你可以用这三个命名空间作技术部署,但我还是推荐你把这三个命名空间留作系统配置用,而不是你的项目。 +一个集群的三个初始命名空间:`default`、`kube-system` 和 `kube-public`。虽然技术上你可以用这三个命名空间作部署,但我还是推荐你把这三个命名空间留作系统配置用,而不是你的项目。 - * **Default** 某些部署没有指明命名空间,这样部署可以快速创建一个网格,但如果做了很多错误信息的部署,就很能去清理。我不去修改它,因为它在为某一个目的服务时,会在不止一种情况下误导我。 - * **Kube-system** 系统相关的所有对象组成的命名空间。任何此命名空间的部署都可能是危险的操作,可能对系统本身造成不可挽回的破坏。没错,我试过;所以我不推荐。 - * **Kube-public** 所有人可读,但是这个命名空间是为系统保留的。 +* `Default` 用于某些没有指明命名空间的部署,这是一种快速创建混乱的做法,如果你在没有正确信息的情况下做了很多部署,将很难清理。我不会去动它,因为它只有这一个用途,而且在不止一种情况下误导过我。 +* `Kube-system` 是 Kubernetes 系统相关的所有对象组成的命名空间。任何对此命名空间的部署都可能是危险的操作,可能对系统本身造成不可挽回的破坏。没错,我试过;所以我不推荐。 +* `Kube-public` 所有人可读,但是这个命名空间是为系统保留的。 ### 用命名空间来实现隔离 -我用了多种方式通过命名空间来实现隔离。我经常用命名空间来把多个用户项目分割到不同的环境。这种方式可以有效防止跨项目的污染,因为命名空间提供了独立的环境。例如,使用者可以安装不同版本的 Jenkins,如果它们的环境变量是在不同的命名空间,就不会冲突。 +我用了多种方式通过命名空间来实现隔离。我经常用命名空间来把多个用户项目分割到不同的环境。这种方式可以有效防止跨项目的污染,因为命名空间提供了独立的环境。例如,用户可以安装不同版本的 Jenkins,如果它们的环境变量是在不同的命名空间,就不会冲突。 -这种隔离对于清理也很有帮助。如果部署组的多个项目被废弃,你可以用命令 `kubectl delete ns <$NAMESPACENAME>` 一键删除命名空间,清理命名空间内的所有东西。(请确认被删除的是正确的命名空间。我曾经在生产环境删除了错误的命名空间,这很不好。) +这种隔离对于清理也很有帮助。如果开发小组的多个项目突然被废弃,你可以用命令 `kubectl delete ns <$NAMESPACENAME>` 一键删除命名空间,清理命名空间内的所有东西。(请确认被删除的是正确的命名空间。我曾经在生产环境删除了错误的命名空间,这很不好。) -如果你是基础设施所有者,请谨慎操作,因为这可能会引发其他团队的的故障或引发其他问题。例如,如果你创建了一个特定的命名空间,里面有 DNS 函数,其他人删除了它,那么命名空间内的所有 pod 和它们运行的应用都会被清空。所有的**删除**操作在真正实施之前都应该由同事(通过 [GitOps][3])评审一下。 +如果你是基础设施所有者,请谨慎操作,因为这可能会引发其他团队的的故障或引发其他问题。例如,如果你创建了一个特定的命名空间,里面有特殊的额外安全的 DNS 功能,但是其他人删除了它,那么命名空间内的所有 pod 和它们运行的应用都会被清空。所有的**删除**操作在真正实施之前都应该由同事(通过 [GitOps][3])评审一下。 虽然官方文档不建议 [10 人以下团队][2] 使用多个命名空间,但出于架构需要,在我自己的集群上还是用了多个命名空间。集群越干净越好。 ### 关于命名空间管理员应该知道的 -首先,命名空间不能嵌套。部署只能在一个命名空间中进行。对于版本化项目,你不一定要用命名空间,你可以使用标签来区分有相同名字的版本化应用。命名空间使用配额来为不同的用户划分资源;例如,*某个命名空间最多能有 x 个 node*。最后,所有的命名空间对于资源类型只能使用一个独一无二的名字。 +首先,命名空间不能嵌套。部署只能在一个命名空间中进行。对于版本化项目,你不一定要用命名空间,你可以使用标签来区分有相同名字的版本化应用。命名空间使用配额来为不同的用户划分资源;例如,*某个命名空间最多能有 x 个节点*。最后,所有的命名空间对于该资源类型只能使用一个独一无二的名字。 ### 命名空间命令操作 -你需要安装 [Minikube][4]、 [Helm][5] 和 [kubectl][6] 命令行,才能使用下面的命名空间命令。我的文章 [_安全浏览你的 DevOps 流水线_][7] 中有它们的安装教程,你也可以去每个工程的官方主页去找安装教程。我使用的是最新的 Minikube。手动安装很快,第一次就能成功运行。 +你需要安装 [Minikube][4]、[Helm][5] 和 [kubectl][6] 命令行,才能使用下面的命名空间命令。我的文章《[安全扫描你的 DevOps 流水线][7]》中有它们的安装教程,你也可以去每个项目的官方主页去找安装教程。我使用的是最新的 Minikube。手动安装很快,第一次就能成功运行。 获取你的第一组命名空间: @@ -63,7 +65,7 @@ jess@Athena:~$ kubectl create namespace athena namespace/athena created ``` -现在开发者可以部署到你创建的命名空间;例如,这里是一个简短的 Helm 结构信息: +现在开发者可以部署到你创建的命名空间了;例如,这里是一个简短的 Helm chart: ``` jess@Athena:~$ helm install teset-deploy stable/redis --namespace athena @@ -74,7 +76,7 @@ STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: -** Please be patient while the chart is being deployed ** +` Please be patient while the chart is being deployed ` Redis can be accessed via port 6379 on the following DNS names from within your cluster: teset-deploy-redis-master.athena.svc.cluster.local for read/write operations @@ -98,6 +100,7 @@ export REDIS_PASSWORD=$(kubectl get secret --namespace athena teset-deploy-redis ``` 2. 使用 Redis CLI 连接: + ```bash redis-cli -h teset-deploy-redis-master -a $REDIS_PASSWORD redis-cli -h teset-deploy-redis-slave -a $REDIS_PASSWORD @@ -110,11 +113,10 @@ kubectl port-forward --namespace athena svc/teset-deploy-redis-master 6379:6379 redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD ``` -现在这一套部署已经完成了,你有一个在命名空间 **test-deploy** 中部署的图表。 +现在这一套部署已经完成了,你有一个在命名空间 `test-deploy` 中部署的 chart。 查看你的命名空间中有哪些 pod: - ``` jess@Athena:~$ kubectl get pods --namespace athena NAME                            READY   STATUS  RESTARTS   AGE @@ -127,7 +129,6 @@ teset-deploy-redis-slave-1      1/1     Running   0             90s 一键删除所有东西: - ```bash jess@Athena:~$ kubectl delete namespace athena namespace "athena" deleted @@ -137,7 +138,6 @@ namespace "athena" deleted 再次检查一下所有东西是否被删除了: - ```bash jess@Athena:~$ kubectl get pods --all-namespaces NAMESPACE       NAME                            READY   STATUS  RESTARTS   AGE @@ -156,11 +156,11 @@ kube-system   storage-provisioner               1/1     Running   0 ### 命名空间实践 -现在我是为了安全使用命名空间,如限制用户的权限。你可以限制所有的东西 — 从哪些角色可以访问命名空间,到命名空间可使用的集群资源(CPU 等)的配额等级。例如,我通过资源配额和基于角色的访问控制(role-based access control,RBAC)配置来确保只有允许的服务账号可以访问命名空间。 +当前我是出于安全考虑才使用命名空间,如限制用户的权限。你可以限制所有的东西 —— 从哪些角色可以访问命名空间,到命名空间可使用的集群资源(CPU 等)的配额等级。例如,我通过资源配额和基于角色的访问控制role-based access control(RBAC)配置来确保只有允许的服务账号可以访问命名空间。 -对于隔离方面的安全,我不希望我的私人 Jenkins 应用可以通过一个信任的本地网络被当做有公共 IP 地址的安全镜像来访问(我不得不假定,可能会做出妥协)。 +对于隔离方面的安全,我不希望我的私人 Jenkins 应用可以通过一个信任的本地网络被当做一个有公共 IP 地址的安全镜像来访问(我不得不假定,可能会被侵袭)。 -如果你很难提前计算出到底要在你的云平台上部署多少 node(就我而言,在把我的私人服务器放到 [segfaulting][8] 之前可以部署多少个 node),那么命名空间在预算方面也很有用。虽然这超出了本文的讨论范围,而且很复杂,但值得你去调研和使用来防止你的集群过分扩展。 +如果你很难提前计算出到底要在你的云平台上部署多少节点(或者,就我而言,是在[搞崩][8]我的家庭服务器之前我能部署多少个),那么命名空间在预算方面也很有用。虽然这超出了本文的讨论范围,而且很复杂,但值得你去调研和使用来防止你的集群过分扩展。 ### 总结 @@ -173,7 +173,7 @@ via: https://opensource.com/article/19/12/kubernetes-namespaces 作者:[Jessica Cherry][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 37c8828eee2b213dcdadf927e2e163923fbc94c0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 09:46:40 +0800 Subject: [PATCH 418/676] PUB @lxbwolf https://linux.cn/article-11749-1.html --- .../20191219 Kubernetes namespaces for beginners.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191219 Kubernetes namespaces for beginners.md (99%) diff --git a/translated/tech/20191219 Kubernetes namespaces for beginners.md b/published/20191219 Kubernetes namespaces for beginners.md similarity index 99% rename from translated/tech/20191219 Kubernetes namespaces for beginners.md rename to published/20191219 Kubernetes namespaces for beginners.md index 06a5c4bf50..c45aa74d42 100644 --- a/translated/tech/20191219 Kubernetes namespaces for beginners.md +++ b/published/20191219 Kubernetes namespaces for beginners.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11749-1.html) [#]: subject: (Kubernetes namespaces for beginners) [#]: via: (https://opensource.com/article/19/12/kubernetes-namespaces) [#]: author: (Jessica Cherry https://opensource.com/users/jrepka) From cbcfbc8dd7330da93819934bd6131128f0230766 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 10:20:23 +0800 Subject: [PATCH 419/676] PRF @wxy --- ...ming resources for coders of all levels.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20191231 12 programming resources for coders of all levels.md b/translated/tech/20191231 12 programming resources for coders of all levels.md index c3687187b3..c61d0aa4c3 100644 --- a/translated/tech/20191231 12 programming resources for coders of all levels.md +++ b/translated/tech/20191231 12 programming resources for coders of all levels.md @@ -1,39 +1,39 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (12 programming resources for coders of all levels) [#]: via: (https://opensource.com/article/19/12/programming-resources) [#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) -12 个给码农们的编程资源 +12 个给全等级码农们的编程资源 ====== > 无论你身处编程旅程中的何处,这 12 篇编程文章都有你需要学习一些东西。 -![Woman sitting in front of her computer][1] +![](https://img.linux.net.cn/data/attachment/album/202001/05/102002cdjy66jucbcfs6dg.jpg) > “学习计算机编程的最佳时间是 20 年前,其次是现在。” -> — (也许是)计算机科学的谚语 +> — 计算机科学的谚语(也许是) -你是新程序员、经验丰富的 Web 开发人员、后端大师、头发花白的系统程序员,还是其他神秘物种的计算机极客?无论你身处广阔的软件开发人员生态系统中的何处,在我们领域中唯一不变的就是需要了解新技术及其应用方法。这是过去一年来阅读量最大的 Opensource.com 文章的集合,我很高兴在这里与你分享它们。 +无论你是新程序员、经验丰富的 Web 开发人员、后端大师、头发花白的系统程序员,还是其他神秘物种的计算机极客?无论你身处广阔的软件开发人员生态系统中的何处,在我们领域中唯一不变的就是需要了解新技术及其应用方法。这是过去一年来阅读量最大的 Opensource.com 文章的集合,我很高兴在这里与你分享它们。 ### 好好学习 无论你的技能或兴趣是什么,学习如何编写计算机程序都可以将特定领域的知识变成一种超能力。不幸的是,至少从现在开始,还不可能通过坐在计算机前面接受电磁辐射就能学会如何编程。在这之前,我推荐这些出色的文章来帮助激发你的编程技能。它们解决了一些重要的问题,例如考虑学习哪种语言以及不同的入门方式。 -* [你应该学习哪种编程语言?][2] -* [学习 Python 的 12 个方式][3] -* [你可以使用树莓派学习的三种流行编程语言][4] -* [利用 Python 引导孩子的计算机思维][5] +* [你应该学习哪种编程语言?][2](译文) +* [学习 Python 的 12 个方式][3](译文) +* [你可以使用树莓派学习的三种流行编程语言][4](译文) +* [利用 Python 引导孩子的计算机思维][5](译文) ### 天天向上 经验丰富的程序员知道,与学习编程相比,唯一更难的就是使你的技能和知识保持最新。但是我们是[自学成才][6]的一族,总是希望提高我们的专业知识和理解力。即使我们不期望使用新技术,我们也知道总会有人问起它们。这些有关 Rust、WebAssembly 和 Podman 的文章是开始学习软件技术一些即将出现的趋势的好地方。 * [为什么要在 WebAssembly 中使用 Rust?][7] -* [使用 WebAssembly 提升命令行游乐场][8] +* [使用 WebAssembly 扩展命令行领域][8] * [免 root 的 Podman 如何工作?][9] * [为什么选择 Rust 作为你的下一种编程语言][10] @@ -42,8 +42,8 @@ 尽管新技术层出不穷,但回顾过去可以帮助你前进。当今惊人的技术是建立在昨天的工具之上的,即使我们从未使用这些传奇语言编写过代码,它也将使我们很好地理解这些工具的功能和局限性。这一系列文章集中于 C 语言、用 AWK 编写的实际应用程序,以及对流行度下降但也许还没有消亡的计算机语言的有趣讨论。 * [C 的巨大影响] [11] -* [如何写好 C main 函数][12] -* [用 AWK 喝咖啡][13] +* [如何写好 C main 函数][12](译文) +* [用 AWK 喝咖啡][13](译文) * [你最喜欢的“死”语言是什么?][14] ### 学习不止 @@ -57,7 +57,7 @@ via: https://opensource.com/article/19/12/programming-resources 作者:[Erik O'Shaughnessy][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 833d4892d808f3b0db96e43d32ee02d990861be3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 10:20:59 +0800 Subject: [PATCH 420/676] PUB @wxy https://linux.cn/article-11751-1.html --- ...91231 12 programming resources for coders of all levels.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191231 12 programming resources for coders of all levels.md (98%) diff --git a/translated/tech/20191231 12 programming resources for coders of all levels.md b/published/20191231 12 programming resources for coders of all levels.md similarity index 98% rename from translated/tech/20191231 12 programming resources for coders of all levels.md rename to published/20191231 12 programming resources for coders of all levels.md index c61d0aa4c3..2e32ec2515 100644 --- a/translated/tech/20191231 12 programming resources for coders of all levels.md +++ b/published/20191231 12 programming resources for coders of all levels.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11751-1.html) [#]: subject: (12 programming resources for coders of all levels) [#]: via: (https://opensource.com/article/19/12/programming-resources) [#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) From 24c143416f9463a5c00a2e5351d6be60a1d95d46 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 5 Jan 2020 14:29:55 +0800 Subject: [PATCH 421/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...w to write a Python web API with Django.md | 247 ------------------ ...w to write a Python web API with Django.md | 230 ++++++++++++++++ 2 files changed, 230 insertions(+), 247 deletions(-) delete mode 100644 sources/tech/20191129 How to write a Python web API with Django.md create mode 100644 translated/tech/20191129 How to write a Python web API with Django.md diff --git a/sources/tech/20191129 How to write a Python web API with Django.md b/sources/tech/20191129 How to write a Python web API with Django.md deleted file mode 100644 index 38acb243cd..0000000000 --- a/sources/tech/20191129 How to write a Python web API with Django.md +++ /dev/null @@ -1,247 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to write a Python web API with Django) -[#]: via: (https://opensource.com/article/19/11/python-web-api-django) -[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) - -How to write a Python web API with Django -====== -Django is one of the most popular frameworks for Python API development. -Learn how to use it in this quick tutorial. -![Hands on a keyboard with a Python book ][1] - -[Django][2] is the comprehensive web framework by which all other frameworks are measured. One of the most popular names in Python API development, Django has surged in popularity since its start in 2005. - -Django is maintained by the Django Software Foundation and has experienced great community support, with over 11,600 members worldwide. On Stack Overflow, Django has around 191,000 tagged questions. Websites like Spotify, YouTube, and Instagram rely on Django for application and data management. - -This article demonstrates a simple API to fetch data from a server using the GET method of the HTTP protocol. - -### Set up a project - -First, create a structure for your Django application; you can do this at any location on your system: - - -``` -$ mkdir myproject -$ cd myproject -``` - -Then, create a virtual environment to isolate package dependencies locally within the project directory: - - -``` -$ python3 -m venv env -$ source env/bin/activate -``` - -On Windows, use the command **env\Scripts\activate** to activate your Python virtual environment. - -### Install Django and the Django REST framework - -Next, install the Python modules for Django and Django REST: - - -``` -$ pip3 install django -$ pip3 install djangorestframework -``` - -### Instantiate a new Django project - -Now that you have a work environment for your app, you must instantiate a new Django project. Unlike a minimal framework like [Flask][3], Django includes dedicated commands for this process (note the trailing **.** character in the first command): - - -``` -$ django-admin startproject tutorial . -$ cd tutorial -$ django-admin startapp quickstart -``` - -Django uses a database as its backend, so you should sync your database before beginning development. The database can be managed with the **manage.py** script that was created when you ran the **django-admin** command. Because you're currently in the **tutorial** directory, use the **../** notation to run the script, located one directory up: - - -``` -$ python3 ../manage.py makemigrations -No changes detected -$ python4 ../manage.py migrate -Operations to perform: -  Apply all migrations: admin, auth, contenttypes, sessions -Running migrations: -  Applying contenttypes.0001_initial... OK -  Applying auth.0001_initial... OK -  Applying admin.0001_initial... OK -  Applying admin.0002_logentry_remove_auto_add... OK -  Applying admin.0003_logentry_add_action_flag_choices... OK -  Applying contenttypes.0002_remove_content_type_name... OK -  Applying auth.0002_alter_permission_name_max_length... OK -  Applying auth.0003_alter_user_email_max_length... OK -  Applying auth.0004_alter_user_username_opts... OK -  Applying auth.0005_alter_user_last_login_null... OK -  Applying auth.0006_require_contenttypes_0002... OK -  Applying auth.0007_alter_validators_add_error_messages... OK -  Applying auth.0008_alter_user_username_max_length... OK -  Applying auth.0009_alter_user_last_name_max_length... OK -  Applying auth.0010_alter_group_name_max_length... OK -  Applying auth.0011_update_proxy_permissions... OK -  Applying sessions.0001_initial... OK -``` - -### Create users in Django - -Create an initial user named **admin** with the example password of **password123**: - - -``` -$ python3 ../manage.py createsuperuser \ -  --email [admin@example.com][4] \ -  --username admin -``` - -Create a password when you're prompted. - -### Implement serializers and views in Django - -For Django to be able to pass information over to an HTTP GET request, the information object must be translated into valid response data. Django implements **serializers** for this. - -In your project, define some serializers by creating a new module named **quickstart/serializers.py**, which you'll use for data representations: - - -``` -from django.contrib.auth.models import User, Group -from rest_framework import serializers - -class UserSerializer(serializers.HyperlinkedModelSerializer): -    class Meta: -        model = User -        fields = ['url', 'username', 'email', 'groups'] - -class GroupSerializer(serializers.HyperlinkedModelSerializer): -    class Meta: -        model = Group -        fields = ['url', 'name'] -``` - -A [view][5] in Django is a function that takes a web request and returns a web response. The response can be HTML, or an HTTP redirect, or an HTTP error, a JSON or XML document, an image or TAR file, or anything else you can get over the internet. To create a view, open **quickstart/views.py** and enter the following code. This file already exists and has some boilerplate text in it, so keep that and append this text to the file: - - -``` -from django.contrib.auth.models import User, Group -from rest_framework import viewsets -from tutorial.quickstart.serializers import UserSerializer, GroupSerializer - -class UserViewSet(viewsets.ModelViewSet): -    """ -    API endpoint  allows users to be viewed or edited. -    """ -    queryset = User.objects.all().order_by('-date_joined') -    serializer_class = UserSerializer - -class GroupViewSet(viewsets.ModelViewSet): -    """ -    API endpoint  allows groups to be viewed or edited. -    """ -    queryset = Group.objects.all() -    serializer_class = GroupSerializer -``` - -### Generate URLs with Django - -Now you can generate URLs so people can access your fledgling API. Open **urls.py** in a text editor and replace the default sample code with this code: - - -``` -from django.urls import include, path -from rest_framework import routers -from tutorial.quickstart import views - -router = routers.DefaultRouter() -router.register(r'users', views.UserViewSet) -router.register(r'groups', views.GroupViewSet) - -# Use automatic URL routing -# Can also include login URLs for the browsable API -urlpatterns = [ -    path('', include(router.urls)), -    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) -] -``` - -### Adjust your Django project settings - -The settings module for this example project is stored in **tutorial/settings.py**, so open that in a text editor and add **rest_framework** to the end of the **INSTALLED_APPS** list: - - -``` -INSTALLED_APPS = [ -    ... -    'rest_framework', -] -``` - -### Test your Django API - -You're now ready to test the API you've built. First, start up the built-in server from the command line: - - -``` -`$ python3 manage.py runserver` -``` - -You can access your API by navigating to the URL **** using **curl**: - - -``` -$ curl --get -[{"url":" -``` - -Or use Firefox or the [open source web browser][6] of your choice: - -![A simple Django API][7] - -For more in-depth knowledge about RESTful APIs using Django and Python, see the excellent [Django documentation][8]. - -### Why should I use Django? - -The major benefits of Django: - - 1. The size of the Django community is ever-growing, so you have lots of resources for guidance, even on a complicated project. - 2. Features like templating, routing, forms, authentication, and management tools are included by default. You don't have to hunt for external tools or worry about third-party tools introducing compatibility issues. - 3. Simple constructs for users, loops, and conditions allow you to focus on writing code. - 4. It's a mature and optimized framework that is extremely fast and reliable. - - - -The major drawbacks of Django are: - - 1. Django is complex! From a developer's point of view, Django can be trickier to learn than a simpler framework. - 2. There's a big ecosystem around Django. This is great once you're comfortable with Django, but it can be overwhelming when you're still learning. - - - -Django is a great option for your application or API. Download it, get familiar with it, and start developing an amazing project! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/python-web-api-django - -作者:[Rachel Waston][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/rachelwaston -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) -[2]: https://www.djangoproject.com/ -[3]: https://opensource.com/article/19/11/python-web-api-flask -[4]: mailto:admin@example.com -[5]: https://docs.djangoproject.com/en/2.2/topics/http/views/ -[6]: https://opensource.com/article/19/7/open-source-browsers -[7]: https://opensource.com/sites/default/files/uploads/django-api.png (A simple Django API) -[8]: https://docs.djangoproject.com/en/2.2 diff --git a/translated/tech/20191129 How to write a Python web API with Django.md b/translated/tech/20191129 How to write a Python web API with Django.md new file mode 100644 index 0000000000..aaf4acefb8 --- /dev/null +++ b/translated/tech/20191129 How to write a Python web API with Django.md @@ -0,0 +1,230 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a Python web API with Django) +[#]: via: (https://opensource.com/article/19/11/python-web-api-django) +[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) + +如何借助 Django 来编写一个 Python Web API +====== +Django 是 Python API 开发中最流行的框架之一,在这个教程中,我们来学习如何使用它。 +![拿起 Python 书来学习吧][1] + +[Django][2] 所有 Web 框架中最全面的,也是最受欢迎的一个。自 2005 年以来,其流行度大幅上升。 + +Django 是由 Django 软件基金会维护,并且获得了社区的大力支持,在全球拥有超过 11,600 名会员。在 Stack Overflow 上,Django 约有 191,000 个带标签的问题。Spotify、YouTube 和 Instagram 等都使用 Django 来构建应用程序和数据管理。 + +本文演示了一个简单的 API,通过它可以使用 HTTP 协议的 GET 方法来从服务器获取数据。 + +### 构建一个项目 + +首先,为你的 Django 应用程序创建一个目录结构,你可以在系统的任何位置创建: + +``` +$ mkdir myproject +$ cd myproject +``` + +然后,在项目目录中创建一个虚拟环境来隔离本地包依赖关系: + +``` +$ python3 -m venv env +$ source env/bin/activate +``` + +在 Windows 上,使用命令 **env\Scripts\activate** 来激活虚拟环境: + +### 安装 Django 和 Django REST framework + +然后,安装 Django 和 Django REST: + +``` +$ pip3 install django +$ pip3 install djangorestframework +``` + +### 实例化一个新的 Django 项目 + +现在你的应用程序已经有了一个工作环境,你必须实例化一个新的 Django 项目。与 [Flask][3] 这样微框架不同的是,Django 有专门的命令来创建(注意第一条命令后的 **.** 字符)。 + +``` +$ django-admin startproject tutorial . +$ cd tutorial +$ django-admin startapp quickstart +``` + +Django 使用数据库来管理后端,所以你应该在开始开发之前同步数据库,数据库可以通过 **manage.py** 脚本管理,它是在你运行 **django-admin** 命令时创建的。因为你现在在 **tutorial** 目录,所以使用 **../** 符号来运行脚本,它位于上一层目录: + +``` +$ python3 ../manage.py makemigrations +No changes detected +$ python4 ../manage.py migrate +Operations to perform: +  Apply all migrations: admin, auth, contenttypes, sessions +Running migrations: +  Applying contenttypes.0001_initial... OK +  Applying auth.0001_initial... OK +  Applying admin.0001_initial... OK +  Applying admin.0002_logentry_remove_auto_add... OK +  Applying admin.0003_logentry_add_action_flag_choices... OK +  Applying contenttypes.0002_remove_content_type_name... OK +  Applying auth.0002_alter_permission_name_max_length... OK +  Applying auth.0003_alter_user_email_max_length... OK +  Applying auth.0004_alter_user_username_opts... OK +  Applying auth.0005_alter_user_last_login_null... OK +  Applying auth.0006_require_contenttypes_0002... OK +  Applying auth.0007_alter_validators_add_error_messages... OK +  Applying auth.0008_alter_user_username_max_length... OK +  Applying auth.0009_alter_user_last_name_max_length... OK +  Applying auth.0010_alter_group_name_max_length... OK +  Applying auth.0011_update_proxy_permissions... OK +  Applying sessions.0001_initial... OK +``` + +### 在 Django 中创建用户 + +创建一个名为 **admin**,密码为 **password123** 的初始用户: + +``` +$ python3 ../manage.py createsuperuser \ +  --email [admin@example.com][4] \ +  --username admin +``` + +在提示时创建密码。 + +### 在 Django 中实现序列化和视图 + +为了使 Django 能够将信息传递给 HTTP GET 请求,必须将信息对象转化为有效的响应数据。Django 为此实现了“序列化类”。 + +在你的项目中,创建一个名为 **quickstart/serializers.py** 的新模块,使用它来定义一些序列化器,模块将用于数据展示: + +``` +from django.contrib.auth.models import User, Group +from rest_framework import serializers + +class UserSerializer(serializers.HyperlinkedModelSerializer): +    class Meta: +        model = User +        fields = ['url', 'username', 'email', 'groups'] + +class GroupSerializer(serializers.HyperlinkedModelSerializer): +    class Meta: +        model = Group +        fields = ['url', 'name'] +``` + +Django 中的 [view][5] 是一个接受 Web 请求并返回 Web 响应的函数。响应可以是 HTML、HTTP 重定向、HTTP 错误、JSON 或 XML 文档、图像或 TAR 文件,或者可以是从 Internet 获得的任何其他内容。要创建视图,打开 **quickstart/views.py** 并输入以下代码。该文件已经存在,并且其中包含一些示例文本,保留这些文本并将以下代码添加到文件中: + +``` +from django.contrib.auth.models import User, Group +from rest_framework import viewsets +from tutorial.quickstart.serializers import UserSerializer, GroupSerializer + +class UserViewSet(viewsets.ModelViewSet): +    """ +    API 允许查看或编辑用户 +    """ +    queryset = User.objects.all().order_by('-date_joined') +    serializer_class = UserSerializer + +class GroupViewSet(viewsets.ModelViewSet): +    """ +    API 允许查看或编辑组 +    """ +    queryset = Group.objects.all() +    serializer_class = GroupSerializer +``` + +### 使用 Django 生成 URL + +现在,你可以生成 URL 以便人们可以访问你刚起步的 API。在文本编辑器中打开 urls.py 并将默认示例代码替换为以下代码: + +``` +from django.urls import include, path +from rest_framework import routers +from tutorial.quickstart import views + +router = routers.DefaultRouter() +router.register(r'users', views.UserViewSet) +router.register(r'groups', views.GroupViewSet) + +# 使用自动路由 URL +# 还有登录 URL +urlpatterns = [ +    path('', include(router.urls)), +    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) +] +``` + +### 调整你的 Django 项目设置 + +这个示例项目的设置模块存储在 **tutorial/settings.py** 中,因此在文本编辑器中将其打开,然后在 **INSTALLED_APPS** 列表的末尾添加 **rest_framework**: + +``` +INSTALLED_APPS = [ +    ... +    'rest_framework', +] +``` + +### 测试 Django API + +现在,你可以测试构建的 API。首先,从命令行启动内置服务器: + +``` +`$ python3 manage.py runserver` +``` + +你可以通过使用 **curl** 导航至 URL **** 来访问 API: + +``` +$ curl --get +[{"url":" +``` + +使用 Firefox 或[开源浏览器][6]: + +![一个简单的 Django API][7] + +有关使用 Django 和 Python 的 RESTful API 的更多深入知识,参考出色的 [Django 文档][8]。 + +### 为什么要使用 Djago? + +Django 的主要优点: + + 1. Django 社区的规模正在不断扩大,因此即使你做一个复杂项目,也会有大量的指导资源。 + 2. 默认包含模板、路由、表单、身份验证和管理工具等功能,你不必寻找外部工具,也不必担心第三方工具会引入兼容性问题。 + 3. 用户,循环和条件的简单结构使你可以专注于编写代码。 + 4. 这是一个成熟且经过优化的框架,它非常快速且可靠。 + +Django 的主要缺点是: + + 1. Django 很复杂!从开发人员视角的角度来看,它可能比简单的框架更难学。 + 2. Django 有一个很大的生态系统。一旦你熟悉它,这会很棒,但是当你深入学习时,它可能会令人感到无所适从。 + +对你的应用程序或 API 来说,Django 是绝佳选择。下载并熟悉它,开始开发一个迷人的项目! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/python-web-api-django + +作者:[Rachel Waston][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rachelwaston +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://www.djangoproject.com/ +[3]: https://opensource.com/article/19/11/python-web-api-flask +[4]: mailto:admin@example.com +[5]: https://docs.djangoproject.com/en/2.2/topics/http/views/ +[6]: https://opensource.com/article/19/7/open-source-browsers +[7]: https://opensource.com/sites/default/files/uploads/django-api.png (A simple Django API) +[8]: https://docs.djangoproject.com/en/2.2 From 73017730a98b1f330565628ab3c4b013d8a0d178 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sun, 5 Jan 2020 19:09:25 +0800 Subject: [PATCH 422/676] translating by lxbwolf --- sources/tech/20191210 Lessons learned from programming in Go.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md index 1702d36c47..0c9aeea2e2 100644 --- a/sources/tech/20191210 Lessons learned from programming in Go.md +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1a18060ceafa26e3ec53d7943f74a06cda233400 Mon Sep 17 00:00:00 2001 From: summer2233 Date: Sun, 5 Jan 2020 21:29:00 +0800 Subject: [PATCH 423/676] Update 20171130 Excellent Business Software Alternatives For Linux.md --- ...171130 Excellent Business Software Alternatives For Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20171130 Excellent Business Software Alternatives For Linux.md b/sources/tech/20171130 Excellent Business Software Alternatives For Linux.md index 3469c62569..4a40b993f3 100644 --- a/sources/tech/20171130 Excellent Business Software Alternatives For Linux.md +++ b/sources/tech/20171130 Excellent Business Software Alternatives For Linux.md @@ -1,3 +1,5 @@ +summer2233 is translating + Excellent Business Software Alternatives For Linux ------- From 6ba21f4ddb9a1ce58ecf32a1e7d7f6ed54bf7c4a Mon Sep 17 00:00:00 2001 From: summer2233 Date: Sun, 5 Jan 2020 21:31:19 +0800 Subject: [PATCH 424/676] Update 20191226 10 Linux command tutorials for beginners and experts.md --- ...1226 10 Linux command tutorials for beginners and experts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md index 3172f26ea1..03fc77a8e1 100644 --- a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md +++ b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (summer2233) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 42dedf47444a6b0fd340182c185f042fdcef75b0 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 5 Jan 2020 22:31:00 +0800 Subject: [PATCH 425/676] Translating --- ...180522 Advanced use of the less text file viewer in Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md b/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md index e080c39b57..9d8ea93869 100644 --- a/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md +++ b/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md @@ -1,3 +1,5 @@ +Translating by MjSeven + Advanced use of the less text file viewer in Linux ====== From 5a1c090897bafe146ffdf3ca2d54d49c2304f422 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 22:46:48 +0800 Subject: [PATCH 426/676] PRF @MjSeven --- ... Python interfaces using zope.interface.md | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md index 9827cb9b28..e2797b9e40 100644 --- a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md +++ b/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (An advanced look at Python interfaces using zope.interface) @@ -9,42 +9,44 @@ 借助 zope.interface 深入了解 Python 接口 ====== -Zope.interface 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 + +> Zope.interface 可以帮助声明存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 + ![Snake charmer cartoon with a yellow snake and a blue snake][1] -**zope.interface** 库可以克服 Python 接口设计中的歧义性。让我们来研究一下。 +`zope.interface` 库可以克服 Python 接口设计中的歧义性。让我们来研究一下。 ### 隐式接口不是 Python 之禅 -[Python 之禅][2] 很宽松,但是有点自相矛盾,你可以从中证明一切。让我们来思考其中最著名的原则之一:“显示胜于隐式”。 +[Python 之禅][2] 很宽松,但是有点自相矛盾,以至于你可以用它来例证任何东西。让我们来思考其中最著名的原则之一:“显示胜于隐式”。 -在 Python 中会隐含的一件事是预期的接口。比如函数已经记录了它期望一个“类文件对象”或“序列”。但是什么是类文件对象呢?它支持 **.writelines** 和 **.seek** 吗?什么是一个“序列”?是否支持分步切片,例如 **a[1:10:2]**? +传统上,在 Python 中会隐含的一件事是预期的接口。比如函数已经记录了它期望一个“类文件对象”或“序列”。但是什么是类文件对象呢?它支持 `.writelines`吗?`.seek` 呢?什么是一个“序列”?是否支持步进切片,例如 `a[1:10:2]`? -最初,Python 的答案是所谓的“鸭子类型”,取自短语“如果它像鸭子一样行走,像鸭子一样嘎嘎叫,那么它可能就是鸭子”。换句话说,“试试看”,这可能是你能得到的最含蓄的表达。 +最初,Python 的答案是所谓的“鸭子类型”,取自短语“如果它像鸭子一样行走,像鸭子一样嘎嘎叫,那么它可能就是鸭子”。换句话说,“试试看”,这可能是你能得到的最具隐式的表达。 -为了使这些内容显式地表达出来,你需要一种方法来表达期望的接口。最早用 Python 编写的大型系统之一是 [Zope][3] Web 框架,它迫切需要这些东西来明确地呈现代码,例如,期望从“类似用户的对象”获得什么。 +为了使这些内容显式地表达出来,你需要一种方法来表达期望的接口。[Zope][3] Web 框架是最早用 Python 编写的大型系统之一,它迫切需要这些东西来使代码明确呈现出来,例如,期望从“类似用户的对象”获得什么。 -**zope.interface** 由 Zope 开发,但作为单独的 Python 包发布。**Zope.interface** 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 +`zope.interface` 由 Zope 开发,但作为单独的 Python 包发布。`Zope.interface` 可以帮助声明存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。 -想象编写一个简单的 2D 游戏,它需要各种东西来支持 sprite 接口(to 校正:这里不知道如何翻译)。例如,表示一个边界框,但也表示对象何时与一个框相交。与一些其他语言不同,在 Python 中,将属性访问作为公共接口一部分是一种常见的做法,而不是实现 getter 和 setter。边界框应该是一个属性,而不是一个方法。 +想象编写一个简单的 2D 游戏,它需要各种东西来支持精灵界面(LCTT 译注:“精灵 Sprite”是指游戏面板中各个组件)。例如,表示一个边界框,但也要表示对象何时与一个框相交。与一些其他语言不同,在 Python 中,将属性访问作为公共接口一部分是一种常见的做法,而不是实现 getter 和 setter。边界框应该是一个属性,而不是一个方法。 -呈现外观列表的方法可能类似于: +呈现精灵列表的方法可能类似于: ``` def render_sprites(render_surface, sprites):     """     sprites 应该是符合 Sprite 接口的对象列表: -    * 一个属性 "bounding_box",包含了边界框 -    * "intersects" 方法,它接受一个 box 并返回 True 或 False +    * 一个名为 "bounding_box" 的属性,包含了边界框 +    * 一个名为 "intersects" 的方法,它接受一个边界框并返回 True 或 False     """ -    pass # 一些代码会渲染 +    pass # 一些做实际渲染的代码 ``` -游戏将具有许多处理 sprite 的功能(函数)。在每个功能(函数)中,你都必须在文档中指定预期。 +该游戏将具有许多处理精灵的函数。在每个函数中,你都必须在随附文档中指定预期。 -此外,某些功能可能期望使用更复杂的 Sprite 对象,例如具有 Z-order 的对象。我们必须跟踪哪些方法需要 Sprite 对象,哪些方法需要 SpriteWithZ 对象。 +此外,某些函数可能期望使用更复杂的精灵对象,例如具有 Z 序的对象。我们必须跟踪哪些方法需要 Sprite 对象,哪些方法需要 SpriteWithZ 对象。 -如果能够使 sprite 的内容显式出来,这样方法就可以声明“我需要一个 sprite”,并严格定义接口,这不是很好吗?来看看 **zope.interface**。 +如果能够使精灵是显式而直观的,这样方法就可以声明“我需要一个精灵”,并有个严格定义的接口,这不是很好吗?来看看 `zope.interface`。 ``` from zope import interface @@ -52,18 +54,18 @@ from zope import interface class ISprite(interface.Interface):     bounding_box = interface.Attribute( -        "The bounding box" +        "边界框"     )     def intersects(box):         "它和一个框相交吗?" ``` -乍看起来,这段代码有点奇怪。这些方法不包括 "self",而包含 "self" 是一种常见的做法,并且它有一个属性。这是在 zope.interface 中声明接口的方法。这看起来很奇怪,因为大多数人不习惯严格声明接口。 +乍看起来,这段代码有点奇怪。这些方法不包括 `self`,而包含 `self` 是一种常见的做法,并且它有一个**属性**。这是在 `zope.interface` 中声明接口的方法。这看起来很奇怪,因为大多数人不习惯严格声明接口。 这样做的原因是接口显示了如何调用方法,而不是如何定义方法。因为接口不是超类,所以它们可以用来声明数据属性。 -下面是一个可能的接口实现: +下面是一个能带有圆形精灵的接口的一个实现: ``` @implementer(ISprite) @@ -89,13 +91,13 @@ class CircleSprite:             for choose_y_from (top_left, bottom_right):                 x = choose_x_from[0]                 y = choose_y_from[1] -                if (((x - self.x) ** 2 + (y - self.y) ** 2) <= -                    self.radius ** 2): +                if (((x - self.x) ` 2 + (y - self.y) ` 2) <= +                    self.radius ` 2):                      return True         return False ``` -这 _显式_ 声明了 **CircleSprite** 类实现接口。它甚至能让我们验证该类是否正确实现了接口: +这**显式**声明了实现了该接口的 `CircleSprite` 类。它甚至能让我们验证该类是否正确实现了接口: ``` from zope.interface import verify @@ -105,7 +107,7 @@ def test_implementation():     verify.verifyObject(ISprite, sprite) ``` -这可以由 **pytest**、**nose** 或其他测试框架运行,它将验证创建的 sprite 是否符合接口。测试通常是局部的:它不会测试文档中没有提及的内容,甚至不会测试方法是否可以在没有异常的情况下被调用!但是,它会检查是否存在正确的方法和属性。这是对单元测试套件一个很好的补充,至少可以防止简单的拼写错误通过测试。 +这可以由 pytest、nose 或其他测试框架运行,它将验证创建的精灵是否符合接口。测试通常是局部的:它不会测试仅在文档中提及的内容,甚至不会测试方法是否可以在没有异常的情况下被调用!但是,它会检查是否存在正确的方法和属性。这是对单元测试套件一个很好的补充,至少可以防止简单的拼写错误通过测试。 -------------------------------------------------------------------------------- @@ -114,7 +116,7 @@ via: https://opensource.com/article/19/9/zopeinterface-python-package 作者:[Moshe Zadka][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d499842bd3be1bf62a1bc3de70efe0202606f187 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 22:47:31 +0800 Subject: [PATCH 427/676] PUB @MjSeven https://linux.cn/article-11752-1.html --- ...advanced look at Python interfaces using zope.interface.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190924 An advanced look at Python interfaces using zope.interface.md (98%) diff --git a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/published/20190924 An advanced look at Python interfaces using zope.interface.md similarity index 98% rename from translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md rename to published/20190924 An advanced look at Python interfaces using zope.interface.md index e2797b9e40..f2918057fc 100644 --- a/translated/tech/20190924 An advanced look at Python interfaces using zope.interface.md +++ b/published/20190924 An advanced look at Python interfaces using zope.interface.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11752-1.html) [#]: subject: (An advanced look at Python interfaces using zope.interface) [#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package) [#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg) From cdee6de4b6aaac4953a4055873acaf3490b905ee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 5 Jan 2020 23:49:32 +0800 Subject: [PATCH 428/676] PRF&PUB @nacyro https://linux.cn/article-11753-1.html --- ... and guides to enhance your tech skills.md | 85 ++++++++++++++++++ ... and guides to enhance your tech skills.md | 88 ------------------- 2 files changed, 85 insertions(+), 88 deletions(-) create mode 100644 published/20200101 9 cheat sheets and guides to enhance your tech skills.md delete mode 100644 translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md diff --git a/published/20200101 9 cheat sheets and guides to enhance your tech skills.md b/published/20200101 9 cheat sheets and guides to enhance your tech skills.md new file mode 100644 index 0000000000..966b7aee3a --- /dev/null +++ b/published/20200101 9 cheat sheets and guides to enhance your tech skills.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: (nacyro) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11753-1.html) +[#]: subject: (9 cheat sheets and guides to enhance your tech skills) +[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +九个提升程序员技术技能的备忘单和指南 +====== + +> 用我们最新的编程备忘单和指南来为新年开局,它适合所有技能水平的人。 + +![](https://img.linux.net.cn/data/attachment/album/202001/05/233115etzm6hv4a3z5yvhg.jpg) + +对刚接触命令行的新程序员来说备忘单是完美的。然而,即便是最有经验的程序员也需要时不时地依靠参考资料。假如你刚好敲不出那个讨厌的快捷键,那么手边有个备忘单就很赞了。这是一份我们可供下载指南的综述,它将助你在 2020 年取得成功。 + +### 备忘单 + +#### Markdown + +[Markdown][2] 不仅针对程序员,任何人都可以借助它为纯文本文档增添语法和结构。此备忘单提供了使用 CommonMark 规范的 Markdown 基础要点。它还包括 GitHub 和 GitLab 的语法。 + +#### Linux 权限和用户 + +用这个 Linux 备忘单把[用户管理][3]命令放在手边。快速学习如何增删用户、查看历史以及设置权限。 + +#### Bash + +一旦你了解了 [Bash][4],在命令行中就蕴含了无限可能。我们的 Bash 备忘单可以帮助你更有效地使用键盘快捷键。不知不觉间,你就能在睡眠中(字面意义上)运行脚本。 + +#### Linux 常用命令 + +毫不奇怪,我们的 [Linux 常用命令备忘单][5]是如此受欢迎。这个备忘单包含了开始安装软件和导览文件系统的要点。为自己和你的同事打印出来吧。 + +#### 微服务 + +似乎每个人都在谈论[微服务][6],而且理由很充分。微服务使应用程序模块化,因此更容易构建和维护。它不再只是这个备忘单上的流行语。在[微服务开源指南][7]中了解重要的术语并学习更多关于微服务的基础知识。 + +#### Java + +此备忘单非常适合初级和中级 [Java][8] 程序员。它包括重要的上下文以及处理导入、变量、类等的代码。 + +#### pip + +程序员爱用 [pip][9] 命令来帮助安装、管理和使用 Python 软件包。然而,pip 可以做的远不止这些。这个备忘单将教你如何构建 wheels 和 record 包。 + +### 指南 + +#### 七个不可或缺的 PyPI 库 + +[这组 Python 教程][10]将帮助你学习如何更快地编写扩展、格式化代码、自动化测试、确保代码一致性,以及更多使用 PyPI 库的方法。 + +#### 开始学习 Kubernetes + +在这份平易近人的[指南][11]中,作者 Scott McCarty 用了一个出人意料的类比来解释 Kubernetes 的价值和上手步骤。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cheat-sheets-guides + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[nacyro](https://github.com/nacyro) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://opensource.com/downloads/cheat-sheet-markdown +[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet +[4]: https://opensource.com/downloads/bash-cheat-sheet +[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[6]: https://opensource.com/downloads/microservices-cheat-sheet +[7]: https://opensource.com/article/19/11/microservices-cheat-sheet +[8]: https://opensource.com/downloads/java-cheat-sheet +[9]: https://opensource.com/downloads/pip-cheat-sheet +[10]: https://opensource.com/downloads/7-essential-pypi-libraries +[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook +[12]: https://opensource.com/users/fatherlinux +[13]: https://opensource.com/downloads/cheat-sheets +[14]: https://opensource.com/email-newsletter diff --git a/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md b/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md deleted file mode 100644 index 15c10736ed..0000000000 --- a/translated/tech/20200101 9 cheat sheets and guides to enhance your tech skills.md +++ /dev/null @@ -1,88 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (nacyro) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 cheat sheets and guides to enhance your tech skills) -[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides) -[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) - -九个提升你技术技能的备忘单和指南 -====== -用我们最新的编程备忘单和指南来为新年开局,它适合所有技能水平的人。来参加我们的投票,让我们知道你接下来想看什么! - -![a checklist for a team][1] - -对刚接触命令行的新程序员来说备忘单是完美的。然而,即便是最有经验的程序员也需要时不时地依靠参考资料。假如你刚好敲不出那个讨厌的快捷键,那么手边有个备忘单就很赞了。这是一份我们可供下载指南的综述,它将助你在 2020 年取得成功。 - -### 备忘单 - -#### [Markdown][2] - -Markdown 不仅针对程序员,任何人都可以借助它为纯文本文档增添语法和结构。此备忘单提供了使用 CommonMark 规范的 Markdown 要点。它还包括 GitHub 和 GitLab 的语法。 - -#### [Linux 权限和用户][3] - -用这个 Linux 备忘单把用户管理命令放在手边。快速学习如何增删用户、查看历史以及设置权限。 - -#### [Bash][4] - -一旦您了解了 Bash,在命令行中就蕴含了无限可能。我们的 Bash 备忘单可以帮助您更有效地使用键盘快捷键。不知不觉间,您就能易如反掌地运行脚本。 - -#### [Linux 常用命令][5] - -毫不奇怪,我们的 Linux 常用命令备忘单是如此受欢迎。这个备忘单包含了开始安装软件和导览文件系统的要点。为自己和你的同事打印出来吧。 - -#### [微服务][6] - -似乎每个人都在谈论微服务,而且理由很充分。微服务使应用程序模块化,因此更容易构建和维护。它不再只是这个备忘单上的流行语。在 [微服务开源指南][7] 中了解重要的术语并学习更多关于微服务的基础知识。 - -#### [Java][8] - -此备忘单非常适合初级和中级 Java 程序员。它包括重要的上下文以及处理导入、变量、类等的代码。 - -#### [pip][9] - -程序员爱用 pip 命令来帮助安装、管理和使用 Python 软件包。然而,pip 可以做的远不止这些。这个备忘单将教你如何构建 wheels 和 record 包。 - -### 指南 - -#### [七个不可或缺的 PyPI 库][10] - -这组 Python 教程将帮助您学习如何更快地编写扩展、格式化代码、自动化测试、确保代码一致性,以及更多使用 PyPI 库的方法。 - -#### [开始学习 Kubernetes][11] - -在这份平易近人的指南中,作者 [Scott McCarty][12] 用了一个出人意料的类比来解释 Kubernetes 的价值和上手步骤。 - -* * * - -我们想听听你的意见:你对新的备忘单或指南有什么高见?参加我们的投票,从选项中选择一个,或者在评论中告诉我们。点击 [这里][13] 查看我们所有的下载。通过 [注册][14] 我们的电子邮件通讯获得关于新备忘单的提醒。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/cheat-sheets-guides - -作者:[Lauren Pritchett][a] -选题:[lujun9972][b] -译者:[nacyro](https://github.com/nacyro) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/lauren-pritchett -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) -[2]: https://opensource.com/downloads/cheat-sheet-markdown -[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet -[4]: https://opensource.com/downloads/bash-cheat-sheet -[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet -[6]: https://opensource.com/downloads/microservices-cheat-sheet -[7]: https://opensource.com/article/19/11/microservices-cheat-sheet -[8]: https://opensource.com/downloads/java-cheat-sheet -[9]: https://opensource.com/downloads/pip-cheat-sheet -[10]: https://opensource.com/downloads/7-essential-pypi-libraries -[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook -[12]: https://opensource.com/users/fatherlinux -[13]: https://opensource.com/downloads/cheat-sheets -[14]: https://opensource.com/email-newsletter From 52b33c1280863165623cc6a188441a9f69a16889 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 6 Jan 2020 00:56:19 +0800 Subject: [PATCH 429/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200105=207=20Wa?= =?UTF-8?q?ys=20NOT=20to=20manage=20your=20remote=20team?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200105 7 Ways NOT to manage your remote team.md --- ...5 7 Ways NOT to manage your remote team.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20200105 7 Ways NOT to manage your remote team.md diff --git a/sources/tech/20200105 7 Ways NOT to manage your remote team.md b/sources/tech/20200105 7 Ways NOT to manage your remote team.md new file mode 100644 index 0000000000..b4e223a03e --- /dev/null +++ b/sources/tech/20200105 7 Ways NOT to manage your remote team.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Ways NOT to manage your remote team) +[#]: via: (https://opensource.com/article/20/1/ways-not-manage-remote-team) +[#]: author: (Matt Shealy https://opensource.com/users/mshealy) + +7 Ways NOT to manage your remote team +====== +Learn to let go and let your team shine with these simple steps. +![World locations with red dots with a sun burst background][1] + +Building a remote development team presents unique challenges. Trying to build a cross-functional team, full of various personalities, virtually can lead to communication disasters. Fortunately, through planning, smart hiring, training, and communication, project leaders can build and lead virtual development teams successfully. + +The demand for remote teams continues to grow. The increased demand for software developers and [new communication technology][2] has removed the barriers of geography. Even with these advancements, disparate team members from different backgrounds may find it challenging to learn how to interact with one another. + +It's easy for misunderstandings and miscommunications to occur. It's becoming more and more critical to [rethink collaboration][3] in a work environment growing increasingly more remote. As a result, project leaders must rethink the needs of teams spread out across the globe. + +By avoiding a few key pitfalls, your team can overcome these challenges consistently. If you follow a few time-tested, in-house practices, and some that apply specifically to remote teams, you can manage a range of personalities and complete your build successfully. + +The following are seven practices to avoid when managing a remote team. + +### Don't slack on training + +A variety of different perspectives is the top benefit of working with diverse remote team members. However, it’s essential to understand and acknowledge those differences during training. + +Addressing language differences is only one part of acknowledging team diversity. When recruiting programmers, it would be best if you focus on candidates with an aptitude for working in a multicultural environment and even in a multi-coding language environment. + +Also, don’t make the mistake of thinking that personal characteristics are unimportant because team members aren’t working face-to-face. Team members still have to collaborate, so their personalities must mesh. + +Training isn’t all technical skills. Emotional training can also help a team work well together remotely. Emotional intelligence [training can help coworkers develop skills like empathy and awareness][4] that can make teams work better together. Emotional distance can make it challenging to establish bonds between new trainees and team leaders from the get-go, which can immediately loosen bonds in what could be a strong remote team. Consider what remote team-building training you can do via video or on Slack. Remember that is it important to constantly be proactive in strengthening relationships throughout the life of your team. + +### Don't use an ad hoc communication system + +When working with diverse remote team members, it’s essential that you use straightforward, effective code management and communication software. Ideally, you want the most uncomplicated resources available. + +The process may need to be further simplified for newer team members and freelancers who do not have the time to learn everything about the ins and outs of the organization’s policies. + +Create standard ways to communicate with team members. Maybe all work discussion happens in Slack or one of its [open source alternatives][5], while teams use [project management software][6] to keep work on schedule. + +Having a clear space for each type of conversation will help those who need to focus on work, while also offering an outlet for fun. Team members must use these resources daily, if not hourly. If your solutions are too complicated, learning to navigate the tools will pull focus from design and implementation work. + +### Don't lose sight of the big picture + +Avoid the pitfalls of focusing too closely on daily goals. It is essential you stay focused on the overall project. You should work with team members to establish your goals and milestones, and make sure team members stay on schedule. As the project leader, it’s your job to make sure these key events contribute to deliverable milestones. + +### Don't micromanage your team + +Some project managers, especially those with a coding background, find it difficult to delegate responsibility. It’s natural to gravitate toward solving familiar problems. However, it’s your job to guide the ship, not develop solutions. + +In [a micromanaged environment][7], the project manager tells the programmers what the code is, and exactly how to craft it. However, this management style ultimately leads to employee dissatisfaction. + +Your team should feel free to explore solutions, initiate positive change, and use innovation for exciting new ideas. + +If you don’t give your coders space to innovate and use their creativity, they feel undervalued. If this sentiment persists, your remote staff members are unlikely to produce the best work possible. + +### Use this opportunity to promote diversity + +If you are going to build a remote team, you must understand and acknowledge that [team members will have different backgrounds][8]. This circumstance is especially beneficial. The diverse viewpoints of staff members will enable your team to offer insights that expand beyond that of a centrally located talent pool. + +Also, your diverse remote team will give you access to experience with global trends. Furthermore, your team will be less likely to suffer from the effect of crowd mentality thinking. + +With the freedom to innovate, team members will feel more comfortable offering their input. Together, these benefits will enable your team as a whole to build a product better suited for multiple regions and verticals. + +### Don't forget to keep an eye on costs + +Ballooning costs are a top challenge for development teams. Despite project planning best practices, scope creep is a real problem for even the most experienced teams. There are two underlying factors that need to be addressed if this problem is to be solved. + +The first is the fact that the more analysis that is done throughout the development process, the more complexity arises and is ultimately added to the system. The second factor is the fact that people who have been through system development before know that there won’t ever be a "second phase" of the project. They know that there will only be one shot at the project, so they try and fit everything possible into the initial project phase. + +These two self-reinforcing factors lead to a death spiral of problems. Too much analysis leads to system complexity and loads of features being crammed into the first phase. A lack of trust between IT and business teams inevitably forms because of this. The design requirements become too big and complicated for there to be any chance of staying on schedule or on budget. Inevitably, blame lands with the IT team. + +The answer to this problem is to restrict analysis to only what the business team needs right now. IT should refrain from speculating on what may be needed in the future or asking business team members what they may need down the line. + +These requirements allow IT to build a reliable project plan and overall budget. If your team is looking to outsource the project at least in part, [calculating the app development costs][9] for each individual team or project component can help to keep things on track. + +### Don't think of time zone differences as a barrier + +Do not view time zone differences as a challenge. You can leverage time zones to your advantage and build your team in a way that will keep the project running around the clock. + +What is more important is choosing candidates who work independently. Good remote coders are responsible, organize their time effectively, and communicate well with team members. With an effective communication system, time differences will have no effect on the successful outcome of your team. + +Remote team members benefit significantly from predictable and straightforward engagement. The relatively new remote work environment demands that staff members establish a new standard for clear, concise communication. To promote a collaborative environment, teams must establish norms, such as universal jargon and consensus on communication tools. + +In an environment that thrives on innovation, predictability is an asset when it comes to teamwork. Everyone is different, and innovation is a sought-after commodity in software development. However, in the remote environment, consistent behavior helps team members communicate effectively. + +### Conclusion + +Remote work is quickly becoming the new default for software development. Be sure to avoid these pitfalls to set your teams up for success. + +Do you have any tips to recommend? Please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/ways-not-manage-remote-team + +作者:[Matt Shealy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mshealy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_remote_teams.png?itok=Wk1yBFv6 (World locations with red dots with a sun burst background) +[2]: https://www.chamberofcommerce.com/business-advice/strategies-and-tools-for-remote-team-collaboration +[3]: https://hbr.org/2018/02/how-to-collaborate-effectively-if-your-team-is-remote +[4]: https://www.skillsoft.com/content-solutions/business-skills-training/emotional-intelligence-training/ +[5]: https://opensource.com/alternatives/slack +[6]: https://opensource.com/business/16/2/top-issue-support-and-bug-tracking-tools +[7]: https://blog.trello.com/how-to-stop-micromanaging-your-remote-team +[8]: https://opensource.com/article/18/10/think-global-communication-challenges +[9]: https://www.appdevelopmentcost.com/#the-definitive-guide-to-understanding-app-development-costs From 0dd01ded175d6f05ede6d9b7b2124d5ea077aa51 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 6 Jan 2020 08:53:02 +0800 Subject: [PATCH 430/676] translated --- ...al- A Secure, Open Source Messaging App.md | 122 ------------------ ...al- A Secure, Open Source Messaging App.md | 122 ++++++++++++++++++ 2 files changed, 122 insertions(+), 122 deletions(-) delete mode 100644 sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md create mode 100644 translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md diff --git a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md deleted file mode 100644 index fbb741b9f5..0000000000 --- a/sources/tech/20200101 Signal- A Secure, Open Source Messaging App.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Signal: A Secure, Open Source Messaging App) -[#]: via: (https://itsfoss.com/signal-messaging-app/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Signal: A Secure, Open Source Messaging App -====== - -**_Brief: Signal is a secure open-source messaging app for smartphones. It also offers a standalone desktop app for Linux, Windows, and macOS_. _Here, we take a look at its features and usability._** - -### Signal is an Excellent Alternative to WhatsApp (and Telegram) for Privacy Concerned People - -![Signal App On Linux][1] - -Signal is an open source application with a keen focus on privacy. It is recommended by privacy advocates like [Edward Snowden][2]. - -It may not have as many features as Telegram or WhatsApp – but if you want to enhance your privacy while having a conversation, this is a solid open-source solution. - -You can install it on your smartphone ([iOS][3]/[Android][4]) and it is also available for Linux, Windows, and macOS. - -### Features of Signal Messenger - -**Note:** _Some of the features are specific/exclusive to smartphones. You may not observe all the features mentioned in the desktop app._ - -As I already mentioned, this is tailored to enhance your privacy. So, the user experience may not be the “best” you’ve ever seen. But, privacy/security-wise, I think it is a good option to have. - -![Signal Features][5] - -#### Disappearing Messages - -You can set a timer for messages in a conversation – so that it will be automatically deleted as per the timer. - -Essentially, anyone in the conversation can activate this feature. So, you control if the messages should stay in a conversation or disappear. - -#### Use it As Default SMS App - -If you want to utilize an open-source app for all your SMSs, you can simply go to Signal’s app settings and set it as the default for SMS and MMS. - -#### Screen Security - -There’s a neat feature to block screenshots in-app, “Screen Security”. - -If you enable it, you won’t be able to take a screenshot of any conversation in the app. You can find the option to enable or disable it from the app settings. - -It may not be useful to everyone – but you can try it out. - -#### Safety Number - -If you want to verify the security of your encryption with a friend, you can simply tap on the profile and scroll down to find “View Safety Number”. - -You can either scan it to verify or simply take a look at it to mark it verified. - -#### Locked Messages - -If you protect the app with a lock (pin/fingerprint), even if your device has been unlocked, you won’t be able to see the messages on your notifications. - -So, when you get a notification while Signal is locked, you will notice the content of the notification as “**Locked Message**” – which is a plus for privacy-oriented users. - -#### Other Features - -![][6] - -As you would expect in a messaging app – you get a couple of stickers to utilize and you can also create a group if you want. - -However, you won’t have the ability to moderate your group – you can just add members and change the profile picture. - -In addition to this, Signal also supports biometric security for its app. - -### Installing Signal on Ubuntu/Linux - -Unfortunately, you don’t get a .**deb** or .**AppImage** to install it on your Linux distro. So, you will need to utilize the terminal as per the [official installation instructions][7]. - -Here’s what you have to type in the terminal: - -``` -curl -s https://updates.signal.org/desktop/apt/keys.asc | sudo apt-key add - -echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/signal-xenial.list -sudo apt update && sudo apt install signal-desktop -``` - -Simply copy-paste the commands one by one in the terminal and you should be good to go. - -[Download Signal for Other Devices][7] - -### My Thoughts On Signal - -I’ve been using Signal for a few years now and it has improved with what it offers. However, I still feel that the user experience can be improved. - -Privacy-wise, it is definitely a good alternative to what we already have (in my opinion). You can give it a try and see how well it works for your usage. - -You can also take a look at their [GitHub page][8] for the latest developments and beta releases if you want to try them out. - -Signal app may not be a popular messaging app when compared to WhatsApp or even [Telegram on Linux][9]. But, you can try it for yourself and encourage your friends to use an open-source messaging app. - -Have you tried it yet? Let me know what you think about the ‘Signal’ app in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/signal-messaging-app/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot.jpg?ssl=1 -[2]: https://en.wikipedia.org/wiki/Edward_Snowden -[3]: https://apps.apple.com/us/app/signal-private-messenger/id874139669 -[4]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&hl=en_IN -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-phone.jpg?ssl=1 -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot-1.jpg?ssl=1 -[7]: https://signal.org/download/ -[8]: https://github.com/signalapp -[9]: https://itsfoss.com/install-telegram-desktop-linux/ diff --git a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md new file mode 100644 index 0000000000..812a97f32f --- /dev/null +++ b/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Signal: A Secure, Open Source Messaging App) +[#]: via: (https://itsfoss.com/signal-messaging-app/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Signal:安全、开源的聊天应用 +====== + +** _简介:Signal 是一款智能手机上的安全开源聊天应用。它还提供了适用于 Linux、Windows 和 macOS 的独立桌面应用。在本文中,我们来看看它的功能和可用性。_** + +### 对于关注隐私的人来说,Signal 是 WhatsApp(和 Telegram)的绝佳替代品 + +![Signal App On Linux][1] + +Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样的隐私权倡导者建议使用它。 + +它可能没有 Telegram 或 WhatsApp 这么多的功能。但是,如果你想在交流时增强隐私,这是一个可靠的开源方案。 + +你可以在智能手机(iOS][3]/[Android][4])上安装,也可以在 Linux、Windows 和 macOS 上安装。 + +### Signal 的功能 + +**注意:** _某些功能是智能手机特有的。你可能无法在桌面应用上看到所有功能。_ + +正如我已经提到的,这是为增强你的隐私而量身定制的。因此,用户体验可能不是你见过“最佳”的。但是,从隐私/安全角度考虑,我认为这是一个不错的选择。 + +![Signal Features][5] + +#### 消失的消息 + +你可以为对话中的消息设置一个计时器,以便根据它自动删除消息。 + +本质上,对话中的任何人都可以激活此功能。因此,你可以控制对话中的消息时保留还是消失。 + +#### 用作默认短信应用 + +如果你想在短信中使用开源应用,那么只需口进入 Signal 的设置,并将其设置为短信和彩信的默认设置。 + +#### 屏幕安全 + +有一个巧妙的功能可以阻止应用内截图,它就是“屏幕安全”。 + +如果你开启它,那么你将无法为应用中的任何对话截图。你可以从应用设置中找到启用或禁用它的选项。 + +它可能并不是对所有人有用,但你可以尝试一下。 + +#### 安全数字 + +如果你想与朋友一起验证加密的安全性,只需点击个人资料并向下滚动找到“查看安全数字”。 + +你可以扫描验证或者看一眼并标记为已验证。 + +#### 锁定消息 + +如果你使用了锁(密码/指纹)来保护应用,那么即使你的设备已解锁,你也无法在通知中看到消息。 + +因此,当 Signal 处于锁定状态收到通知时,你会注意到通知的内容为 “**Locked Message**”,这对于注重隐私的用户来说是一个加分项。 + +#### 其它功能 + +![][6] + +如你所期待的聊天应用,你可以使用几个标签,并且可以根据需要创建一个组。 + +但是,你无法管理你的组,你只能添加成员和更改群头像。 + +此外,Signal 还为其应用支持生物识别。 + +### 在 Ubuntu/Linux 上安装 Signal + +不幸的是,你无法在你的 Linux 发行版上找到 .**deb** 或者 .**AppImage**。因此,你需要根据[官方安装说明][7]在终端上安装。 + +在终端中输入以下内容: + +``` +curl -s https://updates.signal.org/desktop/apt/keys.asc | sudo apt-key add - +echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/signal-xenial.list +sudo apt update && sudo apt install signal-desktop +``` + +只需在终端中一个接一个地复制并粘贴命令。 + +[Download Signal for Other Devices][7] + +### 我对 Signal 的想法 + +我已经使用 Signal 有几年了,它的功能已经得到了改善。但是,我仍然认为可以改善用户体验。 + +在隐私方面,(在我看来)这绝对是我们已有软件的一个很好的替代方案。你可以尝试一下,看看它的使用效果如何。 + +如果你想尝试一下它,也可以看看它的 [GitHub 页面][8]以获取最新的开发和 beta 版本。 + +与 WhatsApp 甚至 [Linux 上的 Telegram][9] 相比,Signal 可能不是流行的聊天应用。但是,你可以自己尝试一下,并鼓励你的朋友使用它。 + +你尝试过了吗?在下面的评论中,让我知道你对 “Signal” 的看法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/signal-messaging-app/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot.jpg?ssl=1 +[2]: https://en.wikipedia.org/wiki/Edward_Snowden +[3]: https://apps.apple.com/us/app/signal-private-messenger/id874139669 +[4]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&hl=en_IN +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-phone.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot-1.jpg?ssl=1 +[7]: https://signal.org/download/ +[8]: https://github.com/signalapp +[9]: https://itsfoss.com/install-telegram-desktop-linux/ From b5ff457b11f128e839a5ed7e717e0a96f53e1165 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 6 Jan 2020 08:59:47 +0800 Subject: [PATCH 431/676] translating --- .../20191214 Make VLC More Awesome With These Simple Tips.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md index de91a1105b..a4dd3b7bd5 100644 --- a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md +++ b/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From df0fe6f778abded40c96df3c823fd629a6882678 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 6 Jan 2020 11:21:54 +0800 Subject: [PATCH 432/676] Rename sources/tech/20200105 7 Ways NOT to manage your remote team.md to sources/talk/20200105 7 Ways NOT to manage your remote team.md --- .../20200105 7 Ways NOT to manage your remote team.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200105 7 Ways NOT to manage your remote team.md (100%) diff --git a/sources/tech/20200105 7 Ways NOT to manage your remote team.md b/sources/talk/20200105 7 Ways NOT to manage your remote team.md similarity index 100% rename from sources/tech/20200105 7 Ways NOT to manage your remote team.md rename to sources/talk/20200105 7 Ways NOT to manage your remote team.md From b72910f7ce18adc4cee91a7ac5d07adfb1bbbb72 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 6 Jan 2020 22:58:24 +0800 Subject: [PATCH 433/676] PRF @lxbwolf --- ...1017 Intro to the Linux useradd command.md | 71 ++++++++++--------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/translated/tech/20191017 Intro to the Linux useradd command.md b/translated/tech/20191017 Intro to the Linux useradd command.md index ffebd61d47..d38143f55e 100644 --- a/translated/tech/20191017 Intro to the Linux useradd command.md +++ b/translated/tech/20191017 Intro to the Linux useradd command.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Intro to the Linux useradd command) @@ -9,8 +9,10 @@ Linux useradd 命令介绍 ====== -使用 useradd 命令来添加用户(并且根据需要修改账号)。 -![people in different locations who are part of the same team][1] + +> 使用 useradd 命令来添加用户(并且根据需要修改账号)。 + +![](https://img.linux.net.cn/data/attachment/album/202001/06/225733hv1u7f4z4vbt8u5x.jpg) 任何计算机系统中,添加用户都是最重要的事之一;本文着重介绍如何在 Linux 系统中添加用户。 @@ -29,21 +31,21 @@ $ file `which adduser` ### 默认处理 -`useradd` 的基本用法相当简单:通过一个用户名就可以添加一个用户 +`useradd` 的基本用法相当简单:提供一个用户名就可以添加一个用户。 ```bash $ sudo useradd sonny ``` -在本例中,`useradd` 命令创建了一个名为 *sonny* 的账号。此命令同时创建了一个同名的组,*sonny* 被放进了这个组,这个组也是 *sonny* 账号的主组。命令执行时,根据配置文件 `/etc/default/useradd` 和 `/etc/login.defs` 中的不同设置,也会有其他的参数处理,如语言和 shell。对于一个私人系统或微小的单服务商业环境,这些参数已经足够了。 +在本例中,`useradd` 命令创建了一个名为 `sonny` 的账号。此命令同时创建了一个同名的组,`sonny` 被放进了这个组,这个组也是 `sonny` 账号的主组。命令执行时,根据配置文件 `/etc/default/useradd` 和 `/etc/login.defs` 中的不同设置,也会有其他的参数,如语言和 shell。对于一个私人系统或微小的单服务商业环境,这些参数已经足够了。 上面两个文件控制 `useradd` 的处理,用户的信息保存在 `/etc` 目录下的一些其他文件中,关于这些信息的讲解会贯穿全文。 | 文件 | 描述 | 域 (加粗的表示由 useradd 命令设置) | | ------ | ------------------------------------ | ------------------------------------------------------------ | -| passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** | -| shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused | -| group | Stores group details | **groupname**:unused:**gid**:**members** | +| `passwd` | 存储用户账号信息 | 用户名:未使用:UID:GID:备注:家目录:shell | +| `shadow` | 存储用户账号的安全信息 | 用户名:加密密码:上次修改时间:最短使用天数:最长使用天数间:修改前警示天数:过期后宽限时间:未使用 | +| `group` | 存储组信息 | 组名:未使用:GID:成员列表 | ### 自定义处理 @@ -51,35 +53,35 @@ $ sudo useradd sonny #### 用户和组 ID -`useradd` 默认主组 ID(GID)与用户 ID(UID)相同,但也不完全是。虽然 UID 与 GID 相同不是必须的,但如果相同,会更方便管理员管理。 +默认情况下,`useradd` 试图使用相同的用户 ID(UID)和主组 ID(GID),但也不完全是。虽然 UID 与 GID 相同不是必须的,但如果相同,会更方便管理员管理。 -下面的场景就是一个 GID 与 UID 不同的 例子。现在我添加另一账号,名为 Timmy。通过使用 `getent` 命令来比较 *sonny* 和 *timmy* 两个账号,显示两个用户和对应的主组。 +下面的场景就是一个 GID 与 UID 不同的例子。现在我添加另一账号,名为 Timmy。通过使用 `getent` 命令来比较 `sonny` 和 `timmy` 两个账号,显示两个用户和对应的主组。 ```bash $ getent passwd sonny timmy -sonny❌1001:1002:Sonny:/home/sonny:/bin/bash -timmy❌1002:1003::/home/timmy:/bin/bash +sonny:x:1001:1002:Sonny:/home/sonny:/bin/bash +timmy:x:1002:1003::/home/timmy:/bin/bash $ getent group sonny timmy -sonny❌1002: -timmy❌1003: +sonny:x:1002: +timmy:x:1003: ``` -不幸的是,两者的 UID 和 GID 都不相同。因为默认的处理是,创建用户时,把下一个可用的 UID 赋给用户,然后把同一个数字作为主组 ID 赋给它。然而,当要使用的 ID 已经被使用时,就再把下一个可用的 GID 赋给它。为了弄清细节,我猜想 1001 这个 GID 已经被使用了,用一个命令确认了一下。 +不幸的是,两者的 UID 和 GID 都不相同。因为默认的处理是,创建用户时,把下一个可用的 UID 赋给用户,然后把同一个数字作为主组 ID 赋给它。然而,当要使用的组 ID 已经被使用时,就再把下一个可用的 GID 赋给它。为了弄清细节,我猜想 1001 这个 GID 已经被使用了,用一个命令确认了一下。 ```bash $ getent group 1001 -book❌1001:alan +book:x:1001:alan ``` -*book* 的 ID 是 *1001*,因此新创建的用户的 GID 都有偏移量 1。这就是为什么系统管理员在用户创建过程中需要多设置一些值的一个实例。为了解决这个问题,我必须先确定下一个可用的 UID 和 GID 是否相同。确定下一个可用值时,可以使用 `getent group` 和 `getent passwd` 命令,通过 `-u` 参数传递要确认的值。 +`book` 的 ID 是 `1001`,因此新创建的用户的 GID 都有偏移量 1。这就是为什么系统管理员在用户创建过程中需要多设置一些值的一个实例。为了解决这个问题,我必须先确定下一个可用的 UID 和 GID 是否相同。确定下一个可用值时,可以使用 `getent group` 和 `getent passwd` 命令,通过 `-u` 参数传递要确认的值。 ```bash $ sudo useradd -u 1004 bobby $ getent passwd bobby; getent group bobby -bobby❌1004:1004::/home/bobby:/bin/bash -bobby❌1004: +bobby:x:1004:1004::/home/bobby:/bin/bash +bobby:x:1004: ``` 另一个需要指定 ID 的场景是,通过 NFS 访问远程系统上的文件时。对于一个给定的用户,当 NFS 所有客户端和服务系统的 ID 都一样时,管理员更容易控制。在我的文章 [使用 autofs 挂载 NFS][2] 中有详细介绍。 @@ -95,12 +97,12 @@ bobby❌1004: ```bash $ sudo useradd -c "Bailey is cool" bailey $ getent passwd bailey -bailey❌1011:1011:Bailey is cool:/home/bailey:/bin/bash +bailey:x:1011:1011:Bailey is cool:/home/bailey:/bin/bash ``` #### 组 -一个用户可以被指定一个主组和多个次组。 `-g` 参数指定主组名称或 GID。如果不指定,`useradd` 会以用户名创建一个主组(前面演示过)。`-G`(大写)参数用一个逗号分隔的组列表来指定此用户所属的组,这些组就是次组。 +一个用户可以被指定一个主组和多个次组。`-g` 参数指定主组名称或 GID。如果不指定,`useradd` 会以用户名创建一个主组(前面演示过)。`-G`(大写)参数用一个逗号分隔的组列表来指定此用户所属的组,这些组就是次组。 ```bash $ sudo useradd -G tgroup,fgroup,libvirt milly @@ -110,12 +112,12 @@ uid=1012(milly) gid=1012(milly) groups=1012(milly),981(libvirt),4000(fgroup),300 #### 家目录 -`useradd` 的默认处理是,在 `/home` 目录下创建用户的家目录。然而,下面的参数可以改写家目录的 base 目录。`-b` 设置另一个可以创建家目录的 base 目录。例如 指定 `/home2` 而不是 `/home`。 +`useradd` 的默认处理是,在 `/home` 目录下创建用户的家目录。然而,下面的参数可以改写家目录的基础目录。`-b` 设置另一个可以创建家目录的基础目录。例如指定 `/home2` 而不是 `/home`。 ```bash $ sudo useradd -b /home2 vicky $ getent passwd vicky -vicky❌1013:1013::/home2/vicky:/bin/bash +vicky:x:1013:1013::/home2/vicky:/bin/bash ``` `-d` 参数可以指定一个与用户名不同的家目录。 @@ -123,24 +125,23 @@ vicky❌1013:1013::/home2/vicky:/bin/bash ```bash $ sudo useradd -d /home/ben jerry $ getent passwd jerry -jerry❌1014:1014::/home/ben:/bin/bash +jerry:x:1014:1014::/home/ben:/bin/bash ``` -#### skeleton 目录 +#### 目录模板 -`-k` 参数指定创建新用户时,会复制 `/etc/skel` 目录下的所有文件到家目录中。这些文件通常是 shell 配置文件,当然也可以是系统管理员想在新建用户时使用的任何文件。 +指定 `-k` 参数会在创建新用户时,复制 `/etc/skel` 目录下的所有文件到用户的家目录中。这些文件通常是 shell 配置文件,当然也可以是系统管理员想在新建用户时使用的任何文件。 #### Shell -`-s` 参数可以指定 shell。如果不指定,则使用默认的 shell。例如,下面的例子中 ,配置文件中定义的 shell 是 `bash`,但 `Wally` 这个用户指定的是 `zsh`。 +`-s` 参数可以指定 shell。如果不指定,则使用默认的 shell。例如,下面的例子中 ,配置文件中定义的 shell 是 `bash`,但 `wally` 这个用户指定的是 `zsh`。 ```bash -$ grep SHELL /etc/default/useradd SHELL=/bin/bash $ sudo useradd -s /usr/bin/zsh wally $ getent passwd wally -wally❌1004:1004::/home/wally:/usr/bin/zsh +wally:x:1004:1004::/home/wally:/usr/bin/zsh ``` #### 安全 @@ -153,7 +154,7 @@ $ sudo getent shadow sammy sammy:!!:18171:0:99999:7::20191231: ``` -当密码过期时,一个账号也可以自动失效。`-f` 参数指定密码过期后经过几天账号失效。如果设为 0,则立即失效。 +当密码过期时,账号也会自动失效。`-f` 参数指定密码过期后经过几天账号失效。如果设为 0,则立即失效。 ```bash $ sudo useradd -f 30 willy @@ -163,7 +164,7 @@ willy:!!:18171:0:99999:7:30:: ### 实例 -生产中,创建一个用户账号时会用到多个参数。例如,我要创建一个 Perry 账号,可能会用下面的命令: +生产环境中,创建一个用户账号时会用到多个参数。例如,我要创建一个 Perry 账号,可能会用下面的命令: ```bash $ sudo useradd -u 1020 -c "Perry Example" \ @@ -176,8 +177,8 @@ $ sudo useradd -u 1020 -c "Perry Example" \ ```bash $ getent passwd perry; getent group perry; getent shadow perry; id perry -perry❌1020:1020:Perry Example:/home2/perry:/usr/bin/zsh -perry❌1020: +perry:x:1020:1020:Perry Example:/home2/perry:/usr/bin/zsh +perry:x:1020: perry:!!:18171:0:99999:7:5:20201201: uid=1020(perry) gid=1020(perry) groups=1020(perry),3000(tgroup) ``` @@ -192,8 +193,8 @@ via: https://opensource.com/article/19/10/linux-useradd-command 作者:[Alan Formy-Duval][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ebdef401aca71102214cb466dc0899ea7e12793d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 6 Jan 2020 22:59:10 +0800 Subject: [PATCH 434/676] PUB @lxbwolf https://linux.cn/article-11756-1.html --- .../20191017 Intro to the Linux useradd command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191017 Intro to the Linux useradd command.md (99%) diff --git a/translated/tech/20191017 Intro to the Linux useradd command.md b/published/20191017 Intro to the Linux useradd command.md similarity index 99% rename from translated/tech/20191017 Intro to the Linux useradd command.md rename to published/20191017 Intro to the Linux useradd command.md index d38143f55e..ae1c1c2d4a 100644 --- a/translated/tech/20191017 Intro to the Linux useradd command.md +++ b/published/20191017 Intro to the Linux useradd command.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11756-1.html) [#]: subject: (Intro to the Linux useradd command) [#]: via: (https://opensource.com/article/19/10/linux-useradd-command) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) From a9580330d10e03ce5b62f895b69fbfb54b7aded0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 6 Jan 2020 23:21:01 +0800 Subject: [PATCH 435/676] PRF --- published/20191017 Intro to the Linux useradd command.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/published/20191017 Intro to the Linux useradd command.md b/published/20191017 Intro to the Linux useradd command.md index ae1c1c2d4a..d088a1d16d 100644 --- a/published/20191017 Intro to the Linux useradd command.md +++ b/published/20191017 Intro to the Linux useradd command.md @@ -43,9 +43,9 @@ $ sudo useradd sonny | 文件 | 描述 | 域 (加粗的表示由 useradd 命令设置) | | ------ | ------------------------------------ | ------------------------------------------------------------ | -| `passwd` | 存储用户账号信息 | 用户名:未使用:UID:GID:备注:家目录:shell | -| `shadow` | 存储用户账号的安全信息 | 用户名:加密密码:上次修改时间:最短使用天数:最长使用天数间:修改前警示天数:过期后宽限时间:未使用 | -| `group` | 存储组信息 | 组名:未使用:GID:成员列表 | +| `passwd` | 存储用户账号信息 | **用户名**:未使用:**UID**:**GID**:**备注**:**家目录**:**shell** | +| `shadow` | 存储用户账号的安全信息 | **用户名**:加密密码:上次修改时间:最短使用天数:最长使用天数间:**修改前警示天数**:**过期后宽限时间**:未使用 | +| `group` | 存储组信息 | **组名**:未使用:**GID**:**成员列表** | ### 自定义处理 From 884c9c8839641c166611347485f8c417b83ab7ed Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 6 Jan 2020 23:45:06 +0800 Subject: [PATCH 436/676] APL --- sources/tech/20191130 7 maker gifts for kids and teens.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191130 7 maker gifts for kids and teens.md b/sources/tech/20191130 7 maker gifts for kids and teens.md index a821b221e3..72a9debb38 100644 --- a/sources/tech/20191130 7 maker gifts for kids and teens.md +++ b/sources/tech/20191130 7 maker gifts for kids and teens.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From eef47403bf13f34fba003404cbf9694462c9fb4f Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 7 Jan 2020 00:46:38 +0800 Subject: [PATCH 437/676] tmp --- ... Lessons learned from programming in Go.md | 191 +++++++++--------- 1 file changed, 96 insertions(+), 95 deletions(-) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md index 0c9aeea2e2..93e9af3398 100644 --- a/sources/tech/20191210 Lessons learned from programming in Go.md +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -1,71 +1,70 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Lessons learned from programming in Go) -[#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) -[#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Lessons learned from programming in Go" +[#]: via: "https://opensource.com/article/19/12/go-common-pitfalls" +[#]: author: "Eduardo Ferreira https://opensource.com/users/edufgf" -Lessons learned from programming in Go +用 Go 编程受到的启发 ====== -Prevent future concurrent processing headaches by learning how to -address these common pitfalls. +通过学习如何定位并发处理的陷阱来避免未来处理这些问题时的困境。 ![Goland gopher illustration][1] -When you are working with complex distributed systems, you will likely come across the need for concurrent processing. At [Mode.net][2], we deal daily with real-time, fast and resilient software. Building a global private network that dynamically routes packets at the millisecond scale wouldn’t be possible without a highly concurrent system. This dynamic routing is based on the state of the network and, while there are many parameters to consider here, our focus is on link [metrics][3]. In our context, link metrics can be anything related to the status or current properties of a network link (e.g.: link latency). +在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。[Mode.net][2] 公司系统每天要处理实时、快速和灵活的以毫秒为单位动态路由数据包的全球专用网络和数据,需要高度并发的系统。他们的动态路由是基于网络状态的,而这个过程需要考虑众多因素,我们只考虑关系链的监控。在我们的环境中,调用关系链监控可以是任何跟网络调用关系链有关的状态和当前属性(如连接延迟)。 -### Concurrent probing for link metrics +### 并发探测链接指标 -[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing), our dynamic routing algorithm relies partially on link metrics to compute its routing table. Those metrics are collected by an independent component that sits on each [PoP][5] (Point of Presence). PoPs are machines that represent a single routing entity in our networks, connected by links and spread around multiple locations shaping our network. This component probes neighboring machines using network packets, and those neighbors will bounce back the initial probe. Link latency values can be derived from the received probes. Because each PoP has more than one neighbor, the nature of such a task is intrinsically concurrent: we need to measure latency for each neighboring link in real-time. We can’t afford sequential processing; each probe must be processed as soon as possible in order to compute this metric. +[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing,译注:逐跳自适应链路状态最佳路由), 我们的动态路由算法部分依赖于链路度量来计算路由表。 这些指标由位于每个PoP(译注:存活节点)上的独立组件收集。PoP是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有多个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探针。 ![latency computation graph][6] -### Sequence numbers and resets: A reordering situation +### 序列号和重置:一个记录场景 -Our probing component exchanges packets and relies on sequence numbers for packet processing. This aims to avoid processing of packet duplication or out-of-order packets. Our first implementation relied on a special sequence number 0 to reset sequence numbers. Such a number was only used during initialization of a component. The main problem was that we were considering an increasing sequence number value that always started at 0. After the component restarts, packet reordering could happen, and a packet could easily replace the sequence number with the value that was being used before the reset. This meant that the following packets would be ignored until it reaches the sequence number that was in use just before the reset. +我们的探测组件互相发送和接收数据包并依靠序列号进行数据包处理。旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号0来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们只考虑了始终从 0 开始递增的序列号。组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,直到排到重置之前用到的值之前,它后面的包都会被忽略掉。 -### UDP handshake and finite state machine +### UDP 握手和有限状态机 -The problem here was proper agreement of a sequence number after a component restarts. There are a few ways to handle this and, after discussing our options, we chose to implement a 3-way handshake protocol with a clear definition of states. This handshake establishes sessions over links during initialization. This guarantees that nodes are communicating over the same session and using the appropriate sequence number for it. +这里的问题是重启前后的序列号是否一致。有几种方法可以解决这个问题,经过讨论,我们选择了实现一个带有清晰状态定义的三向交握协议。这个握手过程在初始化时通过链接建立 session。这样可以确保节点通过同一个 session 进行通信且使用了适当的序列号。 -To properly implement this, we have to define a finite state machine with clear states and transitions. This allows us to properly manage all corner cases for the handshake formation. +为了正确实现这个过程,我们必须顶一个一个有清晰状态和过渡的有限状态机。这样我们就可以正确管理握手过程中的所有极端情况。 ![finite state machine diagram][7] -Session IDs are generated by the handshake initiator. A full exchange sequence is as follows: +session ID 由握手的初始化程序生成。一个完整的交换顺序如下: - 1. The sender sends out a **SYN (ID)*** *packet. - 2. The receiver stores the received **ID** and sends a **SYN-ACK (ID)**. - 3. The sender receives the **SYN-ACK (ID) *_and sends out an **ACK (ID)**._ *It also starts sending packets starting with sequence number 0. - 4. The receiver checks the last received **ID*** _and accepts the **ACK (ID)**_ *if the ID matches. It also starts accepting packets with sequence number 0. + 1. sender 发送一个 **SYN (ID)** 数据包。 + 2. receiver 存储接收到的 **ID** 并发送一个 **SYN-ACK (ID)**. + 3. sender 接收到 **SYN-ACK (ID)** _并发送一个 **ACK (ID)**_。它还发送一个从序列号 0 开始的数据包。 + 4. receiver 检查最后接收到的 **ID**,如果 ID 匹配,_则接受 **ACK (ID)**_。它还开始接受序列号为 0 的数据包。 -### Handling state timeouts +### 处理状态超时 -Basically, at each state, you need to handle, at most, three types of events: link events, packet events, and timeout events. And those events show up concurrently, so here you have to handle concurrency properly. +Basically, at each state, you need to handle, at most, three types of events: link events, packet events, and timeout events. And those events show up concurrently, so here you have to handle concurrency properly.基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 - * Link events are either link up or link down updates. This can either initiate a link session or break an existing session. - * Packet events are control packets **(SYN/SYN-ACK/ACK)** or just probe responses. - * Timeout events are the ones triggered after a scheduled timeout expires for the current session state. + * 链接事件包括连接和断开,连接时会初始化一个链接 session,断开时会断开一个已建立的 seesion。 + * 数据包事件是控制数据包 **(SYN/SYN-ACK/ACK)** 或只是探测响应。 + * 超时事件在当前 session 状态的预定超时时间到期后触发。 -The main challenge here is how to handle concurrent timeout expiration and other events. And this is where one can easily fall into the traps of deadlocks and race conditions. +这里面临的最主要的问题是如何处理并发超时到期和其他事件。这里很容易陷入死锁和资源竞争的陷阱。 -### A first approach +### 第一种方法 -The language used for this project is [Golang][8]. It does provide native synchronization mechanisms such as native channels and locks and is able to spin lightweight threads for concurrent processing. +本项目使用的语言是 [Golang][8]. 它确实提供了原生的同步机制,如自带的 channel 和锁,并且能够使用轻量级线程来进行并发处理。 ![gophers hacking together][9] gophers hacking together -You can start first by designing a structure that represents our **Session** and **Timeout Handlers**. +首先,你可以设计两个分别表示我们的 **Session** 和 **Timeout Handlers** 的结构体。 -``` +```go type Session struct {     State SessionState     Id SessionId   @@ -80,21 +79,21 @@ type TimeoutHandler struct {   } ``` -**Session** identifies the connection session, with the session ID, neighboring link IP, and the current session state. +**Session** 标识连接 session,内有表示 session ID、临近的连接点的 IP 和当前 session 状态的字段。 -**TimeoutHandler** holds the callback function, the session for which it should run, the duration, and a pointer to the scheduled timer. +**TimeoutHandler** 包含回调函数、对应的 session、持续时间和指向调度计时器的 timer 指针。 -There is a global map that will store, per neighboring link session, the scheduled timeout handler. +每一个临近连接点的 session 都包含一个保存调度 `TimeoutHandler` 的全局 map。 ``` `SessionTimeout map[Session]*TimeoutHandler` ``` -Registering and canceling a timeout is achieved by the following methods: +下面方法注册和取消超时: -``` +```go // schedules the timeout callback function.   func (timeout* TimeoutHandler) Register() {     timeout.timer = time.AfterFunc(time.Duration(timeout.duration) * time.Second, func() {   @@ -110,10 +109,10 @@ func (timeout* TimeoutHandler) Cancel() {   } ``` -For the timeouts creation and storage, you can use a method like the following: +你可以使用类似下面的方法来创建和存储超时: -``` +```go func CreateTimeoutHandler(callback func(Session), session Session, duration int) *TimeoutHandler {     if sessionTimeout[session] == nil {       sessionTimeout[session] := new(TimeoutHandler)   @@ -127,12 +126,12 @@ func CreateTimeoutHandler(callback func(Session), session Session, duration int) } ``` -Once the timeout handler is created and registered, it runs the callback after _duration_ seconds have elapsed. However, some events will require you to reschedule a timeout handler (as it happens at **SYN** state — every 3 seconds). +超时 handler 创建后,会在经过了设置的 _duration_ 时间(秒)后执行回调函数。然而,有些事件会使你重新调度一个超时 handler(与 **SYN** 状态时的处理一样 — 每 3 秒一次)。 -For that, you can have the callback rescheduling a new timeout: +为此,你可以让回调函数重新调度一次超时: -``` +```go func synCallback(session Session) {     sendSynPacket(session) @@ -144,34 +143,34 @@ func synCallback(session Session) {   } ``` -This callback reschedules itself in a new timeout handler and updates the global **sessionTimeout** map. +这次回调在新的超时 handler 中重新调度自己,并更新全局 map **sessionTimeout**。 -### **Data race and references** +### 数据竞争和引用 -Your solution is ready. One simple test is to check that a timeout callback is executed after the timer has expired. To do this, register a timeout, sleep for its duration, and then check whether the callback actions were done. After the test is executed, it is a good idea to cancel the scheduled timeout (as it reschedules), so it won’t have side effects between tests. +你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,在 *duration* 时间内 sleep,然后检查是否执行的回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 -Surprisingly, this simple test found a bug in the solution. Canceling timeouts using the cancel method was just not doing its job. The following order of events would cause a data race condition: +令人惊讶的是,这个简单的测试发现了这个解决方案中的一个 bug。使用 cancel 方法来取消超时并没有正确处理。以下顺序的事件会导致数据资源竞争: - 1. You have one scheduled timeout handler. - 2. Thread 1: -a) You receive a control packet, and you now want to cancel the registered timeout and move on to the next session state. (e.g. received a **SYN-ACK** **after you sent a **SYN**). -b) You call **timeout.Cancel()**, which calls a **timer.Stop()**. (Note that a Golang timer stop doesn’t prevent an already expired timer from running.) - 3. Thread 2: -a) Right before that cancel call, the timer has expired, and the callback was about to execute. -b) The callback is executed, it schedules a new timeout and updates the global map. - 4. Thread 1: -a) Transitions to a new session state and registers a new timeout, updating the global map. + 1. 你有一个已调度的超时 handler。 + 2. 线程 1: +a) 你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个 session 状态(如 发送 **SYN** 后接收到一个 **SYN-ACK**) +b) 你调用了 **timeout.Cancel()**,这个函数调用了 **timer.Stop()**。(请注意,Golang 计时器的 stop 不会终止一个已过期的计时器。) + 3. 线程 2: +a) 在调用 cancel 之前,计时器已过期,回调即将执行。 +b) 执行回调,它调度一次新的超时并更新全局 map。 + 4. 线程 1: +a) 切换到新的 session 状态并注册新的超时,更新全局 map。 -Both threads were updating the timeout map concurrently. The end result is that you failed to cancel the registered timeout, and then you also lost the reference to the rescheduled timeout done by thread 2. This results in a handler that keeps executing and rescheduling for a while, doing unwanted behavior. +两个线程同时更新超时 map。最终结果是你无法取消注册的超时,然后你也会丢失对线程 2 重新调度的超时的引用。这导致 handler 在一段时间内持续执行和重新调度,出现非预期行为。 -### When locking is not enough +### 锁也解决不了问题 -Using locks also doesn’t fix the issue completely. If you add locks before processing any event and before executing a callback, it still doesn’t prevent an expired callback to run: +使用锁也不能完全解决问题。如果你在处理所有事件和执行回调之前加锁,它仍然不能阻止一个过期的回调运行: -``` +```go func (timeout* TimeoutHandler) Register() {     timeout.timer = time.AfterFunc(time.Duration(timeout.duration) * time._Second_, func() {       stateLock.Lock()   @@ -182,26 +181,26 @@ func (timeout* TimeoutHandler) Register() {   } ``` -The difference now is that the updates in the global map are synchronized, but this doesn’t prevent the callback from running after you call the **timeout.Cancel() **— This is the case if the scheduled timer expired but didn’t grab the lock yet. You should again lose reference to one of the registered timeouts. +现在的区别就是全局 map 的更新是同步的,但是这还是不能阻止在你调用 **timeout.Cancel() ** 后回调的执行 — 这种情况出现在调度计时器过期了但是还没有拿到锁的时候。你还是会丢失一个已注册的超时的引用。 -### Using cancellation channels +### 使用取消 channel -Instead of relying on golang’s **timer.Stop()**, which doesn’t prevent an expired timer to execute, you can use cancellation channels. +你可以使用取消 channel,而不必依赖不能阻止到期的计时器执行的 golang 函数 **timer.Stop()**。 -It is a slightly different approach. Now you won’t do a recursive re-scheduling through callbacks; instead, you register an infinite loop that waits for cancellation signals or timeout events. +这是一个略有不同的方法。现在你可以不用再通过回调进行递归地重新调度;而是注册一个死循环,这个循环接收到取消信号或超时事件是终止。 -The new **Register()** spawns a new go thread that runs your callback after a timeout and schedules a new timeout after the previous one has been executed. A cancellation channel is returned to the caller to control when the loop should stop. +新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用发一个取消 channel,用来控制循环的终止。 -``` +```go func (timeout *TimeoutHandler) Register() chan struct{} {     cancelChan := make(chan struct{})         go func () {       select {   -    case _ = <\- cancelChan:   +    case _ = <- cancelChan:         return   -    case _ = <\- time.AfterFunc(time.Duration(timeout.duration) * time.Second):   +    case _ = <- time.AfterFunc(time.Duration(timeout.duration) * time.Second):         func () {           stateLock.Lock()           defer stateLock.Unlock() @@ -218,23 +217,23 @@ func (timeout* TimeoutHandler) Cancel() {     if timeout.cancelChan == nil {       return     }   -  timeout.cancelChan <\- struct{}{}   +  timeout.cancelChan <- struct{}{}   } ``` -This approach gives you a cancellation channel for each timeout you register. A cancel call sends an empty struct to the channel and triggers the cancellation. However, this doesn’t resolve the previous issue; the timeout can expire right before you call cancel over the channel, and before the lock is grabbed by the timeout thread. +这个方法提供了你注册的所有超时的取消 channel。对 cancel 的一次调用向 channel 发送一个空结构体并触发取消操作。然而,这并不能解决前面的问题;可能在你通过 channel 调用 cancel 超时线程还没有拿到锁之前,超时时间就已经到了。 -The solution here is to check the cancellation channel inside the timeout scope after you grab the lock. +这里的解决方案是,在拿到锁之后,检查一下超时范围内的取消 channel。 -``` -  case _ = <\- time.AfterFunc(time.Duration(timeout.duration) * time.Second):   +```go +  case _ = <- time.AfterFunc(time.Duration(timeout.duration) * time.Second):       func () {         stateLock.Lock()         defer stateLock.Unlock()               select {   -      case _ = <\- handler.cancelChan:   +      case _ = <- handler.cancelChan:           return         default:           timeout.callback(timeout.session)   @@ -243,47 +242,49 @@ The solution here is to check the cancellation channel inside the timeout scope   } ``` -Finally, this guarantees that the callback is only executed after you grab the lock and no cancellation was triggered. +最终,这可以确保在拿到锁之后执行回调,不会触发取消操作。 -### Beware of deadlocks +### 小心死锁 -This solution seems to work; however, there is one hidden pitfall here: [deadlocks][10]. +这个解决方案看起来有效;但是还是有个隐患:[死锁][10]。 -Please read the code above again and try to find it yourself. Think of concurrent calls to any of the methods described. +请阅读上面的代码,试着自己找到它。考虑下描述的所有函数的并发调用。 -The last problem here is with the cancellation channel itself. We made it an unbuffered channel, which means that sending is a blocking call. Once you call cancel in a timeout handler, you only proceed once that handler is canceled. The problem here is when you have multiple calls to the same cancelation channel, where a cancel request is only consumed once. And this can easily happen if concurrent events were to cancel the same timeout handler, like a link down or control packet event. This results in a deadlock situation, possibly bringing the application to a halt. +这里的问题在取消 channel 本身。我们创建的是无缓冲 channel,即发送是阻塞调用。当你在一个超时 handler 中调用取消函数时,只有在该 handler 被取消后才能继续处理。问题出现在,当你有多个调用请求到同一个取消 channel 时,这时一个取消请求只被处理一次。当多个事件同时取消同一个超时 handler 时,如链接断开或控制包事件,很容易出现这种情况。这会导致死锁,可能会使应用程序 halt。 ![gophers on a wire, talking][11] -Is anyone listening? +还有人吗? -By Trevor Forrey. Used with permission. +已获得 Trevor Forrey 授权。 -The solution here is to at least make the channel buffered by one, so sends are not always blocking, and also explicitly make the send non-blocking in case of concurrent calls. This guarantees the cancellation is sent once and won’t block the subsequent cancel calls. +这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会则色后续的取消调用。 -``` +```go func (timeout* TimeoutHandler) Cancel() {     if timeout.cancelChan == nil {       return     }         select {   -  case timeout.cancelChan <\- struct{}{}:   +  case timeout.cancelChan <- struct{}{}:     default:       // can’t send on the channel, someone has already requested the cancellation.     }   } ``` -### Conclusion +### 总结 -You learned in practice how common mistakes can show up while working with concurrent code. Due to their non-deterministic nature, those issues can go easily undetected, even with extensive testing. Here are the three main problems we encountered in the initial implementation. +在实践中你学到了并发操作时出现的常见错误。由于其不确定性,即使进行大量的测试,也不容易发现这些问题。下面是我们在最初的实现中遇到的三个主要问题: -#### Updating shared data without synchronization +#### 在非同步的情况下更新共享数据 This seems like an obvious one, but it’s actually hard to spot if your concurrent updates happen in different locations. The result is data race, where multiple updates to the same data can cause update loss, due to one update overriding another. In our case, we were updating the scheduled timeout reference on the same shared map. (Interestingly, if Go detects a concurrent read/write on the same Map object, it throws a fatal error —you can try to run Go’s [data race detector][12]). This eventually results in losing a timeout reference and making it impossible to cancel that given timeout. Always remember to use locks when they are needed. + + ![gopher assembly line][13] don’t forget to synchronize gophers’ work @@ -317,18 +318,18 @@ via: https://opensource.com/article/19/12/go-common-pitfalls [a]: https://opensource.com/users/edufgf [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny (Goland gopher illustration) +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny "Goland gopher illustration" [2]: http://mode.net [3]: https://en.wikipedia.org/wiki/Metrics_%28networking%29 [4]: https://people.ece.cornell.edu/atang/pub/15/HALO_ToN.pdf [5]: https://en.wikipedia.org/wiki/Point_of_presence -[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png (latency computation graph) -[7]: https://opensource.com/sites/default/files/uploads/image3_0.png (finite state machine diagram) +[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png "latency computation graph" +[7]: https://opensource.com/sites/default/files/uploads/image3_0.png "finite state machine diagram" [8]: https://golang.org/ -[9]: https://opensource.com/sites/default/files/uploads/image4.png (gophers hacking together) +[9]: https://opensource.com/sites/default/files/uploads/image4.png "gophers hacking together" [10]: https://en.wikipedia.org/wiki/Deadlock -[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg (gophers on a wire, talking) +[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg "gophers on a wire, talking" [12]: https://golang.org/doc/articles/race_detector.html -[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg (gopher assembly line) +[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg "gopher assembly line" [14]: https://en.wikipedia.org/wiki/Monitor_%28synchronization%29#Condition_variables -[15]: https://opensource.com/sites/default/files/uploads/image7.png (gopher boot camp) +[15]: https://opensource.com/sites/default/files/uploads/image7.png "gopher boot camp" From 6dacee06787746bfe551626c3c1f4fa2fd2ce2e1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:55:40 +0800 Subject: [PATCH 438/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Bash?= =?UTF-8?q?=20Script=20to=20Check=20How=20Long=20the=20High=20CPU/Memory?= =?UTF-8?q?=20Consumption=20Processes=20Runs=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md --- ...ory Consumption Processes Runs on Linux.md | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md diff --git a/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md b/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md new file mode 100644 index 0000000000..fc3818c344 --- /dev/null +++ b/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux) +[#]: via: (https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux +====== + +In the past, we have written three different articles to identify this using Linux commands. + +You can access them immediately by going to the relevant URLs below. + + * **[How to Find High CPU Consumption Processes in Linux][1]** + * **[How to Find Out Top Memory Consuming Processes in Linux][2]** + * **[Five Ways to Check How Long a Process Has Been Running in Linux][3]** + + + +Two scripts are included in this tutorial, which helps you to identify how long the high CPU/memory consumption processes are running on Linux. + +The script will show you the process ID, the owner of the process, the name of the process and how long the processes are running. + +This will help you identify which jobs are running overtime (which must be completed beforehand). + +This can be achieved using the ps command. + +### What’s ps Command + +ps stands for processes status, it display the information about the active/running processes on the system. + +It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc. + +### 1) Bash Script to Check How Long the High CPU Consumption Processes Runs on Linux + +This script will help you to identify how long the high CPU consumption processes has been running on Linux. + +``` +# vi /opt/scripts/long-running-cpu-proc.sh + +#!/bin/bash +ps -eo pid,user,ppid,%mem,%cpu,cmd --sort=-%cpu | head | tail -n +2 | awk '{print $1}' > /tmp/long-running-processes.txt +echo "--------------------------------------------------" +echo "UName PID CMD Process_Running_Time" +echo "--------------------------------------------------" +for userid in `cat /tmp/long-running-processes.txt` +do +username=$(ps -u -p $userid | tail -1 | awk '{print $1}') +pruntime=$(ps -p $userid -o etime | tail -1) +ocmd=$(ps -p $userid | tail -1 | awk '{print $4}') +echo "$username $userid $ocmd $pruntime" +done | column -t +echo "--------------------------------------------------" +``` + +Set an executable **[Linux file permission][4]** to **“long-running-cpu-proc.sh”** file. + +``` +# chmod +x /opt/scripts/long-running-cpu-proc.sh +``` + +When you run this script, you will get an output like the one below. + +``` +# sh /opt/scripts/long-running-cpu-proc.sh + +---------------------------------------------------- +UName PID CMD Process_Running_Time +---------------------------------------------------- +daygeek 5214 Web 01:18:48 +daygeek 5748 Web 01:08:20 +daygeek 8043 inkscape 22:11 +daygeek 5269 Web 01:18:31 +daygeek 1712 Web 10:44:50 +daygeek 5335 RDD 01:17:54 +daygeek 1639 firefox 10:44:51 +daygeek 7793 nautilus 24:14 +daygeek 6301 Web 57:40 +---------------------------------------------------- +``` + +### 2) Bash Script to Check How Long the High Memory Consumption Processes Runs on Linux + +This script will help you to identify how long the top memory consumption processes has been running on Linux. + +``` +# sh /opt/scripts/long-running-memory-proc.sh + +#!/bin/bash +ps -eo pid,user,ppid,%mem,%cpu,cmd --sort=-%mem | head | tail -n +2 | awk '{print $1}' > /tmp/long-running-processes-1.txt +echo "--------------------------------------------------" +echo "UName PID CMD Process_Running_Time" +echo "--------------------------------------------------" +for userid in `cat /tmp/long-running-processes-1.txt` +do +username=$(ps -u -p $userid | tail -1 | awk '{print $1}') +pruntime=$(ps -p $userid -o etime | tail -1) +ocmd=$(ps -p $userid | tail -1 | awk '{print $4}') +echo "$username $userid $ocmd $pruntime" +done | column -t +echo "--------------------------------------------------" +``` + +Set an executable Linux file permission to **“long-running-memory-proc.sh”** file. + +``` +# chmod +x /opt/scripts/long-running-memory-proc.sh +``` + +When you run this script, you will get an output like the one below. + +``` +# sh /opt/scripts/long-running-memory-proc.sh + +---------------------------------------------------- +UName PID CMD Process_Running_Time +---------------------------------------------------- +daygeek 1639 firefox 10:44:56 +daygeek 2997 Web 10:39:54 +daygeek 5269 Web 01:18:37 +daygeek 1712 Web 10:44:55 +daygeek 8043 inkscape 22:17 +daygeek 5214 Web 01:18:54 +daygeek 1898 Web 10:44:48 +daygeek 1129 Xorg 10:45:07 +daygeek 6301 Web 57:45 +---------------------------------------------------- +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/ +[2]: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ +[3]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ +[4]: https://www.2daygeek.com/understanding-linux-file-permissions/ From 8ae7e83dcbaa294e82bbc08a2e20cfe37354a9d3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:56:32 +0800 Subject: [PATCH 439/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200106=20Open?= =?UTF-8?q?=20Source=20Supply=20Chain:=20A=20Matter=20of=20Trust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md --- ... Source Supply Chain- A Matter of Trust.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md diff --git a/sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md b/sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md new file mode 100644 index 0000000000..3484c3ca55 --- /dev/null +++ b/sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source Supply Chain: A Matter of Trust) +[#]: via: (https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Open Source Supply Chain: A Matter of Trust +====== + +[![][1]][2] + +_**Co-authored by Curtis Franklin, Jr**_ + +Open source software is often considered safer and more secure than proprietary software because users can, if they want, compile the software from the source code. They know the source of the code running in their environment.  Every component that they are running in their environment can be audited and the developer held accountable.   + +However, users and vendors are moving away from complexity that comes with total control and embracing convenience and ease of use. + +“I am often taken aback when I see a talk around security and privacy and then the presenter runs the ‘docker run’ command to install and run some random binary downloaded from the internet,” said [Dirk Hohndel, Vice-President and Chief Open Source Officer at VMware.][3] “Those two things seem to be a little bit at odds with each other.” + +The software supply chain — the process that takes an application from coding through packaging and distribution to its ultimate user — is complicated. If done wrong, it could be potentially risky, especially for open source software.  A malevolent player can get access to the backend and start inserting any random binary code onto a user’s system without that user’s knowledge or control. + +It’s not a problem specific to the cloud-native world. It can be seen in modern app development environments, including JavaScript, npm, PyPI, RubyGems, and so on.  Even Homebrew on Mac used to be provided through source code that a user would compile themselves.  + +“Today, you just download the binary and install it, hoping that it’s built from the same source code that you have access to,” said Hohndel. “As an industry, we need to pay more attention to our supply chain.  It’s something that is extremely important to me and that I’m trying to get more people interested in it.”  + +It’s not simply a binary versus source code equation, though. There are huge advantages to just running a binary instead of having to build everything from sources.   It allows developers to be more flexible and more responsive in their turnaround. They can cycle very quickly through new development and product releases by reusing some binaries. + +“It would be nice if there was a way to sign these binaries and have an ‘on-the-fly’ verification mechanism so users know they can trust these,” said Hohndel. + +Linux distributions have solved this problem as the distributions act as gatekeepers who check the integrity of packages that go into supported repositories.  + +“Packages offered through distributions like Debian are signed with a key. It takes a lot of work to ensure that this is really the software that should be in the distribution. They have solved the supply chain problem,” said Hohndel. + +But even on Linux distribution, people want to simplify things and trade correctness and security for speed. There are now projects like AppImage, Snap and Flatpack that have adopted the binary route, bringing the trust issue to Linux distributions. It’s the same problem of docker containers all over again. + +“The ideal solution would be to find a way for us as a community to devise a system of trust which ensures that if a binary was signed with a key that is in the network of trust, it can be trusted and provides us with the ability to reliably go back to the sources and do an audit,” suggested Hohndel. + +However, all this additional steps incur costs that most projects are either unwilling or unable to afford. Some projects are trying to find ways around the problem. NPM, for example, has begun to encourage those submitting packages to properly authenticate and secure their accounts to improve trustworthiness on the platform.  + +**Open Source Community Is Good At Solving Problems** + +Hohndel is involved with many efforts to solve the open source supply chain problem and is spreading awareness about it. Last year, [VMware acquired Bitnami,][4] which is a great place for curating open source applications that are signed by VMware.  + +“We are talking with upstream open source communities in various ecosystems to raise awareness about it. We are also discussing technical solutions that will make it easier for these communities to solve the underlying problems,” said Hohndel. + +The open source community has historically been diligent at ensuring software quality, including the mechanisms for security and privacy. Still, Hohndel says, “The biggest concern that I have is that, in the excitement about the next new thing, we often ignore the underlying engineering discipline that we really need.” + +Ultimately, Hohndel feels that answer will come from the open source community itself. “Open source is an engineering methodology and it’s a social experiment. Open source is all about people trusting each other, working with each other, collaborating across borders, between companies, amongst competitors in ways that we didn’t do before,” he explains. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920-1068x801.jpg (hand-1137978_1920) +[2]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920.jpg +[3]: https://www.swapnilbhartiya.com/open-source-leaders-dirk-hohndel-brings-open-source-to-vmware/ +[4]: https://techcrunch.com/2019/05/15/vmware-acquires-bitnami-to-deliver-packaged-applications-anywhere/ From f9c2412d4a61667987ac979d9bc42c88650c4b7e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:57:01 +0800 Subject: [PATCH 440/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Kali?= =?UTF-8?q?=20Linux=20Will=20No=20Longer=20Have=20The=20Default=20Root=20U?= =?UTF-8?q?ser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md --- ...ll No Longer Have The Default Root User.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md diff --git a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md new file mode 100644 index 0000000000..2ffcd8f715 --- /dev/null +++ b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Kali Linux Will No Longer Have The Default Root User) +[#]: via: (https://itsfoss.com/kali-linux-root-user/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Kali Linux Will No Longer Have The Default Root User +====== + +Kali Linux is a specialized Linux distribution for cyber security testing and hacking related tasks. + +If you’ve used [Kali Linux][1], you probably know that it followed a default root user policy. In other words, you are always root in Kali Linux. Whatever you do – you will be accessing tools/applications as root by default. + +It looks like everything back then was kind of “root for all” for everything. So, the default root user policy existed. + +They also explained the history for this in their [announcement post][2]: + +> A lot of those tools back then either required root access to run or ran better when ran as root. With this operating system that would be ran from a CD, never be updated, and had a lot of tools that needed root access to run it was a simple decision to have a “everything as root” security model. It made complete sense for the time. + +### Kali Linux will now have a default non-root user (like most other distributions) + +![][3] + +A default non-root model was necessary because a lot of users now use Kali Linux as their daily driver. + +Of course, they [do not recommend using Kali Linux][4] as a replacement for stable distributions like Ubuntu/Fedora/Manjaro – however, with its active development, some users do consider using it on a day-to-day basis instead of just using it for its tools. + +So, with a wide mainstream usage of the distro, the Kali Linux team thought of switching to a default non-root model because nowadays a lot of applications/tools do not require root access. + +> While we don’t encourage people to run Kali as their day to day operating system, over the last few years more and more users have started to do so _(even if they are not using it to do penetration testing full time)_, including some members of the Kali development team. When people do so, they obviously don’t run as default root user. With this usage over time, there is the obvious conclusion that default root user is no longer necessary and Kali will be better off moving to a more traditional security model. + +So I am reiterating that you should not consider Kali Linux to be fit for your daily tasks if you do not utilize security-related [Kali Linux tools][5]. Feel free to experiment – but I wouldn’t be so sure to rely on it. + +So from the next release, when you install Kali Linux, you’ll be asked to create non-root user that will have admin privileges. Tools and commands that require root access will be run with sudo. + +![][6] + +#### [Pretend to be Using Windows with Kali Linux Undercover Mode][7] + +The new undercover mode in Kali Linux switches the desktop layout to make it look like Windows 10. Find out how to activate the undercover mode. + +### New default user and password for Kali Linux live mode + +![Kali Linux has new user-password in the live system][8] + +Technically, you won’t find a groundbreaking difference. Just note that the default user ID and password in live mode is “**kali**“. + +You can find the new non-root model implemented in the new daily/weekly builds if you want to test it early. + +In either case, you can wait for the 2020.1 release scheduled for late January to take a look at the new default non-root user model. + +### Getting back the old root model in Kali Linux + +If you are a long time Kali Linux user, you may not find it convenient to add sudo before commands and then manually enter the password. + +The good news here is that you can still get the old password-less root rights with this command: + +``` +sudo dpkg-reconfigure kali-grant-root +``` + +What do you think about the default non-root user model? Is it a good decision? Let me know your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kali-linux-root-user/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.kali.org/ +[2]: https://www.kali.org/news/kali-default-non-root-user/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali_linux_default_root_user.png?ssl=1 +[4]: https://itsfoss.com/kali-linux-review/ +[5]: https://itsfoss.com/best-kali-linux-tools/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/kali_linux_undercover_mode.jpg?fit=800%2C450&ssl=1 +[7]: https://itsfoss.com/kali-linux-undercover-mode/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali-linux-live-password.png?ssl=1 From 23bed4dc448b9e84f2a9cec6796ad0ebe3b0fe6c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:57:21 +0800 Subject: [PATCH 441/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20App=20?= =?UTF-8?q?Highlight:=20Catfish=20Desktop=20File=20Searching=20Tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md --- ...ht- Catfish Desktop File Searching Tool.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md diff --git a/sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md b/sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md new file mode 100644 index 0000000000..d485682215 --- /dev/null +++ b/sources/tech/20200107 App Highlight- Catfish Desktop File Searching Tool.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Catfish Desktop File Searching Tool) +[#]: via: (https://itsfoss.com/catfish/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +App Highlight: Catfish Desktop File Searching Tool +====== + +_****Brief: Catfish is a nifty file searching GUI tool for Linux desktop. The interface is lightweight and simple and the tool allows to refine your search with** criteria like time, file type etc.**_ + +The Linux purists use commands like locate, find and grep to search for files in the terminal. + +But as a desktop Linux user, you don’t need to leave the comfort of the graphical user interface (GUI) and deep dive into the command line interface (CLI) just for searching files on your desktop. + +Most Linux distributions provide a basic desktop search feature either via the file manager or through the desktop environment itself. + +On GNOME desktop, you can search for files in the Activities area (use the Windows key to bring it up). Files (previously known as Nautilus) also has a built-in search button. + +![Nautilus file manager already has advanced search feature][1] + +You can extend this search and add options like time and type of the file. One thing it doesn’t do is to search inside the files. For example, you cannot use it to get all the files that contains “university”. + +This is where a desktop file search tool like Catfish could help you. + +### Catfish: A nifty GUI tool for searching files on Linux + +[Catfish][2] is a GUI tool that enables you to search your desktop for any kind of files. It uses locate and find commands underneath. The autocompletion feature uses [Zeitgeist][3] daemon and [locate command][4]. It’s a lightweight tool and uses GTK+. + +Catfish is developed by [Christian Dywan][5], the same person who develops the [lightweight Midori web browser][6]. + +![Catfish interface on MX Linux][7] + +Some of the main features of Catfish are: + + * Search for files anywhere on your system, **including the mounted partitions** + * **Search inside the files** for its contents (can be enabled from preferences) + * Search hidden files as well + * Refine your search based on modification time + * Refine your search based on file type (images, videos, documents etc) + * Refine your search based on location (Documents, Downloads, Pictures or other folders) + * Exclude certain directories and paths from your search + * Lightweight and simple interface + * **Support for Wayland** display server (from version 1.4.12) + + + +Catfish is now a Xfce project and it is providing the search feature to Xfce’s Thunar file manager. + +### Installing Catfish on Ubuntu and other Linux distributions + +Let’s see how to install Catfish on your Linux distributions. + +**Ubuntu-based distributions** + +Catfish is available in the universe repository for Ubuntu based distributions such as Xubuntu, Linux Mint, Linux Lite etc. + +You can install it from the software center by searching for Catfish + +![Catfish in Ubuntu Software Center][8] + +or, use the terminal to install it: + +``` +sudo apt install catfish +``` + +The version provided by Ubuntu may not be the latest. The [official PPA][9] has been abandoned so this means that to get the latest Catfish version, you’ll have to [install it from the source code][10]. + +**On other distributions** + +Catfish is also available in most major Linux distributions. It is certainly available on Fedora and if you check your distribution’s package manager or software center, you should find it there and install it like any other program. + +**Conclusion** + +In this week’s Linux application highlight, you learned about this handy little utility. However, Catfish is not the only tool of its kind. You may check some other search tools like [ANGRYSearch][11] or [SearchMonkey][12]. + +Have you ever used a GUI tool for searching files or do you rely on the good old command line? And what do you think of Catfish? Do you look forward to use it? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/catfish/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/search-files-gnome.jpg?ssl=1 +[2]: https://launchpad.net/catfish-search/ +[3]: https://wiki.archlinux.org/index.php/Zeitgeist +[4]: https://linuxhandbook.com/locate-command/ +[5]: http://www.twotoasts.de/index.php/about/ +[6]: https://itsfoss.com/midori-browser/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/catfish_screenshot.png?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/catfish_ubuntu_software_center.jpg?ssl=1 +[9]: https://itsfoss.com/ppa-guide/ +[10]: https://itsfoss.com/install-software-from-source-code/ +[11]: https://itsfoss.com/angrysearch/ +[12]: https://itsfoss.com/searchmonkey-search-text-files-linux/ From 8638c00497c6dfed4f6918147985517e351fe2df Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:58:19 +0800 Subject: [PATCH 442/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200106=20How=20?= =?UTF-8?q?to=20write=20a=20Python=20web=20API=20with=20Pyramid=20and=20Co?= =?UTF-8?q?rnice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md --- ...Python web API with Pyramid and Cornice.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md diff --git a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md new file mode 100644 index 0000000000..2b10ef953a --- /dev/null +++ b/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a Python web API with Pyramid and Cornice) +[#]: via: (https://opensource.com/article/20/1/python-web-api-pyramid-cornice) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +How to write a Python web API with Pyramid and Cornice +====== +Use Pyramid and Cornice to build and document scalable RESTful web +services. +![Searching for code][1] + +[Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs. + +[Pyramid][3] is a Python web framework designed to scale up with an application: it's simple for simple applications but can grow for big, complex applications. Among other things, Pyramid powers PyPI, the Python package index. [Cornice][4] provides helpers to build and document REST-ish web services with Pyramid. + +This article will use the example of a web service to get famous quotes to show how to use these tools. + +### Set up a Pyramid application + +Start by creating a virtual environment for your application and a file to hold the code: + + +``` +$ mkdir tutorial +$ cd tutorial +$ touch main.py +$ python3 -m venv env +$ source env/bin/activate +(env) $ pip3 install cornice twisted +``` + +### Import the Cornice and Pyramid modules + +Import these modules with: + + +``` +from pyramid.config import Configurator +from cornice import Service +``` + +### Define the service + +Define the quotes service as a **Service** object: + + +``` +QUOTES = Service(name='quotes', +                 path='/', +                 description='Get quotes') +``` + +### Write the quotes logic + +So far, this only supports **GET**ing quotes. Decorate the function with **QUOTES.get**; this is how you can tie in the logic to the REST service: + + +``` +@QUOTES.get() +def get_quote(request): +    return { +        'William Shakespeare': { +            'quote': ['Love all, trust a few, do wrong to none', +            'Some are born great, some achieve greatness, and some have greatness thrust upon them.'] +    }, +    'Linus': { +        'quote': ['Talk is cheap. Show me the code.'] +        } +    } +``` + +Note that unlike in other frameworks, the **get_quote** function is _not_ changed by the decorator. If you import this module, you can still call the function regularly and inspect the result. + +This is useful when writing unit tests for Pyramid RESTful services. + +### Define the application object + +Finally, use **scan** to find all decorated functions and add them to the configuration:  + + +``` +with Configurator() as config: +    config.include("cornice") +    config.scan() +    application = config.make_wsgi_app() +``` + +The default for scan is to scan the current module. You can also give the name of a package if you want to scan all modules in a package. + +### Run the service + +I use Twisted's WSGI server to run the application, but you can use any other [WSGI][5] server, like Gunicorn or uWSGI, if you want: + + +``` +`(env)$ python -m twisted web --wsgi=main.application` +``` + +By default, Twisted's WSGI server runs on port 8080. You can test the service with [HTTPie][6]: + + +``` +(env) $ pip install httpie +... +(env) $ http GET +HTTP/1.1 200 OK +Content-Length: 220 +Content-Type: application/json +Date: Mon, 02 Dec 2019 16:49:27 GMT +Server: TwistedWeb/19.10.0 +X-Content-Type-Options: nosniff + +{ +    "Linus": { +        "quote": [ +            "Talk is cheap. Show me the code." +        ] +    }, +    "William Shakespeare": { +        "quote": [ +            "Love all,trust a few,do wrong to none", +            "Some are born great, some achieve greatness, and some greatness thrust upon them." +        ] +    } +} +``` + +### Why use Pyramid? + +Pyramid is not the most popular framework, but it is used in some high-profile projects like [PyPI][7]. I like Pyramid because it is one of the frameworks that took unit testing seriously: because the decorators do not modify the function and there are no thread-local variables, functions are callable directly from unit tests. For example, functions that need access to the database will get it from the **request** object passed in via **request.config**. This allows a unit tester to put a mock (or real) database object in the request, instead of carefully setting globals, thread-local variables, or other framework-specific things. + +If you're looking for a well-tested library to build your next API, give Pyramid a try. You won't be disappointed. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/python-web-api-pyramid-cornice + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://opensource.com/resources/python +[3]: https://opensource.com/article/18/5/pyramid-framework +[4]: https://cornice.readthedocs.io/en/latest/ +[5]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface +[6]: https://opensource.com/article/19/8/getting-started-httpie +[7]: https://pypi.org/ From dd1cfb171b21de63db5570da5b9ea1d24ed1bec1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:58:47 +0800 Subject: [PATCH 443/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200106=20Create?= =?UTF-8?q?=20fancy=20text=20for=20your=20social=20media=20posts=20with=20?= =?UTF-8?q?this=20Gawk=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md --- ...ocial media posts with this Gawk script.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md diff --git a/sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md b/sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md new file mode 100644 index 0000000000..361bac0726 --- /dev/null +++ b/sources/tech/20200106 Create fancy text for your social media posts with this Gawk script.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create fancy text for your social media posts with this Gawk script) +[#]: via: (https://opensource.com/article/20/1/gawk-scripting-social-media) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Create fancy text for your social media posts with this Gawk script +====== +Add a little style to your status updates by posting text in script, +fraktur, or double-strike characters. +![Chat via email][1] + +Like almost everyone on the planet, I have a few social media accounts. I mostly stick to Facebook to stay up to date with friends and family and Twitter to follow a few other people. + +Have you ever wanted to make a post that includes italics or some other fancy formatting? You can easily change the text to italics or bold when you're writing an email, but most social media platforms don't provide many formatting options. + +And sometimes, I just want to put a little _emphasis_ into what I'm writing. If I've had a really good day and I want to share that with my friends, I might want to put that text in italics. For other posts, I might want to use different formatting that will help my text stand out. Sure, you can use emoji, but sometimes a little text formatting can add that extra pizzazz to your posts. + +I found a way to do just that. With a short [Gawk][2] script I wrote, I can create fancy formatting that I can copy and paste into my social media posts. + +### Special HTML + +HTML includes a bunch of special characters for mathematics, symbols, and other languages that most people are not aware of. Within the Mathematical Markup Language ([MathML][3]) math character support, HTML includes alternate versions of the alphabet for script, fraktur, and double-strike (shown respectively in this image) characters. + +![script, fraktur, and double-strike text][4] + +You can use these alternate versions of the alphabet to create fancy text. + +The script alphabet variation is written as the letter followed by **scr**. Characters can be uppercase or lowercase. For example, to print the script letter **a** in an HTML page, type **&ascr;**, and to print the script letter **Z** in HTML, type **&Zscr;**. + +The fraktur and double-strike variations are referenced in similar ways. The fraktur mathematical lower-case **a** is **&afr;**, and the capital **Y** is **&Yfr;**. The mathematical double-strike **a** is referenced as **&aopf;**, and the double-strike **X** is **&Xopf;**. + +### Gawk functions + +Once you know how to reference the alternate versions of each letter, it's easy to define a few Gawk functions to print those HTML entities. Since these alternate characters exist only for letters and not punctuation or numbers, start with a simple wrapper function to determine if a character is an uppercase or lowercase letter. + + +``` +#!/usr/bin/gawk -f +# Echo the input as different "fonts." Redirect this into an html +# page and copy/paste fancy text into twitter or facebook. + +BEGIN { alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; } + +function is_alpha(c) { +  return(index(alpha, c)); +} +``` + +The **BEGIN** statement defines an alphabet string called **alpha** that contains all letters a–z and A–Z. The **is_alpha(c)** function uses the built-in **index()** function to return the location of the character **c** in the string **alpha**. If the character **c** is not a letter, **index()** returns zero, which the script uses as a False value. + +Because the **is_alpha(c)** function just "wraps" a call to the **index()** function without doing anything else; this is called a _wrapper_ function. Think of it as shorthand that makes the Gawk script easier to read. + +With that, it's easy to define a few functions that convert single letters into each of the alternate versions of the alphabet. In general, each function calls **is_alpha(c)** to determine if a character is a letter a–z or A–Z. If it is (i.e., if the returned value is non-zero), then the function prints the HTML entity for that letter as script, fraktur, and double-strike. Otherwise, the function prints the letter. + + +``` +function print_script(c) { +  if ( is_alpha(c) ) { printf("&%cscr;", c); } else { printf("%c", c); } +} +function print_fraktur(c) { +  if ( is_alpha(c) ) { printf("&%cfr;", c); }  else { printf("%c", c); } +} +function print_double(c) { +  if ( is_alpha(c) ) { printf("&%copf;", c); } else { printf("%c", c); } +} +``` + +The **print_script(c)** function prints a single letter in script. Similarly, the **print_fraktur(c)** function prints a letter in fraktur, and the **print_double(c)** function prints a single letter in double-strike. + +All that's left is a Gawk loop to convert plain text into each of the alternate alphabet characters. This script loops over each line three times and prints the text in script, fraktur, or double-strike. Each line is wrapped in **<p>** and **</p>** HTML tags. + + +``` +{ text=$0; +  len=length(text); + +  print "<p>"; +  for (i=1; i<=len; i++) { +    print_script( substr(text, i, 1) ); +  } +  print "</p><p>"; +  for (i=1; i<=len; i++) { +    print_fraktur( substr(text, i, 1) ); +  } +  print "</p><p>"; +  for (i=1; i<=len; i++) { +    print_double( substr(text, i, 1) ); +  } +  print "</p>"; +} +``` + +### Putting it all together + +I saved the above lines in a script file called **htmlecho** and put it in my **~/bin** directory. + + +``` +$ htmlecho > /tmp/hello.html +Hello world +^Z +``` + +Whenever I want to add fancy text to my Facebook and Twitter posts, I just run the script and save the output to a temporary HTML page. I open the temporary page in a web browser and copy and paste the fancy text I like best into my social media posts. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/gawk-scripting-social-media + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://www.gnu.org/software/gawk/ +[3]: https://en.wikipedia.org/wiki/MathML +[4]: https://opensource.com/sites/default/files/uploads/hello_world.png (script, fraktur, and double-strike text) From 299bf6e3e090c4a0446ef4d689becabc21607800 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 00:59:07 +0800 Subject: [PATCH 444/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200105=20PaperW?= =?UTF-8?q?M:=20tiled=20window=20management=20for=20GNOME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200105 PaperWM- tiled window management for GNOME.md --- ...erWM- tiled window management for GNOME.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/tech/20200105 PaperWM- tiled window management for GNOME.md diff --git a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md new file mode 100644 index 0000000000..0948014fba --- /dev/null +++ b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PaperWM: tiled window management for GNOME) +[#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/) +[#]: author: (Julia Evans https://jvns.ca/) + +PaperWM: tiled window management for GNOME +====== + +When I started using Linux on my personal computer, one of the first things I got excited about was tiny lightweight window managers, largely because my laptop at the time had 32MB of RAM and anything else was unusable. + +Then I got into tiling window managers like [xmonad][1]! I could manage my windows with my keyboard! They were so fast! I could configure xmonad by writing a Haskell program! I could customize everything in all kinds of fun ways (like using [dmenu][2] as a launcher)! I used 3 or 4 different tiling window managers over the years and it was fun. + +About 6 years ago I decided configuring my tiling window manager wasn’t fun for me anymore and switched to using the Ubuntu stock desktop environment: Gnome. (which is much faster now that I have 500x more RAM in my laptop :) ) + +So I’ve been using Gnome for a long time, but I still kind of missed tiling window managers. Then 6 months ago a friend told me about [PaperWM][3], which lets you tile your windows in Gnome! I installed it immediately and I’ve been using it ever since. + +### PaperWM: tiling window management for Gnome + +The basic idea of [PaperWM][3] is: you want to keep using Gnome (because all kinds of things Just Work in Gnome) but you also kinda wish you were using a tiling window manager. + +It’s a Gnome extension (instead of being a standalone window manager) and it’s in Javascript. + +### “Paper” means all of your windows are in a line + +The main idea in PaperWM is it puts all your windows in a line, which is actually quite different from traditional tiling window managers where you can tile your windows any way you want. Here’s a gif of me moving between / resizing some windows while writing this blog post (there’s a browser and two terminal windows): + +![][4] + +PaperWM’s Github README links to this video: , which describes a similar system as a “linear window manager”. + +I’d never heard of this way of organizing windows before but I like the simplicity of it – if I’m looking for a specific window I just move left/right until I find it. + +### everything I do in PaperWM + +there are lots of other features but these are the only ones I use: + + * move left and right between windows (`Super + ,`, `Super + .`) + * move the window left/right in the ordering (`Super+Shift+,`, `Super+Shift+.`) + * full screen a window (`Super + f`) + * make a window smaller (`Super + r`) + + + +### I like tools that I don’t have to configure + +I’ve been using PaperWM for 6 months on a laptop and I really like it! I also really appreciate that even though it’s configurable (by writing a Javascript configuration file), it does the things I want out of the box without me having to research how to configure it. + +The [fish shell][5] is another delightful tool like that – I basically don’t configure fish at all (except to set environment variables etc) and I really like the default feature set. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/01/05/paperwm/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://xmonad.org/ +[2]: https://wiki.archlinux.org/index.php/Dmenu +[3]: https://github.com/paperwm/PaperWM +[4]: https://jvns.ca/images/paperwm.gif +[5]: https://jvns.ca/blog/2017/04/23/the-fish-shell-is-awesome/ From 645361a2416b45bba0b7b078755a89f55b49147f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 7 Jan 2020 01:01:14 +0800 Subject: [PATCH 445/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200105=20Friend?= =?UTF-8?q?=20of=20a=20Friend:=20The=20Facebook=20That=20Could=20Have=20Be?= =?UTF-8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md --- ...iend- The Facebook That Could Have Been.md | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md diff --git a/sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md b/sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md new file mode 100644 index 0000000000..bbdb88f4f3 --- /dev/null +++ b/sources/talk/20200105 Friend of a Friend- The Facebook That Could Have Been.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Friend of a Friend: The Facebook That Could Have Been) +[#]: via: (https://twobithistory.org/2020/01/05/foaf.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +Friend of a Friend: The Facebook That Could Have Been +====== + +> _I express my network in a FOAF file, and that is the start of the revolution._ —Tim Berners-Lee (2007) + +The FOAF standard, or Friend of a Friend standard, is a now largely defunct/ignored/superseded[1][1] web standard dating from the early 2000s that hints at what social networking might have looked like had Facebook not conquered the world. Before we talk about FOAF though, I want to talk about the New York City Subway. + +The New York City Subway is controlled by a single entity, the Metropolitan Transportation Agency, better known as the MTA. The MTA has a monopoly on subway travel in New York City. There is no legal way to travel in New York City by subway without purchasing a ticket from the MTA. The MTA has no competitors, at least not in the “subway space.” + +This wasn’t always true. Surprisingly, the subway system was once run by two corporations that competed with each other. The Inter-borough Rapid Transit Company (IRT) operated lines that ran mostly through Manhattan, while the Brooklyn-Manhattan Transit Corporation (BMT) operated lines in Brooklyn, some of which extended into Manhattan also. In 1932, the City opened its own service called the Independent Subway System to compete with the IRT and BMT, and so for a while there were _three_ different organizations running subway lines in New York City. + +One imagines that this was not an effective way to run a subway. It was not. Constructing interchanges between the various systems was challenging because the IRT and BMT used trains of different widths. Interchange stations also had to have at least two different fare-collection areas since passengers switching trains would have to pay multiple operators. The City eventually took over the IRT and BMT in 1940, bringing the whole system together under one operator, but some of the inefficiencies that the original division entailed are still problems today: Trains designed to run along lines inherited from the BMT (e.g. the A, C, or E) cannot run along lines inherited from the IRT (e.g. the 1, 2, or 3) because the IRT tunnels are too narrow. As a result, the MTA has to maintain two different fleets of mutually incompatible subway cars, presumably at significant additional expense relative to other subway systems in the world that only have to deal with a single tunnel width. + +This legacy of the competition between the IRT and BMT suggests that subway systems naturally tend toward monopoly. It just makes more sense for there to be a single operator than for there to be competing operators. Average passengers are amply compensated for the loss of choice by never having to worry about whether they brought their IRT MetroCard today but forgot their BMT MetroCard at home. + +Okay, so what does the Subway have to do with social networking? Well, I have wondered for a while now whether Facebook has, like the MTA, a natural monopoly. Facebook does seem to have _a_ monopoly, whether natural or unnatural—not over social media per se (I spend much more time on Twitter), but over my internet social connections with real people I know. It has a monopoly over, as they call it, my digitized “social graph”; I would quit Facebook tomorrow if I didn’t worry that by doing so I might lose many of those connections. I get angry about this power that Facebook has over me. I get angry in a way that I do not get angry about the MTA, even though the Subway is, metaphorically and literally, a sprawling trash fire. And I suppose I get angry because at root I believe that Facebook’s monopoly, unlike the MTA’s, is not a natural one. + +What this must mean is that I think Facebook owns all of our social data now because they happened to get there first and then dig a big moat around themselves, not because a world with competing Facebook-like platforms is inefficient or impossible. Is that true, though? There are some good reasons to think it isn’t: Did Facebook simply get there first, or did they instead just do social networking better than everyone else? Isn’t the fact that there is only one Facebook actually convenient if you are trying to figure out how to contact an old friend? In a world of competing Facebooks, what would it mean if you and your boyfriend are now Facebook official, but he still hasn’t gotten around to updating his relationship status on VisageBook, which still says he is in a relationship with his college ex? Which site will people trust? Also, if there were multiple sites, wouldn’t everyone spend a lot more time filling out web forms? + +In the last few years, as the disadvantages of centralized social networks have dramatically made themselves apparent, many people have attempted to create decentralized alternatives. These alternatives are based on open standards that could potentially support an ecosystem of inter-operating social networks (see e.g. [the Fediverse][2]). But none of these alternatives has yet supplanted a dominant social network. One obvious explanation for why this hasn’t happened is the power of network effects: With everyone already on Facebook, any one person thinking of leaving faces a high cost for doing so. Some might say this proves that social networks are natural monopolies and stop there; I would say that Facebook, Twitter, et al. chose to be walled gardens, and given that people have envisioned and even built social networks that inter-operate, the network effects that closed platforms enjoy tell us little about the inherent nature of social networks. + +So the real question, in my mind, is: Do platforms like Facebook continue to dominate merely because of their network effects, or is having a single dominant social network more efficient in the same way that having a single operator for a subway system is more efficient? + +Which finally brings me back to FOAF. Much of the world seems to have forgotten about the FOAF standard, but FOAF was an attempt to build a decentralized and open social network before anyone had even heard of Facebook. If any decentralized social network ever had a chance of occupying the redoubt that Facebook now occupies before Facebook got there, it was FOAF. Given that a large fraction of humanity now has a Facebook account, and given that relatively few people know about FOAF, should we conclude that social networking, like subway travel, really does lend itself to centralization and natural monopoly? Or does the FOAF project demonstrate that decentralized social networking was a feasible alternative that never became popular for other reasons? + +### The Future from the Early Aughts + +The FOAF project, begun in 2000, set out to create a universal standard for describing people and the relationships between them. That might strike you as a wildly ambitious goal today, but aspirations like that were par for the course in the late 1990s and early 2000s. The web (as people still called it then) had just trounced closed systems like America Online and [Prodigy][3]. It could only have been natural to assume that further innovation in computing would involve the open, standards-based approach embodied by the web. + +Many people believed that the next big thing was for the web to evolve into something called the Semantic Web. [I have written about][4] what exactly the Semantic Web was supposed to be and how it was supposed to work before, so I won’t go into detail here. But I will sketch the basic vision motivating the people who worked on Semantic Web technologies, because the FOAF standard was an application of that vision to social networking. + +There is an essay called [“How Google beat Amazon and Ebay to the Semantic Web”][5] that captures the lofty dream of the Semantic Web well. It was written by Paul Ford in 2002. The essay imagines a future (as imminent as 2009) in which Google, by embracing the Semantic Web, has replaced Amazon and eBay as the dominant e-commerce platform. In this future, you can search for something you want to purchase—perhaps a second-hand Martin guitar—by entering `buy:martin guitar` into Google. Google then shows you all the people near your zipcode selling Martin guitars. Google knows about these people and their guitars because Google can read RDF, a markup language and core Semantic Web technology focused on expressing relationships. Regular people can embed RDF on their web pages to advertise (among many other things) the items they have to sell. Ford predicts that as the number of people searching for and advertising products this way grows, Amazon and eBay will lose their near-monopolies over, respectively, first-hand and second-hand e-commerce. Nobody will want to search a single centralized database for something to buy when they could instead search the whole web. Even Google, Ford writes, will eventually lose its advantage, because in theory anyone could crawl the web reading RDF and offer a search feature similar to Google’s. At the very least, if Google wanted to make money from its Semantic Web marketplace by charging a percentage of each transaction, that percentage would probably by forced down over time by competitors offering a more attractive deal. + +Ford’s imagined future was an application of RDF, or the Resource Description Framework, to e-commerce, but the exciting thing about RDF was that hypothetically it could be used for anything. The RDF standard, along with a constellation of related standards, once widely adopted, was supposed to blow open database-backed software services on the internet the same way HTML had blown open document publishing on the internet. + +One arena that RDF and other Semantic Web technologies seemed poised to takeover immediately was social networking. The FOAF project, known originally as “RDF Web Ring” before being renamed, was the Semantic Web effort offshoot that sought to accomplish this. FOAF was so promising in its infancy that some people thought it would inevitably make all other social networking sites obsolete. A 2004 Guardian article about the project introduced FOAF this way: + +> In the beginning, way back in 1996, it was SixDegrees. Last year, it was Friendster. Last week, it was Orkut. Next week, it could be Flickr. All these websites, and dozens more, are designed to build networks of friends, and they are currently at the forefront of the trendiest internet development: social networking. But unless they can start to offer more substantial benefits, it is hard to see them all surviving, once the Friend Of A Friend (FOAF) standard becomes a normal part of life on the net.[2][6] + +The article goes on to complain that the biggest problem with social networking is that there are too many social networking sites. Something is needed that can connect all of the different networks together. FOAF is the solution, and it will revolutionize social networking as a result. + +FOAF, according to the article, would tie the different networks together by doing three key things: + + * It would establish a machine-readable format for social data that could be read by any social networking site, saving users from having to enter this information over and over again + * It would allow “personal information management programs,” i.e. your “Contacts” application, to generate a file in this machine-readable format that you could feed to social networking sites + * It would further allow this machine-readable format to be hosted on personal homepages and read remotely by social networking sites, meaning that you would be able to keep your various profiles up-to-date by just pushing changes to your own homepage + + + +It is hard to believe today, but the problem in 2004, at least for savvy webizens and technology columnists aware of all the latest sites, was not the lack of alternative social networks but instead the proliferation of them. Given _that_ problem—so alien to us now—one can see why it made sense to pursue a single standard that promised to make the proliferation of networks less of a burden. + +### The FOAF Spec + +According to the description currently given on the FOAF project’s website, FOAF is “a computer language defining a dictionary of people-related terms that can be used in structured data.” Back in 2000, in a document they wrote to explain the project’s goals, Dan Brickley and Libby Miller, FOAF’s creators, offered a different description that suggests more about the technology’s ultimate purpose—they introduced FOAF as a tool that would allow computers to read the personal information you put on your homepage the same way that other humans do.[3][7] FOAF would “help the web do the sorts of things that are currently the proprietary offering of centralised services.”[4][8] By defining a standard vocabulary for people and the relationships between them, FOAF would allow you to ask the web questions such as, “Find me today’s web recommendations made by people who work for Medical organizations,” or “Find me recent publications by people I’ve co-authored documents with.” + +Since FOAF is a standardized vocabulary, the most important output of the FOAF project was the FOAF specification. The FOAF specification defines a small collection of RDF _classes_ and RDF _properties_. (I’m not going to explain RDF here, but again see [my post about the Semantic Web][4] if you want to know more.) The RDF _classes_ defined by the FOAF specification represent subjects you might want to describe, such as people (the `Person` class) and organizations (the `Organization` class). The RDF _properties_ defined by the FOAF specification represent logical statements you might make about the different subjects. A person could have, for example, a first name (the `givenName` property), a last name (the `familyName` property), perhaps even a personality type (the `myersBriggs` property), and be near another person or location (the `based_near` property). The idea was that these classes and properties would be sufficient to represent the kind of the things people say about themselves and their friends on their personal homepage. + +The FOAF specification gives the following as an example of a well-formed FOAF document. This example uses XML, though an equivalent document could be written using JSON or a number of other formats: + +``` + + Dan Brickley + + + + +``` + +This FOAF document describes a person named “Dan Brickley” (one of the specification’s authors) that has a homepage at `http://danbri.org`, something called an “open ID,” and a picture available at `/images/me.jpg`, presumably relative to the base address of Brickley’s homepage. The FOAF-specific terms are prefixed by `foaf:`, indicating that they are part of the FOAF namespace, while the more general RDF terms are prefixed by `rdf:`. + +Just to persuade you that FOAF isn’t tied to XML, here is a similar FOAF example from Wikipedia, expressed using a format called JSON-LD[5][9]: + +``` +{ + "@context": { + "name": "http://xmlns.com/foaf/0.1/name", + "homepage": { + "@id": "http://xmlns.com/foaf/0.1/workplaceHomepage", + "@type": "@id" + }, + "Person": "http://xmlns.com/foaf/0.1/Person" + }, + "@id": "https://me.example.com", + "@type": "Person", + "name": "John Smith", + "homepage": "https://www.example.com/" +} +``` + +This FOAF document describes a person named John Smith with a homepage at `www.example.com`. + +Perhaps the best way to get a feel for how FOAF works is to play around with [FOAF-a-matic][10], a web tool for generating FOAF documents. It allows you to enter information about yourself using a web form, then uses that information to create the FOAF document (in XML) that represents you. FOAF-a-matic demonstrates how FOAF could have been used to save everyone from having to enter their social information into a web form ever again—if every social networking site could read FOAF, all you’d need to do to sign up for a new site is point the site to the FOAF document that FOAF-a-matic generated for you. + +Here is a slightly more complicated FOAF example, representing me, that I created using FOAF-a-matic: + +``` + + + + + + + + + Sinclair Target + Sinclair + Target + + + + + John Smith + + + + + + +``` + +This example has quite a lot of preamble setting up the various XML namespaces used by the document. There is also a section containing data about the tool that was used to generate the document, largely so that, it seems, people know whom to email with complaints. The `foaf:Person` element describing me tells you my name, email address, and homepage. There is also a nested `foaf:knows` element telling you that I am friends with John Smith. + +This example illustrates another important feature of FOAF documents: They can link to each other. If you remember from the previous example, my friend John Smith has a homepage at `www.example.com`. In this example, where I list John Smith as a `foaf:person` with whom I have a `foaf:knows` relationship, I also provide a `rdfs:seeAlso` element that points to John Smith’s FOAF document hosted on his homepage. Because I have provided this link, any program reading my FOAF document could find out more about John Smith by following the link and reading his FOAF document. In the FOAF document we have for John Smith above, John did not provide any information about his friends (including me, meaning, tragically, that our friendship is unidirectional). But if he had, then the program reading my document could find out not only about me but also about John, his friends, their friends, and so on, until the program has crawled the whole social graph that John and I inhabit. + +This functionality will seem familiar to anyone that has used Facebook, which is to say that this functionality will seem familiar to you. There is no `foaf:wall` property or `foaf:poke` property to replicate Facebook’s feature set exactly. Obviously, there is also no slick blue user interface that everyone can use to visualize their FOAF social network; FOAF is just a vocabulary. But Facebook’s core feature—the feature that I have argued is key to Facebook’s monopoly power over, at the very least, myself—is here provided in a distributed way. FOAF allows a group of friends to represent their real-life social graph digitally by hosting FOAF documents on their own homepages. It allows them to do this without surrendering control of their data to a centralized database in the sky run by a billionaire android-man who spends much of his time apologizing before congressional committees. + +### FOAF on Ice + +If you visit the current FOAF project homepage, you will notice that, in the top right corner, there is an image of the character Fry from the TV series Futurama, stuck inside some sort of stasis chamber. This is a still from the pilot episode of Futurama, in which Fry gets frozen in a cryogenic tank in 1999 only to awake a millennium later in 2999. Brickley, whom I messaged briefly on Twitter, told me that he put that image there as a way communicating that the FOAF project is currently “in stasis,” though he hopes that there will be a future opportunity to resuscitate the project along with its early 2000s optimism about how the web should work. + +FOAF never revolutionized social networking the way that the 2004 Guardian article about it expected it would. Some social networking sites decided to support the standard: LiveJournal and MyOpera are examples.[6][11] FOAF even played a role in Howard Dean’s presidential campaign in 2004—a group of bloggers and programmers got together to create a network of websites they called “DeanSpace” to promote the campaign, and these sites used FOAF to keep track of supporters and volunteers.[7][12] But today FOAF is known primarily for being one of the more widely used vocabularies of RDF, itself a niche standard on the modern web. If FOAF is part of your experience of the web today at all, then it is as an ancestor to the technology that powers Google’s “knowledge panels” (the little sidebars that tell you the basics about a person or a thing if you searched for something simple). Google uses vocabularies published by the schema.org project—the modern heir to the Semantic Web effort—to populate its knowledge panels.[8][13] The schema.org vocabulary for describing people seems to be somewhat inspired by FOAF and serves many of the same purposes. + +So why didn’t FOAF succeed? Why do we all use Facebook now instead? Let’s ignore that FOAF is a simple standard with nowhere near as many features as Facebook—that’s true today, clearly, but if FOAF had enjoyed more momentum it’s possible that applications could have been built on top of it to deliver a Facebook-like experience. The interesting question is: Why didn’t this nascent form of distributed social networking catch fire when Facebook was not yet around to compete with it? + +There probably is no single answer to that question, but if I had to pick one, I think the biggest issue is that FOAF only makes sense on a web where everyone has a personal website. In the late 1990s and early 2000s, it might have been easy to assume the web would eventually look like this, especially since so many of the web’s early adopters were, as far as I can tell, prolific bloggers or politically engaged technologists excited to have a platform. But the reality is that regular people don’t want to have to learn how to host a website. FOAF allows you to control your own social information and broadcast it to social networks instead of filling out endless web forms, which sounds pretty great if you already have somewhere to host that information. But most people in practice found it easier to just fill out the web form and sign up for Facebook than to figure out how to buy a domain and host some XML. + +What does this mean for my original question about whether or not Facebook’s monopoly is a natural one? I think I have to concede that the FOAF example is evidence that social networking _does_ naturally lend itself to monopoly. + +That people did not want to host their own data isn’t especially meaningful itself—modern distributed social networks like [Mastodon][14] have solved that problem by letting regular users host their profiles on nodes set up by more savvy users. It is a sign, however, of just how much people hate complexity. This is bad news for decentralized social networks, because they are inherently more complex under the hood than centralized networks in a way that is often impossible to hide from users. + +Consider FOAF: If I were to write an application that read FOAF data from personal websites, what would I do if Sally’s FOAF document mentions a John Smith with a homepage at `example.com`, and Sue’s FOAF document mentions a John Smith with a homepage at `example.net`? Are we talking about a single John Smith with two websites or two entirely different John Smiths? What if the both FOAF documents list John Smith’s email as `johnsmith@gmail.com`? This issue of identity was an acute one for FOAF. In a 2003 email, Brickley wrote that because there does not exist and probably should not exist a “planet-wide system for identifying people,” the approach taken by FOAF is “pluralistic.”[9][15] Some properties of FOAF people, such as email addresses and homepage addresses, are special in that their values are globally unique. So these different properties can be used to merge (or, as Libby Miller called it, “smoosh”) FOAF documents about people together. But none of these special properties are privileged above the others, so it’s not obvious how to handle our John Smith case. Do we trust the homepages and conclude we have two different people? Or do we trust the email addresses and conclude we have a single person? Could I really write an application capable of resolving this conflict without involving (and inconveniencing) the user? + +Facebook, with its single database and lack of political qualms, could create a “planet-wide system for identifying people” and so just gave every person a unique Facebook ID. Problem solved. + +Complexity alone might not doom distributed social networks if people cared about being able to own and control their data. But FOAF’s failure to take off demonstrates that people have never valued control very highly. As one blogger has put it, “‘Users want to own their own data’ is an ideology, not a use case.”[10][16] If users do not value control enough to stomach additional complexity, and if centralized systems are more simple than distributed ones—and if, further, centralized systems tend to be closed and thus the successful ones enjoy powerful network effects—then social networks are indeed natural monopolies. + +That said, I think there is still a distinction to be drawn between the subway system case and the social networking case. I am comfortable with the MTA’s monopoly on subway travel because I expect subway systems to be natural monopolies for a long time to come. If there is going to be only one operator of the New York City Subway, then it ought to be the government, which is at least nominally more accountable than a private company with no competitors. But I do not expect social networks to stay natural monopolies. The Subway is carved in granite; the digital world is writ in water. Distributed social networks may now be more complicated than centralized networks in the same way that carrying two MetroCards is more complicated than carrying one. In the future, though, the web, or even the internet, could change in fundamental ways that make distributed technology much easier to use. + +If that happens, perhaps FOAF will be remembered as the first attempt to build the kind of social network that humanity, after a brief experiment with corporate mega-databases, does and always will prefer. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][17] on Twitter or subscribe to the [RSS feed][18] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> I know it's been too long since my last post, but my new one is here! I wrote almost 5000 words on John Carmack, Doom, and the history of the binary space partitioning tree. +> +> — TwoBitHistory (@TwoBitHistory) [November 6, 2019][19] + + 1. Please note that I did not dare say “dead.” [↩︎][20] + + 2. Jack Schofield, “Let’s be Friendsters,” The Guardian, February 19, 2004, accessed January 5, 2020, . [↩︎][21] + + 3. Dan Brickley and Libby Miller, “Introducing FOAF,” FOAF Project, 2008, accessed January 5, 2020, . [↩︎][22] + + 4. ibid. [↩︎][23] + + 5. Wikipedia contributors, “JSON-LD,” Wikipedia: The Free Encyclopedia, December 13, 2019, accessed January 5, 2020, . [↩︎][24] + + 6. “Data Sources,” FOAF Project Wiki, December 11 2009, accessed January 5, 2020, . [↩︎][25] + + 7. Aldon Hynes, “What is Dean Space?”, Extreme Democracy, accessed January 5, 2020, . [↩︎][26] + + 8. “Understand how structured data works,” Google Developer Portal, accessed January 5, 2020, . [↩︎][27] + + 9. tef, “Why your distributed network will not work,” Progamming is Terrible, January 2, 2013, . [↩︎][28] + + 10. Dan Brickley, “Identifying things in FOAF,” rdfweb-dev Mailing List, July 10, 2003, accessed on January 5, 2020, . [↩︎][29] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2020/01/05/foaf.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: tmp.k5HszJyQ4D#fn:1 +[2]: https://en.wikipedia.org/wiki/Fediverse +[3]: https://en.wikipedia.org/wiki/Prodigy_(online_service) +[4]: https://twobithistory.org/2018/05/27/semantic-web.html +[5]: https://www.ftrain.com/google_takes_all +[6]: tmp.k5HszJyQ4D#fn:2 +[7]: tmp.k5HszJyQ4D#fn:3 +[8]: tmp.k5HszJyQ4D#fn:4 +[9]: tmp.k5HszJyQ4D#fn:5 +[10]: http://www.ldodds.com/foaf/foaf-a-matic +[11]: tmp.k5HszJyQ4D#fn:6 +[12]: tmp.k5HszJyQ4D#fn:7 +[13]: tmp.k5HszJyQ4D#fn:8 +[14]: https://en.wikipedia.org/wiki/Mastodon_(software) +[15]: tmp.k5HszJyQ4D#fn:9 +[16]: tmp.k5HszJyQ4D#fn:10 +[17]: https://twitter.com/TwoBitHistory +[18]: https://twobithistory.org/feed.xml +[19]: https://twitter.com/TwoBitHistory/status/1192196764239093760?ref_src=twsrc%5Etfw +[20]: tmp.k5HszJyQ4D#fnref:1 +[21]: tmp.k5HszJyQ4D#fnref:2 +[22]: tmp.k5HszJyQ4D#fnref:3 +[23]: tmp.k5HszJyQ4D#fnref:4 +[24]: tmp.k5HszJyQ4D#fnref:5 +[25]: tmp.k5HszJyQ4D#fnref:6 +[26]: tmp.k5HszJyQ4D#fnref:7 +[27]: tmp.k5HszJyQ4D#fnref:8 +[28]: tmp.k5HszJyQ4D#fnref:9 +[29]: tmp.k5HszJyQ4D#fnref:10 From ff78995b346ce77f6db2b91bf4e1e41626b6ce28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 7 Jan 2020 08:14:14 +0800 Subject: [PATCH 446/676] Translated --- ...n Source Disk Partitioning Tool GParted.md | 116 ------------------ ...n Source Disk Partitioning Tool GParted.md | 116 ++++++++++++++++++ 2 files changed, 116 insertions(+), 116 deletions(-) delete mode 100644 sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md create mode 100644 translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md diff --git a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md deleted file mode 100644 index fe72f5695a..0000000000 --- a/sources/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md +++ /dev/null @@ -1,116 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) -[#]: via: (https://itsfoss.com/gparted/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -App Highlight: Open Source Disk Partitioning Tool GParted -====== - -_**Brief: GParted is an incredibly popular and free partition editor available for Linux distros. Here, we take a look at what it offers in brief.**_ - -### GParted: A Free & Open-Source GUI-based Partition Manager - -![][1] - -GParted is undoubtedly one of the [best partition managers for Linux][2] out there. The user interface is very simple and gets the job done. - -In some cases, you end up using [GParted][3] to fix or format your USB drive as well. I had a [USB disk which I couldn’t format in Ubuntu][4] using the “Disks” app – this is where GParted came to the rescue. - -So, it is a quite useful tool with a lot of good features. Let me highlight them for you. - -Warning! - -Playing with disk partitioning is a risky task. Don’t do it unless it’s absolutely necessary. Or else, you might just end up wiping the entire disk. - -### Features of GParted - -You can do a lot of things with GParted, ranging from a simple format task to important partitioning tasks. I’ll highlight the key features with some screenshots to help you know more about it before installing it. - -#### Create partition tables - -You can create a new partition table for your new disks or erase the content of your existing disk to modify the partition table. - -![][5] - -You will be able to select msdos, gpt, atari, and a lot more types of partition tables. - -#### Create, move, label, delete & modify partitions - -You can easily create, label, delete or modify the partitions with a bunch of options available within GParted. - -![][6] - -Of course, you will have to be careful about what you want to do. - -The good thing is that GParted makes sure that you do not directly apply any changes – it queues up your selected operations/tasks and asks for another final confirmation before you hit it. - -The tick mark symbol ✓on the top allows you to confirm the changes and then only your changes take into effect. - -Here’s another screenshot for the options you have available for the partitions: - -![][7] - -#### Attempt data rescue - -Apart from editing partitions, you can also try to [recover your lost data in Linux][8] using the “**Attempt Data Rescue**” feature as shown in the screenshot below. - -![][9] - -It is worth noting that you do not have this feature installed by default – you only see the option visible. So, for the data recovery feature to work, you have to install gpart separately using the following command (on Ubuntu/Debian-based distributions): - -``` -sudo apt install gpart -``` - -In addition to all the key features, it supports a wide range of storage devices and filesystems. You can learn more about it from the [list of features][10] on their official website. - -### Installing GParted on Ubuntu and other Linux distributions - -You might have GParted pre-installed. So, make sure to verify that. If you do not have it installed, you can head into the software center to get it installed. - -In case you want to use the terminal, simply type in the following command: - -``` -sudo apt install gparted -``` - -As I mentioned above, if you want the data recovery option, you should install gpart package in addition to gparted package. - -If you’re using any other Linux distribution, you can either find it in the respective software manager or simply check out the [official download instructions][11]. - -[Download GParted][11] - -**Wrapping Up** - -GParted is a very useful and important tool when it comes to dealing with disk management and partitions. However, you will have to be careful while using it for the obvious reasons. - -Have you tried GParted? Which other partitioning tool you use on Linux? Feel free to share your experiences in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gparted/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-screenshot.png?ssl=1 -[2]: https://itsfoss.com/partition-managers-linux/ -[3]: https://gparted.org/ -[4]: https://itsfoss.com/format-usb-drive-sd-card-ubuntu/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-create-partition-table.png?ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-modify-partitions.png?ssl=1 -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-partition-options.png?ssl=1 -[8]: https://itsfoss.com/recover-deleted-files-linux/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-attempt-data-rescue-feature.png?ssl=1 -[10]: https://gparted.org/features.php -[11]: https://gparted.org/download.php diff --git a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md new file mode 100644 index 0000000000..6fa07d80a3 --- /dev/null +++ b/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) +[#]: via: (https://itsfoss.com/gparted/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +应用程序推荐:开源磁盘分区工具 GParted +====== + +_**摘要:GParted 是一个非常流行的自由的可用于 Linux 发行版的分区编辑器。在这里,我们简单地看看它提供了什么。**_ + +### GParted:一个基于自由和开放源码的图形化分区管理器 + +![][1] + +GParted 无疑是[在 Linux 下的最好的分区管理器][2]之一。用户界面非常简单,可用完成任务。 + +在一些情况下,你最终也需要使用 [GParted][3] 来修复或格式化你的 USB 驱动器。我有一个[我不能在 Ubuntu 中格式化的 USB 磁盘][4],使用该“磁盘”应用程序 – 这里是 GParted 用来救援的地方。 + +所以,它是非常有用的工具,有很多好的特色。让我为你们推荐一下。 + +警告! + +玩弄磁盘分区是一件危险的工作。除非绝对必要,否则不要做。否则,你可能最终会擦除整个磁盘。 + +### GParted 的特色 + +你可以使用 GParted 做很多事,排列一下简单地格式化任务到重要的分区任务。我将使用一些屏幕截图推荐关键特色,以帮助你在安装它前了解更多信息。 + +#### 创建分区表 + +你可以为你的新的磁盘创建一个新的分区表,或者擦除你现存的磁盘内容来修改分区表。 + +![][5] + +你将能够选择 msdos ,gpt ,atari ,以及更多类型的分区表。 + +#### 创建,移动,标记,删除和修改分区表 + +你可以使用 GParted 中一系列可用的选项来简单地创建,标记,删除或修改分区表。 + +![][6] + +当然,你将不得不小心你想做什么。 + +好的一些东西是,GParted 确保你不能直接应用任何更改 – 在你点击应用更改之前,它将排队你选择的操作/任务,并询问另外一处最后的确认。 + +在顶部的对号标记符号 ✓ 允许你来确认更改,只有你更改时开始生效。 + +这样有另一个你可用的分区选项的屏幕截图: + +![][7] + +#### 尝试数据救援 + +除了编辑分区,你也可以尝试使用“**尝试数据救援**”特色以[在Linux 中恢复你丢失的数据][8],像下面的屏幕截图所示。 + +![][9] + +值得注意的是,默认情况下你没有安装这个功能 – 你仅能看到可见的选项。所以,对于数据恢复特色作业来说,你必需使用下面的命令来单独地安装 gpart (在基于 Ubuntu/Debian 的发行版上): + +``` +sudo apt install gpart +``` + +除了所有关键的特色外,它支持大量的存储设备和文件系统。在它们的官方网站上,你可以从[特色列表][10]中学到很多。 + +### 在 Ubuntu 和其它 Linux 发行版上安装 GParted + +你可能已经预先安装 GParted 。所以,务必核实一下。如果你没有安装它,你可以前往进入软件中心安装它。 + +以备你想使用终端,简单地键入下面的命令: + +``` +sudo apt install gparted +``` + +像我如上所述,如果你想要数据恢复选项,除了 gparted 软件包外,你应该安装 gpart 软件包。 + +如果你正在使用一些其它 Linux 发行版,你可以在各自的软件管理器中找到它,或者简单地查看[官方下载操作指南][11]。 + +[下载 GParted][11] + +**总结** + +当涉及处理磁盘管理和分区时,GParted 是一个非常有用和重要的工具。但是,因为显而易见的原因,当你使用它时,你将不得不小心。 + +你尝试过 GParted 吗?你在 Linux 上使用的其它分区工具是什么?请在下面的评论中分享你的体验。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gparted/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-screenshot.png?ssl=1 +[2]: https://itsfoss.com/partition-managers-linux/ +[3]: https://gparted.org/ +[4]: https://itsfoss.com/format-usb-drive-sd-card-ubuntu/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-create-partition-table.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-modify-partitions.png?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-partition-options.png?ssl=1 +[8]: https://itsfoss.com/recover-deleted-files-linux/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-attempt-data-rescue-feature.png?ssl=1 +[10]: https://gparted.org/features.php +[11]: https://gparted.org/download.php From e2970c5d5149b477378c48886ab4c41dacaa6ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Tue, 7 Jan 2020 08:25:42 +0800 Subject: [PATCH 447/676] Translating --- sources/tech/20191121 Simulate gravity in your Python game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191121 Simulate gravity in your Python game.md b/sources/tech/20191121 Simulate gravity in your Python game.md index 977c234d8d..45e4b4ce50 100644 --- a/sources/tech/20191121 Simulate gravity in your Python game.md +++ b/sources/tech/20191121 Simulate gravity in your Python game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1f3269c9014cacb7cab002a2ffe3ffd69ec976e6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 7 Jan 2020 08:44:15 +0800 Subject: [PATCH 448/676] translated --- ...et- Screen Recorder. Here-s How to Use it.md | 103 ----------------- ...et- Screen Recorder. Here-s How to Use it.md | 104 ++++++++++++++++++ 2 files changed, 104 insertions(+), 103 deletions(-) delete mode 100644 sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md create mode 100644 translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md diff --git a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md deleted file mode 100644 index f761c28dd1..0000000000 --- a/sources/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) -[#]: via: (https://itsfoss.com/gnome-screen-recorder/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it! -====== - -[GNOME][1] is one of the [most popular desktop environments][2] and for good reasons. It has a modern UI and it comes with a number of GNOME-specific applications that blend well with the overall desktop appearance. - -You can [tweak GNOME][3] to your liking as much as you want but I am not here to discuss that. GNOME desktop has some hidden features that you probably are not aware of. - -One of such not-so-obvious feature is a built in screen recorder. - -Yes, you read that right. If you are using GNOME desktop, you don’t necessarily need to install other [screen recorders in Linux][4]. You just need to know the correct keyboard shortcut. - -### Instantly record your screen with GNOME Screen Recorder - -To quickly access the GNOME screen recorder, you have to press this [keyboard shortcut in Ubuntu][5] or other distributions using GNOME desktop: - -``` -Ctrl + Alt + Shift + R -``` - -This will immediately start recording your desktop. You can tell that the screen recording is in progress by looking at the red dot in the system tray area of the top panel: - -![The red dot in the system tray area indicates that screen recording is in progress][6] - -#### Increase the screencast duration - -The default maximum record time is just 30 seconds. It can be increased though. - -Open a terminal and use the following command: - -``` -gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300 -``` - -In the above command, I have increased the maximum length of the recording to 300 seconds (i.e. 5 minutes). You can change it to any other value but it should be in seconds. - -If you **don’t want any limit on the maximum recording time, set it to 0** and then the recording won’t stop until you manually stop it or your disk runs out of space. - -#### Stop the screen recording - -As I mentioned, your desktop recording will stop automatically after it reaches the maximum time limit. - -To stop the recording before that, you can press the same key combination: - -``` -Ctrl + Alt + Shift + R -``` - -Your recordings are saved in [webm][7] format in the Videos folder of your Home directory. - -#### Limitations - -While it might be handy to record your desktop quickly with this handy little tool, it has its several limitations when compared to a full-fledged screen recording tool like [Simple Screen Recorder][8]. - - * There is no time delay option before the recording starts - * There is no pause and play option - * It records the entire screen. No option to record only an application window or a ceratin area or a certain monitor (if you have a multi-monitor setup). - * Videos are saved in webm format in the user’s Videos directory. You cannot change it. You’ll have to use a tool like [HandBrake to convert the videos to other format][9]. - - - -As you can see, the secret GNOME screen recorder is no where near to the features provided by the likes of [Kazam][10] or other such tools. - -But it doesn’t try to be a full-fledged screen recorder. It just provides you a quick way of recording a small screencast. That’s it. - -GNOME is a versatile modern desktop environments. You can [tweak GNOME][3] extensively. The [GNOME Extensions][11] provide another dimension to the desktop customization. - -This screen recorder is one of the hidden features of GNOME like the suspend option that you won’t easily find on your own. - -_How do you like it? Do you know some other hidden GNOME features that you would like to share with us? The comment section is all yours._ - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gnome-screen-recorder/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://gnome.org/ -[2]: https://itsfoss.com/best-linux-desktop-environments/ -[3]: https://itsfoss.com/gnome-tweak-tool/ -[4]: https://itsfoss.com/best-linux-screen-recorders/ -[5]: https://itsfoss.com/ubuntu-shortcuts/ -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/gnome_screen_recording.jpg?ssl=1 -[7]: https://www.webmproject.org/about/ -[8]: https://itsfoss.com/record-screen-ubuntu-simplescreenrecorder/ -[9]: https://itsfoss.com/handbrake/ -[10]: https://itsfoss.com/kazam-screen-recorder/ -[11]: https://itsfoss.com/best-gnome-extensions/ diff --git a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md new file mode 100644 index 0000000000..84d72051eb --- /dev/null +++ b/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) +[#]: via: (https://itsfoss.com/gnome-screen-recorder/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +GNOME 有一个“秘密”的屏幕录像机。下面是使用方法! +====== + +[GNOME][1]是[最受欢迎的桌面环境][2]之一。它有现代的 UI,并且带有许多特定于 GNOME 的应用,这些应用与桌面整体外观完美融合。 + +你可以根据自己的喜好来[调整 GNOME][3],但我不在这里讨论。GNOME 桌面有一些你可能不知道的隐藏功能。 + +这种不太明显的功能之一是内置的屏幕录像机。 + +是的,你没有看错。如果你使用的是 GNOME 桌面,那么不必安装其他的 [Linux 屏幕录像机][4]。你只需要知道正确的快捷键即可。 + +### 立即使用 GNOME 屏幕录像机录制屏幕 + +要快速打开 GNOME 屏幕录像机,你需要[在 Ubuntu 或其他带有 GNOME 桌面的发行版中按下此快捷键][5]: + +``` +Ctrl + Alt + Shift + R +``` + +这将会立即开始录制你的桌面。你可以通过顶部的系统托盘区域的红点了解到正在录制: + +![The red dot in the system tray area indicates that screen recording is in progress][6] + +#### 增加录制时间 + +默认的最大录制时间仅为 30 秒。但是可以增加。 + +打开终端并使用以下命令: + +``` +gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300 +``` + +在上面的命令中,我将录音的最大长度增加到 300 秒(即5分钟)。你可以将其更改为任何其他值,但应以秒为单位。 + +如果你**不希望最长录音时间有任何限制,请将其设置为0**,之后它会在你手动停止或者磁盘空间不足才会停止。 + +#### 停止屏幕录制 + +如前所述,你的桌面录制将在达到最大时间限制后自动停止。 + +要在此之前停止录制,你可以按下相同的组合键: + +``` +Ctrl + Alt + Shift + R +``` + +你的录制内容将以 [webm][7 ]格式保存在家目录的 “Videos” 文件夹中。 + +#### 局限性 + +尽管使用这个小工具可以方便地快速录制桌面,但是与功能强大的 [Simple Screen Recorder][8] 这样的屏幕录制工具相比,它有一些局限性。 + + + * 录制开始之前没有时间延迟选项 +  * 没有暂停和播放选项 +  * 它录制整个屏幕。无法仅录制应用窗口、特定区域或特定屏幕(如果你有多个屏幕)。 +  * 视频以 webm 格式保存在用户的 “Videos” 目录中。你无法更改。你必须使用 [HandBrake 之类的工具将视频转换为其他格式][9]。 + + + +如你所见,秘密的 GNOME 屏幕录像机与 [Kazam][10] 之类的工具或其他此类工具所提供的功能相差很远。 + +但是,它并不会尝试成为全功能的屏幕录像机。它只是为你提供录制屏幕的快速方法。 + +GNOME 是一个多功能的现代桌面环境。你可以大量地[调整 GNOME][3]。[GNOME 扩展][11]为桌面自定义提供了另一个维度。 + +该屏幕录像机是 GNOME 的隐藏功能之一,就像你自己很难轻易找到的挂起选项。 + +_你喜欢它吗?你是否还想与我们分享其他隐藏的 GNOME 功能?请在评论区留言。_ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-screen-recorder/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://gnome.org/ +[2]: https://itsfoss.com/best-linux-desktop-environments/ +[3]: https://itsfoss.com/gnome-tweak-tool/ +[4]: https://itsfoss.com/best-linux-screen-recorders/ +[5]: https://itsfoss.com/ubuntu-shortcuts/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/gnome_screen_recording.jpg?ssl=1 +[7]: https://www.webmproject.org/about/ +[8]: https://itsfoss.com/record-screen-ubuntu-simplescreenrecorder/ +[9]: https://itsfoss.com/handbrake/ +[10]: https://itsfoss.com/kazam-screen-recorder/ +[11]: https://itsfoss.com/best-gnome-extensions/ From 83fab6c4a597314ba0e57516a697b2b45cbfb722 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 7 Jan 2020 08:54:37 +0800 Subject: [PATCH 449/676] translating --- ...200103 My Raspberry Pi retrospective- 6 projects and more.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md index b68e15a924..181276fb45 100644 --- a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md +++ b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 98fade2a5db741a607d63a5ccee3a42983da5195 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 09:00:12 +0800 Subject: [PATCH 450/676] TSL --- ...191130 7 maker gifts for kids and teens.md | 185 ------------------ ...191130 7 maker gifts for kids and teens.md | 176 +++++++++++++++++ 2 files changed, 176 insertions(+), 185 deletions(-) delete mode 100644 sources/tech/20191130 7 maker gifts for kids and teens.md create mode 100644 translated/tech/20191130 7 maker gifts for kids and teens.md diff --git a/sources/tech/20191130 7 maker gifts for kids and teens.md b/sources/tech/20191130 7 maker gifts for kids and teens.md deleted file mode 100644 index 72a9debb38..0000000000 --- a/sources/tech/20191130 7 maker gifts for kids and teens.md +++ /dev/null @@ -1,185 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 maker gifts for kids and teens) -[#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) -[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) - -7 maker gifts for kids and teens -====== -Make your holiday gift shopping easy with this guide to gifts sure to -spark creativity and innovation in babies, kids, tweens, teens, and -beyond. -![Gift box opens with colors coming out][1] - -Struggling with what gifts to give the young person in your life this holiday season? Here are my top picks for open source presents that will spark creativity and inspire for years to come. - -### Hummingbird Robotics Kit - -![Hummingbird Robotics Kit][2] - -**Ages**: 8 to adult - -**What it is:** The [Hummingbird Robotics Kit][3] is a complete robotics kit with a microcontroller, motors, LEDs, and sensors. The robot brain has special ports that little hands can easily attach robot components to. The Hummingbird kits don't come with a body, empowering users to create their own. - -**Why I love it:** The Hummingbird works with multiple programming languages—from visual (BirdBlox, MakeCode, Snap) to text (Python and Java)— making it scalable as users' coding skills increase. All the components are exactly as you'd find them at an electronics store, not obscured by plastic like other robot kits. This demystifies the inner workings of robots and makes it easy to source more parts if needed. - -Because there is no set project, the Hummingbird is the perfect robot for creativity. - -The Hummingbird Bit has open source software and firmware. It works on Linux, Windows, Mac, Chromebook, Android, and iOS. - -**Cost:** Starts at US$ 99. - -### Makey Makey Classic - -![Makey Makey Classic][4] - -**Ages:** 6 to adult - -**What it is:** [Makey Makey Classic][5] turns any conductive object, from marshmallows to a friend, into a computer key. - -You use alligator clips to connect the Makey Makey to the conductive object of your choice. Then, you close the circuit between the ground connection and any trigger key by touching both conductive objects at the same time. The Makey Makey is a good way to safely explore electricity at home while creating interesting ways to interact with your computer. - -**Why I love it:** Makey Makey can be paired with video games made in Scratch to create unique controllers that further immerse users in the game. The possibilities are endless, from instruments made of toilet rolls and foil to interactive art and stories. It works on Linux, Windows, and Mac computers with a USB port. - -**Cost:** US$ 49.95 - -### Arduino Uno - -![Arduino Uno][6] - -**Ages**: 10 to adult - -**What it is:** Arduinos are microcontrollers that can be purchased with or without an electronics kit, and they come in many different flavors, though I like the [Arduino Uno][7] the best. Additional components, such as LEDs, motors, and sensors can be purchased as needed from any electronics shop. - -**Why I love it:** The Arduino Uno is well-documented, so it's easy for makers to find tutorials online. The Arduino can bring a wide variety of electronic projects to life, from simple to complex. The Arduino features open source firmware and hardware. It works on Linux, Mac, and Windows. - -**Cost:** Starts at US$ 22.00 for the board. The overall cost varies depending on projects and skill level. - -### DIY maker kit - -![A maker kit assembled in a quick trip to the hardware store][8] - -**Ages**: 8 to adult - -**What it is:** Many of today's makers, creators, and programmers started out tinkering with objects that happened to be lying around. You can create an awesome maker kit for the young person in your life with a quick trip to the nearest electronics store. Here's what's in my maker kit: - - * Eye goggles - * Hammer - * Nails and screws - * Scraps of wood - * Screwdrivers - * Wire - * LEDs - * Piezo buzzer - * Motors - * AA battery pack with leads - * Wire cutters - * Cardboard - * Masking tape - * Scrap fabric - * Buttons - * Thread - * Needles - * Zippers - * Hooks - * A cool tackle box to store everything in - - - -**Why I love it: **Remember when you were a kid and your parents brought home an empty cardboard box that you turned into a spaceship or a house or a supercomputer? That's what a DIY maker kit can be for older kids. - -Raw components empower kids to experiment and use their imaginations. A DIY maker kit can be completely customized for the recipient. Be sure to throw in some components the giftee may have never thought to create with, like giving an avid sewer some LEDs or a woodworker fabric. - -**Cost:** Variable - -### Heuristic play basket - -![Heuristic play kit][9] - -**Ages:** 8 months to 5 years - -**What it is:** Heuristic play baskets are filled with interesting objects made from natural, non-toxic materials for infants and toddlers to explore using their five senses. It's open-ended, self-directed play at its best. The idea is that an adult will supervise (but not direct) a child's use of the basket and its items for a half-hour, then put the basket away until the next time. - -It's easy to create a lovely play basket with common household objects. Try to include items with varying textures, sounds, smells, shapes, and weights. Here are some ideas to get you started. - - * Colander or ridged wicker basket to hold everything - * Wooden spoon - * Metal whisks and spoons - * Scrubbing brush - * Sponge - * Small egg carton - * Cardboard tubes - * Small rolling pin - * Textured washcloth - * Rocks - * Handbells - * Crochet doily - * Small tin with a lid - - - -Play baskets should not include anything easily breakable or small enough to fit inside a paper towel roll, as these are choking hazards, and all objects should be cleaned thoroughly before being given to a child. - -**Why I love it:** Play baskets are fantastic for sensory development and helping young children ask questions and explore the world around them. This is an important part of developing a maker mindset! - -It's easy to obtain suitable items for a play basket; you probably already have many interesting objects in your home or at your nearest second-hand store. Toddlers will use their play baskets differently than infants. These objects will grow with children as they begin to mimic adult life and tell stories through their play. - -**Cost:** Variable - -### Hello Ruby - -![Hello Ruby book cover][10] - -**Ages**: 5–8 - -**What it is:** _[Hello Ruby][11]: Adventures in Coding_ is an illustrated book by Linda Liukas that introduces children to programming concepts through a fun narrative about a girl who encounters problems and friends, each of which represents code. Liukas' other _Hello Ruby_ books are subtitled _Expedition to the Internet_ and _Journey Inside the Computer_, and _Adventures in Coding_ has been published in more than 20 languages. - -**Why I love it:** The author accompanies the book with a number of free, fun, and unplugged activities that can be downloaded and printed out from the Hello Ruby website. These activities teach coding concepts and also touch on artistic expression, communication, and even time management. - -**Cost:** List price for the hardcover book is US$ 17.99, but you may find it at a lower price through local or online booksellers. - -### Girls Who Code: Learn to Code and Change the World - -![Girls Who Code book cover][12] - -**Ages**: 10 to adult - -**What it is:** Written by Reshma Saujani, the founder of Girls Who Code, _[Girls Who Code: Learn to Code and Change the World][13]_ gives practical information about the tech world for young girls (and boys). It covers a wide variety of topics, including coding languages, use-cases, terminology and vocabulary, career options, and profiles and interviews with people in the tech industry. - -**Why I love it:** This book tells the story of tech in ways even most websites meant for adults miss out on. Technology encompasses so many disciplines, and it's important for young people to understand they can use it to solve real-world problems and make a difference. - -**Cost:** List price for the hardcover book is US$ 17.99 and US$ 10.99 for the paperback, but you may find it at a lower price through local or online booksellers. - -I can see the brightness of curiosity in my six year old niece Shuchi's eyes when she explores a... - -Scratch is a free educational programming language for kids, available in 50 different languages... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/maker-gifts-kids - -作者:[Jess Weichler][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/cyanide-cupcake -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) -[2]: https://opensource.com/sites/default/files/uploads/hummingbird.png (Hummingbird Robotics Kit) -[3]: https://www.birdbraintechnologies.com/hummingbirdbit/ -[4]: https://opensource.com/sites/default/files/uploads/makeymakey2.jpg (Makey Makey Classic) -[5]: https://makeymakey.com/ -[6]: https://opensource.com/sites/default/files/uploads/arduinouno.jpg (Arduino Uno) -[7]: https://www.arduino.cc/ -[8]: https://opensource.com/sites/default/files/makerbox-makerkit.jpg (A maker kit assembled in a quick trip to the hardware store) -[9]: https://opensource.com/sites/default/files/makerbox-sensorykit.jpg (Heuristic play kit) -[10]: https://opensource.com/sites/default/files/uploads/helloruby2.jpg (Hello Ruby book cover) -[11]: https://www.helloruby.com/ -[12]: https://opensource.com/sites/default/files/uploads/girlswhocodebook.jpg (Girls Who Code book cover) -[13]: https://girlswhocode.com/book/girls-code-learn-code-change-world/ diff --git a/translated/tech/20191130 7 maker gifts for kids and teens.md b/translated/tech/20191130 7 maker gifts for kids and teens.md new file mode 100644 index 0000000000..59bc3fc837 --- /dev/null +++ b/translated/tech/20191130 7 maker gifts for kids and teens.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 maker gifts for kids and teens) +[#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +7 个给儿童和少年的创客礼物 +====== +> 这份礼物指南可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力,使你轻松完成节日礼物的采购。 + +![Gift box opens with colors coming out][1] + +还在纠结这个假期给年轻人买什么礼物?这是我精选的开源礼物,这些礼物将激发未来的创意和灵感。 + +### 蜂鸟机器人套件 + +![Hummingbird Robotics Kit][2] + +**年龄:**8 岁 - 成人 + +**这是什么:**[蜂鸟机器人套件][3]是一套完整的机器人套件,带有微控制器、电机、LED 和传感器。机器人的大脑具有特殊的端口,小手可以轻松地将其连接到机器人的组件上。蜂鸟套件并没有身体,鼓励用户自己创建一个。 + +**为什么我喜欢它:**蜂鸟可以使用多种编程语言 —— 从可视化编程(BirdBlox、MakeCode、Snap)到代码编程(Python 和 Java)—— 可以随着用户编码技能的提高而可扩展。所有组件均与你在电子商店中找到的组件完全相同,没有像其他机器人套件那样被塑料所遮盖。这使机器人的内部工作不再神秘,并在你需要时易于采购更多零件。 + +由于没有固定组合项目,因此蜂鸟是发挥创造力的完美机器人。 + +蜂鸟具有开源的软件和固件。它适用于 Linux、Windows、Mac、Chromebook、Android 和 iOS。 + +**费用:**起价为 99 美元。 + +### Makey Makey 经典版 + +![Makey Makey Classic][4] + +**年龄:** 6岁 - 成人 + +**这是什么:** [Makey Makey 经典版][5]可将任何导电物体(从棉花糖到朋友)变成计算机钥匙。 + +你可以使用鳄鱼夹将 Makey Makey 连接到你选择的导电物体上。然后,通过同时触摸两个导电物体来闭合接地和任何触发键之间的电路。Makey Makey 是一种安全的方法,可以安全地在家中探索电力,同时创造与计算机进行交互的有趣方式。 + +**为什么我喜欢它:** Makey Makey 可以与 Scratch 开发的视频游戏搭配使用,以创建独特的控制器,使用户进一步沉浸在游戏中。从用卫生纸卷和铝箔制成的工具到互动艺术和故事,可能性是无限的。它可以在具有 USB 端口的 Linux、Windows 和 Mac 计算机上使用。 + +**费用:** 49.95 美金 + +### Arduino Uno + +![Arduino Uno][6] + +**年龄:** 10 岁 - 成人 + +**这是什么:** Arduino 是随同电子套件购买的微控制器,也可以单独购买,它们具有多种版本,尽管我最喜欢[Arduino Uno][7]。可以根据需要从任何电子商店购买其他组件,例如 LED、电机和传感器。 + +**为什么我喜欢它:** Arduino Uno 的文档很完善,因此创客们很容易在线上找到教程。Arduino 可以实现从简单到复杂的各种电子项目。Arduino 具有开源的固件和硬件。它适用于 Linux、Mac 和 Windows。 + +**费用:**主板的起价为 22.00 美元。总成本取决于项目和技能水平。 + +### DIY 创客套件 + +![A maker kit assembled in a quick trip to the hardware store][8] + +**年龄**:8 岁 - 成人 + +**这是什么:**当今许多创客、发明家和程序员都是从碰巧修补附加的东西开始的。你可以快速前往最近的电子产品商店,为家里的年轻人创建一套出色的创客工具包。这是我的创客工具包中的内容: + +* 护目镜 +* 锤子 +* 钉子和螺丝 +* 碎木 +* 螺丝起子 +* 电线 +* LED +* 压电蜂鸣器 +* 马达 +* 带引线的AA电池组 +* 剪线钳 +* 纸板 +* 美纹纸胶带 +* 废布 +* 纽扣 +* 线程 +* 针 +* 拉链 +* 钩子 +* 一个很酷的工具盒,用来存放所有东西 +   +**我为什么喜欢它:**还记得小时候,你把父母带回家的空纸箱变成了宇宙飞船、房屋或超级计算机吗?这就是为大孩子们准备的 DIY 创客工具包。 + +原始的组件使孩子们可以尝试并运用他们的想象力。DIY 创客工具包可以完全针对接收者定制。可以放入一些接受这份礼品的人可能从未想到过用之发挥创意的某些组件,例如为下水道提供一些 LED 或木工结构。 + +**费用:**不等 + +### 启发式游戏篮 + +![Heuristic play kit][9] + +**年龄:** 8 个月至 5 岁 + +**这是什么:**启发式游戏篮充满了由天然、无毒材料制成的有趣物品,可供婴幼儿使用其五种感官进行探索。这是一种开放式、自娱自乐的游戏。其想法是,成年人将监督(但不指导)儿童使用篮子及其物品半小时,然后将篮子拿走下一次再玩。 + +创建带有常见家用物品的可爱游戏篮很容易。尝试包括质地、声音、气味、形状和重量各不相同的物品。这里有一些想法可以帮助您入门。 + +* 漏勺或脊状柳条篮可容纳所有物品 +* 木勺子 +* 金属打蛋器和汤匙 +* 板刷 +* 海绵 +* 小鸡蛋纸箱 +* 纸板管 +* 小擀面杖 +* 带纹理的毛巾 +* 岩石 +* 手铃 +* 钩针桌巾 +* 带盖的小铁罐 +   +游戏篮中不应包括任何容易破碎的东西或足够小到可以装入纸巾卷的东西,因为它们有窒息危险,应将所有物品彻底清洁后再交给孩子。 + +**我为什么喜欢它:**游戏篮非常适合感官发育,并可以帮助幼儿提出问题和探索周围的世界。这是培养创客思维方式的重要组成部分! + +很容易获得适合这个游戏篮的物品。你可能已经在家中或附近的二手店里有很多有趣的物品。幼儿使用游戏篮的方式与婴儿不同。随着孩子开始模仿成人生活并通过他们的游戏讲故事,这些物品将随孩子一起成长。 + +**费用:**不等 + +### 《Hello Ruby》 + +![Hello Ruby book cover][10] + +**年龄**:5-8 岁 + +**这是什么:** 《[Hello Ruby][11]:编码历险记》是 Linda Liukas 的插图书,通过有趣的故事讲述了一个遇到各种问题和朋友(每个都用一个码代表)的女孩,向孩子们介绍了编程概念。Liukas 还有其他副标题为《互联网探险》和《计算机内的旅程》的《Hello Ruby》书籍,而《编码历险记》已以 20 多种语言出版。 + +**为什么我喜欢它:**作者在书中附带了许多免费、有趣和无障碍的活动,可以从 Hello Ruby 网站下载和打印这些活动。这些活动教授编码概念、还涉及艺术表达、沟通、甚至时间安排。 + +**费用:**精装书的标价为 17.99 美元,但你可以通过本地或在线书店以较低的价格买到这本书。 + +### 《编程少女:学会编程和改变世界》 + +![Girls Who Code book cover][12] + +**年龄**:10 岁 - 成人 + +**内容是什么:**由《编程少女》的创始人 Reshma Saujani 撰写,《[编程少女:学会编程和改变世界][13]》为年轻女孩(以及男孩)提供了科技领域的实用信息。它涵盖了广泛的主题,包括编程语言、用例、术语和词汇、职业选择以及技术行业人士的个人简介和访谈。 + +**为什么我喜欢它:**本书以讲述了大多数面向成年人的网站没有的技术故事。技术涉及许多学科,对于年轻人来说,重要的是要了解他们可以使用它来解决现实世界中的问题并有所作为。 + +**成本:**精装书的标价为 17.99 美元,平装书的标价为 10.99 美元,但你可以通过本地或在线书店以更低的价格找到。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/maker-gifts-kids + +作者:[Jess Weichler][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://opensource.com/sites/default/files/uploads/hummingbird.png (Hummingbird Robotics Kit) +[3]: https://www.birdbraintechnologies.com/hummingbirdbit/ +[4]: https://opensource.com/sites/default/files/uploads/makeymakey2.jpg (Makey Makey Classic) +[5]: https://makeymakey.com/ +[6]: https://opensource.com/sites/default/files/uploads/arduinouno.jpg (Arduino Uno) +[7]: https://www.arduino.cc/ +[8]: https://opensource.com/sites/default/files/makerbox-makerkit.jpg (A maker kit assembled in a quick trip to the hardware store) +[9]: https://opensource.com/sites/default/files/makerbox-sensorykit.jpg (Heuristic play kit) +[10]: https://opensource.com/sites/default/files/uploads/helloruby2.jpg (Hello Ruby book cover) +[11]: https://www.helloruby.com/ +[12]: https://opensource.com/sites/default/files/uploads/girlswhocodebook.jpg (Girls Who Code book cover) +[13]: https://girlswhocode.com/book/girls-code-learn-code-change-world/ From 0968a3bb4ecea07d8c0c117c8600be79e60e9240 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 7 Jan 2020 09:01:55 +0800 Subject: [PATCH 451/676] Rename sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md to sources/talk/20200106 Open Source Supply Chain- A Matter of Trust.md --- .../20200106 Open Source Supply Chain- A Matter of Trust.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200106 Open Source Supply Chain- A Matter of Trust.md (100%) diff --git a/sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md b/sources/talk/20200106 Open Source Supply Chain- A Matter of Trust.md similarity index 100% rename from sources/tech/20200106 Open Source Supply Chain- A Matter of Trust.md rename to sources/talk/20200106 Open Source Supply Chain- A Matter of Trust.md From 1eca447b19eddb900bd0ea73f4f75c11d780f2fa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 09:33:32 +0800 Subject: [PATCH 452/676] PRF @lxbwolf --- ...01 5 predictions for Kubernetes in 2020.md | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md index f760fcfe4a..f87eb41b9f 100644 --- a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md +++ b/translated/tech/20200101 5 predictions for Kubernetes in 2020.md @@ -1,42 +1,49 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 predictions for Kubernetes in 2020) [#]: via: (https://opensource.com/article/20/1/kubernetes-2020) [#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) -2020 年对 Kubernetes 的 5 项预测 +2020 年对 Kubernetes 的 5 个预测 ====== -请先回顾下 2019 年网站上最受欢迎的 Kubernetes 的文章。 + +> 以及,对 2019 年最受欢迎的 Kubernetes 文章的回顾。 + ![Person drinking a hat drink at the computer][1] -你怎么追踪一个广受欢迎的项目(如 Kubernetes)的发展轨迹?你怎么能了解它发展到什么程度了?如果你在为这个项目作贡献或加入了 SIG(Special Interest Group),可能你会在潜移默化中了解到它的发展轨迹,但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。 +你是怎么追踪一个广受欢迎的项目(如 Kubernetes)的发展轨迹?你是怎么了解它发展到什么程度了?如果你在为这个项目作贡献或加入了特殊兴趣组(SIG),可能你会在潜移默化中了解到它的发展轨迹,但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。 -今年,Kubernetes 取得了很大的进展。除了去查看源码、文档、会议笔记,你也可以去浏览博客。为了深入了解,我在 Opensource.com 上看了 Kubernetes 的 top 10 文章。通过这些文章,我们能了解开发者们更喜欢读和写哪些话题的文章。我们开始吧! +今年,Kubernetes 取得了很大的进展。除了去查看源码、文档、会议笔记,你也可以去浏览博客。为了深入了解,我在 Opensource.com 上找到了 Kubernetes 排名前十的文章。通过这些文章,我们能了解开发者们更喜欢读和写哪些话题的文章。我们开始吧! -(2019 年末获取 Kubernetes 文章的 top 10。) +- [为什么数据科学家喜欢Kubernetes][13] +- [Kubernetes 机密信息和 ConfigMap 简介][14] +- [怎样在 Kubernetes 上运行 PostgreSQL][15](译文) +- [为什么说 Kubernetes 是一辆翻斗车][16](译文) +- [安全扫描你的 DevOps 流程][17] +- [在 Kubernetes 上部署 InfluxDB 和 Grafana 以收集 Twitter 统计信息][18] +- [使用 Kubernetes 操作器扩展 PostgreSQL][19] +- [使用 Kubernetes 控制器减少系统管理员的工作量][20] +- [将 Kubernetes 带到裸金属边缘计算][21] +- [为什么你不必担心 Kubernetes][22] -首先,我要指明这些文章中有 5 篇是关于 Kubernetes 工作负载的扩展以及它们可以运行在什么场景。这些工作负载涵盖数据科学、PostgreSQL、InfluxDB、Grafana(不仅仅监控集群本身)和 Edge。从历史角度看,Kubernetes 和容器都是在虚拟机上运行的,尤其是运行在由云提供的基础设施上时。抛开对于 Kubernetes 的兴趣因素,这也表明了终端用户们极度希望在裸机上安装 Kubernetes(参照[OpenShift 环境安装 Kubernetes][2])。 +首先,我要指明这些文章中有 5 篇是关于 Kubernetes 工作负载的扩展以及它们可以运行在什么场景。这些工作负载涵盖数据科学、PostgreSQL、InfluxDB、Grafana(不仅仅监控集群本身)和边缘计算。从历史角度看,Kubernetes 和容器都是在虚拟机上运行的,尤其是运行在由云提供的基础设施上时。抛开对于 Kubernetes 的兴趣因素,这也表明了终端用户们极度希望在裸机上安装 Kubernetes(参照 [用 OpenShift 在裸机环境运行 Kubernetes][2])。 -其次,也有很多开发者希望了解操作相关的知识以及 Kubernetes 的最佳实践。从 [Kubernetes 操作][3] 到 [Kubernetes 控制器][4],从 [Secrets][5] 到 [ConfigMaps][6],开发者和运维人员都希望能找到简化部署和管理工作的最佳实践。我们经常纠结在怎么去修改配置文件或别人会怎么配置,而不去回头想想这些配置是怎么让应用部署运转的(不是怎么安装,也不是怎么运行 Kubernetes)。 +其次,也有很多开发者希望了解操作相关的知识以及 Kubernetes 的最佳实践。从 [Kubernetes 操作器][3] 到 [Kubernetes 控制器][4],从 [机密信息][5] 到 [ConfigMaps][6],开发者和运维人员都希望能找到简化部署和管理工作的最佳实践。我们经常纠结在怎么去修改配置文件或别人会怎么配置,而不去回头想想这些配置是怎么让应用部署运转的(不是怎么安装,也不是怎么运行 Kubernetes)。 -最后,人们似乎对入门教程真的感兴趣。事实上,构建 Kubernetes 所需了解的信息太多了,以至于让人们望而却步,也使他们走了错误的路。流行度高的文章中有几篇讲述了为什么你需要了解用 Kubernetes 运行应用程序,而不仅仅是安装它。就是最佳实践类的文章一样,人们也通常不会回头分析在入门时他们应该在什么地方花费时间。我一直秉持的理念是,把有限的时间和金钱投入到如何使用某项技术上,而不是如何构建它。 +最后,人们似乎对入门教程真的感兴趣。事实上,构建 Kubernetes 所需了解的信息太多了,以至于让人们望而却步,也使他们走了错误的路。流行度高的文章中有几篇讲述了为什么你需要了解用 Kubernetes 运行应用程序,而不仅仅是安装它。就像最佳实践类的文章一样,人们也通常不会回头分析在入门时他们应该在什么地方花费时间。我一直秉持的理念是,把有限的时间和金钱投入到如何使用某项技术上,而不是如何构建它。 -### 2020 年对 Kubernetes 的 5 项预测 +### 2020 年对 Kubernetes 的 5 个预测 -回顾下 2019 年的相关主题,这些主题告诉我们 2020 年将如何发展?结合这些文章中的观点,加上我自己的看法,我来分享下我对于 2020 年以及未来发展趋势的想法: +回顾了 2019 年的相关主题,这些主题告诉我们 2020 年将如何发展?结合这些文章中的观点,加上我自己的看法,我来分享下我对于 2020 年以及未来发展趋势的想法: - 1. 工作负载扩展。我会关注高性能计算,AI/ML 以及使用 Operator 的有状态工作负载。 - - 2. 更多的生产中的最佳实践,尤其是跟一些成熟的标准相关的,像 PCI,HIPAA,NIST 等等. - - 3. rootless 相关的更好的安全性和 [runtimes classes][7](如 [gVisor][8],[Kata Containers][9] 等等)更高的安全性。 - - 4. 在部署和开发者们共享应用时,把 Kubernetes 清单的更好的规范标准作为部署的核心要素。如 [podman generate kube][10], [podman play kube][11], 还有多合一 Kubernetes 环境,如 [CodeReady Containers (CRC)][12] - - 5. 一个前所未有的网络、存储和专业硬件(如 GPU 等等)供应商的生态系统,为 Kubernetes 提供 BoB(译注:best of breed,单项最佳品牌)解决方案(在免费软件中,我们相信开放的生态系统好过垂直整合的解决方案)。 +1. 工作负载扩展。我会关注高性能计算、AI/ML 以及使用操作器的有状态工作负载。 +2. 更多的生产中的最佳实践,尤其是跟一些成熟的标准相关的,像 PCI、HIPAA、NIST 等等。 +3. 提升免 root 和更安全的[运行时类][7](如 [gVisor][8]、[Kata Containers][9] 等等)的安全性。 +4. 在部署和开发者们共享应用时,把 Kubernetes 清单的更好的规范标准作为部署的核心要素。如 [podman 生成 kube][10]、[podman 运行 kube][11],还有多合一 Kubernetes 环境,如 [CodeReady Containers (CRC)][12] +5. 一个前所未有的网络、存储和专业硬件(如 GPU 等等)供应商的生态系统,为 Kubernetes 提供 BoB(LCTT 译注:best of breed,单项最佳品牌)解决方案(在自由软件中,我们相信开放的生态系统好过垂直整合的解决方案)。 期待 Kubernetes 在新的一年里再创辉煌! @@ -47,7 +54,7 @@ via: https://opensource.com/article/20/1/kubernetes-2020 作者:[Scott McCarty][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -65,3 +72,13 @@ via: https://opensource.com/article/20/1/kubernetes-2020 [10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/ [11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities [12]: https://developers.redhat.com/products/codeready-containers/overview +[13]: https://opensource.com/article/19/1/why-data-scientists-love-kubernetes +[14]: https://opensource.com/article/19/6/introduction-kubernetes-secrets-and-configmaps +[15]: https://linux.cn/article-10762-1.html +[16]: https://linux.cn/article-11011-1.html +[17]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline +[18]: https://opensource.com/article/19/2/deploy-influxdb-grafana-kubernetes +[19]: https://opensource.com/article/19/2/scaling-postgresql-kubernetes-operators +[20]: https://opensource.com/article/19/3/reducing-sysadmin-toil-kubernetes-controllers +[21]: https://opensource.com/article/19/3/bringing-kubernetes-bare-metal-edge +[22]: https://opensource.com/article/19/10/kubernetes-complex-business-problem From 1b5a922346f752a62b238fcd96d16344cd9a462e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 09:44:59 +0800 Subject: [PATCH 453/676] PUB @lxbwolf https://linux.cn/article-11758-1.html --- .../20200101 5 predictions for Kubernetes in 2020.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200101 5 predictions for Kubernetes in 2020.md (97%) diff --git a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md b/published/20200101 5 predictions for Kubernetes in 2020.md similarity index 97% rename from translated/tech/20200101 5 predictions for Kubernetes in 2020.md rename to published/20200101 5 predictions for Kubernetes in 2020.md index f87eb41b9f..2ad58abd67 100644 --- a/translated/tech/20200101 5 predictions for Kubernetes in 2020.md +++ b/published/20200101 5 predictions for Kubernetes in 2020.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11758-1.html) [#]: subject: (5 predictions for Kubernetes in 2020) [#]: via: (https://opensource.com/article/20/1/kubernetes-2020) [#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) @@ -12,7 +12,7 @@ > 以及,对 2019 年最受欢迎的 Kubernetes 文章的回顾。 -![Person drinking a hat drink at the computer][1] +![](https://img.linux.net.cn/data/attachment/album/202001/07/094358qucr5o2lu2lo23od.jpg) 你是怎么追踪一个广受欢迎的项目(如 Kubernetes)的发展轨迹?你是怎么了解它发展到什么程度了?如果你在为这个项目作贡献或加入了特殊兴趣组(SIG),可能你会在潜移默化中了解到它的发展轨迹,但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。 From 923e0da51ed798d772ab2a283d831cf23664657c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 23:12:11 +0800 Subject: [PATCH 454/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @BrunoJu 恭喜你完成了第一篇翻译贡献! --- ...es to accelerate your automation skills.md | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md index f50180a6d7..f7805c35f0 100644 --- a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md +++ b/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md @@ -1,43 +1,45 @@ [#]: collector: (lujun9972) [#]: translator: (BrunoJu) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (10 Ansible resources to accelerate your automation skills) [#]: via: (https://opensource.com/article/19/12/ansible-resources) [#]: author: (James Farrell https://opensource.com/users/jamesf) -提升自动化技巧的10大Ansible资源 +提升自动化技巧的 10 篇 Ansible 文章 ====== -今年,准备好,用出色的Ansible自动化技能装备自己的技能包吧。 -![Gears above purple clouds][1] +> 今年,准备好,用出色的 Ansible 自动化技能装备自己的技能包吧。 -今年我关注了大量关于Ansible的文章,以下这些内容都值得每个人学习,无论是否是Ansible的新手。 +![](https://img.linux.net.cn/data/attachment/album/202001/07/231057fbtfjwrn29ficxj0.jpg) -这些文章值得大家标记为书签,或者设置个计划任务(亦或者是设置一个Tower/AWX job),用来提醒自己常读常新。 -如果你是Ansible的新手,那么就从这些文章开始着手吧: - * [_A quickstart guide to Ansible_][2] 拥有一些对新手非常有用的信息,同时还有一些更高级的话题。 - * [_10 Ansible modules you need to know_][3] 和 [_5 ops tasks to do with Ansible_][4] 这篇文章有每一位Ansible的管理者都应该熟悉并认真研习的一些最基础的Ansible功能 - * [_How to use Ansible to document procedures_][5] 这篇文章是对一些额外话题的纵览,我猜你一定会感到很有趣。 +今年我关注了大量关于 Ansible 的文章,以下这些内容都值得每个人学习,无论是否是 Ansible 的新手。 +这些文章值得大家标记为书签,或者设置个计划任务(亦或者是设置一个 Tower/AWX 任务),用来提醒自己常读常新。 -剩余的这些文章包含了更多高级的话题,比如Windows管理,测试、硬件、云和容器,甚至包括了一个案例研究,如何管理那些对技术有兴趣的孩子的需求。 +如果你是 Ansible 的新手,那么就从这些文章开始着手吧: -我希望你能像我一样好好享受Ansible带来的乐趣。不要停止学习哦! - 1. _[How Ansible brought peace to my home][6]_ 这个异想天开的案例,你能看到如何利用Ansible为孩子们快速部署一个新的笔记本(或者重装旧笔记本) - 2. _[Ansible for the Windows admin][7]_ 你知道Ansible也可以管理Windows的节点吗?这篇文章以部署一个IIS为案例,阐述了基础的Ansible服务器和Windows客户端的安装。 - 3. _[10 Ansible modules you need to know][3]_ 这是个学习你最应该知道的那些最常见最基础Ansible模块的好文章。执行命令、安装系统包和操作文件是许多有用的自动化工作的基础。 - 4. _[How to use Ansible to document procedures][5]_  Ansible的YAML文件易于阅读,因此它们可以被用于记录完成任务所需的手动步骤。这一特性可以帮助你调试与扩展,这令工作变得异常轻松。同时,这篇文章还包含关于测试和分析等Ansible相关主题的指导。 - 5. _[Using Testinfra with Ansible to verify server state][8]_ 测试环节是任何一个 CI/CD 开发型运维场景不可或缺的一部分。所以为什么不把测试Ansible的运行结果也纳入其中呢?这个有关于Ansible测试架构的入门级文章可以被用来帮助你配置。 - 6. _[Hardware bootstrapping with Ansible][9]_ 这个世界并不是完全已经被容器和虚拟机所占据。许多系统管理员仍然需要管理众多硬件资源。通过Ansible与PXE、DHCP以及其他一些技术的结合,你可以创建一个简单的管理框架,对硬件实施控制。 - 7. _[What you need to know about Ansible modules][10]_ 模块给Ansible带来了巨大的潜力,许多模块我们已经可以拿来利用。但如果没有你所需的模块,那你可以尝试给自己造一个。看看这篇文章吧,它能让你了解如何从零开始打造自己所需的模块。 - 8. _[5 ops tasks to do with Ansible][4]_ 这是另一个有关于如何使用Ansible来管理常见的系统操作任务的文章。这里描述了一系列可以取代命令行操作的Tower(AWX)的案例。 - 9. _[A quickstart guide to Ansible][2]_ 这篇文章是个可以下载的PDF文档。它可以作为一本随时拿来翻阅的手册。这篇文章的开头有助于初学者入门。同时,还包括了一些其他的研究领域,比如模块测试、系统管理任务和针对K8S对象的管理。 - 10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ 这是一篇每月进行总结更新的文章,充满了有趣的链接。话题包括了Ansible的基础内容、管理Netapp的E系列存储产品、调试、打补丁包和其他一些相关内容。文章中还包括了一些视频以及指导性文章的链接。击这里查看详情! +* 《[Ansible 快速入门指南][2]》拥有一些对新手非常有用的信息,同时还介绍了一些更高级的话题。 +* 《[你需要知道的 10 个 Ansible 模块][3]》和《[5 个 Ansible 运维任务][4]》(译文)这两篇文章有每一位 Ansible 管理员都应该熟悉并认真研习的一些最基础的 Ansible 功能。 +* 《[如何使用 Ansible 记录流程][5]》这篇文章是对一些额外话题的纵览,我猜你一定会感到很有趣。 +剩余的这些文章包含了更多高级的话题,比如 Windows 管理、测试、硬件、云和容器,甚至包括了一个案例研究,如何管理那些对技术有兴趣的孩子的需求。 -如果你也有一些你喜爱的Ansible文章,那请留言告诉我们吧。 +我希望你能像我一样好好享受 Ansible 带来的乐趣。不要停止学习哦! + +1. 《[Ansible 如何为我的家庭带来和平][6]》这个异想天开的案例,你能看到如何利用 Ansible 为孩子们快速部署一个新的笔记本(或者重装旧笔记本) +2. Taz Brown 和 Abner Malivert 的《[适用于 Windows 管理员的 Ansible][7]》:你知道 Ansible 也可以管理 Windows 的节点吗?这篇文章以部署一个 IIS 为案例,阐述了基础的 Ansible 服务器和 Windows 客户端的安装。 +3. Shashank Hegde 的《[你需要知道的 10 个 Ansible 模块][3]》是个学习你最应该知道的那些最常见、最基础的 Ansible 模块的好文章。运行命令、安装软件包和操作文件是许多有用的自动化工作的基础。 +4. Marco Bravo 的《[如何使用 Ansible 记录流程][5]》:Ansible 的 YAML 文件易于阅读,因此它们可以被用于记录完成任务所需的手动步骤。这一特性可以帮助你调试与扩展,这令工作变得异常轻松。同时,这篇文章还包含关于测试和分析等 Ansible 相关主题的指导。 +5. Clement Verna 的《[使用 Testinfra 和 Ansible 验证服务器状态][8]》(译文):测试环节是任何一个 CI/CD DevOps 流程不可或缺的一部分。所以为什么不把测试 Ansible 的运行结果也纳入其中呢?这个测试架构 Testinfra 的入门级文章可以帮助你检查配置结果。 +6. Mark Phillips 的《[Ansible 硬件起步][9]》:这个世界并不是完全已经被容器和虚拟机所占据。许多系统管理员仍然需要管理众多硬件资源。通过 Ansible 与一点 PXE、DHCP 以及其他技巧的结合,你可以创建一个方便的管理框架使硬件易于启动和运行。 +7. Jairo da Silva Junior 的《[你需要了解的关于 Ansible 模块的知识][10]》:模块给 Ansible 带来了巨大的潜力,已经有许多模块可以拿来利用。但如果没有你所需的模块,那你可以尝试给自己打造一个。看看这篇文章吧,它能让你了解如何从零开始打造自己所需的模块。 +8. Mark Phillips 的《[5 个 Ansible 运维任务][4]》(译文):这是另一个有关于如何使用 Ansible 来管理常见的系统操作任务的文章。这里描述了一系列可以取代命令行操作的 Tower(或 AWX)的案例。 +9. Chris Short 的《[Ansible 快速入门指南][2]》是个可以下载的 PDF 文档。它可以作为一本随时拿来翻阅的手册。这篇文章的开头有助于初学者入门。同时,还包括了一些其他的研究领域,比如模块测试、系统管理任务和针对 K8S 对象的管理。 +10. Mark Phillips 的《[Ansible 参考指南,带有 Ansible Tower 和 GitHub 的 CI/CD,等等][11]》:这是一篇每月进行总结更新的文章,充满了有趣的链接。话题包括了 Ansible 的基础内容、管理 Netapp 的 E 系列存储产品、调试、打补丁包和其他一些相关内容。文章中还包括了一些视频以及一些聚会的链接。请查看详情。 + +如果你也有一些你喜爱的 Ansible 文章,那请留言告诉我们吧。 -------------------------------------------------------------------------------- @@ -45,8 +47,8 @@ via: https://opensource.com/article/19/12/ansible-resources 作者:[James Farrell][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/BrunoJu) -校对:[校对者ID](https://github.com/校对者ID) +译者:[BrunoJu](https://github.com/BrunoJu) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -55,11 +57,11 @@ via: https://opensource.com/article/19/12/ansible-resources [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) [2]: https://opensource.com/article/19/2/quickstart-guide-ansible [3]: https://opensource.com/article/19/9/must-know-ansible-modules -[4]: https://opensource.com/article/19/8/ops-tasks-ansible +[4]: https://linux.cn/article-11312-1.html [5]: https://opensource.com/article/19/4/ansible-procedures [6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops [7]: https://opensource.com/article/19/2/ansible-windows-admin -[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state +[8]: https://linux.cn/article-10943-1.html [9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible [10]: https://opensource.com/article/19/3/developing-ansible-modules [11]: https://opensource.com/article/19/7/ansible-news-edition-one From 9de7cd49aa0d08d79a379e08ffd875f2d72ff746 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 7 Jan 2020 23:13:18 +0800 Subject: [PATCH 455/676] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @BrunoJu 本文首发地址:https://linux.cn/article-11760-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/BrunoJu 请注册以领取 LCCN:https://lctt.linux.cn/ --- ... Ansible resources to accelerate your automation skills.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191231 10 Ansible resources to accelerate your automation skills.md (98%) diff --git a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md b/published/20191231 10 Ansible resources to accelerate your automation skills.md similarity index 98% rename from translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md rename to published/20191231 10 Ansible resources to accelerate your automation skills.md index f7805c35f0..00d31b98a2 100644 --- a/translated/tech/20191231 10 Ansible resources to accelerate your automation skills.md +++ b/published/20191231 10 Ansible resources to accelerate your automation skills.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (BrunoJu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11760-1.html) [#]: subject: (10 Ansible resources to accelerate your automation skills) [#]: via: (https://opensource.com/article/19/12/ansible-resources) [#]: author: (James Farrell https://opensource.com/users/jamesf) From d817e328b23780246cb240b9f19e1f1fc4af841b Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 8 Jan 2020 00:20:46 +0800 Subject: [PATCH 456/676] translated --- ... Lessons learned from programming in Go.md | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md index 93e9af3398..682b6c798c 100644 --- a/sources/tech/20191210 Lessons learned from programming in Go.md +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -7,28 +7,28 @@ [#]: via: "https://opensource.com/article/19/12/go-common-pitfalls" [#]: author: "Eduardo Ferreira https://opensource.com/users/edufgf" -用 Go 编程受到的启发 +Go 编程中的经验教训 ====== 通过学习如何定位并发处理的陷阱来避免未来处理这些问题时的困境。 ![Goland gopher illustration][1] -在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。[Mode.net][2] 公司系统每天要处理实时、快速和灵活的以毫秒为单位动态路由数据包的全球专用网络和数据,需要高度并发的系统。他们的动态路由是基于网络状态的,而这个过程需要考虑众多因素,我们只考虑关系链的监控。在我们的环境中,调用关系链监控可以是任何跟网络调用关系链有关的状态和当前属性(如连接延迟)。 +在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。[Mode.net][2] 公司系统每天要处理实时、快速和灵活的以毫秒为单位动态路由数据包的全球专用网络和数据,需要高度并发的系统。这个动态路由是基于网络状态的,而这个过程需要考虑众多因素,我们只考虑关系链的监控。在我们的环境中,调用关系链监控可以是任何跟网络调用关系链有关的状态和当前属性(如链接延迟)。 -### 并发探测链接指标 +### 并发探测链接监控 -[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing,译注:逐跳自适应链路状态最佳路由), 我们的动态路由算法部分依赖于链路度量来计算路由表。 这些指标由位于每个PoP(译注:存活节点)上的独立组件收集。PoP是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有多个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探针。 +[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing,译注:逐跳自适应链路状态最佳路由),我们的动态路由算法部分依赖于链路度量来计算路由表。 这些指标由位于每个PoP(译注:存活节点)上的独立组件收集。PoP是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有不止一个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探针。 ![latency computation graph][6] ### 序列号和重置:一个记录场景 -我们的探测组件互相发送和接收数据包并依靠序列号进行数据包处理。旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号0来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们只考虑了始终从 0 开始递增的序列号。组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,直到排到重置之前用到的值之前,它后面的包都会被忽略掉。 +我们的探测组件互相发送和接收数据包并依靠序列号进行数据包处理。旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号 0 来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们只考虑了始终从 0 开始递增的序列号。组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,直到排到重置之前用到的值之前,它后面的包都会被忽略掉。 ### UDP 握手和有限状态机 这里的问题是重启前后的序列号是否一致。有几种方法可以解决这个问题,经过讨论,我们选择了实现一个带有清晰状态定义的三向交握协议。这个握手过程在初始化时通过链接建立 session。这样可以确保节点通过同一个 session 进行通信且使用了适当的序列号。 -为了正确实现这个过程,我们必须顶一个一个有清晰状态和过渡的有限状态机。这样我们就可以正确管理握手过程中的所有极端情况。 +为了正确实现这个过程,我们必须定义一个有清晰状态和过渡的有限状态机。这样我们就可以正确管理握手过程中的所有极端情况。 ![finite state machine diagram][7] @@ -43,7 +43,7 @@ session ID 由握手的初始化程序生成。一个完整的交换顺序如下 ### 处理状态超时 -Basically, at each state, you need to handle, at most, three types of events: link events, packet events, and timeout events. And those events show up concurrently, so here you have to handle concurrency properly.基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 +基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 * 链接事件包括连接和断开,连接时会初始化一个链接 session,断开时会断开一个已建立的 seesion。 * 数据包事件是控制数据包 **(SYN/SYN-ACK/ACK)** 或只是探测响应。 @@ -59,7 +59,7 @@ Basically, at each state, you need to handle, at most, three types of events: li ![gophers hacking together][9] -gophers hacking together +gopher 们聚众狂欢 首先,你可以设计两个分别表示我们的 **Session** 和 **Timeout Handlers** 的结构体。 @@ -147,19 +147,19 @@ func synCallback(session Session) {   ### 数据竞争和引用 -你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,在 *duration* 时间内 sleep,然后检查是否执行的回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 +你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,在 *duration* 时间内 sleep,然后检查是否执行了回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 令人惊讶的是,这个简单的测试发现了这个解决方案中的一个 bug。使用 cancel 方法来取消超时并没有正确处理。以下顺序的事件会导致数据资源竞争: 1. 你有一个已调度的超时 handler。 2. 线程 1: -a) 你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个 session 状态(如 发送 **SYN** 后接收到一个 **SYN-ACK**) -b) 你调用了 **timeout.Cancel()**,这个函数调用了 **timer.Stop()**。(请注意,Golang 计时器的 stop 不会终止一个已过期的计时器。) +a)你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个 session 状态(如 发送 **SYN** 后接收到一个 **SYN-ACK**) +b)你调用了 **timeout.Cancel()**,这个函数调用了 **timer.Stop()**。(请注意,Golang 计时器的 stop 不会终止一个已过期的计时器。) 3. 线程 2: -a) 在调用 cancel 之前,计时器已过期,回调即将执行。 -b) 执行回调,它调度一次新的超时并更新全局 map。 +a)在调用 cancel 之前,计时器已过期,回调即将执行。 +b)执行回调,它调度一次新的超时并更新全局 map。 4. 线程 1: -a) 切换到新的 session 状态并注册新的超时,更新全局 map。 +a)切换到新的 session 状态并注册新的超时,更新全局 map。 @@ -187,9 +187,9 @@ func (timeout* TimeoutHandler) Register() {   你可以使用取消 channel,而不必依赖不能阻止到期的计时器执行的 golang 函数 **timer.Stop()**。 -这是一个略有不同的方法。现在你可以不用再通过回调进行递归地重新调度;而是注册一个死循环,这个循环接收到取消信号或超时事件是终止。 +这是一个略有不同的方法。现在你可以不用再通过回调进行递归地重新调度;而是注册一个死循环,这个循环接收到取消信号或超时事件时终止。 -新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用发一个取消 channel,用来控制循环的终止。 +新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用方一个取消 channel,用来控制循环的终止。 ```go @@ -254,11 +254,11 @@ func (timeout* TimeoutHandler) Cancel() {   ![gophers on a wire, talking][11] -还有人吗? +有人在听吗? 已获得 Trevor Forrey 授权。 -这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会则色后续的取消调用。 +这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会阻塞后续的取消调用。 ```go @@ -281,29 +281,29 @@ func (timeout* TimeoutHandler) Cancel() {   #### 在非同步的情况下更新共享数据 -This seems like an obvious one, but it’s actually hard to spot if your concurrent updates happen in different locations. The result is data race, where multiple updates to the same data can cause update loss, due to one update overriding another. In our case, we were updating the scheduled timeout reference on the same shared map. (Interestingly, if Go detects a concurrent read/write on the same Map object, it throws a fatal error —you can try to run Go’s [data race detector][12]). This eventually results in losing a timeout reference and making it impossible to cancel that given timeout. Always remember to use locks when they are needed. +这似乎是个很明显的问题,但如果并发更新发生在不同的位置,就很难发现。结果就是数据竞争,由于一个更新会覆盖另一个,因此对同一数据的多次更新中会有某些更新丢失。在我们的案例中,我们是在同时更新同一个共享 map 里的调度超时引用。有趣的是,(如果 Go 检测到在同一个 map 对象上的并发读写,会抛出 fatal 错误 — 你可以尝试下运行 Go 的[数据竞争检测器](https://golang.org/doc/articles/race_detector.html))。这最终会导致丢失超时引用,且无法取消给定的超时。当有必要时,永远不要忘记使用锁。 ![gopher assembly line][13] -don’t forget to synchronize gophers’ work +不要忘记同步 gopher 们的工作 -#### Missing condition checks +#### 缺少条件检查 -Condition checks are needed in situations where you can’t rely only on the lock exclusivity. Our situation is a bit different, but the core idea is the same as [condition variables][14]. Imagine a classic situation where you have one producer and multiple consumers working with a shared queue. A producer can add one item to the queue and wake up all consumers. The wake-up call means that some data is available at the queue, and because the queue is shared, access must be synchronized through a lock. Every consumer has a chance to grab the lock; however, you still need to check if there are items in the queue. A condition check is needed because you don’t know the queue status by the time you grab the lock. +在不能仅依赖锁的独占性的情况下,就需要进行条件检查。我们遇到的场景稍微有点不一样,但是核心思想跟[条件变量][14]是一样的。假设有个经典的一个生产者和多个消费者使用一个共享队列的场景,生产者可以将一个元素添加到队列并唤醒所有消费者。这个唤醒调用意味着队列中的数据是可访问的,并且由于队列是共享的,消费者必须通过锁来进行同步访问。每个消费者都可能拿到锁;然而,你仍然需要检查队列中是否有元素。因为在你拿到锁的瞬间并不知道队列的状态,所以还是需要进行条件检查。 -In our example, the timeout handler got a ‘wake up’ call from a timer expiration, but it still needed to check if a cancel signal was sent to it before it could proceed with the callback execution. +在我们的例子中,超时 handler 收到了计时器到期时发出的「唤醒」调用,但是它仍需要检查是否已向其发送了取消信号,然后才能继续执行回调。 ![gopher boot camp][15] -condition checks might be needed if you wake up multiple gophers +如果你要唤醒多个 gopher,可能就需要进行条件检查 -#### Deadlocks +#### 死锁 -This happens when one thread is stuck, waiting indefinitely for a signal to wake up, but this signal will never arrive. Those can completely kill your application by halting your entire program execution. +当一个线程被卡住,无限期地等待一个唤醒信号,但是这个信号永远不会到达时,就会发生这种情况。死锁可以通过让你的整个程序 halt 来彻底杀死你的应用。 -In our case, this happened due to multiple send calls to a non-buffered and blocking channel. This meant that the send call would only return after a receive is done on the same channel. Our timeout thread loop was promptly receiving signals on the cancellation channel; however, after the first signal is received, it would break off the loop and never read from that channel again. The remaining callers are stuck forever. To avoid this situation, you need to carefully think through your code, handle blocking calls with care, and guarantee that thread starvation doesn’t happen. The fix in our example was to make the cancellation calls non-blocking—we didn’t need a blocking call for our needs. +在我们的案例中,这种情况的发生是由于多次发送请求到一个非缓冲且阻塞的 channel。这意味着向 channel 发送数据只有在从这个 channel 接收完数据后才能 return。我们的超时线程循环迅速从取消 channel 接收信号;然而,在接收到第一个信号后,它将跳出循环,并且再也不会从这个 channel 读取数据。其他的调用会一直被卡住。为避免这种情况,你需要仔细检查代码,谨慎处理阻塞调用,并确保不会发生线程饥饿。我们例子中的解决方法是使取消调用成为非阻塞调用 — 我们不需要阻塞调用。 -------------------------------------------------------------------------------- @@ -311,7 +311,7 @@ via: https://opensource.com/article/19/12/go-common-pitfalls 作者:[Eduardo Ferreira][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lxbwolf](https://github.com/lxbwolf) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e37b92517847b91b7e86bcbb64f0897f44f1f50a Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 8 Jan 2020 00:23:40 +0800 Subject: [PATCH 457/676] modify md --- ... Lessons learned from programming in Go.md | 47 ++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/sources/tech/20191210 Lessons learned from programming in Go.md index 682b6c798c..0c17e142a8 100644 --- a/sources/tech/20191210 Lessons learned from programming in Go.md +++ b/sources/tech/20191210 Lessons learned from programming in Go.md @@ -1,11 +1,11 @@ -[#]: collector: "lujun9972" -[#]: translator: "lxbwolf" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "Lessons learned from programming in Go" -[#]: via: "https://opensource.com/article/19/12/go-common-pitfalls" -[#]: author: "Eduardo Ferreira https://opensource.com/users/edufgf" +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Lessons learned from programming in Go) +[#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) +[#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) Go 编程中的经验教训 ====== @@ -39,8 +39,6 @@ session ID 由握手的初始化程序生成。一个完整的交换顺序如下 3. sender 接收到 **SYN-ACK (ID)** _并发送一个 **ACK (ID)**_。它还发送一个从序列号 0 开始的数据包。 4. receiver 检查最后接收到的 **ID**,如果 ID 匹配,_则接受 **ACK (ID)**_。它还开始接受序列号为 0 的数据包。 - - ### 处理状态超时 基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 @@ -49,8 +47,6 @@ session ID 由握手的初始化程序生成。一个完整的交换顺序如下 * 数据包事件是控制数据包 **(SYN/SYN-ACK/ACK)** 或只是探测响应。 * 超时事件在当前 session 状态的预定超时时间到期后触发。 - - 这里面临的最主要的问题是如何处理并发超时到期和其他事件。这里很容易陷入死锁和资源竞争的陷阱。 ### 第一种方法 @@ -63,7 +59,6 @@ gopher 们聚众狂欢 首先,你可以设计两个分别表示我们的 **Session** 和 **Timeout Handlers** 的结构体。 - ```go type Session struct {     State SessionState   @@ -85,14 +80,12 @@ type TimeoutHandler struct {   每一个临近连接点的 session 都包含一个保存调度 `TimeoutHandler` 的全局 map。 - ``` `SessionTimeout map[Session]*TimeoutHandler` ``` 下面方法注册和取消超时: - ```go // schedules the timeout callback function.   func (timeout* TimeoutHandler) Register() {   @@ -111,7 +104,6 @@ func (timeout* TimeoutHandler) Cancel() {   你可以使用类似下面的方法来创建和存储超时: - ```go func CreateTimeoutHandler(callback func(Session), session Session, duration int) *TimeoutHandler {     if sessionTimeout[session] == nil {   @@ -130,7 +122,6 @@ func CreateTimeoutHandler(callback func(Session), session Session, duration int) 为此,你可以让回调函数重新调度一次超时: - ```go func synCallback(session Session) {     sendSynPacket(session) @@ -161,15 +152,12 @@ b)执行回调,它调度一次新的超时并更新全局 map。 4. 线程 1: a)切换到新的 session 状态并注册新的超时,更新全局 map。 - - 两个线程同时更新超时 map。最终结果是你无法取消注册的超时,然后你也会丢失对线程 2 重新调度的超时的引用。这导致 handler 在一段时间内持续执行和重新调度,出现非预期行为。 ### 锁也解决不了问题 使用锁也不能完全解决问题。如果你在处理所有事件和执行回调之前加锁,它仍然不能阻止一个过期的回调运行: - ```go func (timeout* TimeoutHandler) Register() {     timeout.timer = time.AfterFunc(time.Duration(timeout.duration) * time._Second_, func() {   @@ -191,7 +179,6 @@ func (timeout* TimeoutHandler) Register() {   新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用方一个取消 channel,用来控制循环的终止。 - ```go func (timeout *TimeoutHandler) Register() chan struct{} {     cancelChan := make(chan struct{})   @@ -225,7 +212,6 @@ func (timeout* TimeoutHandler) Cancel() {   这里的解决方案是,在拿到锁之后,检查一下超时范围内的取消 channel。 - ```go   case _ = <- time.AfterFunc(time.Duration(timeout.duration) * time.Second):       func () {   @@ -260,7 +246,6 @@ func (timeout* TimeoutHandler) Cancel() {   这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会阻塞后续的取消调用。 - ```go func (timeout* TimeoutHandler) Cancel() {     if timeout.cancelChan == nil {   @@ -283,8 +268,6 @@ func (timeout* TimeoutHandler) Cancel() {   这似乎是个很明显的问题,但如果并发更新发生在不同的位置,就很难发现。结果就是数据竞争,由于一个更新会覆盖另一个,因此对同一数据的多次更新中会有某些更新丢失。在我们的案例中,我们是在同时更新同一个共享 map 里的调度超时引用。有趣的是,(如果 Go 检测到在同一个 map 对象上的并发读写,会抛出 fatal 错误 — 你可以尝试下运行 Go 的[数据竞争检测器](https://golang.org/doc/articles/race_detector.html))。这最终会导致丢失超时引用,且无法取消给定的超时。当有必要时,永远不要忘记使用锁。 - - ![gopher assembly line][13] 不要忘记同步 gopher 们的工作 @@ -318,18 +301,18 @@ via: https://opensource.com/article/19/12/go-common-pitfalls [a]: https://opensource.com/users/edufgf [b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny "Goland gopher illustration" +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/go-golang.png?itok=OAW9BXny (Goland gopher illustration) [2]: http://mode.net [3]: https://en.wikipedia.org/wiki/Metrics_%28networking%29 [4]: https://people.ece.cornell.edu/atang/pub/15/HALO_ToN.pdf [5]: https://en.wikipedia.org/wiki/Point_of_presence -[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png "latency computation graph" -[7]: https://opensource.com/sites/default/files/uploads/image3_0.png "finite state machine diagram" +[6]: https://opensource.com/sites/default/files/uploads/image2_0_3.png (latency computation graph) +[7]: https://opensource.com/sites/default/files/uploads/image3_0.png (finite state machine diagram) [8]: https://golang.org/ -[9]: https://opensource.com/sites/default/files/uploads/image4.png "gophers hacking together" +[9]: https://opensource.com/sites/default/files/uploads/image4.png (gophers hacking together) [10]: https://en.wikipedia.org/wiki/Deadlock -[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg "gophers on a wire, talking" +[11]: https://opensource.com/sites/default/files/uploads/image5_0_0.jpg (gophers on a wire, talking) [12]: https://golang.org/doc/articles/race_detector.html -[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg "gopher assembly line" +[13]: https://opensource.com/sites/default/files/uploads/image6.jpeg (gopher assembly line) [14]: https://en.wikipedia.org/wiki/Monitor_%28synchronization%29#Condition_variables -[15]: https://opensource.com/sites/default/files/uploads/image7.png "gopher boot camp" +[15]: https://opensource.com/sites/default/files/uploads/image7.png (gopher boot camp) From 327565767baa82996ecd556f11f27a6907183d03 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 8 Jan 2020 00:24:07 +0800 Subject: [PATCH 458/676] move file --- .../tech/20191210 Lessons learned from programming in Go.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191210 Lessons learned from programming in Go.md (100%) diff --git a/sources/tech/20191210 Lessons learned from programming in Go.md b/translated/tech/20191210 Lessons learned from programming in Go.md similarity index 100% rename from sources/tech/20191210 Lessons learned from programming in Go.md rename to translated/tech/20191210 Lessons learned from programming in Go.md From 90dcfb8cbe828bff61e12427e2aebf571a89ca9c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 8 Jan 2020 00:54:36 +0800 Subject: [PATCH 459/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=205=20wa?= =?UTF-8?q?ys=20to=20improve=20your=20Bash=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 5 ways to improve your Bash scripts.md --- ...107 5 ways to improve your Bash scripts.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20200107 5 ways to improve your Bash scripts.md diff --git a/sources/tech/20200107 5 ways to improve your Bash scripts.md b/sources/tech/20200107 5 ways to improve your Bash scripts.md new file mode 100644 index 0000000000..ae4dd4fcf7 --- /dev/null +++ b/sources/tech/20200107 5 ways to improve your Bash scripts.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to improve your Bash scripts) +[#]: via: (https://opensource.com/article/20/1/improve-bash-scripts) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +5 ways to improve your Bash scripts +====== +Find out how Bash can help you tackle the most challenging tasks. +![A person working.][1] + +A system admin often writes Bash scripts, some short and some quite lengthy, to accomplish various tasks. + +Have you ever looked at an installation script provided by a software vendor? They often add a lot of functions and logic in order to ensure that the installation works properly and doesn’t result in damage to the customer’s system. Over the years, I’ve amassed a collection of various techniques for enhancing my Bash scripts, and I’d like to share some of them in hopes they can help others. Here is a collection of small scripts created to illustrate these simple examples. + +### Starting out + +When I was starting out, my Bash scripts were nothing more than a series of commands, usually meant to save time with standard shell operations like deploying web content. One such task was extracting static content into the home directory of an Apache web server. My script went something like this: + + +``` +cp january_schedule.tar.gz /usr/apache/home/calendar/ +cd /usr/apache/home/calendar/ +tar zvxf january_schedule.tar.gz +``` + +While this saved me some time and typing, it certainly was not a very interesting or useful script in the long term. Over time, I learned other ways to use Bash scripts to accomplish more challenging tasks, such as creating software packages, installing software, or backing up a file server. + +### 1\. The conditional statement + +Just as with so many other programming languages, the conditional has been a powerful and common feature. A conditional is what enables logic to be performed by a computer program. Most of my examples are based on conditional logic. + +The basic conditional uses an "if" statement. This allows us to test for some condition that we can then use to manipulate how a script performs. For instance, we can check for the existence of a Java bin directory, which would indicate that Java is installed. If found, the executable path can be updated with the location to enable calls by Java applications. + + +``` +if [ -d "$JAVA_HOME/bin" ] ; then +    PATH="$JAVA_HOME/bin:$PATH" +``` + +### 2\. Limit execution + +You might want to limit a script to only be run by a specific user. Although Linux has standard permissions for users and groups, as well as SELinux for enabling this type of protection, you could choose to place logic within a script. Perhaps you want to be sure that only the owner of a particular web application can run its startup script. You could even use code to limit a script to the root user. Linux has a couple of environment variables that we can test in this logic. One is **$USER**, which provides the username. Another is **$UID**, which provides the user’s identification number (UID) and, in the case of a script, the UID of the executing user. + +#### User + +The first example shows how I could limit a script to the user jboss1 in a multi-hosting environment with several application server instances. The conditional "if" statement essentially asks, "Is the executing user not jboss1?" When the condition is found to be true, the first echo statement is called, followed by the **exit 1,** which terminates the script. + + +``` +if [ "$USER" != 'jboss1' ]; then +     echo "Sorry, this script must be run as JBOSS1!" +     exit 1 +fi +echo "continue script" +``` + +#### Root + +This next example script ensures that only the root user can execute it. Because the UID for root is 0, we can use the **-gt** option in the conditional if statement to prohibit all UIDs greater than zero. + + +``` +if [ "$UID" -gt 0 ]; then +     echo "Sorry, this script must be run as ROOT!" +     exit 1 +fi +echo "continue script" +``` + +### 3\. Use arguments + +Just like any executable program, Bash scripts can take arguments as input. Below are a few examples. But first, you should understand that good programming means that we don’t just write applications that do what we want; we must write applications that _can’t_ do what we _don’t_ want. I like to ensure that a script doesn’t do anything destructive in the case where there is no argument. Therefore, this is the first check that y. The condition checks the number of arguments, **$#**, for a value of zero and terminates the script if true. + + +``` +if [ $# -eq 0 ]; then +    echo "No arguments provided" +    exit 1 +fi +echo "arguments found: $#" +``` + +#### Multiple arguments + +You can pass more than one argument to a script. The internal variables that the script uses to reference each argument are simply incremented, such as **$1**, **$2**, **$3**, and so on. I’ll just expand my example above with the following line to echo the first three arguments. Obviously, additional logic will be needed for proper argument handling based on the total number. This example is simple for the sake of demonstration. + + +``` +`echo $1 $2 $3` +``` + +While we’re discussing these argument variables, you might have wondered, "Did he skip zero?" + +Well, yes, I did, but I have a great reason! There is indeed a **$0** variable, and it is very useful. Its value is simply the name of the script being executed. + + +``` +`echo $0` +``` + +An important reason to reference the name of the script during execution is to generate a log file that includes the script’s name in its own name. The simplest form might just be an echo statement. + + +``` +`echo test >> $0.log` +``` + +However, you will probably want to add a bit more code to ensure that the log is written to a location with the name and information that you find helpful to your use case. + +### 4\. User input + +Another useful feature to use in a script is its ability to accept input during execution. The simplest is to offer the user some input. + + +``` +echo "enter a word please:" + read word + echo $word +``` + +This also allows you to provide choices to the user. + + +``` +read -p "Install Software ?? [Y/n]: " answ + if [ "$answ" == 'n' ]; then +   exit 1 + fi +   echo "Installation starting..." +``` + +### 5\. Exit on failure + +Some years ago, I wrote a script for installing the latest version of the Java Development Kit (JDK) on my computer. The script extracts the JDK archive to a specific directory, updates a symbolic link, and uses the alternatives utility to make the system aware of the new version. If the extraction of the JDK archive failed, continuing could break Java system-wide. So, I wanted the script to abort in such a situation. I don’t want the script to make the next set of system changes unless the archive was successfully extracted. The following is an excerpt from that script: + + +``` +tar kxzmf jdk-8u221-linux-x64.tar.gz -C /jdk --checkpoint=.500; ec=$? +if [ $ec -ne 0 ]; then +     echo "Installation failed - exiting." +     exit 1 +fi +``` + +A quick way for you to demonstrate the usage of the **$?** variable is with this short one-liner: + + +``` +`ls T; ec=$?; echo $ec` +``` + +First, run **touch T** followed by this command. The value of **ec** will be 0. Then, delete **T**, **rm T**, and repeat the command. The value of **ec** will now be 2 because ls reports an error condition since **T** was not found. + +You can take advantage of this error reporting to include logic, as I have above, to control the behavior of your scripts. + +### Takeaway + +We might assume that we need to employ languages, such as Python, C, or Java, for higher functionality, but that’s not necessarily true. The Bash scripting language is very powerful. There is a lot to learn to maximize its usefulness. I hope these few examples will shed some light on the potential of coding with Bash. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/improve-bash-scripts + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) From 909fa992fb18d393ca1463f0f2d57ec01e9d0c51 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 8 Jan 2020 00:55:09 +0800 Subject: [PATCH 460/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20How=20?= =?UTF-8?q?piwheels=20will=20save=20Raspberry=20Pi=20users=20time=20in=202?= =?UTF-8?q?020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md --- ...ll save Raspberry Pi users time in 2020.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md diff --git a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md new file mode 100644 index 0000000000..aa43d04f90 --- /dev/null +++ b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How piwheels will save Raspberry Pi users time in 2020) +[#]: via: (https://opensource.com/article/20/1/piwheels) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +How piwheels will save Raspberry Pi users time in 2020 +====== +By making pre-compiled Python packages for Raspberry Pi available, the +piwheels project saves users significant time and effort. +![rainbow colors on pinwheels in the sun][1] + +Piwheels automates building Python wheels (pre-compiled Python packages) for all of the projects on [PyPI][2], the Python Package Index, using Raspberry Pi hardware to ensure compatibility. This means that when a Raspberry Pi user wants to install a Python library using **pip**, they get a ready-made compiled version that's guaranteed to work on the Raspberry Pi. This makes it much easier for Raspberry Pi users to dive in and get started with their projects. + +![Piwheels logo][3] + +When I wrote [_piwheels: Speedy Python package installation for the Raspberry Pi_][4] in October 2018, the piwheels project was in its first year and already proving its purpose of saving Raspberry Pi users considerable time and effort. But the project, which makes pre-compiled Python packages available for Raspberry Pi, has come a long way in its second year. + +![Raspberry Pi 4][5] + +### How it works + +[Raspbian][6], the primary OS for Raspberry Pi, comes pre-configured to use piwheels, so users don't need to do anything special to get access to the wheels. + +The configuration file (at **/etc/pip.conf**) tells pip to use [piwheels.org][7] as an _additional index_, so pip looks at PyPI first, then piwheels. The Piwheels website is hosted on a Raspberry Pi 3, and all the wheels built by the project are hosted on that Pi. It serves over 1 million packages per month—not bad for a $35 computer! + +In addition to the main Raspberry Pi that serves the website, the piwheels project uses seven other Pis to build the packages. Some run Raspbian Jessie, building wheels for Python 3.4, some run Raspbian Stretch for Python 3.5, and some run Raspbian Buster for Python 3.7. The project doesn't generally support other Python versions. There's also a "proper server"—a virtual machine running the Postgres database. Since the Pi 3 has just 1GB of RAM, the (very large) database doesn't run well on it, so we moved it to a VM. The Pi 4 with 4GB RAM would probably be suitable, so we may move to this in the future. + +The Pis are all on an IPv6-only network in a "Pi Cloud"—a brilliant service provided by Cambridge-based hosting company [Mythic Beasts][8]. + +![Mythic Beasts hosting service][9] + +### Downloads and trends + +Every time a wheel file is downloaded, it is logged in the database. This provides insight into what packages are most popular and what Python versions and operating systems people are using. We don't have much information from the user agent, but because the architecture of Pi 1/Zero shows as "armv6" and Pi 2/3/4 show as "armv7," we can tell them apart. + +As of mid-December 2019, over 14 million packages have been downloaded from piwheels, with nearly 9 million in 2019 alone. + +The 10 most popular packages since the project's inception are: + + 1. [pycparser][10] (821,060 downloads) + 2. [PyYAML][11] (366,979) + 3. [numpy][12] (354,531) + 4. [cffi][13] (336,982) + 5. [MarkupSafe][14] (318,878) + 6. [future][15] (282,349) + 7. [aiohttp][16] (277,046) + 8. [cryptography][17] (276,167) + 9. [home-assistant-frontend][18] (266,667) + 10. [multidict][19] (256,185) + + + +Note that many pure-Python packages, such as [urllib3][20], are provided as wheels on PyPI; because these are compatible across platforms, they're not usually downloaded from piwheels because PyPI takes precedence. + +We also see trends in things like which Python versions are used over time. This shows the quick takeover of Python 3.7 from 3.5 when Raspbian Buster was released: + +![Data from piwheels on Python versions used over time][21] + +You can see more trends in our [stats blog posts][22]. + +### Time saved + +Every package build is logged in the database, and every download is also stored. Cross-referencing downloads with build duration shows how much time has been saved. One example is numpy—the latest version took about 11 minutes to build. + +So far, piwheels has saved users a total of over 165 years of build time. At the current usage rate, piwheels saves _over 200 days per day_. + +As well as saving build time, having pre-compiled wheels also means people don't have to install various development tools to build packages. Some packages require other apt packages for them to access shared libraries. Figuring out which ones you need can be a pain, so we made that step easier, too. First, we figured out the process and [documented it on our blog][23]. Then we added this logic to the build process so that when a wheel is built, its dependencies are automatically calculated and added to the package's project page: + +![numpy dependencies][24] + +### What next for piwheels? + +We launched project pages (e.g., [numpy][25]) this year, which are a really useful way to let people look up information about a project in a human-readable way. They also make it easier for people to report issues, such as if a project is missing from piwheels or they have an issue with a package they've downloaded. + +In early 2020, we're planning to roll out some upgrades to piwheels that will enable a new JSON API, so you can automatically check which versions are available, look up dependencies for a project, and lots more. + +The next Debian/Raspbian upgrade won't happen until mid-2021, so we won't start building wheels for any new Python versions until then. + +You can read more about piwheels on the project's [blog][26], where I'll be publishing a 2019 roundup early in 2020. You can also follow [@piwheels][27] on Twitter, where you'll see daily and monthly stats along with any milestones reached. + +Of course, piwheels is an open source project, and you can see the entire project [source code on GitHub][28]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/piwheels + +作者:[Ben Nuttall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rainbow-pinwheel-piwheel-diversity-inclusion.png?itok=di41Wd3V (rainbow colors on pinwheels in the sun) +[2]: https://pypi.org/ +[3]: https://opensource.com/sites/default/files/uploads/piwheels.png (Piwheels logo) +[4]: https://opensource.com/article/18/10/piwheels-python-raspberrypi +[5]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4_0.jpg (Raspberry Pi 4) +[6]: https://www.raspberrypi.org/downloads/raspbian/ +[7]: http://piwheels.org +[8]: https://www.mythic-beasts.com/order/rpi +[9]: https://opensource.com/sites/default/files/uploads/pi-cloud.png (Mythic Beasts hosting service) +[10]: https://www.piwheels.org/project/pycparser +[11]: https://www.piwheels.org/project/PyYAML +[12]: https://www.piwheels.org/project/numpy +[13]: https://www.piwheels.org/project/cffi +[14]: https://www.piwheels.org/project/MarkupSafe +[15]: https://www.piwheels.org/project/future +[16]: https://www.piwheels.org/project/aiohttp +[17]: https://www.piwheels.org/project/cryptography +[18]: https://www.piwheels.org/project/home-assistant-frontend +[19]: https://www.piwheels.org/project/multidict +[20]: https://piwheels.org/project/urllib3/ +[21]: https://opensource.com/sites/default/files/uploads/pyvers2019.png (Data from piwheels on Python versions used over time) +[22]: https://blog.piwheels.org/piwheels-stats-for-2019/ +[23]: https://blog.piwheels.org/how-to-work-out-the-missing-dependencies-for-a-python-package/ +[24]: https://opensource.com/sites/default/files/uploads/numpy-deps.png (numpy dependencies) +[25]: https://www.piwheels.org/project/numpy/ +[26]: https://blog.piwheels.org/ +[27]: https://twitter.com/piwheels +[28]: https://github.com/piwheels/ From e1088cdf2c4aee98fff42e8232b1227161721579 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Wed, 8 Jan 2020 01:20:21 +0800 Subject: [PATCH 461/676] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E8=AF=A5=E6=96=87?= =?UTF-8?q?=E7=AB=A0=EF=BC=8C=E7=BF=BB=E8=AF=9150%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20181105 5 Minimal Web Browsers for Linux.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index 1fbc18aeae..34c0c1e18e 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MonkeyDEcho ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (5 Minimal Web Browsers for Linux) @@ -9,19 +9,27 @@ 5 Minimal Web Browsers for Linux ====== +linux上的五种微型浏览器 +====== + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. +有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. +web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. +但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. +让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! ### GNOME Web GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. +GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: From 42f1a83728463efea3411631f34a871d0e1305c6 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Wed, 8 Jan 2020 01:23:58 +0800 Subject: [PATCH 462/676] fix --- sources/tech/20181105 5 Minimal Web Browsers for Linux.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index 34c0c1e18e..e3ee66f40a 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -9,27 +9,20 @@ 5 Minimal Web Browsers for Linux ====== -linux上的五种微型浏览器 -====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. -有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. -web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. -但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. -让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! ### GNOME Web GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. -GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: From ad719218b29a617feb3d0fe931e90c9976409350 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Wed, 8 Jan 2020 01:31:32 +0800 Subject: [PATCH 463/676] Update 20181105 5 Minimal Web Browsers for Linux.md --- sources/tech/20181105 5 Minimal Web Browsers for Linux.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index e3ee66f40a..70d75f74e7 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -9,7 +9,6 @@ 5 Minimal Web Browsers for Linux ====== - ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. From 1cd57105714a3362b0c1acc0e74a58da5c0c5c79 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Wed, 8 Jan 2020 01:35:03 +0800 Subject: [PATCH 464/676] fix --- sources/tech/20181105 5 Minimal Web Browsers for Linux.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index 70d75f74e7..34c0c1e18e 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -9,19 +9,27 @@ 5 Minimal Web Browsers for Linux ====== +linux上的五种微型浏览器 +====== + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. +有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. +web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. +但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. +让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! ### GNOME Web GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. +GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: From 0e6d1adb756702f050b674b34988029175449188 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 8 Jan 2020 08:43:15 +0800 Subject: [PATCH 465/676] translated --- ...VLC More Awesome With These Simple Tips.md | 131 ----------------- ...VLC More Awesome With These Simple Tips.md | 132 ++++++++++++++++++ 2 files changed, 132 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md create mode 100644 translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md diff --git a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md deleted file mode 100644 index a4dd3b7bd5..0000000000 --- a/sources/tech/20191214 Make VLC More Awesome With These Simple Tips.md +++ /dev/null @@ -1,131 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Make VLC More Awesome With These Simple Tips) -[#]: via: (https://itsfoss.com/simple-vlc-tips/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Make VLC More Awesome With These Simple Tips -====== - -[VLC][1] is one of the [best open source video players][2], if not the best. What most people don’t know about it is that it is a lot more than just a video player. - -You can do a lot of complex tasks like broadcasting live videos, capturing devices etc. Just open its menu and you’ll see how many options it has. - -It’s FOSS has a detailed tutorial discussing some of the [pro VLC tricks][3] but those are way too complicated for normal users. - -This is why I am writing another article to show you some of the simple tips that you can use with VLC. - -### Do more with VLC with these simple tips - -Let’s see what can you do with VLC other than just playing a video file. - -#### 1\. Watch YouTube videos with VLC - -![][4] - -If you do not want to watch the annoying advertisements on [YouTube][5] or simply want a distraction-free experience for watching a YouTube video, you can use VLC. - -Yes, it is very easy to stream a YouTube video on VLC. - -Simply launch the VLC player, head to the Media settings and click on “**Open Network Stream**” or **CTRL + N** as a shortcut to that. - -![][6] - -Next, you just have to paste the URL of the video that you want to watch. There are some options to tweak – usually, you should not bother using them. But, if you are curious you can click on the “**Advanced options**” to explore. - -You can also add subtitles to the YouTube videos this way. However, an easier way to [watch YouTube or any online video with subtitles is using Penguin subtitle player][7]. - -#### 2\. Convert videos to different formats - -![][8] - -You can [use ffmpeg to convert videos in Linux command line][9]. You can also use a graphical tool like [HandBrake to convert video formats][10]. - -But if you do not want a separate app to transcode videos, you can use VLC media player to get the job done. - -To do that, just head on to the Media option on VLC and then click on “**Convert/Save**” or press CTRL + R as a shortcut to get there while you have VLC media player active. - -Next, you will need to either import the video from your computer/disk or paste the URL of the video that you want to save/convert. - -Whatever your input source is – just hit the “**Convert/Save**” button after selecting the file. - -Now, you will find another window that gives you the option to change the “**Profile**” from the settings. Click on it and choose a format that you’d like the video to be converted to (and saved). - -You can also change the storage path for the converted file by setting the destination folder at the bottom of the screen before converting it. - -#### 3\. Record Audio/Video From Source - -![Vlc Advanced Controls][11] - -Do you want to record the audio/video you’re playing on VLC Media Player? - -If yes, there’s an easy solution to that. Simply navigate your way through **View->click on “Advanced Controls”**. - -Once you do that, you should observe new buttons (including a red record button in your VLC player). - -#### 4\. Download subtitles automatically - -![][12] - -Yes, you can [automatically download subtitles with VLC][13]. You do not even have to look for it on a separate website. You just have to navigate your way to **View->VLSub**. - -By default, it is deactivated, so when you click on the option it gets activated and lets you search/download the subtitles you wanted. - -[VLC also lets you synchronize the subtitles][14] with simple keyboard shortcuts. - -#### 5\. Take A Snapshot - -![][15] - -With VLC, you can get some screenshots/images of the video while watching it. - -You just need to right-click on the player while the video is playing/paused, you will notice a bunch of options now, navigate through **Video->Take Snapshot**. - -If you have an old version installed, you might observe the snapshot option right after performing a right-click. - -#### Bonus Tip: Add Audio/Video Effects to a video - -From the menu, go to the “**Tools**” option. Now, click on “**Effects and Filters**” or simply press **CTRL + E** from the VLC player window to open up the option. - -Here, you can observe audio effects and video effects that you can add to your video. You may not be able to see all the changes in real-time, so you will have to tweak it and save it in order to see what happens. - -![][16] - -I’ll suggest keeping a backup of the original video before you modify the video. - -#### What’s your favorite VLC tip? - -I shared some of my favourite VLC tips. Do you know some cool tip that you use regularly with VLC? Why not share it with us? I may add it to the list here. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/simple-vlc-tips/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.videolan.org/ -[2]: https://itsfoss.com/video-players-linux/ -[3]: https://itsfoss.com/vlc-pro-tricks-linux/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-stream.jpg?ssl=1 -[5]: https://www.youtube.com/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-play.jpg?ssl=1 -[7]: https://itsfoss.com/penguin-subtitle-player/ -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-video-convert.jpg?ssl=1 -[9]: https://itsfoss.com/ffmpeg/ -[10]: https://itsfoss.com/handbrake/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-advanced-controls.png?ssl=1 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-subtitles-automatic.png?ssl=1 -[13]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/ -[14]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/ -[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-snapshot.png?ssl=1 -[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-effects-screenshot.jpg?ssl=1 diff --git a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md new file mode 100644 index 0000000000..7363cb7992 --- /dev/null +++ b/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make VLC More Awesome With These Simple Tips) +[#]: via: (https://itsfoss.com/simple-vlc-tips/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +这些简单的技巧使 VLC 更加出色 +====== + +如果 [VLC][1] 不是最好的播放器,那它是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。 + +你可以进行许多复杂的任务,如直播视频、捕捉设备等。只需打开菜单,你就可以看到它有多少选项。 + +它的 FOSS 页面有一个详细的教程,讨论一些[专业的 VLC 技巧][3],但这些对于普通用户太复杂。 + +这就是为什么我写另一篇文章的原因,来向你展示一些可以在 VLC 中使用的简单技巧。 + +### 使用这些简单技巧让 VLC 做更多事 + +Let’s see what can you do with VLC other than just playing a video file. +让我们看看除了播放视频文件之外,你还可以使用 VLC 做什么。 + +#### 1\. 使用 VLC 观看 YouTube 视频 + +![][4] + +如果你不想在 [YouTube][5] 上观看令人讨厌的广告,或者只想体验没有打扰地观看 YouTube 视频,你可以使用 VLC。 + +是的,在 VLC 上流式传输 YouTube 视频是非常容易的。 + +只需启动 VLC 播放器,前往媒体设置,然后单击 ”**Open Network Stream**“ 或使用快捷方式 **CTRL + N**。 + +![][6] + +接下来,你只需要粘贴要观看的视频的 URL。有一些选项可以调整,但通常你无需担心这些。如果你好奇,你可以点击 ”**Advanced options**“ 来探索。 + +你还可以通过这种方式向 YouTube 视频添加字幕。然而,[一个更简单的带字幕观看 Youtube 视频的办法是使用 Penguin 字幕播放器][7]。 + +#### 2\. 将视频转换为不同格式 + +![][8] + +你可以[在 Linux 命令行使用 ffmpeg 转换视频][9]。你还可以使用图形工具,如 [HandBrake 转换视频格式][10]。 + +但是,如果你不想用一个单独的应用转码视频,你可以使用 VLC 播放器来完成该工作。 + +为此,只需点击 VLC 上的媒体选项,然后单击 **Convert/Save**,或者在 VLC 播放器处于活动状态时按下快捷键 CTRL + R。 + +接下来,你需要从计算机/硬盘或者 URL 导入你想保存/转换的的视频。 + +不管什么来源,只需选择文件后点击 ”**Convert/Save**“ 按钮 + +你现在会看到另外一个窗口给你更改 ”**Profile**“ 设置。点击并选择你想转换的格式(并保存)。 + +你还可以在转换之前通过在屏幕底部设置目标文件夹来更改转换文件的存储路径。 + +#### 3\. 从源录制音频/视频 + +![Vlc Advanced Controls][11] + +你是否想在 VLC 播放器中录制正在播放的音频/视频? + +如果是的话,有一个简单的解决方案。只需**通过 View,然后点击 ”Advanced Controls“**。 + +完成后,你会看到一个新按钮(包括 VLC 播放器中的红色录制按钮)。 + +#### 4\. 自动下载字幕 + +![][12] + +是的,你可以[使用 VLC 自动下载字幕][13]。你甚至不必在单独的网站上查找字幕。你只需点击 **View->VLSub**。 + +默认情况下,它是禁用的,因此当你单击该选项时,它会被激活,并允许你搜索/下载想要的字幕。 + +[VLC 还能让你使用简单的键盘快捷键同步字幕][14] + +#### 5\. 截图 + +![][15] + +你可以在观看视频时使用 VLC 获取一些视频的截图/图像。 + +你只需在视频播放/暂停时右击播放器,你会看到一组选项,点击 **Video->Take Snapshot**。 + +如果安装了旧版本,你可能在右键时看到截图选项。 + +#### 额外技巧:给视频添加音频/视频效果 + +在菜单中,进入 ”**Tools**“ 选项。单击 ”**Effects and Filters**“,或者在 VLC 播放器窗口中按 **CTRL + E** 打开选项。 + +好了,你可以观察你给视频添加的音频和视频效果了。你也许无法实时看到效果,因此你需要调整并保存来看发生了什么。 + +![][16] + +我建议在修改视频之前保存一份原始视频备份。 + +#### 你最喜欢的 VLC 技巧是什么? + +我分享了一些我最喜欢的 VLC 技巧。你知道什么你经常使用的很酷的 VLC 技巧吗?为什么不和我们分享呢?我可以把它添加到列表中。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/simple-vlc-tips/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.videolan.org/ +[2]: https://itsfoss.com/video-players-linux/ +[3]: https://itsfoss.com/vlc-pro-tricks-linux/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-stream.jpg?ssl=1 +[5]: https://www.youtube.com/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-play.jpg?ssl=1 +[7]: https://itsfoss.com/penguin-subtitle-player/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-video-convert.jpg?ssl=1 +[9]: https://itsfoss.com/ffmpeg/ +[10]: https://itsfoss.com/handbrake/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-advanced-controls.png?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-subtitles-automatic.png?ssl=1 +[13]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/ +[14]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-snapshot.png?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-effects-screenshot.jpg?ssl=1 From 4a0eed84886d7440734a2900198135556a798d83 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 8 Jan 2020 08:47:19 +0800 Subject: [PATCH 466/676] translating --- .../tech/20200105 PaperWM- tiled window management for GNOME.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md index 0948014fba..fa99f6c352 100644 --- a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md +++ b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f213a05ee5b45f7a12ca8772157b6ccc91268dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=B3=A5?= <24203166+fuzheng1998@users.noreply.github.com> Date: Wed, 8 Jan 2020 10:29:19 +0800 Subject: [PATCH 467/676] Update 20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md --- ...- EA is Permanently Banning Linux Gamers on Battlefield V.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md b/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md index b0d8bb3874..b0818e5fe8 100644 --- a/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md +++ b/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (fuzheng1998) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d25e4d31152b2f43164afb5e92fdac207274fb37 Mon Sep 17 00:00:00 2001 From: BrunoJu Date: Wed, 8 Jan 2020 11:59:16 +0800 Subject: [PATCH 468/676] Update 20200107 Kali Linux Will No Longer Have The Default Root User.md --- ...0107 Kali Linux Will No Longer Have The Default Root User.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md index 2ffcd8f715..0f087529b9 100644 --- a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md +++ b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (BrunoJu) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7114530f7fa58b5a473b638039ad6bcf7db09bca Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 8 Jan 2020 13:55:50 +0800 Subject: [PATCH 469/676] PRF @wxy --- ...191130 7 maker gifts for kids and teens.md | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/translated/tech/20191130 7 maker gifts for kids and teens.md b/translated/tech/20191130 7 maker gifts for kids and teens.md index 59bc3fc837..002e97e442 100644 --- a/translated/tech/20191130 7 maker gifts for kids and teens.md +++ b/translated/tech/20191130 7 maker gifts for kids and teens.md @@ -1,15 +1,16 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (7 maker gifts for kids and teens) [#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) [#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) -7 个给儿童和少年的创客礼物 +给儿童和青少年的 7 件创客礼物 ====== -> 这份礼物指南可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力,使你轻松完成节日礼物的采购。 + +> 这份礼物指南使你轻松完成节日礼物的采购,它们可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力。 ![Gift box opens with colors coming out][1] @@ -19,13 +20,13 @@ ![Hummingbird Robotics Kit][2] -**年龄:**8 岁 - 成人 +**年龄:**8 岁 - 成人 -**这是什么:**[蜂鸟机器人套件][3]是一套完整的机器人套件,带有微控制器、电机、LED 和传感器。机器人的大脑具有特殊的端口,小手可以轻松地将其连接到机器人的组件上。蜂鸟套件并没有身体,鼓励用户自己创建一个。 +**这是什么:**[蜂鸟机器人套件][3]是一套完整的机器人套件,带有微控制器、电机、LED 和传感器。机器人的大脑具有特殊的端口,小手可以轻松地将其连接到机器人的组件上。蜂鸟套件并没有身体,而是鼓励用户自己创建一个。 **为什么我喜欢它:**蜂鸟可以使用多种编程语言 —— 从可视化编程(BirdBlox、MakeCode、Snap)到代码编程(Python 和 Java)—— 可以随着用户编码技能的提高而可扩展。所有组件均与你在电子商店中找到的组件完全相同,没有像其他机器人套件那样被塑料所遮盖。这使机器人的内部工作不再神秘,并在你需要时易于采购更多零件。 -由于没有固定组合项目,因此蜂鸟是发挥创造力的完美机器人。 +由于没有固定组装项目,因此蜂鸟是发挥创造力的完美机器人。 蜂鸟具有开源的软件和固件。它适用于 Linux、Windows、Mac、Chromebook、Android 和 iOS。 @@ -37,7 +38,7 @@ **年龄:** 6岁 - 成人 -**这是什么:** [Makey Makey 经典版][5]可将任何导电物体(从棉花糖到朋友)变成计算机钥匙。 +**这是什么:** [Makey Makey 经典版][5]可将任何导电物体(从棉花糖到你的朋友)变成计算机钥匙。 你可以使用鳄鱼夹将 Makey Makey 连接到你选择的导电物体上。然后,通过同时触摸两个导电物体来闭合接地和任何触发键之间的电路。Makey Makey 是一种安全的方法,可以安全地在家中探索电力,同时创造与计算机进行交互的有趣方式。 @@ -51,11 +52,11 @@ **年龄:** 10 岁 - 成人 -**这是什么:** Arduino 是随同电子套件购买的微控制器,也可以单独购买,它们具有多种版本,尽管我最喜欢[Arduino Uno][7]。可以根据需要从任何电子商店购买其他组件,例如 LED、电机和传感器。 +**这是什么:** Arduino 是随同电子套件购买的微控制器,也可以单独购买,它们具有多种版本,而我最喜欢 [Arduino Uno][7]。你可以根据需要从任何电子商店购买其他组件,例如 LED、电机和传感器。 **为什么我喜欢它:** Arduino Uno 的文档很完善,因此创客们很容易在线上找到教程。Arduino 可以实现从简单到复杂的各种电子项目。Arduino 具有开源的固件和硬件。它适用于 Linux、Mac 和 Windows。 -**费用:**主板的起价为 22.00 美元。总成本取决于项目和技能水平。 +**费用:** 主板的起价为 22.00 美元。总成本取决于项目和技能水平。 ### DIY 创客套件 @@ -63,7 +64,7 @@ **年龄**:8 岁 - 成人 -**这是什么:**当今许多创客、发明家和程序员都是从碰巧修补附加的东西开始的。你可以快速前往最近的电子产品商店,为家里的年轻人创建一套出色的创客工具包。这是我的创客工具包中的内容: +**这是什么:**当今许多创客、发明家和程序员都是从鼓捣碰巧出现在身边东西开始的。你可以快速前往最近的电子产品商店,为家里的年轻人创建一套出色的创客工具包。这是我的创客工具包中的内容: * 护目镜 * 锤子 @@ -74,7 +75,7 @@ * LED * 压电蜂鸣器 * 马达 -* 带引线的AA电池组 +* 带引线的 AA 电池组 * 剪线钳 * 纸板 * 美纹纸胶带 @@ -85,7 +86,7 @@ * 拉链 * 钩子 * 一个很酷的工具盒,用来存放所有东西 -   + **我为什么喜欢它:**还记得小时候,你把父母带回家的空纸箱变成了宇宙飞船、房屋或超级计算机吗?这就是为大孩子们准备的 DIY 创客工具包。 原始的组件使孩子们可以尝试并运用他们的想象力。DIY 创客工具包可以完全针对接收者定制。可以放入一些接受这份礼品的人可能从未想到过用之发挥创意的某些组件,例如为下水道提供一些 LED 或木工结构。 @@ -98,7 +99,7 @@ **年龄:** 8 个月至 5 岁 -**这是什么:**启发式游戏篮充满了由天然、无毒材料制成的有趣物品,可供婴幼儿使用其五种感官进行探索。这是一种开放式、自娱自乐的游戏。其想法是,成年人将监督(但不指导)儿童使用篮子及其物品半小时,然后将篮子拿走下一次再玩。 +**这是什么:**启发式游戏篮充满了由天然、无毒材料制成的有趣物品,可供婴幼儿使用其五种感官进行探索。这是一种开放式、自娱自乐的游戏。其想法是,成年人将监督(但不指导)儿童使用篮子及其物品半小时,然后将篮子拿走,等下一次再玩。 创建带有常见家用物品的可爱游戏篮很容易。尝试包括质地、声音、气味、形状和重量各不相同的物品。这里有一些想法可以帮助您入门。 @@ -107,7 +108,7 @@ * 金属打蛋器和汤匙 * 板刷 * 海绵 -* 小鸡蛋纸箱 +* 小型鸡蛋纸箱 * 纸板管 * 小擀面杖 * 带纹理的毛巾 @@ -120,7 +121,7 @@ **我为什么喜欢它:**游戏篮非常适合感官发育,并可以帮助幼儿提出问题和探索周围的世界。这是培养创客思维方式的重要组成部分! -很容易获得适合这个游戏篮的物品。你可能已经在家中或附近的二手店里有很多有趣的物品。幼儿使用游戏篮的方式与婴儿不同。随着孩子开始模仿成人生活并通过他们的游戏讲故事,这些物品将随孩子一起成长。 +很容易获得适合这个游戏篮的物品。你可能已经在家中或附近的二手商店里找到了很多有趣的物品。幼儿使用游戏篮的方式与婴儿不同。随着孩子们开始模仿成人生活并通过他们的游戏讲故事,这些物品将随孩子一起成长。 **费用:**不等 @@ -130,7 +131,7 @@ **年龄**:5-8 岁 -**这是什么:** 《[Hello Ruby][11]:编码历险记》是 Linda Liukas 的插图书,通过有趣的故事讲述了一个遇到各种问题和朋友(每个都用一个码代表)的女孩,向孩子们介绍了编程概念。Liukas 还有其他副标题为《互联网探险》和《计算机内的旅程》的《Hello Ruby》书籍,而《编码历险记》已以 20 多种语言出版。 +**这是什么:** 《[Hello Ruby][11]:编码历险记》是 Linda Liukas 的插图书,通过有趣的故事讲述了一个遇到各种问题和朋友(每个都用一个码代表)的女孩,向孩子们介绍了编程概念。Liukas 还有其他副标题为《互联网探险》和《计算机内的旅程》的《Hello Ruby》系列书籍,而《编码历险记》已以 20 多种语言出版。 **为什么我喜欢它:**作者在书中附带了许多免费、有趣和无障碍的活动,可以从 Hello Ruby 网站下载和打印这些活动。这些活动教授编码概念、还涉及艺术表达、沟通、甚至时间安排。 @@ -144,7 +145,7 @@ **内容是什么:**由《编程少女》的创始人 Reshma Saujani 撰写,《[编程少女:学会编程和改变世界][13]》为年轻女孩(以及男孩)提供了科技领域的实用信息。它涵盖了广泛的主题,包括编程语言、用例、术语和词汇、职业选择以及技术行业人士的个人简介和访谈。 -**为什么我喜欢它:**本书以讲述了大多数面向成年人的网站没有的技术故事。技术涉及许多学科,对于年轻人来说,重要的是要了解他们可以使用它来解决现实世界中的问题并有所作为。 +**为什么我喜欢它:**本书以讲述了大多数面向成年人的网站都没有的技术故事。这些技术涉及许多学科,对于年轻人来说,重要的是要了解他们可以使用它来解决现实世界中的问题并有所作为。 **成本:**精装书的标价为 17.99 美元,平装书的标价为 10.99 美元,但你可以通过本地或在线书店以更低的价格找到。 @@ -155,7 +156,7 @@ via: https://opensource.com/article/19/11/maker-gifts-kids 作者:[Jess Weichler][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5fea83c3ca13a218e3c68bf908fdf9c11c93033f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 8 Jan 2020 14:08:32 +0800 Subject: [PATCH 470/676] PUB @wxy https://linux.cn/article-11762-1.html --- .../20191130 7 maker gifts for kids and teens.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191130 7 maker gifts for kids and teens.md (98%) diff --git a/translated/tech/20191130 7 maker gifts for kids and teens.md b/published/20191130 7 maker gifts for kids and teens.md similarity index 98% rename from translated/tech/20191130 7 maker gifts for kids and teens.md rename to published/20191130 7 maker gifts for kids and teens.md index 002e97e442..c92bcc29c9 100644 --- a/translated/tech/20191130 7 maker gifts for kids and teens.md +++ b/published/20191130 7 maker gifts for kids and teens.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11762-1.html) [#]: subject: (7 maker gifts for kids and teens) [#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) [#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) @@ -12,7 +12,7 @@ > 这份礼物指南使你轻松完成节日礼物的采购,它们可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力。 -![Gift box opens with colors coming out][1] +![](https://img.linux.net.cn/data/attachment/album/202001/08/140516t4ewey9ryu24tpz5.jpg) 还在纠结这个假期给年轻人买什么礼物?这是我精选的开源礼物,这些礼物将激发未来的创意和灵感。 From 50e8ec4229d440d6ca3ab56aa765b1d1eaaecef7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:53:24 +0800 Subject: [PATCH 471/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200108=20How=20?= =?UTF-8?q?to=20setup=20multiple=20monitors=20in=20sway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200108 How to setup multiple monitors in sway.md --- ... How to setup multiple monitors in sway.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20200108 How to setup multiple monitors in sway.md diff --git a/sources/tech/20200108 How to setup multiple monitors in sway.md b/sources/tech/20200108 How to setup multiple monitors in sway.md new file mode 100644 index 0000000000..f156d204dc --- /dev/null +++ b/sources/tech/20200108 How to setup multiple monitors in sway.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to setup multiple monitors in sway) +[#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) +[#]: author: (arte219 https://fedoramagazine.org/author/arte219/) + +How to setup multiple monitors in sway +====== + +![][1] + +Sway is a tiling Wayland compositor which has mostly the same features, look and workflow as the [i3 X11 window manager][2]. Because Sway uses Wayland instead of X11, the tools to setup X11 don’t always work in sway. This includes tools like _xrandr_, which are used in X11 window managers or desktops to setup monitors. This is why monitors have to be setup by editing the sway config file, and that’s what this article is about. + +## **Getting your monitor ID’s** + +First, you have to get the names sway uses to refer to your monitors. You can do this by running: + +``` +$ swaymsg -t get_outputs +``` + +You will get information about all of your monitors, every monitor separated by an empty line. + +You have to look for the first line of every section, and for what’s after “Output”. For example, when you see a line like “_Output DVI-D-1 ‘Philips Consumer Electronics Company’_”, the output ID is “DVI-D-1”. Note these ID’s and which physical monitors they belong to. + +## **Editing the config file** + +If you haven’t edited the Sway config file before, you have to copy it to your home directory by running this command: + +``` +cp -r /etc/sway/config ~/.config/sway/config +``` + +Now the default config file is located in _~/.config/sway_ and called “config”. You can edit it using any text editor. + +Now you have to do a little bit of math. Imagine a grid with the origin in the top left corner. The units of the X and Y coordinates are pixels. The Y axis is inverted. This means that if you, for example, start at the origin and you move 100 pixels to the right and 80 pixels down, your coordinates will be (100, 80). + +You have to calculate where your displays are going to end up on this grid. The locations of the displays are specified with the top left pixel. For example, if we want to have a monitor with name HDMI1 and a resolution of 1920×1080, and to the right of it a laptop monitor with name eDP1 and a resolution of 1600×900, you have to type this in your config file: + +``` +output HDMI1 pos 0 0 +output eDP1 pos 1920 0 +``` + +You can also specify the resolutions manually by using the _res_ option:  + +``` +output HDMI1 pos 0 0 res 1920x1080 +output eDP1 pos 1920 0 res 1600x900 +``` + +## **Binding workspaces to monitors** + +Using sway with multiple monitors can be a little bit tricky with workspace management. Luckily, you can bind workspaces to a specific monitor, so you can easily switch to that monitor and use your displays more efficiently. This can simply be done by the workspace command in your config file. For example, if you want to bind workspace 1 and 2 to monitor DVI-D-1 and workspace 8 and 9 to monitor HDMI-A-1, you can do that by using: + +``` +workspace 1 output DVI-D-1 +workspace 2 output DVI-D-1 +``` + +``` +workspace 8 output HDMI-A-1 +workspace 9 output HDMI-A-1 +``` + +That’s it! These are the basics of multi monitor setup in sway. A more detailed guide can be found at . + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ + +作者:[arte219][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/arte219/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/sway-multiple-monitors-816x345.png +[2]: https://fedoramagazine.org/getting-started-i3-window-manager/ From 233e9833d0e95677b396bf973cd430454f508085 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:53:46 +0800 Subject: [PATCH 472/676] add done: 20200108 How to setup multiple monitors in sway.md --- ...duction to the Linux goto shell utility.md | 599 ++++++++++++++++++ 1 file changed, 599 insertions(+) create mode 100644 sources/tech/20200107 Introduction to the Linux goto shell utility.md diff --git a/sources/tech/20200107 Introduction to the Linux goto shell utility.md b/sources/tech/20200107 Introduction to the Linux goto shell utility.md new file mode 100644 index 0000000000..b683f34449 --- /dev/null +++ b/sources/tech/20200107 Introduction to the Linux goto shell utility.md @@ -0,0 +1,599 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to the Linux goto shell utility) +[#]: via: (https://opensource.com/article/20/1/directories-autocomplete-linux) +[#]: author: (Lazarus Lazaridis https://opensource.com/users/iridakos) + +Introduction to the Linux goto shell utility +====== +Learn how to use goto to alias and navigate to directories with +autocomplete in Linux. +![Files in a folder][1] + +The goto shell utility allows users to navigate to aliased directories and also supports autocompletion. + +## How it works + +Before you can use goto, you need to register your directory aliases. For example: + + +``` +`goto -r dev /home/iridakos/development` +``` + +then change to that directory, e.g.: + + +``` +`goto dev` +``` + +![goto demo][2] + +## Autocompletion in goto + +**goto** comes with a nice autocompletion script—whenever you press the Tab key after the **goto** command, Bash or Zsh will prompt you with suggestions of the aliases that are available: + + +``` +$ goto <tab> +bc /etc/bash_completion.d                     +dev /home/iridakos/development +rubies /home/iridakos/.rvm/rubies +``` + +## Installing goto + +There are several ways to install goto. + +### Via script + +Clone the repository and run the install script as a superuser or root: + + +``` +git clone +cd goto +sudo ./install +``` + +### Manually + +Copy the file **goto.sh** somewhere in your filesystem and add a line in your **.zshrc** or **.bashrc** to source it. + +For example, if you placed the file in your home folder, all you have to do is add the following line to your **.zshrc** or **.bashrc** file: + + +``` +`source ~/goto.sh` +``` + +### MacOS Homebrew + +A formula named **goto** is available for the Bash shell in MacOS: + + +``` +`brew install goto` +``` + +### Add colored output + + +``` +`echo -e "\$include /etc/inputrc\nset colored-completion-prefix on" >> ~/.inputrc` +``` + +**Notes:** + + * You need to restart your shell after installation. + * You need to have the Bash completion feature enabled for Bash in MacOS (see this [issue][3]). + * You can install it with **brew install bash-completion** if you don't have it enabled. + + + +## Ways to use goto + +### Change to an aliased directory + +To change to an aliased directory, type: + + +``` +`goto ` +``` + +For example: + + +``` +`goto dev` +``` + +### Register an alias + +To register a directory alias, type: + + +``` +`goto -r ` +``` + +or + + +``` +`goto --register ` +``` + +For example: + + +``` +`goto -r blog /mnt/external/projects/html/blog` +``` + +or + + +``` +`goto --register blog /mnt/external/projects/html/blog` +``` + +**Notes:** + + * **goto** **expands** the directories, so you can easily alias your current directory with the following command and it will automatically be aliased to the whole path: [code]`goto -r last_release .` +``` + * Pressing the Tab key after the alias name provides the shell's default directory suggestions. + + + +### Unregister an alias + +To unregister an alias, use: +``` +`goto -u ` +``` +or +``` +`goto --unregister ` +``` +For example: +``` +`goto -u last_release` +``` +or +``` +`goto --unregister last_release` +``` +**Note:** By pressing the Tab key after the command (**-u** or **\--unregister**), the completion script will prompt you with the list of registered aliases. + +### List aliases + +To get a list of your currently registered aliases, use: +``` +`goto -l` +``` +or +``` +`goto --list` +``` +### Expand an alias + +To expand an alias to its value, use: +``` +`goto -x ` +``` +or +``` +`goto --expand ` +``` +For example: +``` +`goto -x last_release` +``` +or +``` +`goto --expand last_release` +``` +### Clean up aliases + +To clean up the aliases from directories that are no longer accessible in your filesystem, use: +``` +`goto -c` +``` +or +``` +`goto --cleanup` +``` +### Get help + +To view the tool's help information, use: +``` +`goto -h` +``` +or +``` +`goto --help` +``` +### Check the version + +To view the tool's version, use: +``` +`goto -v` +``` +or +``` +`goto --version` +``` +### Push before changing directories + +To push the current directory onto the directory stack before changing directories, type: +``` +`goto -p ` +``` +or +``` +`goto --push ` +``` +### Revert to a pushed directory + +To return to a pushed directory, type: +``` +`goto -o` +``` +or +``` +`goto --pop` +``` +**Note:** This command is equivalent to **popd** but within the **goto** command. + +## Troubleshooting + +If you see the error **command not found: compdef** in Zsh, it means you need to load **bashcompinit**. To do so, append this to your **.zshrc** file: +``` + + +autoload bashcompinit +bashcompinit + +``` +## Get involved + +The goto tool is open source under the [MIT License][4] terms, and contributions are welcomed. To learn more, visit the [Contributing][5] section in goto's GitHub repository. + +## The goto script +``` + + +goto() +{ +  local target +  _goto_resolve_db + +  if [ -z "$1" ]; then +    # display usage and exit when no args +    _goto_usage +    return +  fi + +  subcommand="$1" +  shift +  case "$subcommand" in +    -c|--cleanup) +      _goto_cleanup "$@" +      ;; +    -r|--register) # Register an alias +      _goto_register_alias "$@" +      ;; +    -u|--unregister) # Unregister an alias +      _goto_unregister_alias "$@" +      ;; +    -p|--push) # Push the current directory onto the pushd stack, then goto +      _goto_directory_push "$@" +      ;; +    -o|--pop) # Pop the top directory off of the pushd stack, then change that directory +      _goto_directory_pop +      ;; +    -l|--list) +      _goto_list_aliases +      ;; +    -x|--expand) # Expand an alias +      _goto_expand_alias "$@" +      ;; +    -h|--help) +      _goto_usage +      ;; +    -v|--version) +      _goto_version +      ;; +    *) +      _goto_directory "$subcommand" +      ;; +  esac +  return $? +} + +_goto_resolve_db() +{ +  GOTO_DB="${GOTO_DB:-$HOME/.goto}" +  touch -a "$GOTO_DB" +} + +_goto_usage() +{ +  cat <<\USAGE +usage: goto [<option>] <alias> [<directory>] + +default usage: +  goto <alias> \- changes to the directory registered for the given alias + +OPTIONS: +  -r, --register: registers an alias +    goto -r|--register <alias> <directory> +  -u, --unregister: unregisters an alias +    goto -u|--unregister <alias> +  -p, --push: pushes the current directory onto the stack, then performs goto +    goto -p|--push <alias> +  -o, --pop: pops the top directory from the stack, then changes to that directory +    goto -o|--pop +  -l, --list: lists aliases +    goto -l|--list +  -x, --expand: expands an alias +    goto -x|--expand <alias> +  -c, --cleanup: cleans up non existent directory aliases +    goto -c|--cleanup +  -h, --help: prints this help +    goto -h|--help +  -v, --version: displays the version of the goto script +    goto -v|--version +USAGE +} + +# Displays version +_goto_version() +{ +  echo "goto version 1.2.4.1" +} + +# Expands directory. +# Helpful for ~, ., .. paths +_goto_expand_directory() +{ +  builtin cd "$1" 2>/dev/null && pwd +} + +# Lists registered aliases. +_goto_list_aliases() +{ +  local IFS=$' ' +  if [ -f "$GOTO_DB" ]; then +    while read -r name directory; do +      printf '\e[1;36m%20s  \e[0m%s\n' "$name" "$directory" +    done < "$GOTO_DB" +  else +    echo "You haven't configured any directory aliases yet." +  fi +} + +# Expands a registered alias. +_goto_expand_alias() +{ +  if [ "$#" -ne "1" ]; then +    _goto_error "usage: goto -x|--expand <alias>" +    return +  fi + +  local resolved + +  resolved=$(_goto_find_alias_directory "$1") +  if [ -z "$resolved" ]; then +    _goto_error "alias '$1' does not exist" +    return +  fi + +  echo "$resolved" +} + +# Lists duplicate directory aliases +_goto_find_duplicate() +{ +  local duplicates= + +  duplicates=$(sed -n 's:[^ ]* '"$1"'$:&:p' "$GOTO_DB" 2>/dev/null) +  echo "$duplicates" +} + +# Registers and alias. +_goto_register_alias() +{ +  if [ "$#" -ne "2" ]; then +    _goto_error "usage: goto -r|--register <alias> <directory>" +    return 1 +  fi + +  if ! [[ $1 =~ ^[[:alnum:]]+[a-zA-Z0-9_-]*$ ]]; then +    _goto_error "invalid alias - can start with letters or digits followed by letters, digits, hyphens or underscores" +    return 1 +  fi + +  local resolved +  resolved=$(_goto_find_alias_directory "$1") + +  if [ -n "$resolved" ]; then +    _goto_error "alias '$1' exists" +    return 1 +  fi + +  local directory +  directory=$(_goto_expand_directory "$2") +  if [ -z "$directory" ]; then +    _goto_error "failed to register '$1' to '$2' - can't cd to directory" +    return 1 +  fi + +  local duplicate +  duplicate=$(_goto_find_duplicate "$directory") +  if [ -n "$duplicate" ]; then +    _goto_warning "duplicate alias(es) found: \\\n$duplicate" +  fi + +  # Append entry to file. +  echo "$1 $directory" >> "$GOTO_DB" +  echo "Alias '$1' registered successfully." +} + +# Unregisters the given alias. +_goto_unregister_alias() +{ +  if [ "$#" -ne "1" ]; then +    _goto_error "usage: goto -u|--unregister <alias>" +    return 1 +  fi + +  local resolved +  resolved=$(_goto_find_alias_directory "$1") +  if [ -z "$resolved" ]; then +    _goto_error "alias '$1' does not exist" +    return 1 +  fi + +  # shellcheck disable=SC2034 +  local readonly GOTO_DB_TMP="$HOME/.goto_" +  # Delete entry from file. +  sed "/^$1 /d" "$GOTO_DB" > "$GOTO_DB_TMP" && mv "$GOTO_DB_TMP" "$GOTO_DB" +  echo "Alias '$1' unregistered successfully." +} + +# Pushes the current directory onto the stack, then goto +_goto_directory_push() +{ +  if [ "$#" -ne "1" ]; then +    _goto_error "usage: goto -p|--push <alias>" +    return +  fi + +  { pushd . || return; } 1>/dev/null 2>&1 + +  _goto_directory "$@" +} + +# Pops the top directory from the stack, then goto +_goto_directory_pop() +{ +  { popd || return; } 1>/dev/null 2>&1 +} + +# Unregisters aliases whose directories no longer exist. +_goto_cleanup() +{ +  if ! [ -f "$GOTO_DB" ]; then +    return +  fi + +  while IFS= read -r i && [ -n "$i" ]; do +    echo "Cleaning up: $i" +    _goto_unregister_alias "$i" +  done <<< "$(awk '{al=$1; $1=""; dir=substr($0,2); +                    system("[ ! -d \"" dir "\" ] && echo " al)}' "$GOTO_DB")" +} + +# Changes to the given alias' directory +_goto_directory() +{ +  local target + +  target=$(_goto_resolve_alias "$1") || return 1 + +  builtin cd "$target" 2> /dev/null || \ +    { _goto_error "Failed to goto '$target'" && return 1; } +} + +# Fetches the alias directory. +_goto_find_alias_directory() +{ +  local resolved + +  resolved=$(sed -n "s/^$1 \\\\(.*\\\\)/\\\1/p" "$GOTO_DB" 2>/dev/null) +  echo "$resolved" +} + +# Displays the given error. +# Used for common error output. +_goto_error() +{ +  (>&2 echo -e "goto error: $1") +} + +# Displays the given warning. +# Used for common warning output. +_goto_warning() +{ +  (>&2 echo -e "goto warning: $1") +} + +# Displays entries with aliases starting as the given one. +_goto_print_similar() +{ +  local similar + +  similar=$(sed -n "/^$1[^ ]* .*/p" "$GOTO_DB" 2>/dev/null) +  if [ -n "$similar" ]; then +    (>&2 echo "Did you mean:") +    (>&2 column -t <<< "$similar") +  fi +} + +# Fetches alias directory, errors if it doesn't exist. +_goto_resolve_alias() +{ +  local resolved + +  resolved=$(_goto_find_alias_directory "$1") + +  if [ -z "$resolved" ]; then +    _goto_error "unregistered alias $1" +    _goto_print_similar "$1" +    return 1 +  else +    echo "${resolved}" +  fi +} + +# Completes the goto function with the available commands +_complete_goto_commands() +{ +  local IFS=$' \t\n' + +  # shellcheck disable=SC2207 +  COMPREPLY=($(compgen -W "-r --register -u --unregister -p --push -o --pop -l --list -x --expand -c --cleanup -v --version" -- "$1")) +} + +# Completes the goto function with the available aliases +_complete_goto_aliases() +{ +  local IFS=$'\n' matches +  _goto_resolve_db + +  # shellcheck disable=SC2207 +  matches=($(sed -n "/^$1/p" "$GOTO_DB" 2>/dev/null)) + +  if [ "${#matches[@]}" -eq "1" ]; then +    # remove the filenames attribute from the completion method +    compopt +o filenames 2>/dev/null + +    # if you find only one alias don't append the directory +    COMPREPLY=("${matches[0]// *}") +  else +    for i in "${!matches[@]}"; do +      # remove the filenames attribute from the completion method +      compopt +o filenames 2>/dev/null + +      if ! [[ $(uname -s) =~ Darwin* ]]; then +        matches[$i]=$(printf '%*s' "-$COLUMNS" "${matches[$i]}") + +        COMPREPLY+=("$(compgen -W "${matches[$i]}")") +      els \ No newline at end of file From e1c683242121cb7793991a55ca35754e11cdb387 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:57:11 +0800 Subject: [PATCH 473/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20Huawei?= =?UTF-8?q?=E2=80=99s=20Linux=20Distribution=20openEuler=20is=20Available?= =?UTF-8?q?=20Now!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md --- ...Distribution openEuler is Available Now.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md diff --git a/sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md new file mode 100644 index 0000000000..93c4330b52 --- /dev/null +++ b/sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Huawei’s Linux Distribution openEuler is Available Now!) +[#]: via: (https://itsfoss.com/openeuler/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Huawei’s Linux Distribution openEuler is Available Now! +====== + +Huawei offers a CentOS based enterprise Linux distribution called EulerOS. Recently, Huawei has released a community edition of EulerOS called [openEuler][1]. + +The source code of openEuler is released as well. You won’t find it on Microsoft owned GitHub – the source code is available at [Gitee][2], a Chinese [alternative of GitHub][3]. + +There are two separate repositories, one for the [source code][2] and the other as a [package source][4] to store software packages that help to build the OS. + +![][5] + +The openEuler infrastructure team shared their experience to make the source code available: + +> We are very excited at this moment. It was hard to imagine that we will manage thousands of repositories. And to ensure that they can be compiled successfully, we would like to thank all those who participated in contributing + +### openEuler is a Linux distribution based on CentOS + +Like EulerOS, openEuler OS is also based on [CentOS][6] but is further developed by Huawei Technologies for enterprise applications. + +It is tailored for ARM64 architecture servers and Huawei claims to have made changes to boost its performance. You can read more about it at [Huawei’s dev blog][7]. + +![][8] + +At the moment, as per the official openEuler announcement, there are more than 50 contributors with nearly 600 commits for openEuler. + +The contributors made it possible to make the source code available to the community. + +It is also worth noting that the repositories also include two new projects (or sub-projects) associated with it, [iSulad][9] **and A-Tune**. + +A-Tune is an AI-based OS tuning software and iSulad is a lightweight container runtime daemon that is designed for IoT and Cloud infrastructure, as mentioned on [Gitee][2]. + +Also, the official [announcement post][10] mentioned that these systems are built on the Huawei Cloud through script automation. So, that is definitely something interesting. + +### Downloading openEuler + +![][11] + +As of now, you won’t find the documentation for it in English – so you will have to wait for it or choose to help them with the [documentation][12]. + +You can download the ISO directly from its [official website][13] to test it out: + +[Download openEuler][13] + +### What do you think of Huawei openEuler? + +As per cnTechPost, Huawei had announced that EulerOS would become open source under the new name openEuler. + +At this point, it’s not clear if openEuler is replacing EulerOS or both will exist together like CentOS (community edition) and Red Hat (commercial edition). + +I haven’t tested it yet so I cannot say if openEuler is suitable for English speaking users or not. + +Are you willing to give this a try? In case you’ve already tried it out, feel free to let me know your experience with it in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/openeuler/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://openeuler.org/en/ +[2]: https://gitee.com/openeuler +[3]: https://itsfoss.com/github-alternatives/ +[4]: https://gitee.com/src-openeuler +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/openEuler-website.jpg?ssl=1 +[6]: https://www.centos.org/ +[7]: https://developer.huaweicloud.com/en-us/euleros/euleros-introduction.html +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/openeuler-gitee.jpg?ssl=1 +[9]: https://gitee.com/openeuler/iSulad +[10]: https://openeuler.org/en/news/20200101.html +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/openEuler.jpg?ssl=1 +[12]: https://gitee.com/openeuler/docs +[13]: https://openeuler.org/en/download.html From 2fde18756ccb5a314085545668e8b2a53dc0c5e8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:57:48 +0800 Subject: [PATCH 474/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200108=206=20re?= =?UTF-8?q?quirements=20of=20cloud-native=20software?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200108 6 requirements of cloud-native software.md --- ...6 requirements of cloud-native software.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/tech/20200108 6 requirements of cloud-native software.md diff --git a/sources/tech/20200108 6 requirements of cloud-native software.md b/sources/tech/20200108 6 requirements of cloud-native software.md new file mode 100644 index 0000000000..fcdbe9818c --- /dev/null +++ b/sources/tech/20200108 6 requirements of cloud-native software.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 requirements of cloud-native software) +[#]: via: (https://opensource.com/article/20/1/cloud-native-software) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +6 requirements of cloud-native software +====== +A checklist for developing and implementing cloud-native +(container-first) software. +![Team checklist][1] + +For many years, monolithic applications were the standard enterprise architecture for achieving business requirements. But that changed significantly once cloud infrastructure began treating business acceleration at scale and speed. Application architectures have also transformed to fit into the cloud-native applications and the [microservices][2], [serverless][3], and event-driven services that are running on immutable infrastructures across hybrid and multi-cloud platforms. + +### The cloud-native connection to Kubernetes + +According to the [Cloud Native Computing Foundation][4] (CNCF): + +> "Cloud native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach. +> +> "These techniques enable loosely coupled systems that are resilient, manageable, and observable. Combined with robust automation, they allow engineers to make high-impact changes frequently and predictably with minimal toil." + +Container orchestration platforms like [Kubernetes][5] allow DevOps teams to build immutable infrastructures to develop, deploy, and manage application services. The speed at which rapid iteration is possible now aligns with business needs. Developers building containers to run in Kubernetes need an effective place to do so. + +### Requirements for cloud-native software + +What capabilities are required to create a cloud-native application architecture, and what benefits will developers gain from it? + +While there are many ways to build and architect cloud-native applications, the following are some ingredients to consider: + + * **Runtimes:** They are more likely to be written in the container-first or/and Kubernetes-native language, which means runtimes such as Java, Node.js, Go, Python, and Ruby. + * **Security:** When deploying and maintaining applications in a multi-cloud or hybrid cloud application environment, security is of utmost importance and should be part of the environment. + * **Observability:** Use tools such as Prometheus, Grafana, and Kiali that can enhance observability by providing realtime metrics and more information about how applications are being used and behave in the cloud. + * **Efficiency:** Focus on a tiny memory footprint, small artifact size, and fast boot time to make applications portable across hybrid/multi-cloud platforms. + * **Interoperability:** Integrate cloud-native apps with open source technologies that enable you to meet the requirements listed above, including Infinispan, MicroProfile, Hibernate, Kafka, Jaeger, Prometheus, and more, for building standard runtime architectures. + * **DevOps/DevSecOps:** These methodologies are designed for continuous deployment to production, in-line with the minimum viable product (MVP) and with security as part of the tooling. + + + +### Making cloud-native concrete + +Cloud-native can seem like an abstract term, but reviewing the definition and thinking like a developer can make it more concrete. In order for cloud-native applications to be successful, they need to include a long, well-defined list of ingredients. + +How are you planning for cloud-native application design? Share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cloud-native-software + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) +[2]: https://opensource.com/resources/what-are-microservices +[3]: https://opensource.com/article/18/11/open-source-serverless-platforms +[4]: https://github.com/cncf/toc/blob/master/DEFINITION.md +[5]: https://opensource.com/resources/what-is-kubernetes From 97617dac363ed042ac5eb37338cfd2741aa08e8d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:58:21 +0800 Subject: [PATCH 475/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200108=20Automa?= =?UTF-8?q?ting=20the=20creation=20of=20research=20artifacts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200108 Automating the creation of research artifacts.md --- ...ting the creation of research artifacts.md | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 sources/tech/20200108 Automating the creation of research artifacts.md diff --git a/sources/tech/20200108 Automating the creation of research artifacts.md b/sources/tech/20200108 Automating the creation of research artifacts.md new file mode 100644 index 0000000000..e5d3f96163 --- /dev/null +++ b/sources/tech/20200108 Automating the creation of research artifacts.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automating the creation of research artifacts) +[#]: via: (https://opensource.com/article/20/1/automating-documentation) +[#]: author: (Kiko Fernandez-Reyes https://opensource.com/users/kikofernandez) + +Automating the creation of research artifacts +====== +A simple way to automate generating source code documentation, creating +HTML and PDF versions of user documentation, compiling a technical +(research) document to PDF, generating the bibliography, and +provisioning virtual machines. +![Files in a folder][1] + +In my work as a programming language researcher, I need to create [artifacts][2] that are easy to understand and well-documented. To make my work easier, I found a simple way to automate generating source code documentation, creating HTML and PDF versions of user documentation, compiling a technical (research) document to PDF, generating the bibliography, and provisioning of virtual machines with the software artefact installed for ease of reproducibility of my research. + +The tools I use are: + + * [Make][3] makefiles for overall orchestration of all components + * [Haddock][4] for generating source code documentation + * [Pandoc][5] for generating PDF and HTML files from a Markdown file + * [Vagrant][6] for provisioning virtual machines + * [Stack][7] for downloading Haskell dependencies, compiling, running tests, etc + * [pdflaTeX][8] for compiling a LaTeX file to PDF format + * [BibTeX][9] for generating a bibliography + * [Zip][10] to pack everything and get it ready for distribution + + + +I use the following folder and file structure: + + +``` +├── Makefile +├── Vagrantfile +├── code +│   └── typechecker-oopl (Project) +│       ├── Makefile +│       └── ... +│ +├── documentation +│   ├── Makefile +│   ├── README.md +│   ├── assets +│   │   ├── pandoc.css (Customised CSS for Pandoc) +│   │   └── submitted-version.pdf (PDF of your research) +│   └── meta.yaml +│ +├── research +│   ├── Makefile +│   ├── ACM-Reference-Format.bst +│   ├── acmart.cls +│   ├── biblio.bib +│   └── typecheckingMonad.tex +``` + +The Makefile glues together the output from all of the tools listed above. The **code** folder contains the source code of the tool/language I created. The **documentation** folder contains a Makefile that has instructions on how to generate PDF and HTML versions of the user instructions, located in the README.md file. I generate the PDF and HTML user documentation using Pandoc. The **assets** are simply the CSS style to use and a PDF of my research article that will be hyperlinked from the user-generated documentation, so that it is easy to follow. **meta.yaml** contains meta instructions for generating the user documentation, used by Pandoc for e.g., for author names. The **research** folder contains my research article in LaTeX format, but it could hold any other technical document. + +As you can see in the structure, I have a [Makefile][11] for each folder to decouple each Makefile's responsibility and keep a (somewhat) maintainable design. Here is an overview of the top-level Makefile, which orchestrates generating the user documentation, research paper, bibliography, documentation from source code, and provisioning of a virtual machine. + + +``` +all: doc gen + +doc: +        make -C $(DOC_SRC) $@ +        make -C $(CODE_PATH) $@ +        make -C $(RESEARCH) + +gen: +        # Creation of folder with artefact, empty at the moment +        mkdir -p $(ARTEFACT_FOLDER) + +        # Moving user documentation to artefact folder +        cp $(DOC_SRC)/$(README).pdf $(ARTEFACT_FOLDER) +        cp $(DOC_SRC)/$(README).html $(ARTEFACT_FOLDER) +        cp -r $(DOC_SRC)/$(ASSETS) $(ARTEFACT_FOLDER) + +        # Moving research article to artefact folder +        cp $(RESEARCH)/$(RESEARCH_PAPER).pdf $(ARTEFACT_FOLDER)/$(ASSETS)/submitted-version.pdf + +        # Moving code and autogenerated doc to artefact folder +        cp -r $(CODE_PATH) $(ARTEFACT_FOLDER) +        cd $(ARTEFACT_FOLDER)/$(CODE_SRC) +        $(STACK) +        cd ../.. +        rm -rf $(ARTEFACT_FOLDER)/$(DOC_SRC) +        mv $(ARTEFACT_FOLDER)/$(CODE_SRC)/$(HADDOCK) $(ARTEFACT_FOLDER)/$(DOC_SRC) + +        # zip it! +        zip $(ZIP_FILE) $(ARTEFACT_FOLDER) + +update: +        vagrant up +        vagrant provision + +clean: +        rm -rf $(ARTEFACT_FOLDER) + +.PHONY: all clean doc gen update +``` + +First, the **doc** target generates the user documentation using Pandoc, then it uses Haddock to generate the documentation from the Haskell library source code, and finally, it creates a PDF from the LaTeX file. As depicted in the image below, the generated user documentation is in HTML and CSS. The user documentation contains links to the generated source code documentation, also in HTML and CSS, and to the technical (research) paper . The generated source code documentation links directly to the source code, in case the reader would like to understand the implementation. + +![Artifact automation structure][12] + +The user documentation is generated with the following Makefile: + + +``` +DOCS=README.md +META=meta.yaml +NUMBER_SECTION_HEADINGS=-N + +.PHONY: all doc clean + +all: doc + +doc: $(DOC) +        pandoc -s $(META) $(DOCS) --listings --pdf-engine=xelatex -c assets/pandoc.css -o $(DOCS:md=pdf) +        pandoc -s $(META) $(DOCS) --self-contained -c assets/pandoc.css -o $(DOCS:md=html) + +clean: +        rm $(DOCS:md=pdf) $(DOCS:md=html) +``` + +To generate documentation from Haskell code, I use this other Makefile, which makes use of Stack to compile the library and download dependencies, and Haddock (inside its OPTS, or options) to create documentation in HMTL: + + +``` +OPTS=exec -- haddock --html --hyperlinked-source --odir=docs + +doc: +        stack $(OPTS) src/Initial/AST.hs src/Initial/Typechecker.hs \ +        src/Reader/AST.hs src/Reader/Typechecker.hs \ +        src/Backtrace/AST.hs src/Backtrace/Typechecker.hs \ +        src/Warning/AST.hs src/Warning/Typechecker.hs \ +        src/MultiError/AST.hs src/MultiError/Typechecker.hs \ +        src/PhantomFunctors/AST.hs src/PhantomFunctors/Typechecker.hs \ +        src/PhantomPhases/AST.hs src/PhantomPhases/Typechecker.hs \ +        src/Applicative/AST.hs src/Applicative/Typechecker.hs \ +        src/Final/AST.hs src/Final/Typechecker.hs + +.PHONY: doc +``` + +I compile the research paper from LaTeX to PDF with this simple Makefile: + + +``` +.PHONY: research + +research: +        pdflatex typecheckingMonad.tex +        bibtex typecheckingMonad +        pdflatex typecheckingMonad.tex +        pdflatex typecheckingMonad.tex +``` + +The virtual machine (VM) relies on Vagrant and the Vagrantfile, where I can write all the commands to set up the VM. The one thing that I do not know how to automate is moving all of the documentation, once it is generated, into the VM. If you know how to transfer the file from the host machine to the VM, please share your solution in the comments. That means that, currently, I manually enter in the VM and place the documentation in the Desktop folder. + + +``` +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| +  config.vm.box = "ubuntu/trusty64" +  config.ssh.username = "vagrant" +  config.ssh.password = "vagrant" +  config.vm.provider "virtualbox" do |vb| +    # Display the VirtualBox GUI when booting the machine +    vb.gui = true + +    # Customize the amount of memory on the VM: +    vb.memory = "2048" +    vb.customize ["modifyvm", :id, "--vram", "64"] +  end +  config.vm.provision "shell", inline: <<-SHELL +    ## Installing dependencies, comment after this has been done once. +    # sudo apt-get update -y +    # sudo apt-get install ubuntu-desktop -y +    # sudo apt-get install -y build-essential linux-headers-server + +    # echo 'PATH="/home/vagrant/.local/bin:$PATH"' >> /home/vagrant/.profile + +    ## Comment and remove the folder sharing before submission +    mkdir -p /home/vagrant/Desktop/TypeChecker +    cp -r /vagrant/artefact-submission/* /home/vagrant/Desktop/TypeChecker/ +    chown -R vagrant:vagrant /home/vagrant/Desktop/TypeChecker/ +  SHELL +end +``` + +With this final step, everything has been wired. You can see one example of the result [in HTML][13] and [in PDF][14]. I have created a [GitHub repo with all the source code][15] for ease of study and reproducibility. + +I have used this setup for two conferences—the European Conference on Object-Oriented Programming (ECOOP) and the International Conference on Software Language Engineering (SLE), where we won (in both) the Disguinshed Artifact Award. + +Pinterest software engineer Baogang Song tells us about Pinrepo, Pinterest's open source solution... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/automating-documentation + +作者:[Kiko Fernandez-Reyes][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kikofernandez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://en.wikipedia.org/wiki/Artifact_%28software_development%29 +[3]: https://en.wikipedia.org/wiki/Make_%28software%29 +[4]: https://www.haskell.org/haddock/ +[5]: https://pandoc.org/ +[6]: https://www.vagrantup.com/ +[7]: https://docs.haskellstack.org/en/stable/README/ +[8]: https://linux.die.net/man/1/pdflatex +[9]: http://www.bibtex.org/ +[10]: https://linux.die.net/man/1/zip +[11]: https://opensource.com/article/18/8/what-how-makefile +[12]: https://opensource.com/sites/default/files/uploads/makefile_pandoc_haddock.png (Artifact automation structure) +[13]: https://www.plresearcher.com/files/monadic-typechecker/README.html +[14]: https://www.plresearcher.com/files/monadic-typechecker/README.pdf +[15]: https://github.com/kikofernandez/pandoc-examples/tree/master/artefact-creation From 19eadcbbf2a66030e12856229b463f6a45cd897c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 00:58:49 +0800 Subject: [PATCH 476/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200108=20Detect?= =?UTF-8?q?ing=20CPU=20steal=20time=20in=20guest=20virtual=20machines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md --- ...PU steal time in guest virtual machines.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md diff --git a/sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md b/sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md new file mode 100644 index 0000000000..ed532cecd5 --- /dev/null +++ b/sources/tech/20200108 Detecting CPU steal time in guest virtual machines.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Detecting CPU steal time in guest virtual machines) +[#]: via: (https://opensource.com/article/20/1/cpu-steal-time) +[#]: author: (Jamie Fargen https://opensource.com/users/jamiefargen) + +Detecting CPU steal time in guest virtual machines +====== +Is your VM getting all of its vitamin CPU? Use GNU top to find out +what's causing guest performance issues. +![and old computer and a new computer, representing migration to new software or hardware][1] + +CPU steal time is defined in the [GNU **top**][2] command as "time stolen from [a] VM by the hypervisor." CPU steal time occurs when a hypervisor process and a guest instance are trying to utilize the same hypervisor physical core (pCPU) at the same time. This results in less processor time available to the guest's virtual CPU (vCPU) and performance degradation for the guest. + +In today's virtualized environments (which have become nearly universal with the adoption of public and private clouds), a guest instance can experience performance CPU steal time under several scenarios: + + * Oversubscription of the hypervisor and multiple guest VMs' vCPUs with high CPU utilization are running on the same pCPUs. + * The guest vCPU and its emulator thread are pinned to the same pCPU resulting in vhost processes stealing CPU time from the guest vCPU while processing I/O. + * Hypervisor processes, like monitoring, logging, and I/O processes, are concurrently using a pCPU that is also in use by a guest VM vCPU. + + + +Normally, a systems engineer brought in to investigate an application or system performance issue will find that the system's performance is degraded due to CPU time stolen from the guest. The guest's performance issues usually become apparent in the form of low disk or network I/O performance, network packet loss, and other application performance anomalies. + +Even when a system administrator is observing the guest and the hypervisor, it can be difficult to narrow down the cause of the guest instance's degraded performance due to CPU steal time. There are a few reasons for the difficulty. First, CPU steal time is not logged by any of the commonly monitored log files. A hypervisor that is being observed may be expected to be under heavy load but steal time can occur on hypervisors that are under normal load. And finally, administrators may not be aware that hypervisor CPU contention can be observed from within the guest VM instance using GNU top. + +Fortunately, GNU top indeed makes it quite easy to detect CPU steal time on a guest VM instance. Steal time is displayed in top's output at the end of line 3, which beings with **%Cpu(s)**, as shown in the following screenshots (it is the value at the end, labeled **st**.) The first example shows a guest with little steal time: + +![Output of the top command showing low CPU steal time][3] + +Output of the top command from a guest experiencing a low CPU steal time of 0.2 st. + +This screenshot shows a guest experiencing heavy CPU steal time: + +![Output of the top command showing high CPU steal time][4] + +Output of the top command from a guest experiencing a heavy CPU steal time of 9.0 st. + +In both examples, the stress tool was executed with four processes that consumed all four vCPUs of the guest instance. In the first example, the hypervisor was relatively idle, so the guest's steal time was just 0.2. But in the second example, the stress tool was executed at the same time on the hypervisor with eight processes that consumed all eight of the hypervisors' pCPUs, which produced a high CPU steal time of 9.0. + +There is another sign of steal time in the second example: the stress utility process cannot consume ~100% of the guests' vCPUs; it can only consume 99.3%, 99.3%, 86.4%, and 74.4%, respectively. In total, this is equal to 40.3% of a guest vCPU's being stolen. This is because the hypervisor is consuming cycles on the same pCPUs that the guest vCPU's processes are using. + +### Using top to mitigate poor performance + +This example shows how the oversubscription of guest VM instances and other processes on a hypervisor can contend with a guest, and how to use GNU top to detect it based on the CPU steal time percentage on a guest VM. + +It is important to detect this type of performance degradation in a guest VM so that you can mitigate the cause of poor system and application performance. In a public cloud, the only solution might be migrating the instance or changing to an instance type with guaranteed pCPU service-level agreements (SLAs). In a private cloud, there are more options, but again, the simplest approach may be to migrate the instance to a hypervisor with lower utilization. However, if many guest instances experience high CPU steal time, you will need to make changes to how guests' and hypervisors' processes are managed to attain guest instances' performance SLAs. + +David Both explains the importance of keeping hardware cool and shares some Linux tools that can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/cpu-steal-time + +作者:[Jamie Fargen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamiefargen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q (and old computer and a new computer, representing migration to new software or hardware) +[2]: https://en.wikipedia.org/wiki/Top_(software) +[3]: https://opensource.com/sites/default/files/uploads/cpu-steal-time_1.png (Output of the top command showing low CPU steal time) +[4]: https://opensource.com/sites/default/files/uploads/cpu-steal-time_2.png (Output of the top command showing high CPU steal time) From ee350a59516a6c51bce189bc7e0a8300bb70af6f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 01:01:41 +0800 Subject: [PATCH 477/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Genera?= =?UTF-8?q?ting=20numeric=20sequences=20with=20the=20Linux=20seq=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200107 Generating numeric sequences with the Linux seq command.md --- ...ic sequences with the Linux seq command.md | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 sources/tech/20200107 Generating numeric sequences with the Linux seq command.md diff --git a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md new file mode 100644 index 0000000000..9375e70fa6 --- /dev/null +++ b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Generating numeric sequences with the Linux seq command) +[#]: via: (https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Generating numeric sequences with the Linux seq command +====== +The Linux seq command can generate lists of numbers and at lightning speed. It's easy to use and flexible, too. +[Jamie][1] [(CC BY 2.0)][2] + +One of the easiest ways to generate a list of numbers in Linux is to use the **seq** (sequence) command. In its simplest form, **seq** will take a single number and then list all the numbers from 1 to that number. For example: + +``` +$ seq 5 +1 +2 +3 +4 +5 +``` + +Unless directed otherwise, **seq** always starts with 1. You can start a sequence with a different number by inserting it before the final number. + +``` +$ seq 3 5 +3 +4 +5 +``` + +### Specifying an increment + +You can also specify an increment. Say you want to list multiples of 3. Specify your starting point (first 3 in this example), increment (second 3) and end point (18). + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +$ seq 3 3 18 +3 +6 +9 +12 +15 +18 +``` + +You can elect to go from larger to smaller numbers by using a negative increment (i.e., a decrement). + +``` +$ seq 18 -3 3 +18 +15 +12 +9 +6 +3 +``` + +The **seq** command is also very fast. You can probably generate a list of a million numbers in under 10 seconds. + +Advertisement + +``` +$ time seq 1000000 +1 +2 +3 +… +… +999998 +999999 +1000000 + +real 0m9.290s <== 9+ seconds +user 0m0.020s +sys 0m0.899s +``` + +## Using a separator + +Another very useful option is to use a separator. Instead of listing a single number on each line, you can insert commas, colons or some other characters. The -s option followed by the character you wish to use. + +``` +$ seq -s: 3 3 18 +3:6:9:12:15:18 +``` + +In fact, if you simply want your numbers to be listed on a single line, you can use a blank as your separator in place of the default linefeed. + +**[ Also see [Invaluable tips and tricks for troubleshooting Linux][4]. ]** + +``` +$ seq -s' ' 3 3 18 +3 6 9 12 15 18 +``` + +### Getting to the math + +It may seem like a big leap to go from generating a sequence of numbers to doing math, but given the right separators, **seq** can easily prepare calculations that you can pass to **bc**. For example: + +``` +$ seq -s* 5 | bc +120 +``` + +What is going on in this command? Let’s take a look. First, **seq** is generating a list of numbers and using * as the separator. + +``` +$ seq -s* 5 +1*2*3*4*5 +``` + +It’s then passing the string to the calculator (**bc**) which promptly multiplies the numbers. And you can do a fairly extensive calculation in a fraction of a second. + +``` +$ time seq -s* 117 | bc +39699371608087208954019596294986306477904063601683223011297484643104\ +22041758630649341780708631240196854767624444057168110272995649603642\ +560353748940315749184568295424000000000000000000000000000 + +real 0m0.003s +user 0m0.004s +sys 0m0.000s +``` + +### Limitations + +You only get to choose one separator, so your calculations will be very limited. Use **bc** by itself for more complicated math. In addition, **seq** only works with numbers. To generate a sequence of single letters, use a command like this instead: + +``` +$ echo {a..g} +a b c d e f g +``` + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://creativecommons.org/licenses/by/2.0/ +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 535f97f782d7e1d8f43fdefb4662e1d6f0b38bc9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 01:02:19 +0800 Subject: [PATCH 478/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Resear?= =?UTF-8?q?chers=20aim=20for=20transistors=20that=20compute=20and=20store?= =?UTF-8?q?=20in=20one=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md --- ...that compute and store in one component.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md diff --git a/sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md b/sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md new file mode 100644 index 0000000000..6a0bb4f471 --- /dev/null +++ b/sources/talk/20200107 Researchers aim for transistors that compute and store in one component.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Researchers aim for transistors that compute and store in one component) +[#]: via: (https://www.networkworld.com/article/3510638/researchers-aim-to-build-transistors-that-can-compute-and-store-information-in-one-component.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Researchers aim for transistors that compute and store in one component +====== +Materials incompatibilities have stalled efforts to integrate transistors and memory in a single on-chip, commercial component. That might be about to change. +iStock + +Researchers at Purdue University have made progress towards an elusive goal: building a transistor that can both process and store information. In the future, a single on-chip component could integrate the processing functions of transistors with the storage capabilities of ferroelectric RAM, potentially creating a process-memory combo that enables faster computing and is just atoms thick. + +The ability to cram more functions onto a chip, allowing for greater speed and power without increasing the footprint, is a core goal of electronics design. To get where they are today, engineers at Purdue had to overcome incompatibilities between transistors – the switching and amplification mechanisms used in almost all electronics – and ferroelectric RAM. Ferroelectric RAM is higher-performing memory technology; the material introduces non-volatility, which means it retains information when power is lost, unlike traditional dielectric-layer-constructed DRAM. + +**SEE ALSO:** [Researchers experiment with glass-based storage that doesn't require electronics cooling][1] + +In the past, materials conflicts have hampered the design of commercial electronics that integrate transistors and memory. “Researchers have been trying for decades to integrate the two, but issues happen at the interface between a ferroelectric material and silicon, the semiconductor material that makes up transistors. Instead, ferroelectric RAM operates as a separate unit on-chip, limiting its potential to make computing much more efficient,” Purdue explains in a [statement][2]. + +**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][3] ]** + +A team of engineers at Purdue, led by Peide Ye, came up with a solution: “We used a semiconductor that has ferroelectric properties. This way two materials become one material, and you don’t have to worry about the interface issues,” said Ye, who is a professor of electrical and computer engineering at the university. + +The Purdue engineers’ method revolves around a material called alpha indium selenide. It has ferroelectric properties, but it overcomes a limitation of conventional ferroelectric material, which generally acts as an insulator and doesn’t allow electricity to pass through. The alpha indium selenide material can become a semiconductor, which is necessary for the transistor element, and a room-temperature-stable, low voltage-requiring ferroelectric component, which is needed for the ferroelectric RAM. + +Advertisement + +Alpha indium selenide has a smaller band gap than other materials, the university explains. Band gaps are where no electrons can exist. That shrunken band gap, found in the material natively, means that material isn’t a serious insulator and isn’t too thick for electrical current to pass through — yet there is still a ferroelectric layer. The smaller band gap “[makes] it possible for the material to be a semiconductor without losing ferroelectric properties,” according to Purdue. + +“The result is a so-called ferroelectric semiconductor field-effect transistor, built in the same way as transistors currently used on computer chips.” + +More information is available [here][2]. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3510638/researchers-aim-to-build-transistors-that-can-compute-and-store-information-in-one-component.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3488556/researchers-experiment-with-glass-based-storage-that-doesnt-require-electronics-cooling.html +[2]: https://www.purdue.edu/newsroom/releases/2019/Q4/reorganizing-a-computer-chip-transistors-can-now-both-process-and-store-information.html +[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 527cdab9d4822f2da562833a4b53371e90007c78 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 9 Jan 2020 01:03:09 +0800 Subject: [PATCH 479/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200107=20Wi-Fi?= =?UTF-8?q?=206=20is=20slowly=20gathering=20steam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md --- ...00107 Wi-Fi 6 is slowly gathering steam.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md diff --git a/sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md b/sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md new file mode 100644 index 0000000000..cc11b7fdc8 --- /dev/null +++ b/sources/talk/20200107 Wi-Fi 6 is slowly gathering steam.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Wi-Fi 6 is slowly gathering steam) +[#]: via: (https://www.networkworld.com/article/3512153/wi-fi-6-will-slowly-gather-steam-in-2020.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Wi-Fi 6 is slowly gathering steam +====== +There’s a lot to look forward to about 802.11ax, aka Wi-Fi 6, just don’t expect it to be a top-to-bottom revolution in 2020. +Thinkstock + +The next big wave of Wi-Fi technology, 802.11ax, is going to become more commonplace in enterprise installations over the course of the coming year, just as the marketing teams for the makers of Wi-Fi equivalent will have you believe. Yet the rosiest predictions of revolutionary change in what enterprise Wi-Fi is capable of are still a bit farther off than 2020, according to industry experts. + +The crux of the matter is that, while access points with 802.11ax’s Wi-Fi 6 branding will steadily move into enterprise deployments in, the broader Wi-Fi ecosystem will not be dominated by the new standard for several years, according to Farpoint Group principal Craig Mathias. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] [][2] + +“Keep in mind, we’ve got lots and lots of people that are still in the middle of deploying [802.11]ac,” he said, referring to the previous top-end Wi-Fi standard. The deployment of 802.11ax will tend to follow the same pattern as the deployment of 802.11ac and, indeed, most [previous new Wi-Fi standards][3]. The most common scenario will be businesses waiting for a refresh cycle, testing the new technology and then rolling it out. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +In the near term, enterprises installing 802.11ax access points will bring performance increases – the system’s [MU-MIMO][5] antenna technology is more advanced than that present in previous versions of the Wi-Fi standard, and better suited to high-density environments with large numbers of endpoints connecting at the same time. Yet those increases will be small compared to those that will ensue once 802.11ax endpoints – that is, phones, tablets, computers and more specialized devices like [IoT][6] sensors and medical devices – hit the market. + +That, unfortunately, is still some way off, and Mathias said it will take around five years for 802.11ax to become ubiquitous. + +Advertisement + +“We’re not expecting a lot of [802.11]ax devices for a while,” he said. + +Making sure devices are compliant with modern Wi-Fi standards will be crucial in the future, though it shouldn’t be a serious issue that requires a lot of device replacement outside of fields that are using some of the aforementioned specialized endpoints, like medicine. Healthcare, heavy industry and the utility sector all have much longer-than-average expected device lifespans, which means that some may still be on 802.11ac. + +That’s bad, both in terms of security and throughput, but according to Shrihari Pandit, CEO of Stealth Communications, a fiber ISP based in New York, 802.11ax access points could still prove an advantage in those settings thanks to the technology that underpins them. + +“Wi-Fi 6 devices have eight radios inside them,” he said. “MIMO and beamforming will still mean a performance upgrade, since they’ll handle multiple connections more smoothly.” + +A critical point is that some connected devices on even older 802.11 versions – n, g, and even b in some cases – won’t be able to benefit from the numerous technological upsides of the new standard. Making sure that a given network is completely cross-compatible will be a central issue for IT staff looking to realize performance gains on networks that service legacy gear.” + +Pandit said that, increasingly, data-hungry customers like tech companies are looking to 802.11ax to act as a wireline replacement for those settings. “Lots of the tech companies we service here, some of them want Wi-Fi 6 so that they can use gigabit performance without having to run wires,” he said. + +Whether it goes by Wi-Fi 6 or 802.11ax, the next generation of Wi-Fi technology is likely to be marketed a bit differently than new Wi-Fi standards have been in the past, according to Mathias. It’s less about the mere fact that there’s a new Wi-Fi standard providing faster connectivity, and more about enabling new functionality that 802.11ax makes possible, including better handling of IoT devices and integration with AI/machine learning systems. + +Luckily, prices for top-end Wi-Fi equipment shouldn’t change much compared to the current top of the line, making it easy for almost any organization to budget for the switch. + +“We’re not expecting anyone to pay a premium for [802.11ax],” said Mathias. + +**Now see ["How to determine if Wi-Fi 6 is right for you"][2]** + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3512153/wi-fi-6-will-slowly-gather-steam-in-2020.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html +[3]: https://www.networkworld.com/article/3238664/80211-wi-fi-standards-and-speeds-explained.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3256905/13-things-you-need-to-know-about-mu-mimo-wi-fi.html +[6]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 8e70dfcf9da63cf7f69f25de3ae0b65060e0daa3 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Thu, 9 Jan 2020 01:03:43 +0800 Subject: [PATCH 480/676] =?UTF-8?q?=E7=BF=BB=E8=AF=9180%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...181105 5 Minimal Web Browsers for Linux.md | 55 +++++++++---------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index 34c0c1e18e..e71e21ac1e 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -7,79 +7,73 @@ [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) [#]: url: ( ) -5 Minimal Web Browsers for Linux -====== + linux上的五种微型浏览器 ====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) -There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. 有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 -The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 -There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. 但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 -Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. 让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! ### GNOME Web -GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 -Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: +Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: - * Simplicity - Feature bloat and user interface clutter are considered evil. + * Simplicity简单性 - Feature bloat and user interface clutter are considered evil功能复杂和用户界面混乱都是不被允许的. - * Standards compliance - No non-standard features will ever be introduced to the codebase. + * 规范性 - 任何非标准特性都不会引入到代码库中。 - * Software freedom - Epiphany will always be released under a license that respects freedom. + * 软件开源 - Epiphany始终遵守自由开源许可证。 - * Human interface - Epiphany follows the [GNOME Human Interface Guidelines][6]. + * 人机交互 - Epiphany 始终遵守[GNOME的人机交互指南][6]。 - * Minimal preferences - Preferences are only added when they make sense and after careful consideration. + * 最小首选项 - 经过慎重考虑才添加首选项。 - * Target audience - Non-technical users are the primary target audience (which helps to define the types of features that are included). + * 受众群体 - 非技术用户是主要的受众目标,(有助于定义所包含功能的类型)。 -GNOME Web is as clean and simple a web browser as you’ll find (Figure 1). +GNOME web浏览器就像看到的一样干净简洁 (Figure 1)。 + ![GNOME Web][8] -Figure 1: The GNOME Web browser displaying a minimal amount of preferences for the user. +Figure 1: GNOME 浏览器为用户展示最少的首选项. -[Used with permission][9] +[许可证书][9] -The GNOME Web manifesto reads: - -A web browser is more than an application: it is a way of thinking, a way of seeing the world. Epiphany's principles are simplicity, standards compliance, and software freedom. +GNOME Web 的声明如下: +web 浏览器它不仅仅是一个应用程序,还是一种思维方式,一种看世界的方式。 Epiphany 的原则是简洁,标准和自由。 ### Netsurf -The [Netsurf][10] minimal web browser opens almost faster than you can release the mouse button. Netsurf uses its own layout and rendering engine (designed completely from scratch), which is rather hit and miss in its rendering (Figure 2). +[Netsurf][10] 浏览器是最小的浏览器,他的打开速度几乎和你松开鼠标一样。Netsurf 使用自己的布局和渲染引擎(完全从零开始设计的) 在渲染过程的设计中屡屡碰壁(Figure 2). ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) -Although you might find Netsurf to suffer from rendering issues on certain sites, understand the Hubbub HTML parser is following the work-in-progress HTML5 specification, so there will be issues popup now and then. To ease those rendering headaches, Netsurf does include HTTPS support, web page thumbnailing, URL completion, scale view, bookmarks, full-screen mode, keyboard shorts, and no particular GUI toolkit requirements. That last bit is important, especially when you switch from one desktop to another. +尽管你可能在特定的站点上发现 Netsurf的问题,但如果你了解Hubbub解析器的话,知道它正在兼容html5规范,是不是的会有一点问题。Netsurf对https的支持,网页缩略图,URL解析,缩放视图,书签,全屏模式,快捷键和GUI的工具包的功能;最后一点十分重要,当你桌面来回切换时,为了缓解渲染带来的问题。 -For those curious as to the requirements for Netsurf, the browser can run on a machine as slow as a 30Mhz ARM 6 computer with 16MB of RAM. That’s impressive, by today’s standard. +对于那些对Netsurf 存在好奇的人来说,以现在的标准,他能在 16MB内存,30Mhz的ARM cpu的机器上运行,是让人惊奇的。 ### QupZilla -If you’re looking for a minimal browser that uses the Qt Framework and the QtWebKit rendering engine, [QupZilla][11] might be exactly what you’re looking for. QupZilla does include all the standard features and functions you’d expect from a web browser, such as bookmarks, history, sidebar, tabs, RSS feeds, ad blocking, flash blocking, and CA Certificates management. Even with those features, QupZilla still manages to remain a very fast lightweight web browser. Other features include: Fast startup, speed dial homepage, built-in screenshot tool, browser themes, and more. -One feature that should appeal to average users is that QupZilla has a more standard preferences tools than found in many lightweight browsers (Figure 3). So, if going too far outside the lines isn’t your style, but you still want something lighter weight, QupZilla is the browser for you. +如果你找寻使用Qt Framework 和 the QtWebKit 渲染引擎的最小浏览器,QupZilla][11]是你最佳的选择。QupZilla 包含web浏览所有的标准功能,例如:书签,历史记录,侧边栏,选项卡,RSS,广告屏蔽,flash屏蔽,和CA证书管理。及时拥有这么多的功能,QupZilla 仍然是快速,轻量级的浏览器。另外还有其他的功能:快速启动,快速拨号主页,内置屏幕截图工具,浏览器主题等。 +吸引用户的一点是,与许多轻量级浏览器相比,QupZilla有更标准的首选项工具(图3)。所以,如果你很多功能,但你仍然想要更轻量,那么QupZilla就是你最好的选择。 ![QupZilla][13] -Figure 3: The QupZilla preferences tool. +Figure 3: QupZilla 首选项工具. -[Used with permission][9] +[许可证书][9] ### Otter Browser @@ -130,11 +124,12 @@ Figure 5: The Lynx browser rendering the Linux.com page. I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). -### Plenty More Where This Came From +### Plenty More Where This Came From 更多 -There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not. +There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not.微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. +了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 -------------------------------------------------------------------------------- @@ -142,7 +137,7 @@ via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-li 作者:[Jack Wallen][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[MonkeyDEcho](https://github.com/MonkeyDEcho) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 63e67a8c6b71839c423ddaf6f8c03c6be2639aeb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 9 Jan 2020 07:49:22 +0800 Subject: [PATCH 481/676] Rename sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md to sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md --- ...0109 Huawei-s Linux Distribution openEuler is Available Now.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200109 Huawei-s Linux Distribution openEuler is Available Now.md (100%) diff --git a/sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md similarity index 100% rename from sources/tech/20200109 Huawei-s Linux Distribution openEuler is Available Now.md rename to sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md From d70944391b3315f9b20ee1ceb0111473b81cffb4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 9 Jan 2020 07:56:49 +0800 Subject: [PATCH 482/676] PRF @geekpi --- ...al- A Secure, Open Source Messaging App.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md index 812a97f32f..a9d70b7f96 100644 --- a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md +++ b/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Signal: A Secure, Open Source Messaging App) @@ -10,7 +10,7 @@ Signal:安全、开源的聊天应用 ====== -** _简介:Signal 是一款智能手机上的安全开源聊天应用。它还提供了适用于 Linux、Windows 和 macOS 的独立桌面应用。在本文中,我们来看看它的功能和可用性。_** +> Signal 是一款智能手机上的安全开源聊天应用。它还提供了适用于 Linux、Windows 和 macOS 的独立桌面应用。在本文中,我们来看看它的功能和可用性。 ### 对于关注隐私的人来说,Signal 是 WhatsApp(和 Telegram)的绝佳替代品 @@ -20,11 +20,13 @@ Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样 它可能没有 Telegram 或 WhatsApp 这么多的功能。但是,如果你想在交流时增强隐私,这是一个可靠的开源方案。 -你可以在智能手机(iOS][3]/[Android][4])上安装,也可以在 Linux、Windows 和 macOS 上安装。 +你可以在智能手机([iOS][3]/[Android][4])上安装,也可以在 Linux、Windows 和 macOS 上安装。 ### Signal 的功能 -**注意:** _某些功能是智能手机特有的。你可能无法在桌面应用上看到所有功能。_ +**注意:** 某些功能是智能手机特有的。你可能无法在桌面应用上看到所有功能。 + +另请注意,目前,Signal 需要电话号码才能注册。如果你不想公开自己的私人电话号码,则可以使用 Google 语音或类似服务。 正如我已经提到的,这是为增强你的隐私而量身定制的。因此,用户体验可能不是你见过“最佳”的。但是,从隐私/安全角度考虑,我认为这是一个不错的选择。 @@ -38,7 +40,7 @@ Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样 #### 用作默认短信应用 -如果你想在短信中使用开源应用,那么只需口进入 Signal 的设置,并将其设置为短信和彩信的默认设置。 +如果你想在短信中使用开源应用,那么只需进入 Signal 的设置,并将其设置为短信和彩信的默认设置。 #### 屏幕安全 @@ -64,15 +66,13 @@ Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样 ![][6] -如你所期待的聊天应用,你可以使用几个标签,并且可以根据需要创建一个组。 - -但是,你无法管理你的组,你只能添加成员和更改群头像。 +如你所期待的聊天应用,你可以使用几个标签,并且可以根据需要创建一个组。但是,你无法管理你的组,你只能添加成员和更改群头像。 此外,Signal 还为其应用支持生物识别。 ### 在 Ubuntu/Linux 上安装 Signal -不幸的是,你无法在你的 Linux 发行版上找到 .**deb** 或者 .**AppImage**。因此,你需要根据[官方安装说明][7]在终端上安装。 +不幸的是,你无法在你的 Linux 发行版上找到 .deb 或者 .AppImage。因此,你需要根据[官方安装说明][7]在终端上安装。 在终端中输入以下内容: @@ -105,7 +105,7 @@ via: https://itsfoss.com/signal-messaging-app/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 18eedba7e573051ecf28bc5572210b1eddbd718a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 9 Jan 2020 07:57:16 +0800 Subject: [PATCH 483/676] PUB @geekpi https://linux.cn/article-11764-1.html --- .../20200101 Signal- A Secure, Open Source Messaging App.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200101 Signal- A Secure, Open Source Messaging App.md (98%) diff --git a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md b/published/20200101 Signal- A Secure, Open Source Messaging App.md similarity index 98% rename from translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md rename to published/20200101 Signal- A Secure, Open Source Messaging App.md index a9d70b7f96..4248470b90 100644 --- a/translated/tech/20200101 Signal- A Secure, Open Source Messaging App.md +++ b/published/20200101 Signal- A Secure, Open Source Messaging App.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11764-1.html) [#]: subject: (Signal: A Secure, Open Source Messaging App) [#]: via: (https://itsfoss.com/signal-messaging-app/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From db6842b0a1e8e3ff637473dc194107f260fc5281 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 9 Jan 2020 08:51:50 +0800 Subject: [PATCH 484/676] translated --- ...y Pi retrospective- 6 projects and more.md | 67 ------------------- ...y Pi retrospective- 6 projects and more.md | 65 ++++++++++++++++++ 2 files changed, 65 insertions(+), 67 deletions(-) delete mode 100644 sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md create mode 100644 translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md diff --git a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md deleted file mode 100644 index 181276fb45..0000000000 --- a/sources/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md +++ /dev/null @@ -1,67 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (My Raspberry Pi retrospective: 6 projects and more) -[#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) -[#]: author: (Anderson Silva https://opensource.com/users/ansilva) - -My Raspberry Pi retrospective: 6 projects and more -====== -See what I've done with the fun, educational, and useful Raspberry Pi. -![Raspberry Pi 4 board, posterized filter][1] - -Historically and theoretically speaking, a decade, a century, or a millennium starts when the clock turns midnight on January 1 of the year one of its decimal order. For example, the 20th century started on January 1, 1901, not on January 1, 1900. The reason for this is simple: there is no year 0 in our modern calendar, so these periods of time start on year 1 (using the Gregorian calendar). But that's not how we refer to time periods colloquially and culturally; for example, when we mention '80s music or movies, we're talking about the period from 1980 to 1989. - -The recently passed 2010s, I could argue, was the decade of the cloud, social media, mobile technology, and the Internet of Things (IoT), which includes the [Raspberry Pi][2]. Recently, _Time_ magazine called the Raspberry Pi one of the [10 best gadgets of the past decade][3]. And I very much agree. - -The original Raspberry Pi launched in 2012, and it took me a couple of years to jump on the bandwagon and ride on the Pi-train. But since then, I have built many fun educational projects at home and even documented a few of them for Opensource.com. - -### The Christmas light trilogy - -I wrote three articles over three years that explored controlling Christmas lights with the Raspberry Pi and the open source project LightShowPi. The first article, [_Create your own musical light show with Raspberry Pi_][4], was a mix between a very basic introduction to electronics development and building a Christmas light show. The second article, [_SSH into your Christmas tree with Raspberry Pi_][5], went a little deeper into controlling the lights with things such as remote management and electronic buttons. The last chapter of the trilogy, [_Set the holiday mood with your Raspberry Pi_][6], reviewed changes introduced in the LightShowPi project in the prior year. - -### DIY projects - -Over the years, I've turned my Raspberry Pi into several useful devices. One time, I turned the Pi into a [music-playing device with the Pi MusicBox][7], which allows you to plug your favorite music streaming services into a common web interface and play your favorite tunes around the house. - -Making the Raspberry Pi into a [mobile video recording device][8] was another DIY project I put together. It required a few extra pieces of hardware, like a touchscreen, a Pi Camera, and a battery pack, but it worked. One of the biggest drawbacks of this setup was the small amount of memory available on the Pi at the time. I think the capabilities of this little portable camera could be a lot better if I re-did it on a Raspberry Pi 4 with 4GB of RAM. This may be a project to revisit in 2020. - -Another small project I built, a [digital clock for my living room][9], used the small Adafruit PiTFT screen. As simple as this project was, it probably was the one that I used the longest. That clock stood by my TV set for over a year, running 24 hours a day… until the day the screen burned out. - -### The Pi Day series - -Last but not least, in 2019, I contributed [14 articles in 14 days][10] leading up to Pi Day (March 14). This was by far the most challenging writing project I've ever done, but it allowed me to cover many different topics and hopefully expose readers to even more ideas about the versatility of the Raspberry Pi. - -### To infinity and beyond - -I don't know anyone in the Raspberry Pi Foundation, so I don't have any special access to its roadmaps and future plans. I could (but I won't) speculate on what the future holds for the brand and its devices that have allowed so many people of different social statuses around the world to expand their knowledge about computer science, electronics, and open source development. All I hope is for the foundation's management to stay true to its vision and mission and continue making affordable technology for people everywhere. - -The 2010s are over, and what a sweet decade it was. To me, it smelled like pie, raspberry pie. - -Having recently co-authored a book about building things with the Raspberry Pi ( Raspberry Pi Hacks... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/raspberry-pi-best - -作者:[Anderson Silva][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ansilva -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi4_board_hardware.jpg?itok=KnFU7NvR (Raspberry Pi 4 board, posterized filter) -[2]: https://www.raspberrypi.org/ -[3]: https://time.com/5745302/best-gadgets-of-the-2010s-decade/?utm_source=reddit.com -[4]: https://opensource.com/life/15/2/music-light-show-with-raspberry-pi -[5]: https://opensource.com/life/15/12/ssh-your-christmas-tree-raspberry-pi -[6]: https://opensource.com/article/18/12/lightshowpi-raspberry-pi -[7]: https://opensource.com/life/15/3/pi-musicbox-guide -[8]: https://opensource.com/life/15/9/turning-raspberry-pi-portable-streaming-camera -[9]: https://opensource.com/article/17/7/raspberry-pi-clock -[10]: https://opensource.com/article/19/3/happy-pi-day diff --git a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md new file mode 100644 index 0000000000..2e3d16258d --- /dev/null +++ b/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Raspberry Pi retrospective: 6 projects and more) +[#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +我的树莓派回顾:不止 6 个项目 +====== +看看我在有趣的、有教育意义和有用的树莓派上做了什么。 +![Raspberry Pi 4 board, posterized filter][1] + +从历史和理论上讲,十年、一个世纪或一千年从十进制一那年的 1 月 1 日物业开始。例如,20 世纪始于 1901 年 1 月 1 日,而不是 1900 年 1 月 1 日。原因很简单:现代日历中没有 0 年,因此这些时间段始于 1 年(使用公历)。但这不是我们在口语上和文化上指代时间段的方式。例如,当我们提到 80 年代的音乐或电影时,我们所说的是 1980 年至 1989 年。 + +我可以说,最近过去的 21 世纪 10 年代是云计算、社交媒体、移动技术和物联网 (IoT) 的十年,这其中包括[树莓派][2]。最近,《时代》杂志将树莓派称为[过去十年中 10 个最佳小玩意][3]之一。我非常同意这点。 + +最初的树莓派于 2012 年推出,我过了几年才使用上了它。但是从那以后,我在家中做了许多有趣的教育项目,甚至在 Opensource.com 中记录了一些。 + +### 圣诞灯三部曲 + +三年来,我写了三篇探讨如何使用树莓派和开源项目 LightShowPi 控制圣诞灯的文章。第一篇文章[_用树莓派创建你自己的音乐灯光秀_][4],是基础电子开发介绍和灯光秀的结合。第二篇文章,[_ 使用树莓派 SSH 进入你的圣诞树_][5],更深入地介绍了通过远程管理和电子按钮控制灯光的方法。三部曲的最后一章[_用树莓派设置假期心情_][6],回顾了上一年 LightShowPi 项目中引入的更改。 + +### DIY 项目 + +多年来,我已经将树莓派变成了几种有用的设备。有一次,我将树莓派变成了[带有 Pi MusicBox 的音乐播放设备][7],它可以让你在 Web 界面中导入你喜欢的音乐流并在房间中播放。 + +将树莓派做成[移动视频录制设备][8]是另一个 DIY 项目。它需要一些额外的硬件,例如触摸屏、Pi 摄像头和电池组,但是可以使用。这个设备的最大缺点之一是当时树莓派的可用内存很小。我认为如果我将它重新配置在具有 4GB 内存的树莓派 4 上,那么这款便携式摄像机的功能可能会更好。这可能是一个会在 2020 年重新做项目。 + +我做的另一个小项目[客厅的数字时钟][9]使用了 Adafruit PiTFT 小屏幕。尽管这个项目很简单,但它可能是我使用时间最长的项目。那个时钟在我的电视机上呆了一年多,一天 24 小时不间断运行,直到屏幕烧坏为止。 + +### 圆周率日系列 + +最后但并非最不重要的一点是,在 2019 年的圆周率日(3 月 14 日)之前,我在 [14 内发布了 14 篇文章][10]。这是迄今为止我完成过的最具挑战性的写作项目,但是它使我能够涵盖许多不同的主题,并希望使读者对树莓派的丰富功能有更多的了解。 + +### 走向未来 + +我在树莓派基金会中不认识任何人,因此我不了解任何它的路线图和未来计划。我可以(但我不会)推测品牌及其设备的未来,它们让世界各地这么多不同社会地位的人扩展他们对计算机科学、电子和开源开发的知识。我希望基金会的管理层能够忠于其愿景和使命,并继续为世界各地的人们提供价格合理的技术。 + +21 世纪 10 年代过去了,那是多么甜蜜的十年。对我来说,它闻起来就像树莓派馅饼。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/raspberry-pi-best + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi4_board_hardware.jpg?itok=KnFU7NvR (Raspberry Pi 4 board, posterized filter) +[2]: https://www.raspberrypi.org/ +[3]: https://time.com/5745302/best-gadgets-of-the-2010s-decade/?utm_source=reddit.com +[4]: https://opensource.com/life/15/2/music-light-show-with-raspberry-pi +[5]: https://opensource.com/life/15/12/ssh-your-christmas-tree-raspberry-pi +[6]: https://opensource.com/article/18/12/lightshowpi-raspberry-pi +[7]: https://opensource.com/life/15/3/pi-musicbox-guide +[8]: https://opensource.com/life/15/9/turning-raspberry-pi-portable-streaming-camera +[9]: https://opensource.com/article/17/7/raspberry-pi-clock +[10]: https://opensource.com/article/19/3/happy-pi-day From a58c6703ded107a8e30a6a127512efe650297462 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 9 Jan 2020 09:00:43 +0800 Subject: [PATCH 485/676] translating --- ...7 Generating numeric sequences with the Linux seq command.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md index 9375e70fa6..7ae48a2785 100644 --- a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md +++ b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4441d79f592697bef790364e41156f5dae9dbfca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 9 Jan 2020 13:49:35 +0800 Subject: [PATCH 486/676] Translated by robsean --- ...urce interior design with Sweet Home 3D.md | 142 ------------------ ...urce interior design with Sweet Home 3D.md | 141 +++++++++++++++++ 2 files changed, 141 insertions(+), 142 deletions(-) delete mode 100644 sources/tech/20191016 Open source interior design with Sweet Home 3D.md create mode 100644 translated/tech/20191016 Open source interior design with Sweet Home 3D.md diff --git a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md b/sources/tech/20191016 Open source interior design with Sweet Home 3D.md deleted file mode 100644 index 309b816f81..0000000000 --- a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md +++ /dev/null @@ -1,142 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Open source interior design with Sweet Home 3D) -[#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Open source interior design with Sweet Home 3D -====== -Try out furniture layouts, color schemes, and more in virtual reality -before you go shopping in the real world. -![Several houses][1] - -There are three schools of thought on how to go about decorating a room: - - 1. Buy a bunch of furniture and cram it into the room - 2. Take careful measurements of each item of furniture, calculate the theoretical capacity of the room, then cram it all in, ignoring the fact that you've placed a bookshelf on top of your bed - 3. Use a computer for pre-visualization - - - -Historically, I practiced the little-known fourth principle: don't have furniture. However, since I became a remote worker, I've found that a home office needs conveniences like a desk and a chair, a bookshelf for reference books and tech manuals, and so on. Therefore, I have been formulating a plan to populate my living and working space with actual furniture, made of actual wood rather than milk crates (or glue and sawdust, for that matter), with an emphasis on _plan_. The last thing I want is to bring home a great find from a garage sale to discover that it doesn't fit through the door or that it's oversized compared to another item of furniture. - -It was time to do what the professionals do. It was time to pre-viz. - -### Open source interior design - -[Sweet Home 3D][2] is an open source (GPLv2) interior design application that helps you draw your home's floor plan and then define, resize, and arrange furniture. You can do all of this with precise measurements, down to fractions of a centimeter, without having to do any math and with the ease of basic drag-and-drop operations. And when you're done, you can view the results in 3D. If you can create a basic table (not the furniture kind) in a word processor, you can plan the interior design of your home in Sweet Home 3D. - -### Installing - -Sweet Home 3D is a [Java][3] application, so it's universal. It runs on any operating system that can run Java, which includes Linux, Windows, MacOS, and BSD. Regardless of your OS, you can [download][4] the application from the website. - - * On Linux, [untar][5] the archive. Right-click on the SweetHome3D file and select **Properties**. In the **Permission** tab, grant the file executable permission. - * On MacOS and Windows, expand the archive and launch the application. You must grant it permission to run on your system when prompted. - - - -![Sweet Home 3D permissions][6] - -On Linux, you can also install Sweet Home 3D as a Snap package, provided you have **snapd** installed and enabled. - -### Measures of success - -First thing first: Break out your measuring tape. To get the most out of Sweet Home 3D, you must know the actual dimensions of the living space you're planning for. You may or may not need to measure down to the millimeter or 16th of an inch; you know your own tolerance for variance. But you must get the basic dimensions, including measuring walls and windows and doors. - -Use your best judgment for common sense. For instance, When measuring doors, include the door frame; while it's not technically part of the _door_ itself, it is part of the wall space that you probably don't want to cover with furniture. - -![Measure twice, execute once][7] - -CC-SA-BY opensource.com - -### Creating a room - -When you first launch Sweet Home 3D, it opens a blank canvas in its default viewing mode, a blueprint view in the top panel, and a 3D rendering in the bottom panel. On my [Slackware][8] desktop computer, this works famously, but my desktop is also my video editing and gaming computer, so it's got a great graphics card for 3D rendering. On my laptop, this view was a lot slower. For best performance (especially on a computer not dedicated to 3D rendering), go to the **3D View** menu at the top of the window and select **Virtual Visit**. This view mode renders your work from a ground-level point of view based on the position of a virtual visitor. That means you get to control what is rendered and when. - -It makes sense to switch to this view regardless of your computer's power because an aerial 3D rendering doesn't provide you with much more detail than what you have in your blueprint plan. Once you have changed the view mode, you can start designing. - -The first step is to define the walls of your home. This is done with the **Create Walls** tool, found to the right of the **Hand** icon in the top toolbar. Drawing walls is simple: Click where you want a wall to begin, click to anchor it, and continue until your room is complete. - -![Drawing walls in Sweet Home 3D][9] - -Once you close the walls, press **Esc** to exit the tool. - -#### Defining a room - -Sweet Home 3D is flexible on how you create walls. You can draw the outer boundary of your house first, and then subdivide the interior, or you can draw each room as conjoined "containers" that ultimately form the footprint of your house. This flexibility is possible because, in real life and in Sweet Home 3D, walls don't always define a room. To define a room, use the **Create Rooms** button to the right of the **Create Walls** button in the top toolbar. - -If the room's floor space is defined by four walls, then all you need to do to define that enclosure as a room is double-click within the four walls. Sweet Home 3D defines the space as a room and provides you with its area in feet or meters, depending on your preference. - -For irregular rooms, you must manually define each corner of the room with a click. Depending on the complexity of the room shape, you may have to experiment to find whether you need to work clockwise or counterclockwise from your origin point to avoid quirky Möbius-strip flooring. Generally, however, defining the floor space of a room is straightforward. - -![Defining rooms in Sweet Home 3D][10] - -After you give the room a floor, you can change to the **Arrow** tool and double-click on the room to give it a name. You can also set the color and texture of the flooring, walls, ceiling, and baseboards. - -![Modifying room floors, ceilings, etc. in Sweet Home 3D][11] - -None of this is rendered in your blueprint view by default. To enable room rendering in your blueprint panel, go to the **File** menu and select **Preferences**. In the **Preferences** panel, set **Room rendering in plan** to **Floor color or texture**. - -### Doors and windows - -Once you've finished the basic floor plan, you can switch permanently to the **Arrow** tool. - -You can find doors and windows in the left column of Sweet Home 3D, in the **Doors and Windows** category. You have many choices, so choose whatever is closest to what you have in your home. - -![Moving a door in Sweet Home 3D][12] - -To place a door or window into your plan, drag-and-drop it on the appropriate wall in your blueprint panel. To adjust its position and size, double-click the door or window. - -### Adding furniture - -With the base plan complete, the part of the job that feels like _work_ is over! From this point onward, you can play with furniture arrangements and other décor. - -You can find furniture in the left column, organized by the room for which each is intended. You can drag-and-drop any item into your blueprint plan and control orientation and size with the tools visible when you hover your mouse over the item's corners. Double-click on any item to adjust its color and finish. - -### Visiting and exporting - -To see what your future home will look like, drag the "person" icon in your blueprint view into a room. - -![Sweet Home 3D rendering][13] - -You can strike your own balance between realism and just getting a feel for space, but your imagination is your only limit. You can get additional assets to add to your home from the Sweet Home 3D [download page][4]. You can even create your own furniture and textures with the **Library Editor** applications, which are optional downloads from the project site. - -Sweet Home 3D can export your blueprint plan to SVG format for use in [Inkscape][14], and it can export your 3D model to OBJ format for use in [Blender][15]. To export your blueprint, go to the **Plan** menu and select **Export to SVG format**. To export a 3D model, go to the **3D View** menu and select **Export to OBJ format**. - -You can also take "snapshots" of your home so that you can refer to your ideas without opening Sweet Home 3D. To create a snapshot, go to the **3D View** menu and select **Create Photo**. The snapshot is rendered from the perspective of the person icon in the blueprint view, so adjust as required, then click the **Create** button in the **Create Photo** window. If you're happy with the photo, click **Save**. - -### Home sweet home - -There are many more features in Sweet Home 3D. You can add a sky and a lawn, position lights for your photos, set ceiling height, add another level to your house, and much more. Whether you're planning for a flat you're renting or a house you're buying—or a house that doesn't even exist (yet), Sweet Home 3D is an engaging and easy application that can entertain and help you make better purchasing choices when scurrying around for furniture, so you can finally stop eating breakfast at the kitchen counter and working while crouched on the floor. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/interior-design-sweet-home-3d - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_housing.png?itok=s7i6pQL1 (Several houses) -[2]: http://www.sweethome3d.com/ -[3]: https://opensource.com/resources/java -[4]: http://www.sweethome3d.com/download.jsp -[5]: https://opensource.com/article/17/7/how-unzip-targz-file -[6]: https://opensource.com/sites/default/files/uploads/sweethome3d-permissions.png (Sweet Home 3D permissions) -[7]: https://opensource.com/sites/default/files/images/life/sweethome3d-measure.jpg (Measure twice, execute once) -[8]: http://www.slackware.com/ -[9]: https://opensource.com/sites/default/files/uploads/sweethome3d-walls.jpg (Drawing walls in Sweet Home 3D) -[10]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms.jpg (Defining rooms in Sweet Home 3D) -[11]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms-modify.jpg (Modifying room floors, ceilings, etc. in Sweet Home 3D) -[12]: https://opensource.com/sites/default/files/uploads/sweethome3d-move.jpg (Moving a door in Sweet Home 3D) -[13]: https://opensource.com/sites/default/files/uploads/sweethome3d-view.jpg (Sweet Home 3D rendering) -[14]: http://inkscape.org -[15]: http://blender.org diff --git a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md b/translated/tech/20191016 Open source interior design with Sweet Home 3D.md new file mode 100644 index 0000000000..ebc4a3bc70 --- /dev/null +++ b/translated/tech/20191016 Open source interior design with Sweet Home 3D.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source interior design with Sweet Home 3D) +[#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + + Sweet Home 3D 开放源码室内设计 +====== +在你去真实世界购物前,在虚拟世界中尝试家具布局,配色方案等等。 +![Several houses][1] + +这里有关于如何装饰房间的三大流派: + + 1. 购买一堆家具,并把它们塞进房间。 + 2. 仔细测量每件家具,计算房间的理论容量,然后把它们全部塞进房间,忽略你在床上放置一个书架的事实。 + 3. 使用一台计算机进行预先可视化。 + + + +从历史观点上说,我实践了鲜为人知的第四条原则:没有家具。然而,自从我成为一个远程工作者,我发现家庭办公需要一些便利的设施,像一张桌子和一张椅子,一个用于存放参考书和技术手册的书架等等。因此,我一直在制定一个使用实际的家具来迁移我的生活和工作空间的计划,在 _计划_ 上强调由实木制作,而不是牛奶箱子(或胶水和锯末,或同样的东西)。我最不想做的一件事:从旧货市场淘到得宝贝带回家时,发现其进不了门,或者比另一件家具大很多。 + +是时候做专业人士该做的事了。是时候视觉预览了。 + +### 开放源码室内设计 + +[Sweet Home 3D][2] 是一个开放源码 (GPLv2) 室内设计应用程序,帮助你绘制你的住宅平面图,然后定义,重新调整大小以及安排家具。你可以使用精确的尺寸来完成这些,精确到一厘米以下,而不使用任何数学运算,仅使用简单的拖拽操作。当你完成后,你可以在 3D 中查看结果。如果你可以在一个 word 程序中创建一个基本的表格(不是家具类),你可以在 Sweet Home 3D 中规划你家的室内设计。 + +### 安装 + +Sweet Home 3D 是一个 [Java][3] 应用程序,因此它是通用的。它运行在任何可以运行 Java 的操作系统上,包括 Linux ,Windows ,MacOS 和 BSD 。不用理会你的操作系统,你可以从网站 [下载][4] 应用程序。 + + * 在 Linux 上,[untar][5] 存档文件。在 SweetHome3D 文件上右键单击,并选择**属性**。在**权限**选项卡中,授予文件可执行权限。 + * 在 MacOS 和 Windows 上,展开存档文件并启动应用程序。当系统提示时,你必需授予它权限来在你的系统上运行。 + +![Sweet Home 3D permissions][6] + +在 Linux 上,你也可以像一个 Snap 软件包一样安装 Sweet Home 3D ,前提是你已经安装并启用 **snapd** 。 + +### 成功的测量 + +首先:打开你的卷尺。为充分利用 Sweet Home 3D ,你必须知道你计划生活空间的实际尺寸。你可能需要测量到毫米或1/16英寸;你知道你自己对变化幅度的容忍度。但是你必需获得基本的尺寸,包括材料墙壁和门窗。 + +用你最好的判断力来判断常识。例如,当测量门时,包括门框; + +虽然从技术上讲它不是 _门_ 本身的一部分,它可能是你不想用家具覆盖的墙壁空间的一部分。 + +![Measure twice, execute once][7] + +CC-SA-BY opensource.com + +### 创建一间房间 + +当你第一次启动 Sweet Home 3D 时,它会以它的默认查看模式来打开一个空白的画布,蓝图视图在顶部面板中,3D 渲染在底部面板中。在我的 [Slackware][8] 桌面计算机上,这项工作非常友好,但是我的桌面计算机也是我的视频编辑和游戏计算机,所以它有一个极好的 3D 渲染显卡。在我的笔记本计算机上,这种视图模式是非常慢的。为了最好的性能(尤其是在一台计没有 3D 渲染的专用计算机上),转到窗口顶部的 **3D 视图** 菜单,并选择 **虚拟访问** 。这个视图模式基于虚拟访客的位置从地面视图渲染你的工作。这意味着你可以控制渲染的东西和时机。 + +不顾你计算机的功率来切换到这个视图的有意义的,因为地表以上的 3D 渲染不比蓝图平面图向你提供更多有用的详细信息。在你更改视图模式后,你可以开始设计。 + +第一步是定义你家的墙壁。使用**创建墙壁**工具完成,在顶部工具栏的右侧找到 **手** 图标。绘制墙壁很简单:单击你想要墙壁开始的位置,单击以锚定位置,不断单击锚定,直到你的房间完成。 + +![Drawing walls in Sweet Home 3D][9] + +在你闭合墙壁后,按**Esc**来退出工具。 + +#### 定义一间房间 + +Sweet Home 3D 在你如何创建墙壁的问题上是灵活的。你可以先绘制你房子的外部边界,然后再细分内部,或者你可以绘制每个房间作为结成一体的"容器",最终形成你房子所占的空间量。这种灵活性是能做到的,因为在现实生活中和在 Sweet Home 3D 中,墙壁并不总是定义一间房间。为定义一间房间,使用在顶部工具栏的**创建墙壁** 按钮右侧的 **创建房间** 按钮。 + +如果房间的地板空间是通过四面墙所定义,你们你需要做的全部的定义是像一间房间一样在四面墙壁内双击来圈占地方。Sweet Home 3D 将定义空间为一间房间,并根据你的喜好,以英尺或米为单位向你提供房间的面积。 + +对于不规则的房间,你必需使用每次单击来手动定义房间的每个墙角。根据房间形状的复杂性,你可能不得不进行试验来发现你是否需要从你的原点来顺时针或逆时针工作,以避免奇怪的莫比斯条形地板。不过,一般来说,定义一间房间的地板空间是简单的。 + +![Defining rooms in Sweet Home 3D][10] + +在你给定房间一层地板后,你可以更改到 **箭头** 工具,并在房间上双击来给予它一个名称。你也可以设置地板,墙壁,天花板和踢脚板的颜色及纹理。 + +![Modifying room floors, ceilings, etc. in Sweet Home 3D][11] + +默认情况下,这些都不会在蓝图视图中渲染。为启用在你蓝图面板中的房间渲染,转到 **文件** 菜单并选择 **首选项** 。在 **首选项** 面板中,设置 **平面图中房间渲染** 为 **地板颜色或纹理** 。 + +### 门和窗 + +在你完成基本的地板平面图后,你可以长期地切换到 **箭头** 工具。 + +你可以在 Sweet Home 3D 的左栏中的 **门和窗** 类别下找到门和窗。你有很多选择,所以选择最接近你家的东西。 + +![Moving a door in Sweet Home 3D][12] + +为放置一扇门或窗到你的平面图中,在你的蓝图平面图中的合适的墙壁上拖拽门或窗。为调整它的位置和大小,双击门或窗。 + +### 添加家具 + +随着基本计划完成,部分工作感觉像 _工作_ 结束了!从这点继续,你可以玩弄家具布置以及其它装饰。 + +你可以在左栏中找到家具,按每个计划的房间来组织。你可以拖拽任何项目到你的蓝图平面图中,当你的鼠标悬停在项目的区域上时,使用可视化工具控制方向和大小。在任何项目上双击双击来调整它的颜色和成品表面。 + +### 访问和导出 + +为了看看你未来的家将会看起来是什么样子,在你的蓝图视图中拖拽"人"图标到一个房间中。 + +![Sweet Home 3D rendering][13] + +你可以在现实主义和仅感受空间感之间找到自己的平衡,只要你的想象力是你唯一的限制。你可以从 Sweet Home 3D [下载页面][4] 获取附加的有用的资源来添加到你的家中。你甚至可以使用 **库编辑器** 应用程序创建你自己的家具和纹理,它们可以从项目网站有选择地下载。 + +Sweet Home 3D 可以导出你的蓝图平面图为 SVG 格式,以便在 [Inkscape][14] 中使用,并且它可以导出你的 3D 模型为 OBJ 格式,以便在 [Blender][15] 中使用。为导出你的蓝图,转到**平面图**菜单,并选择**导出为 SVG 格式**。为导出一个 3D 模型,转到 **3D 视图** 菜单并选择**导出为 OBJ 格式**。 + +你也可以拍摄你家的"快照,以便于不打开 Sweet Home 3D 而参考你的想法。为创建一个快照,转到 **3D视图** 菜单并选择 **创建照片**。快照是按照蓝图视图中的人的图标的角度展现的,因此按照需要调整,然后在 **创建照片** 窗口中单击 **创建** 按钮。 如果你对快照满意,单击 **保存** 。 + +### 甜蜜的家 + +在 Sweet Home 3D 中有更多的特色。你可以添加一片天空和一片草坪,为你的照片定位光线,设置天花板高度,给你房子添加另一楼层等等。不管你打算租一套公寓,还是买一套房子—或是(还)尚不存在的房子,Sweet Home 3D 是一款简单迷人的应用程序,当你匆忙购买家具时,它可以娱乐并帮助你做出更好的购买选择。因此,你终于可以停止在厨房的柜台上吃早餐以及蹲在地上工作。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/interior-design-sweet-home-3d + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_housing.png?itok=s7i6pQL1 (Several houses) +[2]: http://www.sweethome3d.com/ +[3]: https://opensource.com/resources/java +[4]: http://www.sweethome3d.com/download.jsp +[5]: https://opensource.com/article/17/7/how-unzip-targz-file +[6]: https://opensource.com/sites/default/files/uploads/sweethome3d-permissions.png (Sweet Home 3D permissions) +[7]: https://opensource.com/sites/default/files/images/life/sweethome3d-measure.jpg (Measure twice, execute once) +[8]: http://www.slackware.com/ +[9]: https://opensource.com/sites/default/files/uploads/sweethome3d-walls.jpg (Drawing walls in Sweet Home 3D) +[10]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms.jpg (Defining rooms in Sweet Home 3D) +[11]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms-modify.jpg (Modifying room floors, ceilings, etc. in Sweet Home 3D) +[12]: https://opensource.com/sites/default/files/uploads/sweethome3d-move.jpg (Moving a door in Sweet Home 3D) +[13]: https://opensource.com/sites/default/files/uploads/sweethome3d-view.jpg (Sweet Home 3D rendering) +[14]: http://inkscape.org +[15]: http://blender.org From 60eada912bb8adb854f5b4b5c4de497d6cef9ebd Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Thu, 9 Jan 2020 23:50:36 +0800 Subject: [PATCH 487/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91done?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...181105 5 Minimal Web Browsers for Linux.md | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md index e71e21ac1e..1a533e6557 100644 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -27,7 +27,7 @@ GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览 Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: - * Simplicity简单性 - Feature bloat and user interface clutter are considered evil功能复杂和用户界面混乱都是不被允许的. + * 简单性 - 功能复杂和用户界面混乱都是不被允许的. * 规范性 - 任何非标准特性都不会引入到代码库中。 @@ -77,58 +77,59 @@ Figure 3: QupZilla 首选项工具. ### Otter Browser -Otter Browser is a free, open source attempt to recreate the closed-source offerings found in the Opera Browser. Otter Browser uses the WebKit rendering engine and has an interface that should be immediately familiar with any user. Although lightweight, Otter Browser does include full-blown features such as: +Otter 浏览器是一种免费开源的,旨在重建Opera 12.x的浏览器。它使用WebKit渲染引擎,并且有用户的熟悉界面。虽然它轻量,但它有丰富的功能: - * Passwords manager + * 密码管理 - * Add-on manager + * 插件管理 + + * 内容拦截 - * Content blocking + * 拼写检查 - * Spell checking + * 自定义界面 - * Customizable GUI + * 网址补全 - * URL completion + * 快速访问 (Figure 4) - * Speed dial (Figure 4) + * 书签和其他相关功能 - * Bookmarks and various related features + * 鼠标手势 - * Mouse gestures + * 用户样式表 - * User style sheets - - * Built-in Note tool + * 内建笔记功能 ![Otter][15] -Figure 4: The Otter Browser Speed Dial tab. +Figure 4: Otter 浏览器快起标签项. -[Used with permission][9] +[许可证书][9] -Otter Browser can be run on nearly any Linux distribution from an [AppImage][16], so there’s no installation required. Just download the AppImage file, give the file executable permissions (with the command chmod u+x otter-browser-*.AppImage), and then launch the app with the command ./otter-browser*.AppImage. +Otter浏览器可以在几乎所有Linux发行版上运行通过[AppImage][16]软件格式,因此无需安装。只需下载AppImage文件,授予文件可执行权限(使用命令 `chmod u+x otter-browser-.AppImage`),然后使用命令`./otter-browser.AppImage` 启动应用程序。 + +Otter浏览器在网站展示方面做得非常出色,可以轻松地用作你的微型浏览器。 -Otter Browser does an outstanding job of rendering websites and could function as your go-to minimal browser with ease. ### Lynx -Let’s get really minimal. When I first started using Linux, back in ‘97, one of the web browsers I often turned to was a text-only take on the app called [Lynx][17]. It should come as no surprise that Lynx is still around and available for installation from the standard repositories. As you might expect, Lynx works from the terminal window and doesn’t display pretty pictures or render much in the way of advanced features (Figure 5). In fact, Lynx is as bare-bones a browser as you will find available. Because of how bare-bones this web browser is, it’s not recommended for everyone. But if you happen to have a gui-less web server and you have a need to be able to read the occasional website, Lynx can be a real lifesaver. +让我们见识真正的微型浏览器。早在97年,当我使用Linux时,就经常使用的[Lynx][17]纯文本模式的网页浏览器。 +Lynx的存在并且可以从标准存储库中进行安装。正如您可能期望的那样,Lynx在终端窗口中工作,并且不会显示漂亮的图片和高级功能的渲染方式(图5)。事实上,Lynx是你能找到的最简单的浏览器。由于这个网页浏览器是如此简陋,所以不建议每个人都使用它。但如果你碰巧有一个没有界面的服务器,你需要能够偶尔访问的网站,Lynx是一个真正的救星。 ![Lynx][19] -Figure 5: The Lynx browser rendering the Linux.com page. +Figure 5: Lynx 浏览器展示 Linux.com 网址界面. -[Used with permission][9] +[许可证书][9] -I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). +我还发现Lynx是一个非常有用的工具,它可以帮助我解决网站某些方面的故障(或者如果网站上的某些功能阻止我在常规浏览器中查看内容)。使用Lynx的另一个重要原因是它可以让我们更加专注内容(而不是其他无关的元素)。 ### Plenty More Where This Came From 更多 -There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not.微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 +微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 -Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. 了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 -------------------------------------------------------------------------------- From 299f273a2f4c02ab8d84beeed762e9e106960e9e Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Thu, 9 Jan 2020 23:55:08 +0800 Subject: [PATCH 488/676] done --- ...181105 5 Minimal Web Browsers for Linux.md | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 translated/tech/20181105 5 Minimal Web Browsers for Linux.md diff --git a/translated/tech/20181105 5 Minimal Web Browsers for Linux.md b/translated/tech/20181105 5 Minimal Web Browsers for Linux.md new file mode 100644 index 0000000000..1a533e6557 --- /dev/null +++ b/translated/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: (MonkeyDEcho ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (5 Minimal Web Browsers for Linux) +[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) +[#]: url: ( ) + + +linux上的五种微型浏览器 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) + +有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 + +web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 + +但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 + +让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! + +### GNOME Web + +GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 + +Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: + + * 简单性 - 功能复杂和用户界面混乱都是不被允许的. + + * 规范性 - 任何非标准特性都不会引入到代码库中。 + + * 软件开源 - Epiphany始终遵守自由开源许可证。 + + * 人机交互 - Epiphany 始终遵守[GNOME的人机交互指南][6]。 + + * 最小首选项 - 经过慎重考虑才添加首选项。 + + * 受众群体 - 非技术用户是主要的受众目标,(有助于定义所包含功能的类型)。 + + + + +GNOME web浏览器就像看到的一样干净简洁 (Figure 1)。 + + +![GNOME Web][8] + +Figure 1: GNOME 浏览器为用户展示最少的首选项. + +[许可证书][9] + +GNOME Web 的声明如下: + +web 浏览器它不仅仅是一个应用程序,还是一种思维方式,一种看世界的方式。 Epiphany 的原则是简洁,标准和自由。 +### Netsurf + +[Netsurf][10] 浏览器是最小的浏览器,他的打开速度几乎和你松开鼠标一样。Netsurf 使用自己的布局和渲染引擎(完全从零开始设计的) 在渲染过程的设计中屡屡碰壁(Figure 2). + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) + +尽管你可能在特定的站点上发现 Netsurf的问题,但如果你了解Hubbub解析器的话,知道它正在兼容html5规范,是不是的会有一点问题。Netsurf对https的支持,网页缩略图,URL解析,缩放视图,书签,全屏模式,快捷键和GUI的工具包的功能;最后一点十分重要,当你桌面来回切换时,为了缓解渲染带来的问题。 + +对于那些对Netsurf 存在好奇的人来说,以现在的标准,他能在 16MB内存,30Mhz的ARM cpu的机器上运行,是让人惊奇的。 + +### QupZilla + +如果你找寻使用Qt Framework 和 the QtWebKit 渲染引擎的最小浏览器,QupZilla][11]是你最佳的选择。QupZilla 包含web浏览所有的标准功能,例如:书签,历史记录,侧边栏,选项卡,RSS,广告屏蔽,flash屏蔽,和CA证书管理。及时拥有这么多的功能,QupZilla 仍然是快速,轻量级的浏览器。另外还有其他的功能:快速启动,快速拨号主页,内置屏幕截图工具,浏览器主题等。 +吸引用户的一点是,与许多轻量级浏览器相比,QupZilla有更标准的首选项工具(图3)。所以,如果你很多功能,但你仍然想要更轻量,那么QupZilla就是你最好的选择。 + +![QupZilla][13] + +Figure 3: QupZilla 首选项工具. + +[许可证书][9] + +### Otter Browser + +Otter 浏览器是一种免费开源的,旨在重建Opera 12.x的浏览器。它使用WebKit渲染引擎,并且有用户的熟悉界面。虽然它轻量,但它有丰富的功能: + + * 密码管理 + + * 插件管理 + + * 内容拦截 + + * 拼写检查 + + * 自定义界面 + + * 网址补全 + + * 快速访问 (Figure 4) + + * 书签和其他相关功能 + + * 鼠标手势 + + * 用户样式表 + + * 内建笔记功能 + + +![Otter][15] + +Figure 4: Otter 浏览器快起标签项. + +[许可证书][9] + +Otter浏览器可以在几乎所有Linux发行版上运行通过[AppImage][16]软件格式,因此无需安装。只需下载AppImage文件,授予文件可执行权限(使用命令 `chmod u+x otter-browser-.AppImage`),然后使用命令`./otter-browser.AppImage` 启动应用程序。 + +Otter浏览器在网站展示方面做得非常出色,可以轻松地用作你的微型浏览器。 + + +### Lynx + +让我们见识真正的微型浏览器。早在97年,当我使用Linux时,就经常使用的[Lynx][17]纯文本模式的网页浏览器。 +Lynx的存在并且可以从标准存储库中进行安装。正如您可能期望的那样,Lynx在终端窗口中工作,并且不会显示漂亮的图片和高级功能的渲染方式(图5)。事实上,Lynx是你能找到的最简单的浏览器。由于这个网页浏览器是如此简陋,所以不建议每个人都使用它。但如果你碰巧有一个没有界面的服务器,你需要能够偶尔访问的网站,Lynx是一个真正的救星。 + +![Lynx][19] + +Figure 5: Lynx 浏览器展示 Linux.com 网址界面. + +[许可证书][9] + +我还发现Lynx是一个非常有用的工具,它可以帮助我解决网站某些方面的故障(或者如果网站上的某些功能阻止我在常规浏览器中查看内容)。使用Lynx的另一个重要原因是它可以让我们更加专注内容(而不是其他无关的元素)。 + +### Plenty More Where This Came From 更多 + +微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 + +了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[MonkeyDEcho](https://github.com/MonkeyDEcho) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.mozilla.org/en-US/firefox/new/ +[2]: https://www.chromium.org/ +[3]: https://vivaldi.com/ +[4]: https://www.google.com/chrome/ +[5]: https://www.merriam-webster.com/dictionary/epiphany +[6]: https://developer.gnome.org/hig/stable/ +[7]: /files/images/minimalbrowsers1jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) +[9]: /licenses/category/used-permission +[10]: https://www.netsurf-browser.org/ +[11]: https://qupzilla.com/ +[12]: /files/images/minimalbrowsers3jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) +[14]: /files/images/minimalbrowsers4jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) +[16]: https://sourceforge.net/projects/otter-browser/files/ +[17]: https://lynx.browser.org/ +[18]: /files/images/minimalbrowsers5jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) +[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 90ad890789888cfa40b34f020f22983b4399bd0b Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Thu, 9 Jan 2020 23:56:31 +0800 Subject: [PATCH 489/676] rm done --- ...181105 5 Minimal Web Browsers for Linux.md | 167 ------------------ 1 file changed, 167 deletions(-) delete mode 100644 sources/tech/20181105 5 Minimal Web Browsers for Linux.md diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md deleted file mode 100644 index 1a533e6557..0000000000 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ /dev/null @@ -1,167 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MonkeyDEcho ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (5 Minimal Web Browsers for Linux) -[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -[#]: url: ( ) - - -linux上的五种微型浏览器 -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) - -有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 - -web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 - -但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 - -让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! - -### GNOME Web - -GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 - -Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: - - * 简单性 - 功能复杂和用户界面混乱都是不被允许的. - - * 规范性 - 任何非标准特性都不会引入到代码库中。 - - * 软件开源 - Epiphany始终遵守自由开源许可证。 - - * 人机交互 - Epiphany 始终遵守[GNOME的人机交互指南][6]。 - - * 最小首选项 - 经过慎重考虑才添加首选项。 - - * 受众群体 - 非技术用户是主要的受众目标,(有助于定义所包含功能的类型)。 - - - - -GNOME web浏览器就像看到的一样干净简洁 (Figure 1)。 - - -![GNOME Web][8] - -Figure 1: GNOME 浏览器为用户展示最少的首选项. - -[许可证书][9] - -GNOME Web 的声明如下: - -web 浏览器它不仅仅是一个应用程序,还是一种思维方式,一种看世界的方式。 Epiphany 的原则是简洁,标准和自由。 -### Netsurf - -[Netsurf][10] 浏览器是最小的浏览器,他的打开速度几乎和你松开鼠标一样。Netsurf 使用自己的布局和渲染引擎(完全从零开始设计的) 在渲染过程的设计中屡屡碰壁(Figure 2). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) - -尽管你可能在特定的站点上发现 Netsurf的问题,但如果你了解Hubbub解析器的话,知道它正在兼容html5规范,是不是的会有一点问题。Netsurf对https的支持,网页缩略图,URL解析,缩放视图,书签,全屏模式,快捷键和GUI的工具包的功能;最后一点十分重要,当你桌面来回切换时,为了缓解渲染带来的问题。 - -对于那些对Netsurf 存在好奇的人来说,以现在的标准,他能在 16MB内存,30Mhz的ARM cpu的机器上运行,是让人惊奇的。 - -### QupZilla - -如果你找寻使用Qt Framework 和 the QtWebKit 渲染引擎的最小浏览器,QupZilla][11]是你最佳的选择。QupZilla 包含web浏览所有的标准功能,例如:书签,历史记录,侧边栏,选项卡,RSS,广告屏蔽,flash屏蔽,和CA证书管理。及时拥有这么多的功能,QupZilla 仍然是快速,轻量级的浏览器。另外还有其他的功能:快速启动,快速拨号主页,内置屏幕截图工具,浏览器主题等。 -吸引用户的一点是,与许多轻量级浏览器相比,QupZilla有更标准的首选项工具(图3)。所以,如果你很多功能,但你仍然想要更轻量,那么QupZilla就是你最好的选择。 - -![QupZilla][13] - -Figure 3: QupZilla 首选项工具. - -[许可证书][9] - -### Otter Browser - -Otter 浏览器是一种免费开源的,旨在重建Opera 12.x的浏览器。它使用WebKit渲染引擎,并且有用户的熟悉界面。虽然它轻量,但它有丰富的功能: - - * 密码管理 - - * 插件管理 - - * 内容拦截 - - * 拼写检查 - - * 自定义界面 - - * 网址补全 - - * 快速访问 (Figure 4) - - * 书签和其他相关功能 - - * 鼠标手势 - - * 用户样式表 - - * 内建笔记功能 - - -![Otter][15] - -Figure 4: Otter 浏览器快起标签项. - -[许可证书][9] - -Otter浏览器可以在几乎所有Linux发行版上运行通过[AppImage][16]软件格式,因此无需安装。只需下载AppImage文件,授予文件可执行权限(使用命令 `chmod u+x otter-browser-.AppImage`),然后使用命令`./otter-browser.AppImage` 启动应用程序。 - -Otter浏览器在网站展示方面做得非常出色,可以轻松地用作你的微型浏览器。 - - -### Lynx - -让我们见识真正的微型浏览器。早在97年,当我使用Linux时,就经常使用的[Lynx][17]纯文本模式的网页浏览器。 -Lynx的存在并且可以从标准存储库中进行安装。正如您可能期望的那样,Lynx在终端窗口中工作,并且不会显示漂亮的图片和高级功能的渲染方式(图5)。事实上,Lynx是你能找到的最简单的浏览器。由于这个网页浏览器是如此简陋,所以不建议每个人都使用它。但如果你碰巧有一个没有界面的服务器,你需要能够偶尔访问的网站,Lynx是一个真正的救星。 - -![Lynx][19] - -Figure 5: Lynx 浏览器展示 Linux.com 网址界面. - -[许可证书][9] - -我还发现Lynx是一个非常有用的工具,它可以帮助我解决网站某些方面的故障(或者如果网站上的某些功能阻止我在常规浏览器中查看内容)。使用Lynx的另一个重要原因是它可以让我们更加专注内容(而不是其他无关的元素)。 - -### Plenty More Where This Came From 更多 - -微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 - -了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[MonkeyDEcho](https://github.com/MonkeyDEcho) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.mozilla.org/en-US/firefox/new/ -[2]: https://www.chromium.org/ -[3]: https://vivaldi.com/ -[4]: https://www.google.com/chrome/ -[5]: https://www.merriam-webster.com/dictionary/epiphany -[6]: https://developer.gnome.org/hig/stable/ -[7]: /files/images/minimalbrowsers1jpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) -[9]: /licenses/category/used-permission -[10]: https://www.netsurf-browser.org/ -[11]: https://qupzilla.com/ -[12]: /files/images/minimalbrowsers3jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) -[14]: /files/images/minimalbrowsers4jpg -[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) -[16]: https://sourceforge.net/projects/otter-browser/files/ -[17]: https://lynx.browser.org/ -[18]: /files/images/minimalbrowsers5jpg -[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) -[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 5da985aef58c487b224082f6906c8ab9aba5dfc3 Mon Sep 17 00:00:00 2001 From: MonkeyDEcho <863626156@qq.com> Date: Fri, 10 Jan 2020 00:08:33 +0800 Subject: [PATCH 490/676] Update 20180416 Cgo and Python.md --- sources/tech/20180416 Cgo and Python.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180416 Cgo and Python.md b/sources/tech/20180416 Cgo and Python.md index e5688d43c8..c78a820276 100644 --- a/sources/tech/20180416 Cgo and Python.md +++ b/sources/tech/20180416 Cgo and Python.md @@ -1,4 +1,5 @@ Cgo and Python +[#] MonkeyDEcho translating ============================================================ ![](https://datadog-prod.imgix.net/img/blog/engineering/cgo-and-python/cgo_python_hero.png?auto=format&w=1900&dpr=1) From 2cb066da2fc0d37f930cc94cf7a3cd54cd9d97a2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:52:36 +0800 Subject: [PATCH 491/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200110=20Bash?= =?UTF-8?q?=20Script=20to=20Send=20eMail=20With=20a=20List=20of=20User=20A?= =?UTF-8?q?ccounts=20Expiring=20in=20=E2=80=9CX=E2=80=9D=20Days?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md --- ...t of User Accounts Expiring in -X- Days.md | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md diff --git a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md new file mode 100644 index 0000000000..1b3330a6e8 --- /dev/null +++ b/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days) +[#]: via: (https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days +====== + +The password enforcement policy is common to all operating systems and applications. + +If you want to **[implement a password enforcement policy on Linux][1]**, go to the following article. + +The password enforcement policy will be enforced by most companies by default, but the time period will be different depending on the company’s requirements. + +Usually everyone uses a 90-days password cycle. + +The user will only **[change the password][2]** on some of the servers they use, and they won’t change the password on the servers they don’t use often. + +In particular, most team forget to change the service account password, which can lead to breaking regular jobs even if they are configured to work with **[SSH key-based authentication][3]**. + +SSH key-based authentication and **[cronjobs][4]** will not work if the user account password expires. + +To avoid this situation, we have created a **[shell script][5]** that sends you a list of user accounts that expire within 10 days. + +There are two **[bash scripts][6]** included in this tutorial that will help you collect information about user expiration days on your system. + +### 1) Bash Script to Check List of User Accounts Expiring in 10 Days + +This script will help you to check the list of user accounts that expire in 10 days on your terminal. + +``` +# vi /opt/script/user-password-expiry.sh + +#!/bin/sh +/tmp/user-expiry-1.txt +/tmp/user-expiry.txt +echo "-------------------------------------------------" +echo "UserName The number of days the password expires" +echo "-------------------------------------------------" +for usern in u1 u2 u3 u4 +do +today=$(date +%s) +userexpdate=$(chage -l $usern | grep 'Password expires' |cut -d: -f2) +passexp=$(date -d "$userexpdate" "+%s") +exp=`expr \( $passexp - $today \)` +expday=`expr \( $exp / 86400 \)` +echo "$usern $expday" >> /tmp/user-expiry.txt +done +cat /tmp/user-expiry.txt | awk '$2 <= 10' > /tmp/user-expiry-1.txt +cat /tmp/user-expiry-1.txt | column -t +``` + +Set an executable Linux file permission to **“user-password-expiry.sh”** file. + +``` +# chmod +x /opt/script/user-password-expiry.sh +``` + +You will get an output like the one below. But the username and days may be different + +``` +# sh /opt/script/user-password-expiry.sh + +------------------------------------------------- +UserName The number of days the password expires +------------------------------------------------- +u1 -25 +u2 9 +u3 3 +u4 5 +``` + +### 2) Bash Script to Send eMail With a List of User Accounts Expiring in 10 Days + +This script will send a mail with a list of user accounts expiring in 10 days. + +``` +# vi /opt/script/user-password-expiry-mail.sh + +#!/bin/sh +SUBJECT="Information About User Password Expiration on "`date`"" +MESSAGE="/tmp/user-expiry.txt" +MESSAGE1="/tmp/user-expiry-1.txt" +TO="[email protected]" +echo "-------------------------------------------------" >> $MESSAGE1 +echo "UserName The number of days the password expires" >> $MESSAGE1 +echo "-------------------------------------------------" >> $MESSAGE1 +for usern in u1 u2 u3 u4 +do +today=$(date +%s) +userexpdate=$(chage -l $usern | grep 'Password expires' |cut -d: -f2) +passexp=$(date -d "$userexpdate" "+%s") +exp=`expr \( $passexp - $today \)` +expday=`expr \( $exp / 86400 \)` +echo "$usern $expday" >> $MESSAGE +done +cat $MESSAGE | awk '$2 <= 10' >> $MESSAGE1 +mail -s "$SUBJECT" "$TO" < $MESSAGE1 +rm $MESSAGE +rm $MESSAGE1 +``` + +Set an executable Linux file permission to **“user-password-expiry-mail.sh”** file. + +``` +# chmod +x /opt/script/user-password-expiry-mail.sh +``` + +Finally add a **[cronjob][4]** to automate this. It runs once in a day at 8AM. + +``` +# crontab -e +0 8 * * * /bin/bash /opt/script/user-password-expiry-mail.sh +``` + +You will receive a mail similar to the first shell script output. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ +[2]: https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-users-password-in-linux-using-shell-script/ +[3]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ +[4]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ +[5]: https://www.2daygeek.com/category/shell-script/ +[6]: https://www.2daygeek.com/category/bash-script/ From 874447fbc6fc18bac8b6dbb27ef9133e75a3742f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:55:49 +0800 Subject: [PATCH 492/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20My=20f?= =?UTF-8?q?avorite=20Bash=20hacks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200109 My favorite Bash hacks.md --- .../tech/20200109 My favorite Bash hacks.md | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 sources/tech/20200109 My favorite Bash hacks.md diff --git a/sources/tech/20200109 My favorite Bash hacks.md b/sources/tech/20200109 My favorite Bash hacks.md new file mode 100644 index 0000000000..857f10e160 --- /dev/null +++ b/sources/tech/20200109 My favorite Bash hacks.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My favorite Bash hacks) +[#]: via: (https://opensource.com/article/20/1/bash-scripts-aliases) +[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) + +My favorite Bash hacks +====== +Improve your productivity with aliases and other shortcuts for the +things you forget too often. +![bash logo on green background][1] + +When you work with computers all day, it's fantastic to find repeatable commands and tag them for easy use later on. They all sit there, tucked away in **~/.bashrc** (or ~/.zshrc for [Zsh users][2]), waiting to help improve your day! + +In this article, I share some of my favorite of these helper commands for things I forget a lot, in hopes that they will save you, too, some heartache over time. + +### Say when it's over + +When I'm using longer-running commands, I often multitask and then have to go back and check if the action has completed. But not anymore, with this helpful invocation of **say** (this is on MacOS; change for your local equivalent): + + +``` +function looooooooong { +    START=$(date +%s.%N) +    $* +    EXIT_CODE=$? +    END=$(date +%s.%N) +    DIFF=$(echo "$END - $START" | bc) +    RES=$(python -c "diff = $DIFF; min = int(diff / 60); print('%s min' % min)") +    result="$1 completed in $RES, exit code $EXIT_CODE." +    echo -e "\n⏰  $result" +    ( say -r 250 $result 2>&1 > /dev/null & ) +} +``` + +This command marks the start and end time of a command, calculates the minutes it takes, and speaks the command invoked, the time taken, and the exit code. I find this super helpful when a simple console bell just won't do. + +### Install helpers + +I started using Ubuntu back in the Lucid days, and one of the first things I needed to learn was how to install packages. And one of the first aliases I ever added was a helper for this (named based on the memes of the day): + + +``` +`alias canhas="sudo apt-get install -y"` +``` + +### GNU Privacy Guard (GPG) signing + +On the off chance I have to sign a [GPG][3] email without having an extension or application to do it for me, I drop down into the command line and use these terribly dorky aliases: + + +``` +alias gibson="gpg --encrypt --sign --armor" +alias ungibson="gpg --decrypt" +``` + +### Docker + +There are many Docker commands, but there are even more **docker compose** commands. I used to forget the **\--rm** flags, but not anymore with these useful aliases: + + +``` +alias dc="docker-compose" +alias dcr="docker-compose run --rm" +alias dcb="docker-compose run --rm --build" +``` + +### gcurl helper for Google Cloud + +This one is relatively new to me, but it's [heavily documented][4]. gcurl is an alias to ensure you get all the correct flags when using local curl commands with authentication headers when working with Google Cloud APIs.  + +### Git and ~/.gitignore + +I work a lot in Git, so I have a special section dedicated to Git helpers. + +One of my most useful helpers is one I use to clone GitHub repos. Instead of having to run: + + +``` +`git clone git@github.com:org/repo /Users/glasnt/git/org/repo` +``` + +I set up a clone function: + + +``` +clone(){ +    echo Cloning $1 to ~/git/$1 +    cd ~/git +    git clone [git@github.com][5]:$1 $1 +    cd $1 +} +``` + +Even though I always forget and giggle any time I'm diving into my **~/.bashrc** file, I also have my "refresh upstream" command: + + +``` +`alias yoink="git checkout master && git fetch upstream master && git merge upstream/master"` +``` + +Another helper for Git-ville is a global ignore file. In your **git config --global --list** you should see a **core.excludesfile**. If not, [create one][6], and fill it full of things that you always put into your individual **.gitignore** files. As a Python developer on MacOS, for me this is: + + +``` +.DS_Store     # macOS clutter +venv/         # I never want to commit my virtualenv +*.egg-info/*  # ... nor any locally compiled packages +__pycache__   # ... or source +*.swp         # ... nor any files open in vim +``` + +You can find other suggestions over on [Gitignore.io][7] or on the [Gitignore repo][8] on GitHub. + +### Your turn + +What are your favorite helper commands? Please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/bash-scripts-aliases + +作者:[Katie McLaughlin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/glasnt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/19/9/getting-started-zsh +[3]: https://gnupg.org/ +[4]: https://cloud.google.com/service-infrastructure/docs/service-control/getting-started +[5]: mailto:git@github.com +[6]: https://help.github.com/en/github/using-git/ignoring-files#create-a-global-gitignore +[7]: https://www.gitignore.io/ +[8]: https://github.com/github/gitignore From bc0fe0c7b43c19ad14d1e0cd619235f5fead93f4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:56:11 +0800 Subject: [PATCH 493/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20Create?= =?UTF-8?q?=20demo=20project=20templates=20with=20one=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200109 Create demo project templates with one script.md --- ... demo project templates with one script.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20200109 Create demo project templates with one script.md diff --git a/sources/tech/20200109 Create demo project templates with one script.md b/sources/tech/20200109 Create demo project templates with one script.md new file mode 100644 index 0000000000..950ec0e85f --- /dev/null +++ b/sources/tech/20200109 Create demo project templates with one script.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create demo project templates with one script) +[#]: via: (https://opensource.com/article/20/1/initsh-script) +[#]: author: (Eric D. Schabell https://opensource.com/users/eschabell) + +Create demo project templates with one script +====== +This init.sh script makes it easier to create demos to convince your +customers, team, and boss that your project is exactly what they need. +![Person using a laptop][1] + +When you're standing on a stage or doing a live demo in an online session, getting your project into a perfect-looking state may appear easy. But a lot of work goes on behind the scenes to create working, easy to use, and repeatable demo projects. + +When you're doing a demo, the technology in a project must support your bigger story about the project without failing. My fellow JBoss technology evangelists and I often have to set up different technologies, so it became necessary for us to tune some sort of generic framework or template to put these demo projects into. + +Achieving this goal was guided by three principles: + + * KISS (keep it simple, stupid) + * Consistency + * Repeatability + + + +These stem from our aim to support anyone who wants to explore and get started with a JBoss technology. Note that while the order of these principles has some significance about what is most important, they all have to balance each other. + +If one must be weighed more heavily, when using technology, it is KISS. Therefore, you will find that this principle is followed almost religiously when deciding how to solve anything within the demo project template. + +### Simple + +The demos need to have a simple set up, taking almost no effort to get them started or, more realistically, the least amount of effort possible. + +Each project requires just three steps to get going: + + 1. Download and unzip the project. + 2. Add products to the project's **installs** directory. + 3. Run **init.sh** (for Unix) or **init.bat** (for Windows) to install the project. + + + +That's it; just watch the install's output to continue with the project as you see fit. + +This setup also relies on the very smallest or most basic set of dependencies that are physically possible for Unix- and Windows-based systems—Java and Maven, nothing more than that. + +A demo is all about learning what the project in front of you does, so it must be clear and offer the possibility to explore how the project is set up, configured, and runs. Based on users' feedback over the years, full automation is not desirable, as it takes the project out of the user's learning sphere. + +There is a balance offered when installing a project with autoconfiguration and setup, but there are still some steps that allow you to pause, consider, and explore what has been done. + +### Consistent + +The only way for people to be able to jump between our various technologies and products is to have some consistency in our demo projects. A customer, partner, or interested party needs to be able to recognize a simple and clear form of project setup. + +This is done with a simple and clear project template structure: + + * **docs/** contains project documentation and screenshots. + * **installs/** is where you place needed products. + * **projects/** contains sources for services, clients, or other project-based code. + * **support/** holds all other configuration, setup, or other necessary files and utilities. + * **init.{sh|bat}** stores installation scripts needed to set up the project. + + + +That's it; every single time it will look like this. + +### Repeatable + +Nothing is worse than spending a large amount of time to provide a demo project and only being able to run it one time. Often, there is some factor that rushes a project's completion so that you have little chance to bring some sort of order to it. + +Our template allows you to develop a demo project while saving its repeatability. Note that the entire setup is done in a new directory called **target**, where you can throw it all away and just set the project up again (with the initial **init** script). + +This is a golden rule: Every demo project should be repeatable in minutes, if not less. + +### Generic demo template project + +You want to create your own awesome demo to convince your friends, team, and boss that your project is exactly what the doctor ordered? This template will provide the tools to set up simple, consistent and easily repeatable demo projects. + +### Getting started with this template + + 1. [Download and unzip it][2]. + + + +Run **init.sh** to populate a project, and see the README files that are generated for how to use it: + + +``` +`$ ./init.sh PROJECTNAME` +``` + +#### + +![Setting up your project][3] + +#### Released versions + + * v2.0—Updated to generic template project creation + * v1.0—Image added and final touches + + + +  + +![Installing the template][4] + +![Installing the template][5] + +_This article is adapted from "How to create simple, consistent, repeatable demo projects" on [Eric D. Schabell's blog][6] and is reused with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/initsh-script + +作者:[Eric D. Schabell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/eschabell +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://github.com/jbossdemocentral/jboss-demo-template/archive/master.zip +[3]: https://opensource.com/sites/default/files/uploads/settingup_demotemplate.png (Setting up your project) +[4]: https://opensource.com/sites/default/files/uploads/install_eric_schabell.png (Installing the template) +[5]: https://opensource.com/sites/default/files/uploads/install-2_eric_schabell.png (Installing the template) +[6]: http://www.schabell.org/2015/02/jboss-evangelist-howto-create-demo-projects.html From 4a9fdf4bc73831fe8672886073243403ffeaef22 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:56:33 +0800 Subject: [PATCH 494/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20What's?= =?UTF-8?q?=20HTTPS=20for=20secure=20computing=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200109 What-s HTTPS for secure computing.md --- ...00109 What-s HTTPS for secure computing.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20200109 What-s HTTPS for secure computing.md diff --git a/sources/tech/20200109 What-s HTTPS for secure computing.md b/sources/tech/20200109 What-s HTTPS for secure computing.md new file mode 100644 index 0000000000..364ff39b13 --- /dev/null +++ b/sources/tech/20200109 What-s HTTPS for secure computing.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's HTTPS for secure computing?) +[#]: via: (https://opensource.com/article/20/1/confidential-computing) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +What's HTTPS for secure computing? +====== +Security by default hasn't arrived yet. +![Secure https browser][1] + +Over the past few years, it's become difficult to find a website that is just "http://…" This is because the industry has finally realised that security on the web is "a thing," and also because it has become easy for both servers and clients to set up and use HTTPS connections. A similar shift may be on its way in computing across cloud, edge, Internet of Things, blockchain, artificial intelligence, machine learning, and beyond. We've known for a long time that we should encrypt data at rest (in storage) and in transit (on the network), but encrypting it in use (while processing) has been difficult and expensive. Confidential computing—providing this type of protection for data and algorithms in use using hardware capabilities such as trusted execution environments (TEEs)—protects data on hosted systems or vulnerable environments. + +I've written several times about [TEEs][2] and, of course, the [Enarx project][3] of which I'm a co-founder with Nathaniel McCallum (see [_Enarx for everyone (a quest)_][4] and [_Enarx goes multi-platform_][5] for examples). Enarx uses TEEs and provides a platform- and language-independent deployment platform to allow you safely to deploy sensitive applications or components (such as microservices) onto hosts that you don't trust. Enarx is, of course, completely open source (we're using the Apache 2.0 licence, for those with an interest). Being able to run workloads on hosts that you don't trust is the promise of confidential computing, which extends normal practice for sensitive data at rest and in transit to data in use: + + * **Storage:** You encrypt your data at rest because you don't fully trust the underlying storage infrastructure. + * **Networking:** You encrypt your data in transit because you don't fully trust the underlying network infrastructure. + * **Compute:** You encrypt your data in use because you don't fully trust the underlying compute infrastructure. + + + +I've got a lot to say about trust, and the word "fully" in the statements above is important (I added it on re-reading what I'd written). In each case, you have to trust the underlying infrastructure to some degree, whether it's to deliver your packets or store your blocks, for instance. In the case of the compute infrastructure, you're going to have to trust the CPU and associated firmware, just because you can't really do computing without trusting them (there are techniques such as homomorphic encryption, which are beginning to offer some opportunities here, but they're limited and the technology still immature). + +Questions sometimes come up about whether you should fully trust CPUs, given some of the security problems that have been found with them, and also about whether they are fully secure against physical attacks on the host on which they reside. + +The answer to both questions is "no," but this is the best technology we currently have available at scale and at a price point to make it generally deployable. To address the second question, nobody is pretending that this (or any other technology) is fully secure: what we need to do is consider our [threat model][6] and decide whether TEEs (in this case) provide sufficient security for our specific requirements. In terms of the first question, the model that Enarx adopts is to allow decisions to be made at deployment time as to whether you trust a particular set of CPUs. So, for example, if vendor Q's generation R chips are found to contain a vulnerability, it will be easy to say "refuse to deploy my workloads to R-type CPUs from Q, but continue to deploy to S-type, T-type, and U-type chips from Q and any CPUs from vendors P, M, and N." + +I think there are three changes in the landscape that are leading to the interest and adoption of confidential computing right now: + + 1. **Hardware availability:** It is only over the past six to 12 months that hardware supporting TEEs has started to become widely available, with the key examples in the market at the moment being Intel's SGX and AMD's SEV. We can expect to see other examples of TEE-enabled hardware coming out in the fairly near future. + 2. **Industry readiness:** Just as cloud use is increasingly becoming accepted as a model for application deployment, regulators and legislators are increasing the requirements on organisations to protect the data they manage. Organisations are beginning to clamour for ways to run sensitive applications (or applications that handle sensitive data) on untrusted hosts—or, to be more accurate, on hosts that they cannot fully trust with that sensitive data. This should be no surprise: the chip vendors would not have invested so much money into this technology if they saw no likely market for it. Formation of the Linux Foundation's [Confidential Computing Consortium][7] (CCC) is another example of how the industry is interested in finding common models for the use of confidential computing and encouraging open source projects to employ these technologies.[1][8] + 3. **Open source:** Like blockchain, confidential computing is one of those technologies where it's an absolute no-brainer to use open source. If you are going to run sensitive applications, you need to trust what's doing the running for you. That's not just the CPU and firmware but also the framework that supports the execution of your workload within the TEE. It's all very well saying, "I don't trust the host machine and its software stack, so I'm going to use a TEE," but if you don't have visibility into the TEE software environment, then you're just swapping one type of software opacity for another. Open source support for TEEs allows you or the community—in fact, you _and_ the community—to check and audit what you're running in a way that is impossible for proprietary software. This is why the CCC sits within the Linux Foundation (which is committed to the open development model) and is encouraging TEE-related software projects to join and go open source (if they weren't already). + + + +I'd argue that this triad of hardware availability, industry readiness, and open source has become the driver for technology change over the past 15 to 20 years. Blockchain, AI, cloud computing, webscale computing, big data, and internet commerce are all examples of these three meeting at the same time and leading to extraordinary changes in our industry. + +Security by default is a promise that we've been hearing for decades now, and it hasn't arrived yet. Honestly, I'm not sure it ever will. But as new technologies become available, security ubiquity for particular use cases becomes more practical and more expected within the industry. It seems that confidential computing is ready to be the next big change—and you, dear reader, can join the revolution (it's open source, after all). + +* * * + + 1. Enarx, initiated by Red Hat, is a CCC project. + + + +* * * + +_This article was originally published on [Alice, Eve, and Bob][9] and is reprinted with the author's permission._ + +Get a sneak peek at Daniel Roesler's Texas Linux Fest talk, "If you're not using HTTPS, your... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/confidential-computing + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/secure_https_url_browser.jpg?itok=OaPuqBkG (Secure https browser) +[2]: https://aliceevebob.com/2019/02/26/oh-how-i-love-my-tee-or-do-i/ +[3]: https://enarx.io/ +[4]: https://aliceevebob.com/2019/08/20/enarx-for-everyone-a-quest/ +[5]: https://aliceevebob.com/2019/10/29/enarx-goes-multi-platform/ +[6]: https://aliceevebob.com/2018/02/20/there-are-no-absolutes-in-security/ +[7]: https://confidentialcomputing.io/ +[8]: tmp.VEZpFGxsLv#1 +[9]: https://aliceevebob.com/2019/12/03/confidential-computing-the-new-https/ From d4c144561acc823fa28e5ac6704ead91dfbdde89 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 10 Jan 2020 00:57:29 +0800 Subject: [PATCH 495/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200109=20How=20?= =?UTF-8?q?to=20Deliver=20Affordable=20and=20Optimized=20Application=20Acc?= =?UTF-8?q?ess=20Worldwide=20with=20SASE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md --- ... Application Access Worldwide with SASE.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md diff --git a/sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md b/sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md new file mode 100644 index 0000000000..9e217c7d24 --- /dev/null +++ b/sources/talk/20200109 How to Deliver Affordable and Optimized Application Access Worldwide with SASE.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Deliver Affordable and Optimized Application Access Worldwide with SASE) +[#]: via: (https://www.networkworld.com/article/3512640/how-to-deliver-affordable-and-optimized-application-access-worldwide-with-sase.html) +[#]: author: (Cato Networks https://www.networkworld.com/author/Matt-Conran/) + +How to Deliver Affordable and Optimized Application Access Worldwide with SASE +====== +Gartner tells you to use your MPLS renewal budget to transition into SASE, but not every SASE can replace MPLS. Here's what to look for. +Vit_Mar + +Global expansion is a common goal for many enterprises. In some verticals, like manufacturing, running production lines globally is an established practice. However, deploying international sales, service, and engineering teams is becoming the norm for many other sectors including high tech, finance, retail, and more. + +A global enterprise footprint creates a unique set of challenges that do not occur in regional businesses. Users in a remote office will need to securely access data-center applications, cloud applications, or both. Depending on the distance between the remote location and the application—and the sensitivity of the application to high latency, packet loss, and jitter—an expensive set of technologies and capabilities will be needed to optimize the user experience. + +[SD-WAN][1] focuses on affordable, high-performance site connectivity. Alone it cannot solve the broader networking and security challenges faced by global enterprises, which is why Gartner and other analysts are already recognizing the need to look beyond SD-WAN for a new class of enterprise solutions. Gartner has coined the term [secure access service edge (SASE, pronounced “sassy”)][2] for solutions that converge SD-WAN capabilities with enterprise security into a global, cloud-native platform. Let’s take a deeper look. + +#### **The Application Access Optimization Challenge** + +Across the enterprise, IT finds itself facing various challenges delivering network access to users and data everywhere. While those challenges will vary, their impact point remains the same—the user experience and IT budget. + +For data-center access, organizations traditionally relied on global MPLS providers. The predictability of MPLS ensured consistent latency and low packet loss and jitter needed to support critical applications like voice and ERP. The challenge with global MPLS was the cost per megabit that required organizations to spend heavily on limited bandwidth, creating a capacity constraint. The introduction of SD-WAN appliances and Internet-based connectivity does little to address the global connectivity challenge because SD-WAN appliances can't control the packet routing once the packet is placed on the Internet-leg of the SD-WAN. + +Another option to address global connectivity challenges was to shorten the distance between users and applications. Enterprises built regional data centers or hubs to get applications closer to end users. This is a very costly and complex endeavor that is most suitable for very large organizations with distributed IT staff who can optimize application performance and availability. + +#### **Global Cloud Access** + +The migration to cloud applications and cloud data centers created a new challenge for remote users. While MPLS was optimized for the organization’s on-premises data-center access, cloud data centers often reside in different geographic locations. Special connectivity solutions, such as [AWS DirectConnect and Azure ExpressRoute][3], are used to optimally connect physical enterprise locations to the cloud data centers. And while SD-WAN appliances claim cloud optimization, they require deploying a second appliance into the cloud — no easy task. + +Regardless of application location, none of the network solutions discussed are extensible to home offices and mobile users, where deploying edge appliances for SD-WAN or WAN optimization is not possible. This creates an application access challenge because the users must use the public internet to access the edge of the data center hosting their application. This access is subject to the unpredictable quality of the network from the user’s location to the destination. + +#### **SASE Delivers Optimized and Secured Application Access Anywhere** + +Global expansion, the migration from on-premises to cloud data centers, and the emergence of the mobile and telecommuting workforce are straining legacy network architectures. The network “patches” created to address this challenge, such as edge-SD-WAN, hybrid MPLS, Internet transports, and premium cloud connectivity, are costly and incomplete. + +To address this architectural challenge, a new architecture that connects and optimizes all edges—physical, virtual, cloud, mobile—anywhere in the world, must be created. That’s the story of [SASE][2]. SASE services converge networking and security into an identity-aware, cloud-native software stack. It’s the convergence that is key. Without the necessary network optimizations and capabilities, the SASE platform will not be able to meet performance expectations everywhere. + +#### **Cloud-Native: Built for and Delivered from the Cloud** + +A core characteristic of SASE is a cloud-native, as-a-service model. A cloud-native architecture leverages key cloud capabilities, including elasticity, adaptability, self-healing, and self-maintenance. + +SASE calls for the creation of a network of cloud points of presence (PoPs), which comprise the SASE Cloud. The PoPs run the provider software that delivers a wide range of networking and network security capabilities as a service. The PoPs should seamlessly scale to adapt to changes in traffic load via the addition of compute nodes. The PoPs software can be upgraded to deliver new features or bug fixes seamlessly and without IT involvement. The cloud architecture must include self-healing capabilities to automatically move processing away from failing compute nodes and PoPs and into healthy ones. + +These capabilities can't be achieved by spinning up virtual appliances in the cloud. Appliances are designed to serve a single customer (single tenant) and lack the overall cloud orchestration layer to ensure elasticity and self-healing. + +**Globally Distributed: Available Near All Edges** + +SASE Cloud is implemented as a globally distributed cloud platform. The SASE Cloud design guarantees that wherever your edges are, the full range of networking and security capabilities will be available to support them. SASE providers will have to strategically deploy PoPs to support business locations, cloud applications, and mobile users. As Gartner notes, SASE PoPs must extend beyond public cloud providers’ footprints (like AWS and Azure) to deliver a low-latency service to enterprise edges. + +Building a global cloud platform requires providers to hone their ability to rapidly deploy PoPs into cloud and physical data centers, ensure high capacity and redundant connectivity to support both WAN and cloud access, and apply security and optimization end-to-end across all edges. + +#### **Thin Edge: DC, Branch, Cloud, User** + +By placing processing and business logic in the cloud, SASE has minimal requirements for connecting various edges. This is a key challenge for SD-WAN edges especially in the context of NFV and uCPE. Running SD-WAN and network security side by side on the same appliance increases the likelihood of an overload, forcing the need to over-spec the underlying appliance.  This isn't a theoretical issue: An increase in branch throughput or rise in encrypted traffic volume can force an out-of-budget expansion. A Thin Edge approach has the following benefits:** ** + + * **Low cost:** By minimizing edge processing, low-cost appliances can achieve high throughput as most resource-intensive processing, such as deep packet inspection, is done using cloud resources that can scale better. + * **Low maintenance:** By keeping the over-functionality limited, it is possible to run a slower upgrade cycle to the edges, which has a higher potential for disruption vs. introducing new capabilities in the cloud. + * **Low impact:** Cloud integration is achieved with no edge appliances at all (agentless), while security and global network optimization remains intact. Mobile devices and new kinds of IoT devices no longer need significant processing resources to participate in the corporate network. They can automatically connect to the nearest SASE PoP with minimal battery impact. + + + +#### **End-to-End Optimization** + +Combining intelligent routing at the WAN edge with a software-defined global private backbone enables end-to-end traffic optimization. Last-mile optimizations focus on addressing last-mile issues, such as packet loss, by dynamically routing traffic over multiple ISPs. Middle-mile optimizations focus on optimizing routing globally and over multiple carriers comprising a diverse underlay. The middle-mile optimization extends to all edges—physical, virtual, and mobile—which is a unique benefit to a cloud-based, rather than an edge appliance-based, architecture. + +In short, SASE implements a new architecture that is built to support the modern global enterprise and address the various resources, requirements, and use cases in a holistic platform. Yes, SASE provides a fresh way to secure the network, but SASE also needs the “networking capabilities” of the network if companies are to deliver users everywhere an optimum user experience. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3512640/how-to-deliver-affordable-and-optimized-application-access-worldwide-with-sase.html + +作者:[Cato Networks][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.catonetworks.com/sd-wan?utm_source=idg +[2]: https://www.catonetworks.com/sase?utm_source=idg +[3]: https://www.catonetworks.com/cato-cloud#cloud-datacenter From ab89bd8d00f5d056bad82cef582c82835be90792 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 10 Jan 2020 08:51:05 +0800 Subject: [PATCH 496/676] translated --- ...erWM- tiled window management for GNOME.md | 71 ------------------- ...erWM- tiled window management for GNOME.md | 71 +++++++++++++++++++ 2 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 sources/tech/20200105 PaperWM- tiled window management for GNOME.md create mode 100644 translated/tech/20200105 PaperWM- tiled window management for GNOME.md diff --git a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md b/sources/tech/20200105 PaperWM- tiled window management for GNOME.md deleted file mode 100644 index fa99f6c352..0000000000 --- a/sources/tech/20200105 PaperWM- tiled window management for GNOME.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (PaperWM: tiled window management for GNOME) -[#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/) -[#]: author: (Julia Evans https://jvns.ca/) - -PaperWM: tiled window management for GNOME -====== - -When I started using Linux on my personal computer, one of the first things I got excited about was tiny lightweight window managers, largely because my laptop at the time had 32MB of RAM and anything else was unusable. - -Then I got into tiling window managers like [xmonad][1]! I could manage my windows with my keyboard! They were so fast! I could configure xmonad by writing a Haskell program! I could customize everything in all kinds of fun ways (like using [dmenu][2] as a launcher)! I used 3 or 4 different tiling window managers over the years and it was fun. - -About 6 years ago I decided configuring my tiling window manager wasn’t fun for me anymore and switched to using the Ubuntu stock desktop environment: Gnome. (which is much faster now that I have 500x more RAM in my laptop :) ) - -So I’ve been using Gnome for a long time, but I still kind of missed tiling window managers. Then 6 months ago a friend told me about [PaperWM][3], which lets you tile your windows in Gnome! I installed it immediately and I’ve been using it ever since. - -### PaperWM: tiling window management for Gnome - -The basic idea of [PaperWM][3] is: you want to keep using Gnome (because all kinds of things Just Work in Gnome) but you also kinda wish you were using a tiling window manager. - -It’s a Gnome extension (instead of being a standalone window manager) and it’s in Javascript. - -### “Paper” means all of your windows are in a line - -The main idea in PaperWM is it puts all your windows in a line, which is actually quite different from traditional tiling window managers where you can tile your windows any way you want. Here’s a gif of me moving between / resizing some windows while writing this blog post (there’s a browser and two terminal windows): - -![][4] - -PaperWM’s Github README links to this video: , which describes a similar system as a “linear window manager”. - -I’d never heard of this way of organizing windows before but I like the simplicity of it – if I’m looking for a specific window I just move left/right until I find it. - -### everything I do in PaperWM - -there are lots of other features but these are the only ones I use: - - * move left and right between windows (`Super + ,`, `Super + .`) - * move the window left/right in the ordering (`Super+Shift+,`, `Super+Shift+.`) - * full screen a window (`Super + f`) - * make a window smaller (`Super + r`) - - - -### I like tools that I don’t have to configure - -I’ve been using PaperWM for 6 months on a laptop and I really like it! I also really appreciate that even though it’s configurable (by writing a Javascript configuration file), it does the things I want out of the box without me having to research how to configure it. - -The [fish shell][5] is another delightful tool like that – I basically don’t configure fish at all (except to set environment variables etc) and I really like the default feature set. - --------------------------------------------------------------------------------- - -via: https://jvns.ca/blog/2020/01/05/paperwm/ - -作者:[Julia Evans][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://jvns.ca/ -[b]: https://github.com/lujun9972 -[1]: https://xmonad.org/ -[2]: https://wiki.archlinux.org/index.php/Dmenu -[3]: https://github.com/paperwm/PaperWM -[4]: https://jvns.ca/images/paperwm.gif -[5]: https://jvns.ca/blog/2017/04/23/the-fish-shell-is-awesome/ diff --git a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md new file mode 100644 index 0000000000..dab0726417 --- /dev/null +++ b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PaperWM: tiled window management for GNOME) +[#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/) +[#]: author: (Julia Evans https://jvns.ca/) + +PaperWM:GNOME 下的平铺窗口管理 +====== + +当我开始在个人计算机上使用 Linux 时,令我兴奋的第一件事就是轻巧的窗口管理器,这主要是因为当时我的笔记本电脑只有有 32MB 的内存,且没有其他可使用的内存。 + +接着我开始接触 [xmonad][1] 之类的平铺窗口管理器!我可以用键盘管理窗口了!它们太快了!我可以通过编写 Haskell 程序来配置 xmonad!我可以用各种有趣的方式自定义所有内容(例如使用 [dmenu][2] 作为启动器)!这些年来,我用过 3,4 个不同的平铺窗口管理器,它们很有趣。 + +大约 6 年前,我觉得配置平铺窗口管理器对我来说不再是一件有趣的事情,因此转而使用 Ubuntu 桌面环境 Gnome。 (现在,我的笔记本电脑中的内存增加了 500 倍,这要快得多 :) ) + +我使用 Gnome 已有很长时间了,但是我仍然有点想念平铺窗口管理器。六个月前,一个朋友告诉我有关 [PaperWM][3] 的消息,它使你可以在 Gnome中 平铺窗口!我立即安装了它,并从那时起我一直在使用它。 + +### PaperWM:Gnome 下的平铺窗口管理 + +[PaperWM][3] 的基本思想是:你想继续使用 Gnome(因为在 Gnome 中各种任务都能完成),但是你也希望使用平铺窗口管理器。 + +它是一个 Gnome 扩展程序(而不是一个独立的窗口管理器),并且使用 Javascript。 + +### “Paper” 表示你的所有窗户都在一行中 + +PaperWM 的主要思想是将所有窗口排成一行,这实际上与传统的平铺窗口管理器大不相同,在传统的平铺窗口管理器中,你可以按任意方式平铺窗口。这是我写这篇博客时在几个窗口之间切换/调整大小的 gif 图像(有一个浏览器和两个终端窗口): + +![][4] + +PaperWM 的 Github README 链接了此视频:,它描述为一个类似的”线性窗口管理器“。 + +我以前从未听说过这种组织窗口的方式,但是我喜欢它的简单性。如果要查找特定的窗口,只需向左/向右移动,直到找到它。 + +### 我在 PaperWM 中所做的一切 + +还有很多其他功能,但这是我使用的功能: + + * 在窗口之间左右移动(`Super + ,`, `Super + .`) +  * 按顺序向左/向右移动窗口(`Super+Shift+,`,`Super+Shift+.`) +  * 全屏显示窗口(`Super + f`) +  * 缩小窗口(`Super + r`) + + + +### 我喜欢不需要配置的工具 + +我在笔记本上使用 PaperWM 已经6个月了,我真的很喜欢它!即使它是可配置(通过编写 Javascript 配置文件),我也非常欣赏它,它自带我想要的功能,我无需研究如何去配置。 + +[fish shell][5] 是另一个类似的令人愉悦的工具,我基本上没有配置 fish(除了设置环境变量等),我真的很喜欢它的默认功能。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/01/05/paperwm/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://xmonad.org/ +[2]: https://wiki.archlinux.org/index.php/Dmenu +[3]: https://github.com/paperwm/PaperWM +[4]: https://jvns.ca/images/paperwm.gif +[5]: https://jvns.ca/blog/2017/04/23/the-fish-shell-is-awesome/ From fa31c8aab28d211786a5992d469b039891f2cd8a Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 10 Jan 2020 08:57:45 +0800 Subject: [PATCH 497/676] translating --- ...06 How to write a Python web API with Pyramid and Cornice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md index 2b10ef953a..eaab46c5bc 100644 --- a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md +++ b/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 357183cce76c020e080a7515e1c79e484db92910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 10 Jan 2020 09:17:48 +0800 Subject: [PATCH 498/676] Translated --- ...21 Simulate gravity in your Python game.md | 96 ++++++++++--------- 1 file changed, 49 insertions(+), 47 deletions(-) rename {sources => translated}/tech/20191121 Simulate gravity in your Python game.md (64%) diff --git a/sources/tech/20191121 Simulate gravity in your Python game.md b/translated/tech/20191121 Simulate gravity in your Python game.md similarity index 64% rename from sources/tech/20191121 Simulate gravity in your Python game.md rename to translated/tech/20191121 Simulate gravity in your Python game.md index 45e4b4ce50..fd02e851d6 100644 --- a/sources/tech/20191121 Simulate gravity in your Python game.md +++ b/translated/tech/20191121 Simulate gravity in your Python game.md @@ -7,29 +7,28 @@ [#]: via: (https://opensource.com/article/19/11/simulate-gravity-python) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Simulate gravity in your Python game +在你的 Python 游戏中模拟引力 ====== -Learn how to program video games with Python's Pygame module and start -manipulating gravity. +学习如何使用 Python 的 Pygame 模块编程电脑游戏,并开始操作引力。 ![Cosmic stars in outer space][1] -The real world is full of movement and life. The thing that makes the real world so busy and dynamic is physics. Physics is the way matter moves through space. Since a video game world has no matter, it also has no physics, so game programmers have to _simulate_ physics. +真实的世界充满了运动和生活。物理学使得真实的生活如此忙碌和动态。物理学是物质在空间中运动的方式。既然一个电脑游戏世界没有物质,它也就没有物理学规律,使用游戏程序员不得不 _模拟_ 物理学。 -In terms of most video games, there are basically only two aspects of physics that are important: gravity and collision. +从大多数电脑游戏来说,这里基本上仅有物理学的两个方向是重要的:引力和碰撞。 -You implemented some collision detection when you [added an enemy][2] to your game, but this article adds more because gravity requires collision detection. Think about why gravity might involve collisions. If you can't think of any reasons, don't worry—it'll become apparent as you work through the sample code. +当你[添加一个敌人][2]到你的游戏中时,你实现了一下碰撞检测,但是这篇文章添加更多的东西,因为引力需要碰撞检测。想想为什么引力可能涉及碰撞。如果你不能想到任何原因,不要担心—当你通过示例代码工作时,它将变得明显。 -Gravity in the real world is the tendency for objects with mass to be drawn toward one another. The larger the object, the more gravitational influence it exerts. In video game physics, you don't have to create objects with mass great enough to justify a gravitational pull; you can just program a tendency for objects to fall toward the presumed largest object in the video game world: the world itself. +引力在真实世界中的是有质量的物体来相互吸引的趋势。物体(质量)越大,它施加越大的引力作用。在电脑游戏物理学中,你不必创建质量足够大的物体来证明引力的正确;你可以在电脑游戏世界本身中仅编程一个物体落向假设的最大的对象的倾向。 -### Adding a gravity function +### 添加一个引力函数 -Remember that your player already has a property to determine motion. Use this property to pull the player sprite toward the bottom of the screen. +记住你的玩家已经有一个属性来决定动作。使用这个属性来将玩家精灵拉向屏幕底部。 -In Pygame, higher numbers are closer to the bottom edge of the screen. +在 Pygame 中,较高的数字更接近屏幕的底部边缘。 -In the real world, gravity affects everything. In platformers, however, gravity is selective—if you add gravity to your entire game world, all of your platforms would fall to the ground. Instead, you add gravity just to your player and enemy sprites. +在真实的世界中,引力影响一切。然而,在平台中,引力是有选择性的—如果你添加引力到你的整个游戏世界,你所有平台都将掉到地上。作为替换,你仅添加引力到你的玩家和敌人精灵中。 -First, add a **gravity** function in your **Player** class: +首先,在你的 **Player** 类中添加一个 **引力** 函数: ``` @@ -37,11 +36,11 @@ First, add a **gravity** function in your **Player** class:         self.movey += 3.2 # how fast player falls ``` -This is a simple function. First, you set your player in vertical motion, whether your player wants to be in motion or not. In other words, you have programmed your player to always be falling. That's basically gravity. +这是一个简单的函数。首先,不管你的玩家是否想运动,你设置你的玩家垂直运动。也就是说,你已经编程你的玩家总是在下降。这基本上就是引力。 -For the gravity function to have an effect, you must call it in your main loop. This way, Python applies the falling motion to your player once every clock tick. +为使引力函数生效,你必需在你的主循环中调用它。这样,当每一个时钟滴答作响时,Python 应用下落运动到你玩家。 -In this code, add the first line to your loop: +在这代码中,添加第一行到你的循环中: ``` @@ -49,49 +48,50 @@ In this code, add the first line to your loop:     player.update() ``` -Launch your game to see what happens. Look sharp, because it happens fast: your player falls out of the sky, right off your game screen. +启动你的游戏来看看会发生什么。注意,因为它快速地发生:你是玩家从天空上下落,恰好从你的游戏屏幕落下。 -Your gravity simulation is working, but maybe too well. +你的引力模拟是工作的,但是,也许太好了。 -As an experiment, try changing the rate at which your player falls. +作为一次试验,尝试更改你玩家下落的速度。 -### Adding a floor to gravity +### 添加一个地板到引力 -The problem with your character falling off the world is that there's no way for your game to detect it. In some games, if a player falls off the world, the sprite is deleted and respawned somewhere new. In other games, the player loses points or a life. Whatever you want to happen when a player falls off the world, you have to be able to detect when the player disappears offscreen. +你的游戏没有办法发现你的角色掉落出世界的问题。在一些游戏中,如果一个玩家掉落出世界,该精灵被删除,并在新的位置重生。在其它的游戏中,玩家丢失分数或一条生命。当一个玩家掉落出世界时,不管你想发生什么,你必需能够侦测出玩家何时消失在屏幕外。 -In Python, to check for a condition, you can use an **if** statement. +在 Python 中,要检查一个条件,你可以使用一个 **if** 语句。 -You must check to see **if** your player is falling and how far your player has fallen. If your player falls so far that it reaches the bottom of the screen, then you can do _something_. To keep things simple, set the position of the player sprite to 20 pixels above the bottom edge. +你必需查看你玩家**是否**正在掉落,以及你的玩家掉落到什么程度。如果你的玩家掉落到屏幕的底部,那么你可以做 _一些事情_ 。 为保持事情简单,设置玩家精灵的位置为底部边缘上方20像素。 -Make your **gravity** function look like this: +使你的 **引力** 函数看起来像这样: ```     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty ``` -Then launch your game. Your sprite still falls, but it stops at the bottom of the screen. You may not be able to _see_ your sprite behind the ground layer, though. An easy fix is to make your player sprite bounce higher by adding another **-ty** to its new Y position after it hits the bottom of the game world: +然后,启动你的游戏。你的精灵仍然下落,但是它停在屏幕的底部。不过,你也许不能 _看到_ 你在地面层下的精灵。一个简单的解决方法是,在精灵碰撞游戏世界的底部后,通过添加另一个 **-ty** 到它的新 Y 位置,从而使你的精灵弹跳更高: ```     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty-ty ``` -Now your player bounces at the bottom of the screen, just behind your ground sprites. +现在你的玩家在屏幕底部弹跳,恰好在你地面层精灵的后面。 -What your player really needs is a way to fight gravity. The problem with gravity is, you can't fight it unless you have something to push off of. So, in the next article, you'll add ground and platform collision and the ability to jump. In the meantime, try applying gravity to the enemy sprite. +你的玩家真正需要的是反抗引力的方法。引力问题是,你不能反抗它,除非你有一些东西来推开引力作用。因此,在接下来的文章中,你将添加地面和平台碰撞以及跳跃能力。在这期间,尝试应用引力到敌人精灵。 -Here's all the code so far: + +到目前为止,这里是全部的代码: ``` @@ -150,7 +150,7 @@ class Player(pygame.sprite.Sprite):     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty-ty         @@ -170,16 +170,16 @@ class Player(pygame.sprite.Sprite):         self.rect.y = self.rect.y + self.movey         # moving left -        if self.movex < 0: +        if self.movex < 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani]         # moving right -        if self.movex > 0: +        if self.movex > 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] @@ -215,9 +215,9 @@ class Enemy(pygame.sprite.Sprite):         distance = 80         speed = 8 -        if self.counter >= 0 and self.counter <= distance: +        if self.counter >= 0 and self.counter <= distance:             self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: +        elif self.counter >= distance and self.counter <= distance*2:             self.rect.x -= speed         else:             self.counter = 0 @@ -243,7 +243,7 @@ class Level():         ground_list = pygame.sprite.Group()         i=0         if lvl == 1: -            while i < len(gloc): +            while i < len(gloc):                 ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png')                 ground_list.add(ground)                 i=i+1 @@ -262,9 +262,9 @@ class Level():             ploc.append((300,worldy-ty-256,3))             ploc.append((500,worldy-ty-128,4)) -            while i < len(ploc): +            while i < len(ploc):                 j=0 -                while j <= ploc[i][2]: +                while j <= ploc[i][2]:                     plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png')                     plat_list.add(plat)                     j=j+1 @@ -311,7 +311,7 @@ tx = 64 #tile size ty = 64 #tile size i=0 -while i <= (worldx/tx)+tx: +while i <= (worldx/tx)+tx:     gloc.append(i*tx)     i=i+1 @@ -366,13 +366,14 @@ while main == True: * * * -This is part 6 in an ongoing series about creating video games in [Python 3][3] using the [Pygame][4] module. Previous articles are: +这是仍在进行中的关于使用 [Pygame][4] 模块来在 [Python 3][3] 在创建电脑游戏的第七部分。先前的文章是: - * [Learn how to program in Python by building a simple dice game][5] - * [Build a game framework with Python using the Pygame module][6] - * [How to add a player to your Python game][7] - * [Using Pygame to move your game character around][8] - * [What's a hero without a villain? How to add one to your Python game][2] + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][5] + * [使用 Python 和 Pygame 模块构建一个游戏框架][6] + * [如何在你的 Python 游戏中添加一个玩家][7] + * [用 Pygame 使你的游戏角色移动起来][8] + * [如何向你的 Python 游戏中添加一个敌人][2] + * [在 Pygame 游戏中放置平台][9] @@ -382,7 +383,7 @@ via: https://opensource.com/article/19/11/simulate-gravity-python 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[robsean](https://github.com/robsean) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -397,3 +398,4 @@ via: https://opensource.com/article/19/11/simulate-gravity-python [6]: https://opensource.com/article/17/12/game-framework-python [7]: https://opensource.com/article/17/12/game-python-add-a-player [8]: https://opensource.com/article/17/12/game-python-moving-player +[9]: https://opensource.com/article/18/7/put-platforms-python-game From 98e4b4bedc17c4c9995afc79595c695b5aa29608 Mon Sep 17 00:00:00 2001 From: cycoe Date: Fri, 10 Jan 2020 10:29:46 +0800 Subject: [PATCH 499/676] Translating by cycoe --- .../tech/20191205 Add jumping to your Python platformer game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191205 Add jumping to your Python platformer game.md b/sources/tech/20191205 Add jumping to your Python platformer game.md index 9d64001082..5c4ec0507e 100644 --- a/sources/tech/20191205 Add jumping to your Python platformer game.md +++ b/sources/tech/20191205 Add jumping to your Python platformer game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (cycoe) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2bc8a25f50d20410b4d452514ceec332b4e55f58 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 10 Jan 2020 10:36:40 +0800 Subject: [PATCH 500/676] PRF @geekpi --- ...et- Screen Recorder. Here-s How to Use it.md | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md index 84d72051eb..f8d1db0dd7 100644 --- a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md +++ b/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) [#]: via: (https://itsfoss.com/gnome-screen-recorder/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -GNOME 有一个“秘密”的屏幕录像机。下面是使用方法! +GNOME 有一个“隐藏”的屏幕录像机 ====== -[GNOME][1]是[最受欢迎的桌面环境][2]之一。它有现代的 UI,并且带有许多特定于 GNOME 的应用,这些应用与桌面整体外观完美融合。 +[GNOME][1] 是[最受欢迎的桌面环境][2]之一。它有现代的 UI,并且带有许多特定于 GNOME 的应用,这些应用与桌面整体外观完美融合。 你可以根据自己的喜好来[调整 GNOME][3],但我不在这里讨论。GNOME 桌面有一些你可能不知道的隐藏功能。 -这种不太明显的功能之一是内置的屏幕录像机。 +这种不太显眼的功能之一是内置的屏幕录像机。 是的,你没有看错。如果你使用的是 GNOME 桌面,那么不必安装其他的 [Linux 屏幕录像机][4]。你只需要知道正确的快捷键即可。 @@ -40,9 +40,9 @@ Ctrl + Alt + Shift + R gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300 ``` -在上面的命令中,我将录音的最大长度增加到 300 秒(即5分钟)。你可以将其更改为任何其他值,但应以秒为单位。 +在上面的命令中,我将录音的最大长度增加到 300 秒(即 5 分钟)。你可以将其更改为任何其它值,但应以秒为单位。 -如果你**不希望最长录音时间有任何限制,请将其设置为0**,之后它会在你手动停止或者磁盘空间不足才会停止。 +如果你**不希望最长录音时间有任何限制,请将其设置为 `0`**,之后它会在你手动停止或者磁盘空间不足才会停止。 #### 停止屏幕录制 @@ -54,29 +54,24 @@ gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length Ctrl + Alt + Shift + R ``` -你的录制内容将以 [webm][7 ]格式保存在家目录的 “Videos” 文件夹中。 +你的录制内容将以 [webm][7] 格式保存在家目录的 `Videos` 文件夹中。 #### 局限性 尽管使用这个小工具可以方便地快速录制桌面,但是与功能强大的 [Simple Screen Recorder][8] 这样的屏幕录制工具相比,它有一些局限性。 +* 录制开始之前没有时间延迟选项 +* 没有暂停和播放选项 +* 它录制整个屏幕。无法仅录制应用窗口、特定区域或特定屏幕(如果你有多个屏幕)。 +* 视频以 webm 格式保存在用户的 `Videos` 目录中。你无法更改。你必须使用 [HandBrake 之类的工具将视频转换为其他格式][9]。 - * 录制开始之前没有时间延迟选项 -  * 没有暂停和播放选项 -  * 它录制整个屏幕。无法仅录制应用窗口、特定区域或特定屏幕(如果你有多个屏幕)。 -  * 视频以 webm 格式保存在用户的 “Videos” 目录中。你无法更改。你必须使用 [HandBrake 之类的工具将视频转换为其他格式][9]。 - - - -如你所见,秘密的 GNOME 屏幕录像机与 [Kazam][10] 之类的工具或其他此类工具所提供的功能相差很远。 - -但是,它并不会尝试成为全功能的屏幕录像机。它只是为你提供录制屏幕的快速方法。 +如你所见,这个秘密的 GNOME 屏幕录像机与 [Kazam][10] 之类的工具或其他此类工具所提供的功能相差很远。但是,它并不会尝试成为全功能的屏幕录像机。它只是为你提供录制屏幕的快速方法。 GNOME 是一个多功能的现代桌面环境。你可以大量地[调整 GNOME][3]。[GNOME 扩展][11]为桌面自定义提供了另一个维度。 该屏幕录像机是 GNOME 的隐藏功能之一,就像你自己很难轻易找到的挂起选项。 -_你喜欢它吗?你是否还想与我们分享其他隐藏的 GNOME 功能?请在评论区留言。_ +你喜欢它吗?你是否还想与我们分享其他隐藏的 GNOME 功能?请在评论区留言。 -------------------------------------------------------------------------------- @@ -85,7 +80,7 @@ via: https://itsfoss.com/gnome-screen-recorder/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6924452c356a4ea7ded256846182ec79f2d1e709 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 10 Jan 2020 10:37:32 +0800 Subject: [PATCH 501/676] PUB @geekpi https://linux.cn/article-11766-1.html --- ...ME has a ‘Secret- Screen Recorder. Here-s How to Use it.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md (98%) diff --git a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md similarity index 98% rename from translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md rename to published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md index f8d1db0dd7..87e445c9b0 100644 --- a/translated/tech/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md +++ b/published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11766-1.html) [#]: subject: (GNOME has a ‘Secret’ Screen Recorder. Here’s How to Use it!) [#]: via: (https://itsfoss.com/gnome-screen-recorder/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 480defaa87da0c8e6d029aa4a573dc35c74ddf06 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 10 Jan 2020 10:42:14 +0800 Subject: [PATCH 502/676] =?UTF-8?q?Rename=2020200103=20GNOME=20has=20a=20?= =?UTF-8?q?=E2=80=98Secret-=20Screen=20Recorder.=20Here-s=20How=20to=20Use?= =?UTF-8?q?=20it.md=20to=2020200103=20GNOME=20has=20a=20Secret-=20Screen?= =?UTF-8?q?=20Recorder.=20Here-s=20How=20to=20Use=20it.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...03 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename published/{20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md => 20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md} (100%) diff --git a/published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md b/published/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md similarity index 100% rename from published/20200103 GNOME has a ‘Secret- Screen Recorder. Here-s How to Use it.md rename to published/20200103 GNOME has a Secret- Screen Recorder. Here-s How to Use it.md From 0778586a45ccd97d95ea036c047d5945a1235c21 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 10 Jan 2020 11:16:17 +0800 Subject: [PATCH 503/676] Revert "Fiveweb done" --- ...181105 5 Minimal Web Browsers for Linux.md | 171 ++++++++++++++++++ ...181105 5 Minimal Web Browsers for Linux.md | 167 ----------------- 2 files changed, 171 insertions(+), 167 deletions(-) create mode 100644 sources/tech/20181105 5 Minimal Web Browsers for Linux.md delete mode 100644 translated/tech/20181105 5 Minimal Web Browsers for Linux.md diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md new file mode 100644 index 0000000000..34c0c1e18e --- /dev/null +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (MonkeyDEcho ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (5 Minimal Web Browsers for Linux) +[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) +[#]: url: ( ) + +5 Minimal Web Browsers for Linux +====== +linux上的五种微型浏览器 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) + +There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. +有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 + +The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. +web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 + +There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. +但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 + +Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. +让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! + +### GNOME Web + +GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. +GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 + +Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: + + * Simplicity - Feature bloat and user interface clutter are considered evil. + + * Standards compliance - No non-standard features will ever be introduced to the codebase. + + * Software freedom - Epiphany will always be released under a license that respects freedom. + + * Human interface - Epiphany follows the [GNOME Human Interface Guidelines][6]. + + * Minimal preferences - Preferences are only added when they make sense and after careful consideration. + + * Target audience - Non-technical users are the primary target audience (which helps to define the types of features that are included). + + + + +GNOME Web is as clean and simple a web browser as you’ll find (Figure 1). + +![GNOME Web][8] + +Figure 1: The GNOME Web browser displaying a minimal amount of preferences for the user. + +[Used with permission][9] + +The GNOME Web manifesto reads: + +A web browser is more than an application: it is a way of thinking, a way of seeing the world. Epiphany's principles are simplicity, standards compliance, and software freedom. + +### Netsurf + +The [Netsurf][10] minimal web browser opens almost faster than you can release the mouse button. Netsurf uses its own layout and rendering engine (designed completely from scratch), which is rather hit and miss in its rendering (Figure 2). + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) + +Although you might find Netsurf to suffer from rendering issues on certain sites, understand the Hubbub HTML parser is following the work-in-progress HTML5 specification, so there will be issues popup now and then. To ease those rendering headaches, Netsurf does include HTTPS support, web page thumbnailing, URL completion, scale view, bookmarks, full-screen mode, keyboard shorts, and no particular GUI toolkit requirements. That last bit is important, especially when you switch from one desktop to another. + +For those curious as to the requirements for Netsurf, the browser can run on a machine as slow as a 30Mhz ARM 6 computer with 16MB of RAM. That’s impressive, by today’s standard. + +### QupZilla + +If you’re looking for a minimal browser that uses the Qt Framework and the QtWebKit rendering engine, [QupZilla][11] might be exactly what you’re looking for. QupZilla does include all the standard features and functions you’d expect from a web browser, such as bookmarks, history, sidebar, tabs, RSS feeds, ad blocking, flash blocking, and CA Certificates management. Even with those features, QupZilla still manages to remain a very fast lightweight web browser. Other features include: Fast startup, speed dial homepage, built-in screenshot tool, browser themes, and more. +One feature that should appeal to average users is that QupZilla has a more standard preferences tools than found in many lightweight browsers (Figure 3). So, if going too far outside the lines isn’t your style, but you still want something lighter weight, QupZilla is the browser for you. + +![QupZilla][13] + +Figure 3: The QupZilla preferences tool. + +[Used with permission][9] + +### Otter Browser + +Otter Browser is a free, open source attempt to recreate the closed-source offerings found in the Opera Browser. Otter Browser uses the WebKit rendering engine and has an interface that should be immediately familiar with any user. Although lightweight, Otter Browser does include full-blown features such as: + + * Passwords manager + + * Add-on manager + + * Content blocking + + * Spell checking + + * Customizable GUI + + * URL completion + + * Speed dial (Figure 4) + + * Bookmarks and various related features + + * Mouse gestures + + * User style sheets + + * Built-in Note tool + + +![Otter][15] + +Figure 4: The Otter Browser Speed Dial tab. + +[Used with permission][9] + +Otter Browser can be run on nearly any Linux distribution from an [AppImage][16], so there’s no installation required. Just download the AppImage file, give the file executable permissions (with the command chmod u+x otter-browser-*.AppImage), and then launch the app with the command ./otter-browser*.AppImage. + +Otter Browser does an outstanding job of rendering websites and could function as your go-to minimal browser with ease. + +### Lynx + +Let’s get really minimal. When I first started using Linux, back in ‘97, one of the web browsers I often turned to was a text-only take on the app called [Lynx][17]. It should come as no surprise that Lynx is still around and available for installation from the standard repositories. As you might expect, Lynx works from the terminal window and doesn’t display pretty pictures or render much in the way of advanced features (Figure 5). In fact, Lynx is as bare-bones a browser as you will find available. Because of how bare-bones this web browser is, it’s not recommended for everyone. But if you happen to have a gui-less web server and you have a need to be able to read the occasional website, Lynx can be a real lifesaver. + +![Lynx][19] + +Figure 5: The Lynx browser rendering the Linux.com page. + +[Used with permission][9] + +I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). + +### Plenty More Where This Came From + +There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not. + +Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.mozilla.org/en-US/firefox/new/ +[2]: https://www.chromium.org/ +[3]: https://vivaldi.com/ +[4]: https://www.google.com/chrome/ +[5]: https://www.merriam-webster.com/dictionary/epiphany +[6]: https://developer.gnome.org/hig/stable/ +[7]: /files/images/minimalbrowsers1jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) +[9]: /licenses/category/used-permission +[10]: https://www.netsurf-browser.org/ +[11]: https://qupzilla.com/ +[12]: /files/images/minimalbrowsers3jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) +[14]: /files/images/minimalbrowsers4jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) +[16]: https://sourceforge.net/projects/otter-browser/files/ +[17]: https://lynx.browser.org/ +[18]: /files/images/minimalbrowsers5jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) +[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20181105 5 Minimal Web Browsers for Linux.md b/translated/tech/20181105 5 Minimal Web Browsers for Linux.md deleted file mode 100644 index 1a533e6557..0000000000 --- a/translated/tech/20181105 5 Minimal Web Browsers for Linux.md +++ /dev/null @@ -1,167 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MonkeyDEcho ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (5 Minimal Web Browsers for Linux) -[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -[#]: url: ( ) - - -linux上的五种微型浏览器 -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) - -有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 - -web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 - -但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 - -让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! - -### GNOME Web - -GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 - -Epiphany 使用WebKit的渲染引擎,该引擎与Apple的Safari浏览器中使用的引擎相同。这个引擎和Epiphany非常契合,可以达到非常快的页面渲染速度。Epiphany严格遵守以下准则: - - * 简单性 - 功能复杂和用户界面混乱都是不被允许的. - - * 规范性 - 任何非标准特性都不会引入到代码库中。 - - * 软件开源 - Epiphany始终遵守自由开源许可证。 - - * 人机交互 - Epiphany 始终遵守[GNOME的人机交互指南][6]。 - - * 最小首选项 - 经过慎重考虑才添加首选项。 - - * 受众群体 - 非技术用户是主要的受众目标,(有助于定义所包含功能的类型)。 - - - - -GNOME web浏览器就像看到的一样干净简洁 (Figure 1)。 - - -![GNOME Web][8] - -Figure 1: GNOME 浏览器为用户展示最少的首选项. - -[许可证书][9] - -GNOME Web 的声明如下: - -web 浏览器它不仅仅是一个应用程序,还是一种思维方式,一种看世界的方式。 Epiphany 的原则是简洁,标准和自由。 -### Netsurf - -[Netsurf][10] 浏览器是最小的浏览器,他的打开速度几乎和你松开鼠标一样。Netsurf 使用自己的布局和渲染引擎(完全从零开始设计的) 在渲染过程的设计中屡屡碰壁(Figure 2). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) - -尽管你可能在特定的站点上发现 Netsurf的问题,但如果你了解Hubbub解析器的话,知道它正在兼容html5规范,是不是的会有一点问题。Netsurf对https的支持,网页缩略图,URL解析,缩放视图,书签,全屏模式,快捷键和GUI的工具包的功能;最后一点十分重要,当你桌面来回切换时,为了缓解渲染带来的问题。 - -对于那些对Netsurf 存在好奇的人来说,以现在的标准,他能在 16MB内存,30Mhz的ARM cpu的机器上运行,是让人惊奇的。 - -### QupZilla - -如果你找寻使用Qt Framework 和 the QtWebKit 渲染引擎的最小浏览器,QupZilla][11]是你最佳的选择。QupZilla 包含web浏览所有的标准功能,例如:书签,历史记录,侧边栏,选项卡,RSS,广告屏蔽,flash屏蔽,和CA证书管理。及时拥有这么多的功能,QupZilla 仍然是快速,轻量级的浏览器。另外还有其他的功能:快速启动,快速拨号主页,内置屏幕截图工具,浏览器主题等。 -吸引用户的一点是,与许多轻量级浏览器相比,QupZilla有更标准的首选项工具(图3)。所以,如果你很多功能,但你仍然想要更轻量,那么QupZilla就是你最好的选择。 - -![QupZilla][13] - -Figure 3: QupZilla 首选项工具. - -[许可证书][9] - -### Otter Browser - -Otter 浏览器是一种免费开源的,旨在重建Opera 12.x的浏览器。它使用WebKit渲染引擎,并且有用户的熟悉界面。虽然它轻量,但它有丰富的功能: - - * 密码管理 - - * 插件管理 - - * 内容拦截 - - * 拼写检查 - - * 自定义界面 - - * 网址补全 - - * 快速访问 (Figure 4) - - * 书签和其他相关功能 - - * 鼠标手势 - - * 用户样式表 - - * 内建笔记功能 - - -![Otter][15] - -Figure 4: Otter 浏览器快起标签项. - -[许可证书][9] - -Otter浏览器可以在几乎所有Linux发行版上运行通过[AppImage][16]软件格式,因此无需安装。只需下载AppImage文件,授予文件可执行权限(使用命令 `chmod u+x otter-browser-.AppImage`),然后使用命令`./otter-browser.AppImage` 启动应用程序。 - -Otter浏览器在网站展示方面做得非常出色,可以轻松地用作你的微型浏览器。 - - -### Lynx - -让我们见识真正的微型浏览器。早在97年,当我使用Linux时,就经常使用的[Lynx][17]纯文本模式的网页浏览器。 -Lynx的存在并且可以从标准存储库中进行安装。正如您可能期望的那样,Lynx在终端窗口中工作,并且不会显示漂亮的图片和高级功能的渲染方式(图5)。事实上,Lynx是你能找到的最简单的浏览器。由于这个网页浏览器是如此简陋,所以不建议每个人都使用它。但如果你碰巧有一个没有界面的服务器,你需要能够偶尔访问的网站,Lynx是一个真正的救星。 - -![Lynx][19] - -Figure 5: Lynx 浏览器展示 Linux.com 网址界面. - -[许可证书][9] - -我还发现Lynx是一个非常有用的工具,它可以帮助我解决网站某些方面的故障(或者如果网站上的某些功能阻止我在常规浏览器中查看内容)。使用Lynx的另一个重要原因是它可以让我们更加专注内容(而不是其他无关的元素)。 - -### Plenty More Where This Came From 更多 - -微型浏览器还有很多。但是这里列出的清单应该使你开始走极简主义的道路。无论您是否在低功率计算机上运行,​​这些浏览器中的一个(或多个)都一定可以满足这一需求。 - -了解linux 更多信息可以通过免费的["Linux 简洁" ][20]课程,该课程来源Linux基金和edX平台提供的。 - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[MonkeyDEcho](https://github.com/MonkeyDEcho) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.mozilla.org/en-US/firefox/new/ -[2]: https://www.chromium.org/ -[3]: https://vivaldi.com/ -[4]: https://www.google.com/chrome/ -[5]: https://www.merriam-webster.com/dictionary/epiphany -[6]: https://developer.gnome.org/hig/stable/ -[7]: /files/images/minimalbrowsers1jpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) -[9]: /licenses/category/used-permission -[10]: https://www.netsurf-browser.org/ -[11]: https://qupzilla.com/ -[12]: /files/images/minimalbrowsers3jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) -[14]: /files/images/minimalbrowsers4jpg -[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) -[16]: https://sourceforge.net/projects/otter-browser/files/ -[17]: https://lynx.browser.org/ -[18]: /files/images/minimalbrowsers5jpg -[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) -[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From bfdde198d60206c3f109adfdcaf35d04f6bf0adb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 10 Jan 2020 11:39:24 +0800 Subject: [PATCH 504/676] PRF&PUB @wxy https://linux.cn/article-11768-1.html --- .../20190405 File sharing with Git.md | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) rename {translated/tech => published}/20190405 File sharing with Git.md (66%) diff --git a/translated/tech/20190405 File sharing with Git.md b/published/20190405 File sharing with Git.md similarity index 66% rename from translated/tech/20190405 File sharing with Git.md rename to published/20190405 File sharing with Git.md index a1ad1bc228..57d89c14c8 100644 --- a/translated/tech/20190405 File sharing with Git.md +++ b/published/20190405 File sharing with Git.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11768-1.html) [#]: subject: (File sharing with Git) [#]: via: (https://opensource.com/article/19/4/file-sharing-git) [#]: author: (Seth Kenlon) -用 Git 共享文件 +用 Git 来共享文件 ====== -> SparkleShare 是一个开源的基于 Git、Dropbox 风格的文件共享应用程序。在我们的系列文章中了解有关 Git 鲜为人知的用法。 +> SparkleShare 是一个开源的基于 Git 的 Dropbox 风格的文件共享应用程序。在我们的系列文章中了解有关 Git 鲜为人知的用法。 -![][1] +![](https://img.linux.net.cn/data/attachment/album/202001/10/113645qb2ufvuu2ttimugv.png) [Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 @@ -22,13 +22,13 @@ Git 的优点之一是它具有固有的分发能力。它可用来建立共享。即使你只是与自己网络上的其他计算机共享资源库,Git 也会为从共享位置获取文件的行为带来透明性。 -随着其界面的发展,Git 变得非常简单。虽然因用户而异,他们坐下来完成一些工作时的共同点仅仅是 `git pull` 或稍微复杂一点的 `git pull && git checkout -b my-branch`。但是,对于某些人来说,将*命令输入*到他们的计算机中的做法完全是令人困惑或烦恼的。计算机旨在使生活变得轻松,计算机擅长重复性工作,因此有更简便的方法可以与 Git 共享文件。 +随着其界面的发展,Git 变得非常简单。虽然因用户而异,他们坐下来完成一些工作时的共同点仅仅是 `git pull` 或稍微复杂一点的 `git pull && git checkout -b my-branch`。但是,对于某些人来说,将*命令输入*到他们的计算机中的做法完全是令人困惑或烦恼的。计算机旨在使生活变得轻松,它擅长于重复性工作,因此有更简便的方法可以与 Git 共享文件。 ### SparkleShare -[SparkleShare][3] 项目是一个基于 Git 的跨平台的开源的 Dropbox 式的文件共享应用程序。它通过将文件拖放到专门指定的 SparkleShare 目录中的简单操作,自动执行所有 Git 命令,触发添加、提交、推送和拉取过程。因为它基于 Git,所以你可以获得基于差异(diff)的快速推送和拉取,并且继承了 Git 版本控制和后端基础设施(如 Git 挂钩)的所有优点。它可以完全自托管,也可以将其与 [GitLab][4]、GitHub、Bitbucket 等 Git 托管服务一起使用。此外,由于它基本上只是一个 Git 的前端,因此你可以在可能没有 SparkleShare 客户端但有 Git 客户端的设备上访问 SparkleShare 中的文件。 +[SparkleShare][3] 项目是一个基于 Git 的跨平台的、开源的 Dropbox 式的文件共享应用程序。它通过将文件拖放到专门指定的 SparkleShare 目录中的简单操作,自动执行所有 Git 命令,触发添加、提交、推送和拉取过程。因为它基于 Git,所以你可以获得基于差异(diff)的快速推送和拉取,并且继承了 Git 版本控制和后端基础设施(如 Git 挂钩)的所有优点。它可以完全自托管,也可以将其与 [GitLab][4]、GitHub、Bitbucket 等 Git 托管服务一起使用。此外,由于它基本上只是一个 Git 的前端,因此你可以在可能没有 SparkleShare 客户端但有 Git 客户端的设备上访问 SparkleShare 中的文件。 -正如你获得 Git 的所有好处一样,你也会受到所有常见的 Git 限制:使用 SparkleShare 存储数百张照片、音乐和视频是不切实际的,因为 Git 是为文本而设计和优化的。Git 当然可以存储二进制文件的大文件,但是因为它可以跟踪历史记录,因此一旦将文件添加到其中,几乎就不可能完全删除它。这在某种程度上限制了 SparkleShare 对某些人的实用性,但使其非常适合许多工作流程,包括 [日程安排][5]。 +正如你获得 Git 的所有好处一样,你也会受到所有常见的 Git 限制:使用 SparkleShare 存储数百张照片、音乐和视频是不切实际的,因为 Git 是为文本而设计和优化的。Git 当然可以存储二进制文件的大文件,但是因为它可以跟踪历史记录,因此一旦将文件添加到其中,几乎就不可能完全删除它。这在某种程度上限制了 SparkleShare 对某些人的实用性,但使其非常适合许多工作流程,包括[日程安排][5]。 #### 安装 SparkleShare @@ -41,17 +41,17 @@ $ sudo flatpak install flathub org.sparkleshare.SparkleShare ### 创建一个 Git 存储库 -SparkleShare 并不是软件即服务(SaaS)。你在计算机上运行 SparkleShare 以与 Git 存储库进行通信,而 SparkleShare 并不存储你的数据。如果你还没有与文件夹同步的 Git 存储库,则必须在启动 SparkleShare 之前创建一个文件夹。你有三个选择:托管的 Git、自托管 Git 或自托管 SparkleShare。 +SparkleShare 并不是软件即服务(SaaS)。你在计算机上运行 SparkleShare 与 Git 存储库进行通信,而 SparkleShare 并不存储你的数据。如果你还没有与文件夹同步的 Git 存储库,则必须在启动 SparkleShare 之前创建一个文件夹。你有三个选择:托管的 Git、自托管 Git 或自托管 SparkleShare。 -#### 托管的 Git +#### 托管的 Git -SparkleShare 可以使用你可以访问的任何 Git 存储库进行存储,因此,如果你拥有(或可在其中创建的)GitLab 或任何其他托管服务的帐户,则它可以成为 SparkleShare 的后端。例如,开源 [Notabug.org][8] 服务是一个类似于 GitHub 和 GitLab 的 Git 托管服务,但其独特性足以证明 SparkleShare 的灵活性。根据用户界面的不同,不同的托管服务创建新存储库的方法也有所不同,但是所有主要存储库都遵循相同的通用模型。 +SparkleShare 可以使用你能访问的任何 Git 存储库进行存储,因此,如果你拥有 GitLab 或任何其他托管服务的帐户(或创建一个),则它可以成为 SparkleShare 的后端。例如,开源 [Notabug.org][8] 服务是一个类似于 GitHub 和 GitLab 的 Git 托管服务,但其独特性足以证明 SparkleShare 的灵活性。根据用户界面的不同,不同的托管服务创建新存储库的方法也有所不同,但是所有主要存储库都遵循相同的通用模型。 -首先,在托管服务中找到创建一个新项目或存储库的按钮,单击它以开始。然后逐步完成存储库的创建过程,为存储库提供名称、隐私级别(存储库通常默认为公共),以及是否使用 `README` 文件初始化存储库。无论你是否需要个 `README` 文件,请初始化建立一个。使用一个文件创立存储库不是绝对必要的,但是它会强制 Git 主机实例化存储库中的 `master` 分支,这有助于确保前端应用程序(例如 SparkleShare)具有要提交并推送的分支。即使文件几乎是空的 `README` 文件,也可以用来查看该文件以确认你已连接成功。 +首先,在托管服务中找到创建新项目或存储库的按钮,单击它以开始。然后逐步完成存储库的创建过程,为存储库提供名称、隐私级别(存储库通常默认为公共),以及是否使用 `README` 文件初始化存储库。无论你是否需要个 `README` 文件,请初始化建立一个。使用一个文件来创建存储库不是绝对必要的,但是它会强制 Git 主机实例化存储库中的 `master` 分支,这有助于确保前端应用程序(例如 SparkleShare)具有要提交并推送的分支。即使文件是几乎空的 `README` 文件,也可以用来查看该文件以确认你已连接成功。 ![Creating a Git repository][9] -创建存储库后,获取其用于 SSH 克隆的 URL。你可以像获取任何人从 Git 项目获得其 URL 一样获得此 URL:导航至存储库页面并查找 “Clone” 按钮或字段。 +创建存储库后,获取其用于 SSH 克隆的 URL。就像从 Git 项目获得其 URL 一样,你也可以获取此 URL:导航至存储库页面并查找 “Clone” 按钮或字段。 ![Cloning a URL on GitHub][10] @@ -63,7 +63,6 @@ SparkleShare 可以使用你可以访问的任何 Git 存储库进行存储, 这是 SparkleShare 用于获取数据的地址,因此请记下它。你的 Git 存储库现已配置好。 - #### 自托管的 Git 你可以使用 SparkleShare 访问你有权访问的任何计算机上的 Git 存储库。除了一个 Git 裸存储库外,无需任何特殊设置。但是,如果你想将对 Git 存储库的访问权授予其他任何人,则应运行 [Gitolite][12] 之类的 Git 管理器或 SparkleShare 自己的 Dazzle 服务器来帮助你管理 SSH 密钥和帐户。至少,创建一个特定于 Git 的用户,以便有权访问你的 Git 存储库的用户不会自动获得对服务器其余部分的访问权限。 @@ -99,21 +98,21 @@ $ dazzle create sparkly ### 配置 SparkleShare -首次启动 SparkleShare 时,系统会提示你配置要让 SparkleShare 用于存储的服务器。这个过程可能看起来像一个首次运行的安装向导,但实际上是在 SparkleShare 中设置新共享位置的通常过程。与许多共享驱动器应用程序不同,使用 SparkleShare 可以一次配置多个位置。你配置的第一个共享位置并不比你以后可以设置的任何共享位置重要,并且你也没有注册 SparkleShare 或任何其他服务。你只是将 SparkleShare 指向 Git 存储库,以便它知道如何使第一个 SparkleShare 文件夹保持同步。 +首次启动 SparkleShare 时,系统会提示你配置 SparkleShare 用于存储的服务器。这个过程可能看起来像一个首次运行的安装向导,但实际上是在 SparkleShare 中设置新共享位置的通常过程。与许多共享驱动器应用程序不同,使用 SparkleShare 可以一次配置多个位置。你配置的第一个共享位置并不比你以后可以配置的任何共享位置更重要,并且你也不用注册 SparkleShare 或任何其他服务。你只是将 SparkleShare 指向 Git 存储库,以便它知道如何使第一个 SparkleShare 文件夹保持同步。 -在第一个屏幕上,给出一个身份,SparkleShare 将在代表你进行的 Git 提交记录中使用这些信息。你可以使用任何内容,甚至可以不代表任何意义的伪造信息。它仅用于提交消息,如果你对审查 Git 后端进程没有兴趣,你可能甚至看不到它们。 +在第一个屏幕上,给出一个身份信息,SparkleShare 将在代表你进行的 Git 提交记录中使用这些信息。你可以使用任何内容,甚至可以使用不代表任何意义的伪造信息。它仅用于提交消息,如果你对审查 Git 后端进程没有兴趣,你可能甚至看不到它们。 下一个屏幕提示你选择主机类型。如果你使用的是 GitLab、GitHub、Planio 或 Bitbucket,则可以选择一个适当的。否则,请选择“自己的服务器”。 ![Choosing a Sparkleshare host][14] -在此屏幕底部,您必须输入 SSH 的克隆 URL。如果你是自托管的 Git,则地址类似于 ``,而远程路径是为此目的而创建的 Git 存储库的绝对路径。 +在此屏幕底部,你必须输入 SSH 的克隆 URL。如果你是自托管的 Git,则地址类似于 ``,而远程路径是为此目的而创建的 Git 存储库的绝对路径。 -根据上面的自托管示例,我虚构的服务器的地址为 `ssh://git@example.com:22122`(`:22122` 表示非标准的 SSH 端口),远程路径为 `/home/git/sparkly.git`。 +根据上面的自托管示例,我虚构的服务器的地址为 `ssh://git@example.com:22122`(`:22122` 表示一个非标准的 SSH 端口),远程路径为 `/home/git/sparkly.git`。 如果我改用 Notabug.org 帐户,则上例中的地址为 `ssh://git@notabug.org`,路径为 `seth/sparkly.git`。 -SparkleShare 首次尝试连接到主机时将失败,因为你尚未将 SparkleShare 客户端 ID(特定于 SparkleShare 应用程序的 SSH 密钥)复制到 Git 主机。这是预料之中的,所以不要取消该过程。将 SparkleShare 设置窗口保持打开状态,并从系统任务栏中的 SparkleShare 图标处获取客户端 ID。然后将客户端 ID 复制到剪贴板,以便可以将其添加到 Git 主机。 +SparkleShare 首次尝试连接到主机时会失败,因为你尚未将 SparkleShare 客户端 ID(特定于 SparkleShare 应用程序的 SSH 密钥)复制到 Git 主机。这是预料之中的,所以不要取消该过程。将 SparkleShare 设置窗口保持打开状态,并从系统任务栏中的 SparkleShare 图标处获取客户端 ID。然后将客户端 ID 复制到剪贴板,以便可以将其添加到 Git 主机。 ![Getting the client ID from Sparkleshare][16] @@ -127,7 +126,7 @@ SparkleShare 首次尝试连接到主机时将失败,因为你尚未将 Sparkl #### 将你的客户端 ID 添加到自托管的 Git 帐户 -SparkleShare 客户端 ID 只是一个 SSH 密钥,因此将其复制并粘贴到 Git 用户的 `~/.ssh/authorized_keys`文件中。 +SparkleShare 客户端 ID 只是一个 SSH 密钥,因此将其复制并粘贴到 Git 用户的 `~/.ssh/authorized_keys` 文件中。 #### 使用 Dazzle 添加你的客户 ID @@ -153,7 +152,7 @@ $ dazzle link #### 排除某些文件 -由于 Git 从设计上就是要记住*一切*,因此你可能希望从记录中排除特定的文件类型。排除一些文件是有原因的。通过定义摆脱 SparkleShare 限制的文件,可以避免意外复制大文件。你还可以为自己设计一种方案,使你可以将存储在一个目录中的逻辑上属于同一文件(例如,MIDI 文件及其 .flac 导出文件),但是可以自己手动备份大文件,而同时让 SparkleShare 备份基于文本的文件。 +由于 Git 从设计上就是要记住*一切*,因此你可能希望从记录中排除特定的文件类型。排除一些文件是有原因的。通过定义摆脱 SparkleShare 管理的文件,可以避免意外复制大文件。你还可以为自己设计一种方案,使你可以将存储在一个目录中的逻辑上属于同一个文件(例如,MIDI 文件及其 .flac 导出文件),但是可以自己手动备份大文件,而同时让 SparkleShare 备份基于文本的文件。 如果在系统的文件管理器中看不到隐藏的文件,请显示它们。导航到你的 SparkleShare 文件夹,然后到代表你的存储库的目录,找到一个名为 `.gitignore` 的文件,然后在文本编辑器中将其打开。你可以在 `.gitignore` 中输入文件扩展名或文件名(每行一个),任何与你列出的文件匹配的文件都会被忽略(如文件名所示)。 @@ -186,13 +185,13 @@ $RECYCLE.BIN/ *.cbz ``` -你知道最经常遇到哪些文件类型,因此请集中精力处理最有可能潜入你的 SparkleShare 目录的文件。如果您想稍微矫枉过正一些,可以在 Notabug.org 以及整个网上找到 `.gitignore` 文件的好集合。 +你知道最经常遇到哪些文件类型,因此请集中精力处理最有可能潜入你的 SparkleShare 目录的文件。如果你想稍微矫枉过正一些,可以在 Notabug.org 以及整个网上找到 `.gitignore` 文件的好集合。 -通过将这些条目保存在 `.gitignore` 文件中,你可以将不需要发送到 Git 主机的大文件放在 SparkleShare 目录中,SparkleShare 将完全忽略它们。当然,这意味着您需要确保它们可以备份或通过其他方式分发给你的 SparkleShare 合作者。 +通过将这些条目保存在 `.gitignore` 文件中,你可以将不需要发送到 Git 主机的大文件放在 SparkleShare 目录中,SparkleShare 将完全忽略它们。当然,这意味着你需要确保它们可以备份或通过其他方式分发给你的 SparkleShare 协作者。 ### 自动化 -[自动化][20] 是我们与计算机达成的默契之一:计算机执行重复的、无聊的工作,而我们人类要么不擅长做这些,要么不擅长记忆这些。SparkleShare 是一种很好的、简单的自动执行例行数据分发的方法。无论如何,这并不适合每个 Git 存储库。它没有用于高级 Git 功能的接口,它没有暂停按钮或手动管理的操作。没关系,因为它的范围是有意限制的。SparkleShare 可以完成 SparkleShare 计划要做的事情,它做得很好,而且它是你无需关心的一个 Git 存储库。 +[自动化][20] 是我们与计算机达成的默契之一:计算机执行重复的、无聊的工作,而我们人类要么不擅长做这些,要么不擅长记忆这些。SparkleShare 是一种很好的、简单的自动执行例行数据分发的方法。但不管怎么说,这并不适合每个 Git 存储库。它没有用于高级 Git 功能的接口,它没有暂停按钮或手动管理的操作。没关系,因为它的使用范围是有意限制的。SparkleShare 可以完成它计划要做的事情,它做得很好,而且它是你无需关心的一个 Git 存储库。 如果你想使用这种稳定的、看不见的自动化,请尝试一下 SparkleShare。 @@ -203,7 +202,7 @@ via: https://opensource.com/article/19/4/file-sharing-git 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0eb14f0a7e4df77df754a01b62fa34094fe0d546 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Fri, 10 Jan 2020 14:35:51 +0800 Subject: [PATCH 505/676] Update 20200102 Put some loot in your Python platformer game.md --- .../20200102 Put some loot in your Python platformer game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200102 Put some loot in your Python platformer game.md b/sources/tech/20200102 Put some loot in your Python platformer game.md index 678fb69516..296739c2b9 100644 --- a/sources/tech/20200102 Put some loot in your Python platformer game.md +++ b/sources/tech/20200102 Put some loot in your Python platformer game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -514,7 +514,7 @@ via: https://opensource.com/article/20/1/loot-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9ab354cdb30e23b5a7644e4ddd88ca6f9698716d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 10 Jan 2020 16:16:37 +0800 Subject: [PATCH 506/676] Translating --- sources/tech/20200103 Add scorekeeping to your Python game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200103 Add scorekeeping to your Python game.md b/sources/tech/20200103 Add scorekeeping to your Python game.md index d2055cc067..0bcfe955c7 100644 --- a/sources/tech/20200103 Add scorekeeping to your Python game.md +++ b/sources/tech/20200103 Add scorekeeping to your Python game.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 740bbe6981c5350dc71e39edf31ea16d005417f5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 10 Jan 2020 22:00:54 +0800 Subject: [PATCH 507/676] PRF @robsean --- ...n Source Disk Partitioning Tool GParted.md | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md index 6fa07d80a3..6721773f69 100644 --- a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md +++ b/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -1,94 +1,96 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) [#]: via: (https://itsfoss.com/gparted/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -应用程序推荐:开源磁盘分区工具 GParted +应用推荐:开源磁盘分区工具 GParted ====== -_**摘要:GParted 是一个非常流行的自由的可用于 Linux 发行版的分区编辑器。在这里,我们简单地看看它提供了什么。**_ +![](https://img.linux.net.cn/data/attachment/album/202001/10/220015lp58jjjt22xfppjj.jpg) -### GParted:一个基于自由和开放源码的图形化分区管理器 +> GParted 是一个可用于 Linux 发行版的非常受欢迎且免费的分区编辑器。在这里,我们简要地介绍一下它提供的功能。 + +### GParted:一个自由开源的图形化分区管理器 ![][1] -GParted 无疑是[在 Linux 下的最好的分区管理器][2]之一。用户界面非常简单,可用完成任务。 +GParted 无疑是 [Linux 下的最好的分区管理器][2]之一。用户界面非常简单而可以完成任务。 -在一些情况下,你最终也需要使用 [GParted][3] 来修复或格式化你的 USB 驱动器。我有一个[我不能在 Ubuntu 中格式化的 USB 磁盘][4],使用该“磁盘”应用程序 – 这里是 GParted 用来救援的地方。 +在某些情况下,你最终还是会使用 [GParted][3] 来修复或格式化你的 USB 驱动器。我有一个[在 Ubuntu 中使用“磁盘”应用程序不能格式化的 USB 磁盘][4],而这是 GParted 用来救援的地方。 -所以,它是非常有用的工具,有很多好的特色。让我为你们推荐一下。 +所以,它是一个非常有用的工具,有很多出色的功能。让我为你们重点介绍一下。 -警告! +> 警告! +> +> 进行磁盘分区是一件危险的工作。除非绝对必要,否则不要做。否则,你可能最终擦除了整个磁盘。 -玩弄磁盘分区是一件危险的工作。除非绝对必要,否则不要做。否则,你可能最终会擦除整个磁盘。 +### GParted 的功能 -### GParted 的特色 - -你可以使用 GParted 做很多事,排列一下简单地格式化任务到重要的分区任务。我将使用一些屏幕截图推荐关键特色,以帮助你在安装它前了解更多信息。 +从简单地格式化任务到重要的分区任务,你可以使用 GParted 做很多事。我将使用一些屏幕截图突出关键功能,以帮助你在安装它前进一步了解它。 #### 创建分区表 -你可以为你的新的磁盘创建一个新的分区表,或者擦除你现存的磁盘内容来修改分区表。 +你可以为新磁盘创建一个新的分区表,也可以擦除你现存的磁盘内容来修改分区表。 ![][5] -你将能够选择 msdos ,gpt ,atari ,以及更多类型的分区表。 +你能够选择 msdos、gpt、atari,以及更多类型的分区表。 -#### 创建,移动,标记,删除和修改分区表 +#### 创建、移动、标记、删除和修改分区表 -你可以使用 GParted 中一系列可用的选项来简单地创建,标记,删除或修改分区表。 +你可以使用 GParted 中一系列选项来轻松地创建、标记、删除或修改分区表。 ![][6] -当然,你将不得不小心你想做什么。 +当然,你必须要谨慎你要做的事情。 -好的一些东西是,GParted 确保你不能直接应用任何更改 – 在你点击应用更改之前,它将排队你选择的操作/任务,并询问另外一处最后的确认。 +好的是,GParted 可以确保你不能直接应用任何更改 —— 在你点击应用更改之前,它将排队你选择的操作/任务,并在你执行前最后再要求确认一次。 -在顶部的对号标记符号 ✓ 允许你来确认更改,只有你更改时开始生效。 +顶部的对号标记符号 `✓` 可以让你确认更改,然后你的更改才会生效。 -这样有另一个你可用的分区选项的屏幕截图: +这是分区可用选项的另一个屏幕截图: ![][7] #### 尝试数据救援 -除了编辑分区,你也可以尝试使用“**尝试数据救援**”特色以[在Linux 中恢复你丢失的数据][8],像下面的屏幕截图所示。 +除了编辑分区以外,你也可以试着使用“尝试数据救援”功能以[在 Linux 中恢复丢失的数据][8],如下面的屏幕截图所示。 ![][9] -值得注意的是,默认情况下你没有安装这个功能 – 你仅能看到可见的选项。所以,对于数据恢复特色作业来说,你必需使用下面的命令来单独地安装 gpart (在基于 Ubuntu/Debian 的发行版上): +值得注意的是,默认情况下你没有安装此功能 —— 你只是能看到这个选项。因此,要使这个数据恢复功能可以正常工作,你必须使用下面的命令来单独地安装 gpart (在基于 Ubuntu/Debian 的发行版上): ``` sudo apt install gpart ``` -除了所有关键的特色外,它支持大量的存储设备和文件系统。在它们的官方网站上,你可以从[特色列表][10]中学到很多。 +除了所有这些关键功能以外,它支持各种存储设备和文件系统。你可以从其官方网站的[功能列表][10]中了解到更多信息。 ### 在 Ubuntu 和其它 Linux 发行版上安装 GParted -你可能已经预先安装 GParted 。所以,务必核实一下。如果你没有安装它,你可以前往进入软件中心安装它。 +你可能已经预安装了 GParted 。所以,务必核实一下。如果你尚未安装它,则可以进入软件中心安装它。 -以备你想使用终端,简单地键入下面的命令: +如果你想使用终端,简单地键入下面的命令: ``` sudo apt install gparted ``` -像我如上所述,如果你想要数据恢复选项,除了 gparted 软件包外,你应该安装 gpart 软件包。 +如上所述,如果你想要使用数据恢复选项,除了安装 gparted 软件包外,还应该安装 gpart 软件包。 -如果你正在使用一些其它 Linux 发行版,你可以在各自的软件管理器中找到它,或者简单地查看[官方下载操作指南][11]。 +如果你使用的是其它 Linux 发行版,你可以在各自的软件管理器中找到它,或者直接查看[官方下载操作说明][11]。 -[下载 GParted][11] +- [下载 GParted][11] -**总结** +### 总结 -当涉及处理磁盘管理和分区时,GParted 是一个非常有用和重要的工具。但是,因为显而易见的原因,当你使用它时,你将不得不小心。 +当涉及处理磁盘管理和分区时,GParted 是一个非常有用且重要的工具。但是,因为显而易见的原因,当你使用它时,你必须要小心。 -你尝试过 GParted 吗?你在 Linux 上使用的其它分区工具是什么?请在下面的评论中分享你的体验。 +你尝试过 GParted 吗?你在 Linux 上使用的其它哪个分区工具?请在下面的评论中分享你的经验。 -------------------------------------------------------------------------------- @@ -97,7 +99,7 @@ via: https://itsfoss.com/gparted/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cf4ee95d88ad27ac988e9e34a9ff078fb2c4ac1b Mon Sep 17 00:00:00 2001 From: chen ni Date: Fri, 10 Jan 2020 23:05:58 +0800 Subject: [PATCH 508/676] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Still Using an ‘Outdated- Linux Kernel.md | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md b/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md index 6152697eb3..3b2ef30859 100644 --- a/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md +++ b/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md @@ -7,93 +7,93 @@ [#]: via: (https://itsfoss.com/why-distros-use-old-kernel/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Explained! Why Your Distribution Still Using an ‘Outdated’ Linux Kernel? +为什么你的发行版仍然在使用“过时的”Linux 内核? ====== -[Check your Linux kernel version][1]. Chances are that you’ll find that the kernel version your system is using has already reached end of life (EOL) as listed on Linux Kernel website. +[检查一下你的系统所使用的 Linux 内核版本][1],你十有八九会发现,按照 Linux 内核官网提供的信息,该内核版本已经达到使用寿命终期了。 -End of life means a software won’t get bug fixes and support anymore. +如果一个软件达到了使用寿命终期,这就意味着它再也不会得到 bug 修复和维护了。 -That poses some valid questions. Why is my Linux distribution using a kernel that has reached end of life? Is this not a security risk? Is my system safe? +这自然会引发一连串问题:为什么我的 Linux 发行版会使用一个已经达到使用寿命终期的内核呢?这样做有没有安全风险?我的系统还安全吗? -Let me explain all these questions in this article. +下面将逐一解答这些问题。 -Summary +总结 -The upstream kernel support and the your distribution’s kernel support are two different things. +上游内核维护与你的发行版的内核维护是两个不同的概念。 -For example, Linux kernel 4.15 might have reached end of life (as per the official Linux kernel website) but Ubuntu 18.04 LTS release will use it and maintain it till April 2023 by backporting security patches and bug fixes. +例如,根据 Linux 内核官网,Linux 内核 4.15 版本可能已经达到使用寿命终期了,但是在 2023 年 4 月之前,Ubuntu 18.04 长期维护版本将会继续使用这个版本,并通过向后移植安全补丁和修复 bug 来提供维护。 -### Checking Linux kernel version and finding its end of life status +### 检查 Linux 内核版本,以及是否达到使用寿命终期 -Let’s first check the Linux kernel version on your system: +首先,查看你的系统所使用的 Linux 内核版本: ``` uname -r ``` -I am using Ubuntu 18.04 here and it shows the Linux kernel version like this: +我使用的是 Ubuntu 18.04,输出的 Linux 内核版本如下: ``` [email protected]:~$ uname -r 5.0.0-37-generic ``` -Now, you may go to the official Linux kernel website and see what Linux kernels are still being supported. It’s displayed on the homepage itself. +接下来,可以到 Linux 内核官网上看看哪些 Linux 内核版本仍然在维护状态。在网站主页上就可以看到相关信息。 -[Linux Kernel Official Website][2] +[Linux 内核官网][2] -You should see a status like this: +你看到的内核版本状态应该类似于下图: -![Linux Kernel Status][3] +![Linux 内核状态][3] -If you don’t see a kernel version listed on the homepage of kernel website, it means that specific version has reached end of life. +如果你的内核版本没有列在内核官网主页上,那么就说明该版本已经达到了使用寿命终期。 -As you can see, kernel 5.0 is not listed here. It indicates that this kernel version is not being supported anymore. Actually, it [reached end of life in June 2019][4]. +可以看到,5.0 内核版本并不在列,这说明该内核版本已经不再得到维护。事实上,该版本在 [2019 年 6 月就已经达到使用寿命终期了][4]。 -The life cycle of a Linux kernel doesn’t follow a set pattern, unfortunately. It’s NOT like a regular kernel stable release will be supported for X months and a long term support(LTS) kernel will be supported for Y years. +不幸的是,Linux 内核的生命周期没有任何规律可循。不是说常规的内核稳定发布版可以得到 X 月的维护、长期维护版本(LTS)可以得到 Y 年的维护。没有这回事。 -Based on the demand and requirements, there could be several LTS kernel versions with different EOL. You can find them along with their projected EOL on [this page][5]. +根据实际需求,可能会存在内核的多个 LTS 版本,其使用寿命终期各不相同。在[这个页面][5]上可以查到这些 LTS 版本的相关信息,包括推定的使用寿命终期。 -Now comes the big question. Why is Ubuntu providing kernel 5.0 if the Linux kernel website shows that it has reached its end of life? +那么问题来了:既然 Linux 内核官网上明确表示 5.0 版本的内核已经达到了使用寿命终期,那 Ubuntu 为什么还在提供这个内核版本呢? -### Your distribution uses an EOL Linux kernel but that’s Okay! +### 你的发行版使用的 Linux 内核已经达到了使用寿命终期,但是没关系! ![][6] -Have you ever wondered why Ubuntu/Debian/Fedora etc are called Linux distributions? It’s because they ‘distribute’ the Linux kernel. +你是否想过,为什么 Ubuntu/Debian/Fedora 等发行版被称为 Linux “发行版”?这是因为,它们“发行” Linux 内核。 -They have their own modification of the Linux kernel, they add the GUI elements (desktop environment, display server etc) and software and they make it available to their users. +这些发行版会对 Linux 内核进行不同的修改,并添加各种 GUI 元素(包括桌面环境,显示服务器等)以及软件,然后再呈现给用户。 -In the typical workflow, a Linux distribution will choose a kernel to provide to its users. And then it will hold on to this kernel for months or years even after the kernel has reached end of life. +按照通常的工作流,Linux 发行版会选择一个内核,提供给其用户,然后在接下来的几个月、几年中,甚至是达到内核的使用寿命终期之后,仍然会继续使用该内核。 -How is it safe then? It’s because the _**distribution maintains the kernel by backporting all the important fixes to its kernel**_. +这样能够保障安全吗?其实是可以的,因为 _**发行版会通过向后移植全部的重要修补来维护内核**_。 -In other words, your Linux distribution makes sure that your Linux kernel is patched well and has all the bug fixes and important new features backported to it. There will be thousands of changes on top of the ‘old outdated Linux kernel’. +换句话说,你的 Linux 发行版会确保 Linux 内核没有漏洞和 bug,并且通过向后移植获得了重要的新特性。在“过时的旧版本 Linux 内核”上,其实有着数以千计的改动。 -When the Linux kernel website says that a certain kernel version has reached EOL, it means that the core Linux kernel maintainers are not going to update/patch that kernel version anymore. +如果 Linux 内核网站上说某个内核版本已经达到了使用寿命终期,那么就意味着 Linux 内核的核心维护团队不会再对该内核版本进行升级和打补丁了。 -But at the same time, the developers at Debian/Ubuntu or other distributions work to keep the same old version alive by bringing the relevant changes from the newer kernel versions (being maintained by the core kernel team) to your distribution’s old kernel. +但与此同时,Debian/Ubuntu 或者其他发行版的开发者们会继续工作,通过从(由内核核心团队维护的)更新的内核版本中迁移相关的修改,维持这个老版本的生命力。 -Bottom line is that even if it seems like your distribution is using an outdated Linux kernel, it is actually being well maintained and not really outdated. +重点在于,即使你的发行版看上去是在使用一个已经过时的 Linux 内核,其实该内核也得到了良好的维护,并非是真的过时了。 -### Should you use the latest stable kernel version? +### 是否应该使用最新的稳定内核版本? ![][7] -A new stable Linux kernel version is released every 2-3 months. And this makes many users wonder who they can get their hands on that new shiny thing. +新的 Linux 内核稳定版本每隔 2 到 3 个月发布一次,有不少用户跃跃欲试。 -To be frank, you should not do that unless you have a pretty good reason for it. Your distribution doesn’t provide it to you. You cannot just use ‘_sudo apt give-me-the-latest-stable-kernel_‘. +实话说,除非有十分充分的理由,否则不应该使用最新版本的稳定内核。你使用的发行版并不会提供这个选项,你也不可能指望在键盘上敲出“_sudo apt give-me-the-latest-stable-kernel_”就解决问题。 -Now, manually [installing the mainline Linux kernel version][8] could be a challenge in itself. Even if you manage to install it, it is now up to you to make sure that this kernel is updated every time there is a bug fix. And when this new kernel reaches end of life, it becomes your responsibility to upgrade to the newer kernel version. It won’t be handled with apt upgrade like regular [Ubuntu updates][9]. +此外,手动[安装主流 Linux 内核版本][8]本身就是一个挑战。即使安装成功,之后每次发布 bug 修复的时候,负责更新内核的就会使你了。此外,当新内核达到使用寿命终期之后,你就有责任将它升级到更新的内核版本了。和常规的[Ubuntu 更新][9]不同,内核升级无法通过 apt upgrade 完成。 -You should also keep in mind that your distribution also has drivers and patches which you may not be able to use if you switch to the mainline kernel. +同样需要记住的是,切换到主流内核之后,可能就无法使用你的发行版提供的一些驱动程序和补丁了。 -As [Greg Kroah-Hartman][10] puts it, “_**the best kernel you can use is one that someone else supports**_“. And who can be better at this job then your Linux distribution! +正如 [Greg Kroah-Hartman][10]所言,“_**你能使用的最好的内核,就是别人在维护的内核。**_”除了你的 Linux 发行版之外,又有谁更胜任这份工作呢。 -I hope you have a better understanding on this topic and you won’t panic the next time you find out that the kernel version your system is using has reached end of life. +希望你对这个主题已经有了更好的理解。下回发现你的系统正在使用的内核版本已经达到使用寿命终期的时候,希望你不会感到惊慌失措。 -I welcome your questions and suggestions. Please feel free to use the comment section. +欢迎在下面的评论区中留下你的疑问或建议。 -------------------------------------------------------------------------------- From e1fda19f43f01a46f1c01ce689884d9cb69dce2f Mon Sep 17 00:00:00 2001 From: chen ni Date: Fri, 10 Jan 2020 23:13:48 +0800 Subject: [PATCH 509/676] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E5=B9=B6=E7=A7=BB=E5=8A=A8=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ion Still Using an ‘Outdated- Linux Kernel.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename {sources => translated}/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md (88%) diff --git a/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md b/translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md similarity index 88% rename from sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md rename to translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md index 3b2ef30859..b8af543814 100644 --- a/sources/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md +++ b/translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md @@ -12,7 +12,7 @@ [检查一下你的系统所使用的 Linux 内核版本][1],你十有八九会发现,按照 Linux 内核官网提供的信息,该内核版本已经达到使用寿命终期了。 -如果一个软件达到了使用寿命终期,这就意味着它再也不会得到 bug 修复和维护了。 +一个软件一旦达到了使用寿命终期,那么就意味着它再也不会得到 bug 修复和维护了。 这自然会引发一连串问题:为什么我的 Linux 发行版会使用一个已经达到使用寿命终期的内核呢?这样做有没有安全风险?我的系统还安全吗? @@ -47,7 +47,7 @@ uname -r ![Linux 内核状态][3] -如果你的内核版本没有列在内核官网主页上,那么就说明该版本已经达到了使用寿命终期。 +如果你的内核版本没有列在内核官网主页上,就说明该版本已经达到了使用寿命终期。 可以看到,5.0 内核版本并不在列,这说明该内核版本已经不再得到维护。事实上,该版本在 [2019 年 6 月就已经达到使用寿命终期了][4]。 @@ -55,7 +55,7 @@ uname -r 根据实际需求,可能会存在内核的多个 LTS 版本,其使用寿命终期各不相同。在[这个页面][5]上可以查到这些 LTS 版本的相关信息,包括推定的使用寿命终期。 -那么问题来了:既然 Linux 内核官网上明确表示 5.0 版本的内核已经达到了使用寿命终期,那 Ubuntu 为什么还在提供这个内核版本呢? +那么问题来了:既然 Linux 内核官网上明确表示 5.0 版本的内核已经达到了使用寿命终期,Ubuntu 为什么还在提供这个内核版本呢? ### 你的发行版使用的 Linux 内核已经达到了使用寿命终期,但是没关系! @@ -69,7 +69,7 @@ uname -r 这样能够保障安全吗?其实是可以的,因为 _**发行版会通过向后移植全部的重要修补来维护内核**_。 -换句话说,你的 Linux 发行版会确保 Linux 内核没有漏洞和 bug,并且通过向后移植获得了重要的新特性。在“过时的旧版本 Linux 内核”上,其实有着数以千计的改动。 +换句话说,你的 Linux 发行版会确保 Linux 内核没有漏洞和 bug,并且已经通过向后移植获得了重要的新特性。在“过时的旧版本 Linux 内核”上,其实有着数以千计的改动。 如果 Linux 内核网站上说某个内核版本已经达到了使用寿命终期,那么就意味着 Linux 内核的核心维护团队不会再对该内核版本进行升级和打补丁了。 @@ -77,19 +77,19 @@ uname -r 重点在于,即使你的发行版看上去是在使用一个已经过时的 Linux 内核,其实该内核也得到了良好的维护,并非是真的过时了。 -### 是否应该使用最新的稳定内核版本? +### 你是否应该使用最新的稳定内核版本? ![][7] 新的 Linux 内核稳定版本每隔 2 到 3 个月发布一次,有不少用户跃跃欲试。 -实话说,除非有十分充分的理由,否则不应该使用最新版本的稳定内核。你使用的发行版并不会提供这个选项,你也不可能指望在键盘上敲出“_sudo apt give-me-the-latest-stable-kernel_”就解决问题。 +实话说,除非有十分充分的理由,否则不应该使用最新版本的稳定内核。你使用的发行版并不会提供这个选项,你也不能指望通过在键盘上敲出“_sudo apt give-me-the-latest-stable-kernel_”解决问题。 -此外,手动[安装主流 Linux 内核版本][8]本身就是一个挑战。即使安装成功,之后每次发布 bug 修复的时候,负责更新内核的就会使你了。此外,当新内核达到使用寿命终期之后,你就有责任将它升级到更新的内核版本了。和常规的[Ubuntu 更新][9]不同,内核升级无法通过 apt upgrade 完成。 +此外,手动[安装主流 Linux 内核版本][8]本身就是一个挑战。即使安装成功,之后每次发布 bug 修复的时候,负责更新内核的就会是你了。此外,当新内核达到使用寿命终期之后,你就有责任将它升级到更新的内核版本了。和常规的[Ubuntu 更新][9]不同,内核升级无法通过 apt upgrade 完成。 同样需要记住的是,切换到主流内核之后,可能就无法使用你的发行版提供的一些驱动程序和补丁了。 -正如 [Greg Kroah-Hartman][10]所言,“_**你能使用的最好的内核,就是别人在维护的内核。**_”除了你的 Linux 发行版之外,又有谁更胜任这份工作呢。 +正如 [Greg Kroah-Hartman][10]所言,“_**你能使用的最好的内核,就是别人在维护的内核。**_”除了你的 Linux 发行版之外,又有谁更胜任这份工作呢! 希望你对这个主题已经有了更好的理解。下回发现你的系统正在使用的内核版本已经达到使用寿命终期的时候,希望你不会感到惊慌失措。 From a39d5cbd63dcb84d3ebfd6452319226c0e727a49 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 11 Jan 2020 00:57:45 +0800 Subject: [PATCH 510/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200111=20Don?= =?UTF-8?q?=E2=80=99t=20Use=20ZFS=20on=20Linux:=20Linus=20Torvalds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md --- ... Don-t Use ZFS on Linux- Linus Torvalds.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md diff --git a/sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md b/sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md new file mode 100644 index 0000000000..7323b77a8e --- /dev/null +++ b/sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Don’t Use ZFS on Linux: Linus Torvalds) +[#]: via: (https://itsfoss.com/linus-torvalds-zfs/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Don’t Use ZFS on Linux: Linus Torvalds +====== + +_“Don’t use ZFS. It’s that simple. It was always more of a buzzword than anything else, I feel, and the licensing issues just make it a non-starter for me.”_ + +This is what Linus Torvalds [said in a mailing list][1] to once again express his disliking for [ZFS filesystem][2] specially over its licensing. + +To avoid unnecessary confusion, this is more intended for Linux distributions, kernel developers and maintainers rather than individual Linux users. + +### What’s the licensing issue with ZFS and Linux kernel? + +![][3] + +ZFS was open sourced around 2003. This would have meant that Linux distributions start supporting ZFS. But that didn’t really happen because of the complexity of [open source licenses][4]. + +ZFS is open source under [Common Development and Distribution License][5] (CDDL) 1.0 whereas Linux kernel is licensed under the GNU General Public License (GPL) 2.0. + +These two open source licenses are not fully compatible with each other. As noted by [PCWorld][6], if ZFS with this license is included in the Linux kernel, this would mean that kernel+ZFS is a derivative work of the (original ZFS-less) Linux kernel. + +### Torvalds doesn’t trust Oracle + +![][7] + +While the whole derivative thing is a matter of debate for legal and licensing experts, Torvalds is skeptical of Oracle. Oracle has a history of suing enterprises for using its code. Remember [Oracle vs Android lawsuit over the use of Java][8]? + +> Other people think it can be ok to merge ZFS code into the kernel and that the module interface makes it ok, and that’s their decision. But considering Oracle’s litigious nature, and the questions over licensing, there’s no way I can feel safe in ever doing so. +> +> And I’m not at all interested in some “ZFS shim layer” thing either that some people seem to think would isolate the two projects. That adds no value to our side, and given Oracle’s interface copyright suits (see Java), I don’t think it’s any real licensing win either. + +Torvalds doesn’t want Linux kernel to get into legal troubles with Oracle in future and hence he refuses to include ZFS in mainline kernel until Orcale provides a signed letter that a kernel with ZFS will be under GPL license. + +> And honestly, there is no way I can merge any of the ZFS efforts until I get an official letter from Oracle that is signed by their main legal counsel or preferably by Larry Ellison himself that says that yes, it’s ok to do so and treat the end result as GPL’d. + +He is not stopping other (distributions) from using ZFS. But they are on their own. + +> If somebody adds a kernel module like ZFS, they are on their own. I can’t maintain it, and I can not be bound by other peoples kernel changes. + +Canonical, Ubuntu’s parent company, has been too keen on ZFS. Their [legal department thinks that including ZFS in kernel doesn’t make it a derivative work][9]. So they took their chances and now they provide an option to [use ZFS on root from Ubuntu 19.10][10]. + +### Torvalds is also not impressed with ZFS in general + +![][11] + +While some people drool over ZFS, Linus Torvalds is not that impressed with ZFS. He doesn’t think it’s using ZFS is a good idea specially when it is not actively maintained by Oracle (after they open sourced it) + +> The benchmarks I’ve seen do not make ZFS look all that great. And as far as I can tell, it has no real maintenance behind it either any more, so from a long-term stability standpoint, why would you ever want to use it in the first place? + +I am no legal expert but if there is even a slightest doubt, I would prefer staying away from ZFS. What do you think of the whole ZFS debate? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linus-torvalds-zfs/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.realworldtech.com/forum/?threadid=189711&curpostid=189841 +[2]: https://itsfoss.com/what-is-zfs/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/dont_use_zfs_torvalds.jpg?ssl=1 +[4]: https://itsfoss.com/open-source-licenses-explained/ +[5]: https://opensource.org/licenses/CDDL-1.0 +[6]: https://www.pcworld.com/article/3061924/ubuntu-1604s-support-for-the-zfs-file-system-may-violate-the-general-public-license.html +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/linus-torvalds-zfs-quotes-1.jpg?ssl=1 +[8]: https://itsfoss.com/oracle-google-dispute/ +[9]: https://ubuntu.com/blog/zfs-licensing-and-linux +[10]: https://itsfoss.com/zfs-ubuntu/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/linus-torvalds-zfs-quotes-2.jpg?ssl=1 From ec111ac4a5dd9faeece3a98ec010a2aac5bde9f7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 11 Jan 2020 00:58:26 +0800 Subject: [PATCH 511/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200110=205=20op?= =?UTF-8?q?s=20hacks=20for=20sysadmins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200110 5 ops hacks for sysadmins.md --- .../20200110 5 ops hacks for sysadmins.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20200110 5 ops hacks for sysadmins.md diff --git a/sources/tech/20200110 5 ops hacks for sysadmins.md b/sources/tech/20200110 5 ops hacks for sysadmins.md new file mode 100644 index 0000000000..409d5a0716 --- /dev/null +++ b/sources/tech/20200110 5 ops hacks for sysadmins.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ops hacks for sysadmins) +[#]: via: (https://opensource.com/article/20/1/ops-hacks-sysadmins) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +5 ops hacks for sysadmins +====== +Five tools to help you find the source of your users' IT problems when +you don't know where to start. +![Wratchet set tools][1] + +As a sysadmin, every day I am faced with problems I need to solve quickly because there are users and managers who expect things to run smoothly. In a large environment like the one I manage, it's nearly impossible to know all of the systems and products from end to end, so I have to use creative techniques to find the source of the problems and (hopefully) come up with solutions. + +This has been my daily experience for well over 20 years, and I love it! Coming to work each day, I never quite know what will happen. So, I have a few quick and dirty tricks that I default to when a problem lands on my lap, but I don't know where to start. + +_BUT WAIT!_ Before you jump straight onto the command line, spend some time talking to your users. Yes, it can be tedious, but they will have some good information for you. Keep in mind that users probably don't have as much experience as you have, and you will need to do some interpreting of whatever they say. Try to get a clear picture of what _is_ happening and what _should be_ happening, then describe the fault to yourself in technical language. Be aware that most users don't read what is on the screen in front of them; it's sad but true. Make sure you and the user are reading all of the text to gather as much information as possible. Once you have that together, jump onto the command line with these five tools. + +### Telnet + +I am starting with a classic. [Telnet][2] was the predecessor to SSH, and, in the olden days, it was used on Unix systems to connect to a remote terminal just like SSH does, but it was not encrypted. Telnet has a very neat and invaluable trick for diagnosing network connectivity issues: you can Telnet into TCP ports that are not reserved for it. To do so, use Telnet like you normally would, but add the TCP port onto the end (**telnet localhost 80,** for instance) to connect to a web server. This enables you to check a server to see if a service is running or if a firewall is blocking it. So, without having the application client or even a login for the application, you can check if the TCP port is responding. If you know how, sometimes you can elicit a response from the server by manually typing into the Telnet prompt and checking the response. Web servers and mail servers are two examples where you can do this. + +![Getting a response from a webserver with Telnet][3] + +### Tcpdump + +The [tcpdump][4] tool lets you inspect what data is being transmitted on the network. Most network protocols are fairly simple and, if you combine tcpdump with a tool like [Wireshark][5], you will have a nice, easy way to browse the traffic that you have captured. In the example below, I am inspecting packets in the bottom window and connecting to TCP port 3260 in the top. + +![Inspecting packets in real time with tcpdump][6] + +This screenshot shows a real-world use of Wireshark to look at the iSCSI protocol; in this case, I was able to identify that there was a problem with the way our QNAP network-attached storage was configured. + +![Using Wireshark to inspect a TCP session][7] + +### find + +The [find][8] command is simply the best tool if you don't know where to start. In its most simple form, you can use it to "find" files. For example, if I wanted to do a recursive search through all directories and get a list of the conf files, I could enter: + + +``` +`find . -name '*.conf'.` +``` + +![find command output][9] + +But one of find's hidden gems is that you can use it to execute a command against each item it finds. For example, if I wanted to get a long list of each file, I could enter: + + +``` +`find . -name '*.conf' -exec ls -las {} \;` +``` + +![find command output][10] + +Once you know this technique, you can use it in all sorts of creative ways to find, search, and execute programs in specific ways. + +### strace + +I was introduced to the concept of [strace][11] on Solaris, where it is called truss. It is still as useful today as it was all those years ago. strace allows you to inspect what a process is doing as it runs in real time. Using it is simple; just use the command **ps -ef** and find the process ID that you are interested in. Start strace with **strace -p <pid>**; this will start printing out a whole lot of stuff, which at first looks like junk. But if you look closer, you will see text that you recognize, such as words like **OPEN** and **CLOSE** and filenames. This can lead you in the right direction if you are trying to figure out why a program is not working. + +### grep + +Leaving the best for last: [grep][12]. This tool is so useful and powerful that I have trouble coming up with a succinct way to describe it. Put simply, it's a search tool, but the way it searches is what makes it so powerful. In problem analysis, I typically grep over a bunch of logs to search for something. A companion command called zgrep does the same thing with zipped files. In the following example, I used **zgrep /var/log/* bancroft** to grep across all the log files to see what I have been up to on the system. I used zgrep because there are zipped files in the directory. + +![grep command output][13] + +Another great way to use grep is for piping the output of other tools into it; this way, it can be used as a filter of sorts. In the following example, I listed the auth file and grepped for my login to see what I have been doing by using **cat auth.log |grep bancroft**. This can also be written as **grep bancroft auth.log**, but I used the pipe (**|**) to demonstrate the point. + +![grep command output][14] + +### Other tools to consider + +You can do a lot more with these tools, but I hope this brief introduction gives you a window into how to use them to solve the nasty problems that come your way. Another tool worth your attention is [Nmap][15], which I did not include because it is so comprehensive that it needs an entire article (or more) to explain it. Finally, I recommend learning some white hat and hacking techniques; they can be very beneficial when trying to get to the bottom of a problem because they can help you collect information that can be crucial in decision making. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/ops-hacks-sysadmins + +作者:[Stephen Bancroft][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stevereaver +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4 (Wratchet set tools) +[2]: https://en.wikipedia.org/wiki/Telnet +[3]: https://opensource.com/sites/default/files/uploads/telnet_1.png (Getting a response from a webserver with Telnet) +[4]: https://www.tcpdump.org/ +[5]: https://www.wireshark.org/ +[6]: https://opensource.com/sites/default/files/uploads/tcpdump_1.png (Inspecting packets in real time with tcpdump) +[7]: https://opensource.com/sites/default/files/uploads/tcpdump_2.png (Using Wireshark to inspect a TCP session) +[8]: https://en.wikipedia.org/wiki/Find_%28Unix%29 +[9]: https://opensource.com/sites/default/files/uploads/find_1_0.png (find command output) +[10]: https://opensource.com/sites/default/files/uploads/find_2.png (find command output) +[11]: https://strace.io/ +[12]: https://en.wikipedia.org/wiki/Grep +[13]: https://opensource.com/sites/default/files/uploads/grep_1.png (grep command output) +[14]: https://opensource.com/sites/default/files/uploads/grep_2.png (grep command output) +[15]: https://nmap.org/ From f56bef9e248961cdb05a8f0631cac035fe6a78bf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 11 Jan 2020 00:59:27 +0800 Subject: [PATCH 512/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200110=20How=20?= =?UTF-8?q?I=20upgraded=20my=20CuBox=20open=20source=20music=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200110 How I upgraded my CuBox open source music server.md --- ...raded my CuBox open source music server.md | 237 ++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 sources/tech/20200110 How I upgraded my CuBox open source music server.md diff --git a/sources/tech/20200110 How I upgraded my CuBox open source music server.md b/sources/tech/20200110 How I upgraded my CuBox open source music server.md new file mode 100644 index 0000000000..b4651d48c4 --- /dev/null +++ b/sources/tech/20200110 How I upgraded my CuBox open source music server.md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I upgraded my CuBox open source music server) +[#]: via: (https://opensource.com/article/20/1/upgrade-cubox-open-source-music-server) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +How I upgraded my CuBox open source music server +====== +Our resident audiophile explains how he updated his CuBox music server +after more than five years of excellent use. +![open source music with piano keys background][1] + +Back in early 2014, I purchased my first [ARM-based computer][2], a [SolidRun CuBox-i4][3]. My goal for the CuBox was to have a headless device (e.g., no display) that takes up minimal space in the audio equipment shelf, makes minimal noise, and serves music files to my digital-to-analog converter (DAC) and thus to the rest of the stereo. On paper, the CuBox was a perfect fit. It is fanless, works with various Linux distros, provides a separate [eSATA interface][4] for a locally mounted hard drive and therefore leaves the USB ports free for other stuff, provides a [TOSLINK port][5] for digital audio, uses a [MicroSD card][6] (by default, anyway) for the system installation and boot drive, and comes with 2GB of RAM and a reasonably fast [i.MX6q quad-core processor][7], all in an unobtrusive 5x5x5cm black plastic box. + +And as luck would (sometimes) have it, those promises have mostly been kept. The box still runs and provides my family with a great deal of musical enjoyment. The attached hard drive contains about 275GB of music files—a bit over 7,500 FLAC files with some 300 or so MP3 files thrown in. + +As our home music server, the CuBox runs a barebones Linux server distro with Music Player Daemon ([MPD][8]) as the music-serving software, sending digital data to the DAC via the [ALSA][9] with no software mixing, up- or down-sampling, or volume control on the server. Lately, I've found it convenient to run [lighttpd][10], a lightweight, simple-to-configure HTTP server, to provide cover images to the various MPD clients that we run in the house. (But now MPD provides that capability, so that convenience may soon go away.) For the user interfaces to play music, we use [Cantata][11] on the desktop and [MPD Remote][12] (caution: it may not be open source) on our Android phones to browse, select, and play music. + +In 2017, I wrote about [my experiences using the CuBox][13]. I had tried [Voyage Linux][14], [Volumio][15], and [Archphile Linux][16], and had just moved to [Armbian][17], which at that time was based on Ubuntu 16.04 LTS (long term support). This fall, I decided it was time to upgrade the server, get the latest version of MPD, and deal with a few other bothersome details along the way. + +### The upgrade + +Given my generally great experience with Armbian, I decided to go there again for upgrade materials. There are two supported options: a Debian Buster-based server configuration and an Ubuntu 18.04 desktop configuration. Bearing in mind my desire to keep the system display-free and minimalist, I selected the Debian version. + +![Armbian versions][18] + +The download was trouble-free, and I soon had an install image in my Downloads folder. As before, I was impressed with the quality and "to the point" nature of the [Armbian documentation][19], which notes: + +> Images shall only be written with Etcher on all platforms since, unlike other tools, Etcher validates burning results **saving you from corrupted SD card contents**. + +This was my first experience using [Etcher][20], and I was duly impressed with its usability (yet another wonderful reason to use open source software). I inserted the resulting MicroSD card into the CuBox, connected the Ethernet cable, DAC, and eSATA drive, and powered it on. Soon, I could SSH into the CuBox to configure it. Talk about a painless experience! Here's what I see when I log into that machine using SSH: + +![CuBox login][21] + +In terms of configuration, I had the following objectives: + + * Finish the initial configuration + * Configure static IP addressing for the wired networking connection + * Get the installed system up to date + * Disable the wireless + * Install and configure MPD + * Install and configure lighttpd + * Listen to some music! + + + +I used the excellent [Armbian Config program][22] to carry out a bunch of these initial configuration tasks. + +![Armbian-Config screen][23] + +Choosing System presents this menu: + +![Armbian-Config settings][24] + +I used this to disable root login over SSH and enable password and public key authentication. + +In the Network subsystem, I set static IP addressing (to conform to my home router settings), and in the Personal subsystem, I changed the time zone and hostname. I probably could have used the Software subsystem to run the initial update, but I chose to exit to the shell and use apt to finish up this initial configuration with: + + +``` +sudo apt update +sudo apt upgrade +``` + +I also used apt to install MPD and lighttpd with: + + +``` +`sudo apt install mpd lighttpd` +``` + +I had my previous MPD configuration file (**/etc/mpd.conf**); generally, I prefer to use these types of older files as guides to configure a new one, rather than just plunking the old one on top of the new. In the end, there weren't many changes to make; here are the differences between the old and new files: + + +``` +clh@stereo:/etc$ diff mpd.conf.orig mpd.conf +85c85,86 +< bind_to_address               "localhost" +\--- +> #bind_to_address              "localhost" +> bind_to_address               "192.168.1.21" +241c242,249 +<       name            "My ALSA Device" +\--- +>       name            "Drop Airist R2R" +>       device          "hw:CARD=U20,DEV=0" +>       mixer_type      "none" +>       replay_gain_handler      "none" +> #     name            "Schit Bifrost 4490" +> #     device          "hw:CARD=S2,DEV=0" +> #     mixer_type      "none" +> #     replay_gain_handler      "none" +clh@stereo:/etc$ +``` + +You can see that I have two DACs (just because), and the second is commented out (and not connected). Also, I had to change **bind_to_address** so that MPD will listen over the local area network. + +As for lighttpd, I only had to change the **document-root**: + + +``` +clh@stereo:/etc/lighttpd$ diff lighttpd.conf.orig lighttpd.conf +8c8,13 +< server.document-root        = "/var/www/html" +\--- +> # Used this config documentation +> # +> # which wasn't good - wrong user name, didn't need to add +> # the mime config +> # in the end just changed the document root. +> +> server.document-root        = "/var/lib/mpd/music/" +clh@stereo:/etc/lighttpd$ +``` + +To get to the music files, I added the following line to **/etc/fstab**: + + +``` +`/dev/sda1 /mnt/eSATA ext4 rw 0 0` +``` + +and created the mount point with: + + +``` +`sudo mkdir /mnt/eSATA` +``` + +At this point, I mounted the external hard drive with: + + +``` +`sudo mount /dev/sda1` +``` + +Finally, I linked MPD's configuration directory to the music with: + + +``` +sudo rmdir /var/lib/mpd/music +sudo ln -s /mnt/eSATA/Music /var/lib/mpd/music +``` + +I used this approach because I'd rather not futz around with MPD's configuration more than I have to. + +It's a good idea to check that the music files are owned by the correct MPD user ID. Do this with: + + +``` +clh@stereo:~$ ls -ld /var/lib/mpd/music/* | head +drwxrwxrwx   5 mpd audio  4096 Jan 22  2017 /var/lib/mpd/music/Academy of St. Martin-in-the-Fields +drwxrwxrwx   3 mpd audio  4096 Jan 22  2017 /var/lib/mpd/music/Acantus +drwxrwxrwx   3 mpd audio  4096 Dec 13  2014 /var/lib/mpd/music/Afrikan_Sciences +drwxrwxrwx   5 mpd audio  4096 Sep 25  2016 /var/lib/mpd/music/Afro Celt Sound System +drwxrwxrwx   3 mpd audio  4096 Mar 11  2014 /var/lib/mpd/music/Agnes Obel +drwxrwxrwx   3 mpd audio  4096 Oct  9  2013 /var/lib/mpd/music/Alexander Malter, Dietmar Schwalke, Vladimir Spiakov, Sergej Bezrodny +drwxrwxrwx   3 mpd audio  4096 Oct  8  2013 /var/lib/mpd/music/Ali Farka Toure & Toumani Diabate +drwxrwxrwx   3 mpd audio  4096 Oct  8  2013 /var/lib/mpd/music/Ali Farka Touré with Ry Cooder +drwxrwxrwx   5 mpd audio  4096 Jan  1  2018 /var/lib/mpd/music/Amadou et Mariam +drwxrwxrwx   3 mpd audio  4096 Jul 11  2017 /var/lib/mpd/music/American Authors +clh@stereo:~$ +``` + +This looks fine (user ID **mpd**, group ID **audio**). + +Finally, to disable the wireless, I entered: + + +``` +`sudo nmcli radio wifi off` +``` + +And I'm done! Time for a reboot: + + +``` +`sudo systemctl reboot` +``` + +Once it rebooted, I used Cantata to force MPD to refresh its database. Here's what it looks like when that's done, and I'm listening to [Frameworks' latest album, _Imagine Gold_][25]: + +![Frameworks "Imagine Gold" in Cantata][26] + +Just to the left of the track listings, you can see the cover images that lighttpd serves. + +### And speaking of music + +I really do like Frameworks' latest album. It's quite similar to his previous work, and he always has the greatest hooks with very dance-able stuff and just that great bit of "yearning." It's nice to buy his stuff on Bandcamp, as usual (see link above, where you can also listen). + +Lately, I've also been buying stuff in that other great open source format, vinyl records. In particular, two fine recent albums from the [Erased Tapes][27] label, [Anne Müller's _Heliopause_][28], which is a beautiful record of her own solo cello and supporting instruments and sounds, "focusing on novel approaches to classical instrumentation," and [Penguin Cafe's _Handfuls of Night_][29], which "began life after Greenpeace commissioned [Arthur] Jeffes [of Penguin Cafe] to write four pieces of music corresponding to four breeds of penguins to help raise awareness for the endangered Antarctic seas." How could a Linux user not have music about penguins by Penguin Cafe? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/upgrade-cubox-open-source-music-server + +作者:[Chris Hermansen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_LIFE_music_520x292_0411_ma.png?itok=v_ARy1ZT (open source music with piano keys background) +[2]: https://en.wikipedia.org/wiki/ARM_architecture +[3]: https://www.solid-run.com/nxp-family/cubox-i/ +[4]: https://en.wikipedia.org/wiki/Serial_ATA +[5]: https://en.wikipedia.org/wiki/TOSLINK +[6]: https://www.makeuseof.com/tag/5-mistakes-avoid-buying-next-microsd-card/ +[7]: https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/i.mx-applications-processors/i.mx-6-processors/i.mx-6quad-processors-high-performance-3d-graphics-hd-video-arm-cortex-a9-core:i.MX6Q?&cid=ps_PRG100148_CAM262037_EETECH&gclid=CjwKCAiA27LvBRB0EiwAPc8XWfLpyKIpi4OPNrPLdmXpSynIaDP0FG2jQ9PPZ1q49ENp1CbQU2fKxxoCKtMQAvD_BwE +[8]: https://www.musicpd.org/ +[9]: https://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture +[10]: https://www.lighttpd.net/ +[11]: https://opensource.com/article/17/8/cantata-music-linux +[12]: https://play.google.com/store/apps/details?id=net.prezz.mpr&hl=en_CA +[13]: https://opensource.com/article/17/6/armbian-cubox-i4pro +[14]: https://wiki.debian.org/Derivatives/Census/VoyageLinux +[15]: https://volumio.org/ +[16]: https://archphile.org/ +[17]: https://www.armbian.com/ +[18]: https://opensource.com/sites/default/files/uploads/armbianversions.png (Armbian versions) +[19]: https://docs.armbian.com/ +[20]: https://www.etcher.io/ +[21]: https://opensource.com/sites/default/files/uploads/cuboxlogin.png (CuBox login) +[22]: https://docs.armbian.com/User-Guide_Armbian-Config/ +[23]: https://opensource.com/sites/default/files/uploads/armbian-config.png (Armbian-config screen) +[24]: https://opensource.com/sites/default/files/uploads/armbian-config_settings.png (Armbian-config settings) +[25]: https://frameworksuk.bandcamp.com/album/imagine-gold +[26]: https://opensource.com/sites/default/files/uploads/frameworks-imaginegold.png (Frameworks "Imagine Gold" in Cantata) +[27]: https://www.erasedtapes.com/ +[28]: https://www.erasedtapes.com/release/eratp128-anne-mueller-heliopause +[29]: https://www.erasedtapes.com/release/eratp127-penguin-cafe-handfuls-of-night From a3fcdcbbc510200eb296b88038513dbbadde86e6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 08:40:59 +0800 Subject: [PATCH 513/676] PUB @robsean https://linux.cn/article-11770-1.html --- ...p Highlight- Open Source Disk Partitioning Tool GParted.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md (98%) diff --git a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md b/published/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md similarity index 98% rename from translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md rename to published/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md index 6721773f69..088b578c82 100644 --- a/translated/tech/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md +++ b/published/20191217 App Highlight- Open Source Disk Partitioning Tool GParted.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11770-1.html) [#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted) [#]: via: (https://itsfoss.com/gparted/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 18e314b9e43f2f2b83de1ca60b78f147df21a4d5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 11 Jan 2020 08:46:22 +0800 Subject: [PATCH 514/676] Rename sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md to sources/talk/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md --- .../20200111 Don-t Use ZFS on Linux- Linus Torvalds.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md (100%) diff --git a/sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md b/sources/talk/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md similarity index 100% rename from sources/tech/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md rename to sources/talk/20200111 Don-t Use ZFS on Linux- Linus Torvalds.md From b6f217100ff0ecadaa85b5903bfcc515abc89dea Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 09:20:28 +0800 Subject: [PATCH 515/676] PRF @geekpi --- ...y Pi retrospective- 6 projects and more.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md index 2e3d16258d..001d8cd841 100644 --- a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md +++ b/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -7,26 +7,28 @@ [#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) [#]: author: (Anderson Silva https://opensource.com/users/ansilva) -我的树莓派回顾:不止 6 个项目 +我的树莓派项目回顾 ====== -看看我在有趣的、有教育意义和有用的树莓派上做了什么。 -![Raspberry Pi 4 board, posterized filter][1] -从历史和理论上讲,十年、一个世纪或一千年从十进制一那年的 1 月 1 日物业开始。例如,20 世纪始于 1901 年 1 月 1 日,而不是 1900 年 1 月 1 日。原因很简单:现代日历中没有 0 年,因此这些时间段始于 1 年(使用公历)。但这不是我们在口语上和文化上指代时间段的方式。例如,当我们提到 80 年代的音乐或电影时,我们所说的是 1980 年至 1989 年。 +> 看看我在好玩、能学习、有用处的树莓派上做了些什么。 -我可以说,最近过去的 21 世纪 10 年代是云计算、社交媒体、移动技术和物联网 (IoT) 的十年,这其中包括[树莓派][2]。最近,《时代》杂志将树莓派称为[过去十年中 10 个最佳小玩意][3]之一。我非常同意这点。 +![](https://img.linux.net.cn/data/attachment/album/202001/11/091748wekfv77t5ux5zzv2.jpg) -最初的树莓派于 2012 年推出,我过了几年才使用上了它。但是从那以后,我在家中做了许多有趣的教育项目,甚至在 Opensource.com 中记录了一些。 +无论是从历史上,还是从理论上讲,当时钟走到一个十年份第一年的 1 月 1 日的午夜 0 点时,就开始了一个十年或一个世纪或一个千年纪元。例如,20 世纪始于 1901 年 1 月 1 日,而不是 1900 年 1 月 1 日。原因很简单:现代日历中没有 0 年,因此这些时间段始于 1 年(使用公历)。但这不是我们在口语上和文化上指代时间段的方式。例如,当我们提到 80 年代的音乐或电影时,我们所说的是 1980 年至 1989 年。 + +我可以说,最近过去的 21 世纪 10 年代是云计算、社交媒体、移动技术和物联网(IoT)的十年,这其中就包括[树莓派][2]。最近,《时代》杂志将树莓派称为[过去十年中 10 个最佳小玩意][3]之一。我非常同意这点。 + +树莓派最初的于 2012 年推出,我过了几年才使用上了它。不过从那以后,我在家中做了许多有趣的教育项目,还在 Opensource.com 中记录了一些。 ### 圣诞灯三部曲 -三年来,我写了三篇探讨如何使用树莓派和开源项目 LightShowPi 控制圣诞灯的文章。第一篇文章[_用树莓派创建你自己的音乐灯光秀_][4],是基础电子开发介绍和灯光秀的结合。第二篇文章,[_ 使用树莓派 SSH 进入你的圣诞树_][5],更深入地介绍了通过远程管理和电子按钮控制灯光的方法。三部曲的最后一章[_用树莓派设置假期心情_][6],回顾了上一年 LightShowPi 项目中引入的更改。 +三年来,我写了三篇探讨如何使用树莓派和开源项目 LightShowPi 控制圣诞灯的文章。第一篇文章《[用树莓派创建你自己的音乐灯光秀][4]》,非常基础地介绍了电子开发介绍和灯光秀的结合。第二篇文章,《[使用树莓派 SSH 进入你的圣诞树][5]》,稍微深入地介绍了通过远程管理和电子按钮控制灯光的方法。三部曲的最后一章《[用树莓派设置假期心情][6]》,回顾了上一年 LightShowPi 项目中引入的更改。 ### DIY 项目 -多年来,我已经将树莓派变成了几种有用的设备。有一次,我将树莓派变成了[带有 Pi MusicBox 的音乐播放设备][7],它可以让你在 Web 界面中导入你喜欢的音乐流并在房间中播放。 +多年来,我已经将树莓派变成了几种有用的设备。有一次,我将树莓派变成了 [Pi MusicBox 音乐播放设备][7],它可以让你在 Web 界面中导入你喜欢的音乐流并在房间中播放。 -将树莓派做成[移动视频录制设备][8]是另一个 DIY 项目。它需要一些额外的硬件,例如触摸屏、Pi 摄像头和电池组,但是可以使用。这个设备的最大缺点之一是当时树莓派的可用内存很小。我认为如果我将它重新配置在具有 4GB 内存的树莓派 4 上,那么这款便携式摄像机的功能可能会更好。这可能是一个会在 2020 年重新做项目。 +将树莓派做成[移动视频录制设备][8]是另一个 DIY 项目。它需要一些额外的硬件,例如触摸屏、树莓派摄像头和电池组,但是它工作的很好。这个设备的最大缺点之一是当时树莓派的可用内存很小。我认为如果我将它重新配置在具有 4GB 内存的树莓派 4 上,那么这款便携式摄像机的功能可能会更好。这可能是一个会在 2020 年重新打造的项目。 我做的另一个小项目[客厅的数字时钟][9]使用了 Adafruit PiTFT 小屏幕。尽管这个项目很简单,但它可能是我使用时间最长的项目。那个时钟在我的电视机上呆了一年多,一天 24 小时不间断运行,直到屏幕烧坏为止。 @@ -36,7 +38,7 @@ ### 走向未来 -我在树莓派基金会中不认识任何人,因此我不了解任何它的路线图和未来计划。我可以(但我不会)推测品牌及其设备的未来,它们让世界各地这么多不同社会地位的人扩展他们对计算机科学、电子和开源开发的知识。我希望基金会的管理层能够忠于其愿景和使命,并继续为世界各地的人们提供价格合理的技术。 +我不认识树莓派基金会中的任何人,因此我不了解它的任何路线图和未来计划。我可以(但我不会)推测品牌及其设备的未来,它们让世界各地这么多不同社会地位的人扩展他们对计算机科学、电子和开源开发的知识。我希望基金会的管理层能够忠于其愿景和使命,并继续为世界各地的人们提供价格合理的技术。 21 世纪 10 年代过去了,那是多么甜蜜的十年。对我来说,它闻起来就像树莓派馅饼。 @@ -47,7 +49,7 @@ via: https://opensource.com/article/20/1/raspberry-pi-best 作者:[Anderson Silva][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f08f47ea1e16aaea73e208503b3aed5771c07ab3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 09:21:10 +0800 Subject: [PATCH 516/676] PUB @geekpi https://linux.cn/article-11771-1.html --- ...03 My Raspberry Pi retrospective- 6 projects and more.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200103 My Raspberry Pi retrospective- 6 projects and more.md (98%) diff --git a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md b/published/20200103 My Raspberry Pi retrospective- 6 projects and more.md similarity index 98% rename from translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md rename to published/20200103 My Raspberry Pi retrospective- 6 projects and more.md index 001d8cd841..ad2ff90485 100644 --- a/translated/tech/20200103 My Raspberry Pi retrospective- 6 projects and more.md +++ b/published/20200103 My Raspberry Pi retrospective- 6 projects and more.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11771-1.html) [#]: subject: (My Raspberry Pi retrospective: 6 projects and more) [#]: via: (https://opensource.com/article/20/1/raspberry-pi-best) [#]: author: (Anderson Silva https://opensource.com/users/ansilva) From d6cc786096a61d066f3a18be662e62a44808ccc1 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Sat, 11 Jan 2020 09:46:16 +0800 Subject: [PATCH 517/676] Update 20200102 Put some loot in your Python platformer game.md --- ...ome loot in your Python platformer game.md | 84 ++++++++----------- 1 file changed, 37 insertions(+), 47 deletions(-) diff --git a/sources/tech/20200102 Put some loot in your Python platformer game.md b/sources/tech/20200102 Put some loot in your Python platformer game.md index 296739c2b9..998b7da88d 100644 --- a/sources/tech/20200102 Put some loot in your Python platformer game.md +++ b/sources/tech/20200102 Put some loot in your Python platformer game.md @@ -8,40 +8,36 @@ [#]: author: (Seth Kenlon https://opensource.com/users/seth) Put some loot in your Python platformer game +在你的 Python 平台类游戏中放一些奖励 ====== -Give your players some treasures to collect and boost their score in -this installment on programming video games with Python's Pygame module. + +这部分是关于在使用 Python Pygame 模块开发视频游戏给你的玩家提供收集的宝物和经验值的内容。 ![Hearts, stars, and dollar signs][1] -This is part 9 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are: +这是正在进行的关于使用 [Python 3][2]的[Pygame][3]模块创建视频游戏的系列文章的第9部分。以前的文章有: - * [Learn how to program in Python by building a simple dice game][4] - * [Build a game framework with Python using the Pygame module][5] - * [How to add a player to your Python game][6] - * [Using Pygame to move your game character around][7] - * [What's a hero without a villain? How to add one to your Python game][8] - * [Simulate gravity in your Python game][9] - * [Add jumping to your Python platformer game][10] - * [Enable your Python game player to run forward and backward][11] + * [通过构建一个简单的骰子游戏学习如何用 Python 编程][4] + * [使用 Pygame 模块用 Python 构建游戏框架][5] + * [如何在 Python 游戏中添加玩家][6] + * [使用 Pygame 移动你的游戏角色][7] + * [没有恶棍的哪里来的英雄?如何在您的 Python 游戏中添加一个][8] + * [在你的 Python 游戏中模拟重力][9] + * [将跳跃添加到您的 Python 平台游戏中][10] + * [使你的 Python 游戏玩家能够向前和向后跑][11] +如果你已经阅读了本系列的前几篇文章,那么你已经了解了编写游戏的所有基础知识。现在你可以在这些基础上,创造一个全功能的游戏。当你第一次学习时,遵循像本系列代码示例,这样的“用例”是有帮助的,但是,用例也会约束你。现在是时候运用你学到的知识,以新的方式应用它们了。 +如果说,说起来容易做起来难,这篇文章展示了一个如何将你已经了解的内容用于新目的的例子中。具体来说,就是它涵盖了如何使用你以前的课程中已经了解到的来实现奖励系统。 -If you've followed along with the previous articles in this series, then you know all the basics of programming video game mechanics. You can build upon these basics to create a fully functional video game all your own. Following a "recipe" like the code samples in this series is helpful when you're first learning, but eventually, the recipe becomes a constraint. It's time to use the principles you've learned and apply them in new ways. +在大多数电子游戏中,你有机会在游戏世界中获得“奖励”或收集到宝物和其他物品。奖励通常会增加你的分数或者你的健康指数,或者为你的下一次任务提供信息。 -If that sounds easier said than done, this article demonstrates an example of how to leverage what you already know for new purposes. Specifically, it covers how to implement a looting system +游戏中包含的奖励类似于编程平台。像平台一样,奖励没有用户控制,随着游戏世界的滚动,并且必须检查与玩家的碰撞。 -using what you have already learned about platforms from previous lessons. +### 创建奖励函数 -In most video games, you have the opportunity to "loot," or collect treasures and other items within the game world. Loot usually increases your score or your health or provides information leading to your next quest. - -Including loot in your game is similar to programming platforms. Like platforms, loot has no user controls, scrolls with the game world, and must check for collisions with the player sprite. - -### Creating the loot function - -Loot is so similar to platforms that you don't even need a Loot class. You can just reuse the **Platform** class and call the results loot. - -Since loot type and placement probably differ from level to level, create a new function called **loot** in your **Level** class, if you don't already have one. Since loot items are not platforms, you must also create a new **loot_list** group and then add loot objects to it. As with platforms, ground, and enemies, this group is used when checking for collisions: +奖励和平台非常相似,你甚至不需要奖励类。您可以重用 **Platform** 类,并将结果称为奖励。 +由于奖励类型和位置可能因级别不同而不同,如果你还没有一个新的功能,请在你的 **Level** 中创建一个名为 **Level** 的新功能。因为奖励物品不是平台,你也必须创建一个新的 **loot_list** 组,然后添加奖励物品。与平台、地面和敌人一样,该组用于检查冲突: ```     def loot(lvl,lloc): @@ -56,10 +52,9 @@ Since loot type and placement probably differ from level to level, create a new         return loot_list ``` -You can add as many loot objects as you like; just remember to add each one to your loot list. The arguments for the **Platform** class are the X position, the Y position, the width and height of the loot sprite (it's usually easiest to keep your loot sprite the same size as all other tiles), and the image you want to use as loot. Placement of loot can be just as complex as mapping platforms, so use the level design document you created when creating the level. - -Call your new loot function in the **Setup** section of your script. In the following code, the first three lines are for context, so just add the fourth: +你可以随意添加任意数量的奖励对象;记住把每一个都加到你的奖励清单上。***Platform** 类的参数是奖励图标的X位置、Y位置、宽度和高度(通常最容易让你的奖励图标保持和所有其他方块一样的大小),以及你想要用作的奖励图标。奖励的放置可以和贴图平台一样复杂,所以使用创建关卡时需要创建关卡设计文档。 +在脚本的 **Setup** 部分调用新的奖励函数。在下面的代码中,前三行是上下文,所以只需添加第四行: ``` enemy_list = Level.bad( 1, eloc ) @@ -68,8 +63,7 @@ plat_list = Level.platform( 1,tx,ty ) loot_list = Level.loot(1,tx,ty) ``` -As you know by now, the loot won't get drawn to the screen unless you include it in your main loop. Add the final line from the following code sample to your loop: - +正如你现在所知道的,除非你把它包含在你的主循环中,否则奖励不会被显示到屏幕上。将下面代码示例的最后一行添加到循环中: ```     enemy_list.draw(world) @@ -78,16 +72,16 @@ As you know by now, the loot won't get drawn to the screen unless you include it     loot_list.draw(world) ``` -Launch your game to see what happens. +启动你的游戏看看会发生什么。 ![Loot in Python platformer][12] -Your loot objects are spawned, but they don't do anything when your player runs into them, nor do they scroll when your player runs past them. Fix these issues next. +你的奖励会产生,但是当你的玩家碰到它们时,它们不会做任何事情,当你的玩家经过它们时,它们也不会滚动。接下来解决这些问题。 -### Scrolling loot +### 滚动奖励 Like platforms, loot has to scroll when the player moves through the game world. The logic is identical to platform scrolling. To scroll the loot forward, add the last two lines: - +像平台一样,当玩家在游戏世界中移动时,奖励必须滚动。逻辑与平台滚动相同。要向前滚动战利品,添加最后两行: ```         for e in enemy_list: @@ -96,7 +90,7 @@ Like platforms, loot has to scroll when the player moves through the game world.             l.rect.x -= scroll ``` -To scroll it backward, add the last two lines: +要向后滚动,请添加最后两行: ``` @@ -106,16 +100,15 @@ To scroll it backward, add the last two lines:             l.rect.x += scroll ``` -Launch your game again to see that your loot objects now act like they're _in_ the game world instead of just painted on top of it. +再次启动你的游戏,看看你的奖励物品现在表现得像在游戏世界里一样,而不是仅仅画在上面。 -### Detecting collisions +### 检测碰撞 -As with platforms and enemies, you can check for collisions between loot and your player. The logic is the same as other collisions, except that a hit doesn't (necessarily) affect gravity or health. Instead, a hit causes the loot to disappear and increment the player's score. +就像平台和敌人一样,你可以检查奖励物品和玩家之间的碰撞。逻辑与其他碰撞相同,除了撞击不会(必然)影响重力或健康。取而代之的是,命中会导致奖励物品会消失并增加玩家的分数。 -When your player touches a loot object, you can remove that object from the **loot_list**. This means that when your main loop redraws all loot items in **loot_list**, it won't redraw that particular object, so it will look like the player has grabbed the loot. - -Add the following code above the platform collision detection in the **update** function of your **Player** class (the last line is just for context): +当你的玩家触摸到一个奖励对象时,你可以从 **奖励列表** 中移除该对象。这意味着当你的主循环在 **loot_list** 中重绘所有奖励物品时,它不会重绘那个特定的对象,所以看起来玩家已经获得了奖励物品。 +在 **Player** 类的 **update** 函数中的平台碰撞检测之上添加以下代码(最后一行仅用于上下文): ```                 loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) @@ -127,8 +120,7 @@ Add the following code above the platform collision detection in the **update**         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) ``` -Not only do you remove the loot object from its group when a collision happens, but you also award your player a bump in score. You haven't created a score variable yet, so add that to your player's properties, created in the **__init__** function of the **Player** class. In the following code, the first two lines are for context, so just add the score variable: - +当碰撞发生时,你不仅要把奖励从它的组中移除,还要给你的玩家一个分数提升。你还没有创建分数变量,所以请将它添加到你的玩家属性中,该属性是在***Player** 类的**__init__**函数中创建的。在下面的代码中,前两行是上下文,所以只需添加分数变量: ```         self.frame = 0 @@ -136,20 +128,18 @@ Not only do you remove the loot object from its group when a collision happens,         self.score = 0 ``` -When calling the **update** function in your main loop, include the **loot_list**: - +当在主循环中调用**update**函数时,需要包括**loot_list**: ```         player.gravity()         player.update() ``` -As you can see, you've got all the basics. All you have to do now is use what you know in new ways. +如你所见,你已经掌握了所有的基本知识。你现在要做的就是用新的方式使用你所知道的。 -There are a few more tips in the next article, but in the meantime, use what you've learned to make a few simple, single-level games. Limiting the scope of what you are trying to create is important so that you don't overwhelm yourself. It also makes it easier to end up with a finished product that looks and feels finished. - -Here's all the code you've written for this Python platformer so far: +在下一篇文章中还有一些提示,但是与此同时,用你学到的知识来制作一些简单的单层游戏。限制你试图创造的东西的范围是很重要的,这样你就不会埋没自己。这也使得最终的成品看起来和感觉上更容易完成。 +以下是迄今为止你为这个 Python 平台编写的所有代码: ``` #!/usr/bin/env python3 From b74afa0013d3aa652767befc7bc5686330967f90 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Sat, 11 Jan 2020 10:52:36 +0800 Subject: [PATCH 518/676] heguangzhi translated --- ...ut some loot in your Python platformer game.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) rename {sources => translated}/tech/20200102 Put some loot in your Python platformer game.md (94%) diff --git a/sources/tech/20200102 Put some loot in your Python platformer game.md b/translated/tech/20200102 Put some loot in your Python platformer game.md similarity index 94% rename from sources/tech/20200102 Put some loot in your Python platformer game.md rename to translated/tech/20200102 Put some loot in your Python platformer game.md index 998b7da88d..14d2715438 100644 --- a/sources/tech/20200102 Put some loot in your Python platformer game.md +++ b/translated/tech/20200102 Put some loot in your Python platformer game.md @@ -11,7 +11,7 @@ Put some loot in your Python platformer game 在你的 Python 平台类游戏中放一些奖励 ====== -这部分是关于在使用 Python Pygame 模块开发视频游戏给你的玩家提供收集的宝物和经验值的内容。 +这部分是关于在使用 Python 的 Pygame 模块开发视频游戏给你的玩家提供收集的宝物和经验值的内容。 ![Hearts, stars, and dollar signs][1] 这是正在进行的关于使用 [Python 3][2]的[Pygame][3]模块创建视频游戏的系列文章的第9部分。以前的文章有: @@ -25,19 +25,19 @@ Put some loot in your Python platformer game * [将跳跃添加到您的 Python 平台游戏中][10] * [使你的 Python 游戏玩家能够向前和向后跑][11] -如果你已经阅读了本系列的前几篇文章,那么你已经了解了编写游戏的所有基础知识。现在你可以在这些基础上,创造一个全功能的游戏。当你第一次学习时,遵循像本系列代码示例,这样的“用例”是有帮助的,但是,用例也会约束你。现在是时候运用你学到的知识,以新的方式应用它们了。 +如果你已经阅读了本系列的前几篇文章,那么你已经了解了编写游戏的所有基础知识。现在你可以在这些基础上,创造一个全功能的游戏。当你第一次学习时,遵循本系列代码示例,这样的“用例”是有帮助的,但是,用例也会约束你。现在是时候运用你学到的知识,以新的方式应用它们了。 如果说,说起来容易做起来难,这篇文章展示了一个如何将你已经了解的内容用于新目的的例子中。具体来说,就是它涵盖了如何使用你以前的课程中已经了解到的来实现奖励系统。 在大多数电子游戏中,你有机会在游戏世界中获得“奖励”或收集到宝物和其他物品。奖励通常会增加你的分数或者你的健康指数,或者为你的下一次任务提供信息。 -游戏中包含的奖励类似于编程平台。像平台一样,奖励没有用户控制,随着游戏世界的滚动,并且必须检查与玩家的碰撞。 +游戏中包含的奖励类似于编程平台。像平台一样,奖励没有用户控制,随着游戏世界的滚动进行,并且必须检查与玩家的碰撞。 ### 创建奖励函数 奖励和平台非常相似,你甚至不需要奖励类。您可以重用 **Platform** 类,并将结果称为奖励。 -由于奖励类型和位置可能因级别不同而不同,如果你还没有一个新的功能,请在你的 **Level** 中创建一个名为 **Level** 的新功能。因为奖励物品不是平台,你也必须创建一个新的 **loot_list** 组,然后添加奖励物品。与平台、地面和敌人一样,该组用于检查冲突: +由于奖励类型和位置可能因关卡不同而不同,如果你还没有一个新的功能,请在你的 **Level** 中创建一个名为 **Level** 的新功能。因为奖励物品不是平台,你也必须创建一个新的 **loot_list** 组,然后添加奖励物品。与平台、地面和敌人一样,该组用于检查玩家碰撞: ```     def loot(lvl,lloc): @@ -76,12 +76,11 @@ loot_list = Level.loot(1,tx,ty) ![Loot in Python platformer][12] -你的奖励会产生,但是当你的玩家碰到它们时,它们不会做任何事情,当你的玩家经过它们时,它们也不会滚动。接下来解决这些问题。 +你的奖励将会显示出来,但是当你的玩家碰到它们时,它们不会做任何事情,当你的玩家经过它们时,它们也不会滚动。接下来解决这些问题。 ### 滚动奖励 -Like platforms, loot has to scroll when the player moves through the game world. The logic is identical to platform scrolling. To scroll the loot forward, add the last two lines: -像平台一样,当玩家在游戏世界中移动时,奖励必须滚动。逻辑与平台滚动相同。要向前滚动战利品,添加最后两行: +像平台一样,当玩家在游戏世界中移动时,奖励必须滚动。逻辑与平台滚动相同。要向前滚动奖励物品,添加最后两行: ```         for e in enemy_list: @@ -100,7 +99,7 @@ Like platforms, loot has to scroll when the player moves through the game world.             l.rect.x += scroll ``` -再次启动你的游戏,看看你的奖励物品现在表现得像在游戏世界里一样,而不是仅仅画在上面。 +再次启动你的游戏,看看你的奖励物品现在表现得像在游戏世界里一样了,而不是仅仅画在上面。 ### 检测碰撞 From 74d6c1c6f61dac8a069b4f035608ee99eed748d1 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Sat, 11 Jan 2020 14:20:38 +0800 Subject: [PATCH 519/676] Update 20200107 How piwheels will save Raspberry Pi users time in 2020.md --- ... How piwheels will save Raspberry Pi users time in 2020.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md index aa43d04f90..9a05b56b50 100644 --- a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md +++ b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -90,7 +90,7 @@ via: https://opensource.com/article/20/1/piwheels 作者:[Ben Nuttall][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From df7d6ab3e32d36eeb84f0265b96b8a6ce93b5aba Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 14:25:49 +0800 Subject: [PATCH 520/676] PRF @MjSeven --- ...w to write a Python web API with Django.md | 126 +++++++++--------- 1 file changed, 64 insertions(+), 62 deletions(-) diff --git a/translated/tech/20191129 How to write a Python web API with Django.md b/translated/tech/20191129 How to write a Python web API with Django.md index aaf4acefb8..5ba1650a1f 100644 --- a/translated/tech/20191129 How to write a Python web API with Django.md +++ b/translated/tech/20191129 How to write a Python web API with Django.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to write a Python web API with Django) @@ -9,12 +9,14 @@ 如何借助 Django 来编写一个 Python Web API ====== -Django 是 Python API 开发中最流行的框架之一,在这个教程中,我们来学习如何使用它。 -![拿起 Python 书来学习吧][1] + +> Django 是 Python API 开发中最流行的框架之一,在这个教程中,我们来学习如何使用它。 + +![](https://img.linux.net.cn/data/attachment/album/202001/11/142503aio2325mk5weiozz.jpg) [Django][2] 所有 Web 框架中最全面的,也是最受欢迎的一个。自 2005 年以来,其流行度大幅上升。 -Django 是由 Django 软件基金会维护,并且获得了社区的大力支持,在全球拥有超过 11,600 名会员。在 Stack Overflow 上,Django 约有 191,000 个带标签的问题。Spotify、YouTube 和 Instagram 等都使用 Django 来构建应用程序和数据管理。 +Django 是由 Django 软件基金会维护,并且获得了社区的大力支持,在全球拥有超过 11,600 名成员。在 Stack Overflow 上,约有 191,000 个带 Django 标签的问题。Spotify、YouTube 和 Instagram 等都使用 Django 来构建应用程序和数据管理。 本文演示了一个简单的 API,通过它可以使用 HTTP 协议的 GET 方法来从服务器获取数据。 @@ -34,11 +36,11 @@ $ python3 -m venv env $ source env/bin/activate ``` -在 Windows 上,使用命令 **env\Scripts\activate** 来激活虚拟环境: +在 Windows 上,使用命令 `env\Scripts\activate` 来激活虚拟环境。 ### 安装 Django 和 Django REST framework -然后,安装 Django 和 Django REST: +然后,安装 Django 和 Django REST 模块: ``` $ pip3 install django @@ -47,7 +49,7 @@ $ pip3 install djangorestframework ### 实例化一个新的 Django 项目 -现在你的应用程序已经有了一个工作环境,你必须实例化一个新的 Django 项目。与 [Flask][3] 这样微框架不同的是,Django 有专门的命令来创建(注意第一条命令后的 **.** 字符)。 +现在你的应用程序已经有了一个工作环境,你必须实例化一个新的 Django 项目。与 [Flask][3] 这样微框架不同的是,Django 有专门的命令来创建(注意第一条命令后的 `.` 字符)。 ``` $ django-admin startproject tutorial . @@ -55,68 +57,68 @@ $ cd tutorial $ django-admin startapp quickstart ``` -Django 使用数据库来管理后端,所以你应该在开始开发之前同步数据库,数据库可以通过 **manage.py** 脚本管理,它是在你运行 **django-admin** 命令时创建的。因为你现在在 **tutorial** 目录,所以使用 **../** 符号来运行脚本,它位于上一层目录: +Django 使用数据库来管理后端,所以你应该在开始开发之前同步数据库,数据库可以通过 `manage.py` 脚本管理,它是在你运行 `django-admin` 命令时创建的。因为你现在在 `tutorial` 目录,所以使用 `../` 符号来运行脚本,它位于上一层目录: ``` $ python3 ../manage.py makemigrations No changes detected $ python4 ../manage.py migrate Operations to perform: -  Apply all migrations: admin, auth, contenttypes, sessions + Apply all migrations: admin, auth, contenttypes, sessions Running migrations: -  Applying contenttypes.0001_initial... OK -  Applying auth.0001_initial... OK -  Applying admin.0001_initial... OK -  Applying admin.0002_logentry_remove_auto_add... OK -  Applying admin.0003_logentry_add_action_flag_choices... OK -  Applying contenttypes.0002_remove_content_type_name... OK -  Applying auth.0002_alter_permission_name_max_length... OK -  Applying auth.0003_alter_user_email_max_length... OK -  Applying auth.0004_alter_user_username_opts... OK -  Applying auth.0005_alter_user_last_login_null... OK -  Applying auth.0006_require_contenttypes_0002... OK -  Applying auth.0007_alter_validators_add_error_messages... OK -  Applying auth.0008_alter_user_username_max_length... OK -  Applying auth.0009_alter_user_last_name_max_length... OK -  Applying auth.0010_alter_group_name_max_length... OK -  Applying auth.0011_update_proxy_permissions... OK -  Applying sessions.0001_initial... OK + Applying contenttypes.0001_initial... OK + Applying auth.0001_initial... OK + Applying admin.0001_initial... OK + Applying admin.0002_logentry_remove_auto_add... OK + Applying admin.0003_logentry_add_action_flag_choices... OK + Applying contenttypes.0002_remove_content_type_name... OK + Applying auth.0002_alter_permission_name_max_length... OK + Applying auth.0003_alter_user_email_max_length... OK + Applying auth.0004_alter_user_username_opts... OK + Applying auth.0005_alter_user_last_login_null... OK + Applying auth.0006_require_contenttypes_0002... OK + Applying auth.0007_alter_validators_add_error_messages... OK + Applying auth.0008_alter_user_username_max_length... OK + Applying auth.0009_alter_user_last_name_max_length... OK + Applying auth.0010_alter_group_name_max_length... OK + Applying auth.0011_update_proxy_permissions... OK + Applying sessions.0001_initial... OK ``` ### 在 Django 中创建用户 -创建一个名为 **admin**,密码为 **password123** 的初始用户: +创建一个名为 `admin`,示例密码为 `password123` 的初始用户: ``` $ python3 ../manage.py createsuperuser \ -  --email [admin@example.com][4] \ -  --username admin + --email admin@example.com \ + --username admin ``` 在提示时创建密码。 ### 在 Django 中实现序列化和视图 -为了使 Django 能够将信息传递给 HTTP GET 请求,必须将信息对象转化为有效的响应数据。Django 为此实现了“序列化类”。 +为了使 Django 能够将信息传递给 HTTP GET 请求,必须将信息对象转化为有效的响应数据。Django 为此实现了“序列化类” `serializers`。 -在你的项目中,创建一个名为 **quickstart/serializers.py** 的新模块,使用它来定义一些序列化器,模块将用于数据展示: +在你的项目中,创建一个名为 `quickstart/serializers.py` 的新模块,使用它来定义一些序列化器,模块将用于数据展示: ``` from django.contrib.auth.models import User, Group from rest_framework import serializers class UserSerializer(serializers.HyperlinkedModelSerializer): -    class Meta: -        model = User -        fields = ['url', 'username', 'email', 'groups'] + class Meta: + model = User + fields = ['url', 'username', 'email', 'groups'] class GroupSerializer(serializers.HyperlinkedModelSerializer): -    class Meta: -        model = Group -        fields = ['url', 'name'] + class Meta: + model = Group + fields = ['url', 'name'] ``` -Django 中的 [view][5] 是一个接受 Web 请求并返回 Web 响应的函数。响应可以是 HTML、HTTP 重定向、HTTP 错误、JSON 或 XML 文档、图像或 TAR 文件,或者可以是从 Internet 获得的任何其他内容。要创建视图,打开 **quickstart/views.py** 并输入以下代码。该文件已经存在,并且其中包含一些示例文本,保留这些文本并将以下代码添加到文件中: +Django 中的[视图][5]是一个接受 Web 请求并返回 Web 响应的函数。响应可以是 HTML、HTTP 重定向、HTTP 错误、JSON 或 XML 文档、图像或 TAR 文件,或者可以是从 Internet 获得的任何其他内容。要创建视图,打开 `quickstart/views.py` 并输入以下代码。该文件已经存在,并且其中包含一些示例文本,保留这些文本并将以下代码添加到文件中: ``` from django.contrib.auth.models import User, Group @@ -124,23 +126,23 @@ from rest_framework import viewsets from tutorial.quickstart.serializers import UserSerializer, GroupSerializer class UserViewSet(viewsets.ModelViewSet): -    """ -    API 允许查看或编辑用户 -    """ -    queryset = User.objects.all().order_by('-date_joined') -    serializer_class = UserSerializer + """ + API 允许查看或编辑用户 + """ + queryset = User.objects.all().order_by('-date_joined') + serializer_class = UserSerializer class GroupViewSet(viewsets.ModelViewSet): -    """ -    API 允许查看或编辑组 -    """ -    queryset = Group.objects.all() -    serializer_class = GroupSerializer + """ + API 允许查看或编辑组 + """ + queryset = Group.objects.all() + serializer_class = GroupSerializer ``` ### 使用 Django 生成 URL -现在,你可以生成 URL 以便人们可以访问你刚起步的 API。在文本编辑器中打开 urls.py 并将默认示例代码替换为以下代码: +现在,你可以生成 URL 以便人们可以访问你刚起步的 API。在文本编辑器中打开 `urls.py` 并将默认示例代码替换为以下代码: ``` from django.urls import include, path @@ -154,19 +156,19 @@ router.register(r'groups', views.GroupViewSet) # 使用自动路由 URL # 还有登录 URL urlpatterns = [ -    path('', include(router.urls)), -    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) + path('', include(router.urls)), + path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] ``` ### 调整你的 Django 项目设置 -这个示例项目的设置模块存储在 **tutorial/settings.py** 中,因此在文本编辑器中将其打开,然后在 **INSTALLED_APPS** 列表的末尾添加 **rest_framework**: +这个示例项目的设置模块存储在 `tutorial/settings.py` 中,因此在文本编辑器中将其打开,然后在 `INSTALLED_APPS` 列表的末尾添加 `rest_framework`: ``` INSTALLED_APPS = [ -    ... -    'rest_framework', + ... + 'rest_framework', ] ``` @@ -175,17 +177,17 @@ INSTALLED_APPS = [ 现在,你可以测试构建的 API。首先,从命令行启动内置服务器: ``` -`$ python3 manage.py runserver` +$ python3 manage.py runserver ``` -你可以通过使用 **curl** 导航至 URL **** 来访问 API: +你可以通过使用 `curl` 导航至 URL `http://localhost:8000/users` 来访问 API: ``` -$ curl --get -[{"url":" +$ curl --get http://localhost:8000/users/?format=json +[{"url":"http://localhost:8000/users/1/?format=json","username":"admin","email":"admin@example.com","groups":[]}] ``` -使用 Firefox 或[开源浏览器][6]: +使用 Firefox 或你选择的[开源浏览器][6]: ![一个简单的 Django API][7] @@ -197,10 +199,10 @@ Django 的主要优点: 1. Django 社区的规模正在不断扩大,因此即使你做一个复杂项目,也会有大量的指导资源。 2. 默认包含模板、路由、表单、身份验证和管理工具等功能,你不必寻找外部工具,也不必担心第三方工具会引入兼容性问题。 - 3. 用户,循环和条件的简单结构使你可以专注于编写代码。 + 3. 用户、循环和条件的简单结构使你可以专注于编写代码。 4. 这是一个成熟且经过优化的框架,它非常快速且可靠。 -Django 的主要缺点是: +Django 的主要缺点: 1. Django 很复杂!从开发人员视角的角度来看,它可能比简单的框架更难学。 2. Django 有一个很大的生态系统。一旦你熟悉它,这会很棒,但是当你深入学习时,它可能会令人感到无所适从。 @@ -214,7 +216,7 @@ via: https://opensource.com/article/19/11/python-web-api-django 作者:[Rachel Waston][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5cab9d11e26dab1ec1f0627644a30246e36028f3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 14:26:27 +0800 Subject: [PATCH 521/676] PUB @MjSeven https://linux.cn/article-11773-1.html --- .../20191129 How to write a Python web API with Django.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20191129 How to write a Python web API with Django.md (100%) diff --git a/translated/tech/20191129 How to write a Python web API with Django.md b/published/20191129 How to write a Python web API with Django.md similarity index 100% rename from translated/tech/20191129 How to write a Python web API with Django.md rename to published/20191129 How to write a Python web API with Django.md From ae7bb0737328a4f038ff5bfd7cfbed0263e5827f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 14:33:21 +0800 Subject: [PATCH 522/676] APL --- sources/tech/20190406 Run a server with Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190406 Run a server with Git.md b/sources/tech/20190406 Run a server with Git.md index 2d7749a465..7387669ac0 100644 --- a/sources/tech/20190406 Run a server with Git.md +++ b/sources/tech/20190406 Run a server with Git.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 904d29fbcc86e71876530e2cdc110d1dc074e79d Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Sat, 11 Jan 2020 15:45:33 +0800 Subject: [PATCH 523/676] heguangzhi translated --- ...ll save Raspberry Pi users time in 2020.md | 127 ----------------- ...ll save Raspberry Pi users time in 2020.md | 128 ++++++++++++++++++ 2 files changed, 128 insertions(+), 127 deletions(-) delete mode 100644 sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md create mode 100644 translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md diff --git a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md deleted file mode 100644 index 9a05b56b50..0000000000 --- a/sources/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md +++ /dev/null @@ -1,127 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (heguangzhi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How piwheels will save Raspberry Pi users time in 2020) -[#]: via: (https://opensource.com/article/20/1/piwheels) -[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) - -How piwheels will save Raspberry Pi users time in 2020 -====== -By making pre-compiled Python packages for Raspberry Pi available, the -piwheels project saves users significant time and effort. -![rainbow colors on pinwheels in the sun][1] - -Piwheels automates building Python wheels (pre-compiled Python packages) for all of the projects on [PyPI][2], the Python Package Index, using Raspberry Pi hardware to ensure compatibility. This means that when a Raspberry Pi user wants to install a Python library using **pip**, they get a ready-made compiled version that's guaranteed to work on the Raspberry Pi. This makes it much easier for Raspberry Pi users to dive in and get started with their projects. - -![Piwheels logo][3] - -When I wrote [_piwheels: Speedy Python package installation for the Raspberry Pi_][4] in October 2018, the piwheels project was in its first year and already proving its purpose of saving Raspberry Pi users considerable time and effort. But the project, which makes pre-compiled Python packages available for Raspberry Pi, has come a long way in its second year. - -![Raspberry Pi 4][5] - -### How it works - -[Raspbian][6], the primary OS for Raspberry Pi, comes pre-configured to use piwheels, so users don't need to do anything special to get access to the wheels. - -The configuration file (at **/etc/pip.conf**) tells pip to use [piwheels.org][7] as an _additional index_, so pip looks at PyPI first, then piwheels. The Piwheels website is hosted on a Raspberry Pi 3, and all the wheels built by the project are hosted on that Pi. It serves over 1 million packages per month—not bad for a $35 computer! - -In addition to the main Raspberry Pi that serves the website, the piwheels project uses seven other Pis to build the packages. Some run Raspbian Jessie, building wheels for Python 3.4, some run Raspbian Stretch for Python 3.5, and some run Raspbian Buster for Python 3.7. The project doesn't generally support other Python versions. There's also a "proper server"—a virtual machine running the Postgres database. Since the Pi 3 has just 1GB of RAM, the (very large) database doesn't run well on it, so we moved it to a VM. The Pi 4 with 4GB RAM would probably be suitable, so we may move to this in the future. - -The Pis are all on an IPv6-only network in a "Pi Cloud"—a brilliant service provided by Cambridge-based hosting company [Mythic Beasts][8]. - -![Mythic Beasts hosting service][9] - -### Downloads and trends - -Every time a wheel file is downloaded, it is logged in the database. This provides insight into what packages are most popular and what Python versions and operating systems people are using. We don't have much information from the user agent, but because the architecture of Pi 1/Zero shows as "armv6" and Pi 2/3/4 show as "armv7," we can tell them apart. - -As of mid-December 2019, over 14 million packages have been downloaded from piwheels, with nearly 9 million in 2019 alone. - -The 10 most popular packages since the project's inception are: - - 1. [pycparser][10] (821,060 downloads) - 2. [PyYAML][11] (366,979) - 3. [numpy][12] (354,531) - 4. [cffi][13] (336,982) - 5. [MarkupSafe][14] (318,878) - 6. [future][15] (282,349) - 7. [aiohttp][16] (277,046) - 8. [cryptography][17] (276,167) - 9. [home-assistant-frontend][18] (266,667) - 10. [multidict][19] (256,185) - - - -Note that many pure-Python packages, such as [urllib3][20], are provided as wheels on PyPI; because these are compatible across platforms, they're not usually downloaded from piwheels because PyPI takes precedence. - -We also see trends in things like which Python versions are used over time. This shows the quick takeover of Python 3.7 from 3.5 when Raspbian Buster was released: - -![Data from piwheels on Python versions used over time][21] - -You can see more trends in our [stats blog posts][22]. - -### Time saved - -Every package build is logged in the database, and every download is also stored. Cross-referencing downloads with build duration shows how much time has been saved. One example is numpy—the latest version took about 11 minutes to build. - -So far, piwheels has saved users a total of over 165 years of build time. At the current usage rate, piwheels saves _over 200 days per day_. - -As well as saving build time, having pre-compiled wheels also means people don't have to install various development tools to build packages. Some packages require other apt packages for them to access shared libraries. Figuring out which ones you need can be a pain, so we made that step easier, too. First, we figured out the process and [documented it on our blog][23]. Then we added this logic to the build process so that when a wheel is built, its dependencies are automatically calculated and added to the package's project page: - -![numpy dependencies][24] - -### What next for piwheels? - -We launched project pages (e.g., [numpy][25]) this year, which are a really useful way to let people look up information about a project in a human-readable way. They also make it easier for people to report issues, such as if a project is missing from piwheels or they have an issue with a package they've downloaded. - -In early 2020, we're planning to roll out some upgrades to piwheels that will enable a new JSON API, so you can automatically check which versions are available, look up dependencies for a project, and lots more. - -The next Debian/Raspbian upgrade won't happen until mid-2021, so we won't start building wheels for any new Python versions until then. - -You can read more about piwheels on the project's [blog][26], where I'll be publishing a 2019 roundup early in 2020. You can also follow [@piwheels][27] on Twitter, where you'll see daily and monthly stats along with any milestones reached. - -Of course, piwheels is an open source project, and you can see the entire project [source code on GitHub][28]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/piwheels - -作者:[Ben Nuttall][a] -选题:[lujun9972][b] -译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bennuttall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rainbow-pinwheel-piwheel-diversity-inclusion.png?itok=di41Wd3V (rainbow colors on pinwheels in the sun) -[2]: https://pypi.org/ -[3]: https://opensource.com/sites/default/files/uploads/piwheels.png (Piwheels logo) -[4]: https://opensource.com/article/18/10/piwheels-python-raspberrypi -[5]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4_0.jpg (Raspberry Pi 4) -[6]: https://www.raspberrypi.org/downloads/raspbian/ -[7]: http://piwheels.org -[8]: https://www.mythic-beasts.com/order/rpi -[9]: https://opensource.com/sites/default/files/uploads/pi-cloud.png (Mythic Beasts hosting service) -[10]: https://www.piwheels.org/project/pycparser -[11]: https://www.piwheels.org/project/PyYAML -[12]: https://www.piwheels.org/project/numpy -[13]: https://www.piwheels.org/project/cffi -[14]: https://www.piwheels.org/project/MarkupSafe -[15]: https://www.piwheels.org/project/future -[16]: https://www.piwheels.org/project/aiohttp -[17]: https://www.piwheels.org/project/cryptography -[18]: https://www.piwheels.org/project/home-assistant-frontend -[19]: https://www.piwheels.org/project/multidict -[20]: https://piwheels.org/project/urllib3/ -[21]: https://opensource.com/sites/default/files/uploads/pyvers2019.png (Data from piwheels on Python versions used over time) -[22]: https://blog.piwheels.org/piwheels-stats-for-2019/ -[23]: https://blog.piwheels.org/how-to-work-out-the-missing-dependencies-for-a-python-package/ -[24]: https://opensource.com/sites/default/files/uploads/numpy-deps.png (numpy dependencies) -[25]: https://www.piwheels.org/project/numpy/ -[26]: https://blog.piwheels.org/ -[27]: https://twitter.com/piwheels -[28]: https://github.com/piwheels/ diff --git a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md new file mode 100644 index 0000000000..3b7ec879eb --- /dev/null +++ b/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How piwheels will save Raspberry Pi users time in 2020) +[#]: via: (https://opensource.com/article/20/1/piwheels) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + + +piwheels 是如何在2020年节省树莓派用户的时间的 +====== +通过为树莓派提供预编译的 Python 包,piwheels 项目为用户节省了大量的时间和精力。![rainbow colors on pinwheels in the sun][1] + +piwheels 自动为[PiPi][2]上的所有项目构建 Python wheels( 预编译的 Python包 ),即 Python 包索引,使用树莓派硬件确保其兼容性。这意味着,当树莓派用户想要使用 **pip**,安装一个Python库时,他们会得到一个现成的编译版本,并保证可以在树莓派上良好的工作。这使得树莓派用户更容易进入和开始他们的项目。 + +![Piwheels logo][3] + +当我在2018年10月写[piwheels:为树莓派提供快速 Python 包安装][4]时,piwheels 项目已经进入第一年,并且已经证明了其为树莓派用户节省大量时间和精力。但是这个项目已经进入第二年,它为树莓派提供了预编译的 Python 包走了更长的路。 + +![Raspberry Pi 4][5] + +### 它是怎么工作的 + +[Raspbian][6],树莓派的主要操作系统,预配置使用 piwheels,所以用户不需要做任何特殊的事情就可以使用piwheels。 + +配置文件(在 **/etc/pip.conf**)告诉 pip 使用[piwheels.org][7]作为 _附加索引_,因此 pip 首先查看PyPI,然后查看 piwheels。piwheels 网站位于树莓派 3的 hosts中,该项目建造的所有 wheels 都位于该派上。它每月提供100多万套服务——对于一台35美元的电脑来说还不错! + +网站除了主要服务于树莓派以外,piwheels 项目还对使用其他七个派系统并构建软件包。有人运行 Raspbian Jessie,为 Python 3.4 建造 wheels,有人运行 Raspbian Stretch 为 Python 3.5,有人运行 Raspbian Buster 为 Python 3.7。该项目通常不支持其他 Python 版本。还有一个“合适的服务器”——运行 Postgres 数据库的虚拟机。由于 派3 只有1GB的内存,所以(非常大的)数据库不能在其上很好地运行,所以我们把它移到了虚拟机上。带 4GB 内存的 派4 可能是合适的,所以我们将来可能会用到它。 + +派都在“派云”中的 IPv6 网络上——这是一项由总部位于剑桥的托管公司[Mythic Beasts][8]提供的卓越的服务。 +![Mythic Beasts hosting service][9] + +### 下载和统计趋势 + +每次下载 piwheels 文件时,它都会记录在数据库中。这提供了对什么包最受欢迎以及人们使用什么 Python 版本和操作系统的统计。我们没有太多来自用户代理的信息,但是因为 派1/Zero 的架构显示为 “armv6”,派2/3/4显示为“armv7”,所以我们可以将它们区分开来。 + +截至2019年12月中旬,从派风车下载的软件包超过1,400万个,仅2019年就有近900万个。 + +自项目开始以来最受欢迎的10个软件包是: + + 1. [pycparser][10] (821,060 downloads) + 2. [PyYAML][11] (366,979) + 3. [numpy][12] (354,531) + 4. [cffi][13] (336,982) + 5. [MarkupSafe][14] (318,878) + 6. [future][15] (282,349) + 7. [aiohttp][16] (277,046) + 8. [cryptography][17] (276,167) + 9. [home-assistant-frontend][18] (266,667) + 10. [multidict][19] (256,185) + + + +请注意,许多纯 Python 包,如[urllib3][20],都是作为 PyPI 上的 wheels 提供的;因为这些是跨平台兼容的,所以通常不会从 piwheels 下载,因为PyPI优先。 + +随着时间的推移,我们也看到了使用哪些 Python 版本的趋势。这里显示了 Raspbian Buster 发布时从3.5版快速升级到了Python 3.7: + +![Data from piwheels on Python versions used over time][21] + + +你可以看到更多的统计趋势在[stats blog posts][22]。 + +### 节省时间 + + +每个包构建都被记录在数据库中,并且每个下载也被存储。带有构建持续时间的交叉引用下载显示了节省了多少时间。一个例子是 numpy ——最新版本大约需要11分钟来构建。 + +迄今为止,piwheels 项目已经为用户节省了总计超过165年的构建时间。按照目前的使用率,piwheels 项目每天节省200多天。 + + +除了节省构建时间,拥有预编译的 wheels 也意味着人们不必安装各种开发工具来构建包。一些包需要其他apt包来访问共享库。弄清楚你需要哪一个可能会很痛苦,所以我们也让这一步变得容易了。首先,我们找到了这个过程,[在博客上记录了这个过程][23]。然后,我们将这个逻辑添加到构建过程中,这样当构建一个 wheels 时,它的依赖关系会被自动计算并添加到包的项目页面中: + +![numpy dependencies][24] + +### 派风车的下一步是什么? + +今年,我们推出了项目页面(例如,[numpy][25),这是一种非常有用的方式,可以让人们以人类可读的方式查找项目信息。它们还使人们更容易报告问题,例如 piwheels 中缺少一个项目,或者他们下载的包有问题。 + +2020年初,我们计划对 piwheels 项目进行一些升级,以启用新的JSON应用编程接口,这样你就可以自动检查哪些版本可用,查找项目的依赖关系,等等。 + +下一次 Debian/Raspbian 升级要到2021年年中才会发生,所以在那之前我们不会开始为任何新的 Python 版本 制造 wheels。 + +你可以在这个项目的[博客][26]上读到更多关于 piwheels 的信息,我将在2020年初在那里发表一篇2019年的综述。你也可以在推特上关注[@piwheels][27],在那里你可以看到每日和每月的统计数据以及任何达到的里程碑。 + +当然,piwheels 是一个开源项目,你可以在[GitHub][28]上看到整个项目源代码。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/piwheels + +作者:[Ben Nuttall][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rainbow-pinwheel-piwheel-diversity-inclusion.png?itok=di41Wd3V (rainbow colors on pinwheels in the sun) +[2]: https://pypi.org/ +[3]: https://opensource.com/sites/default/files/uploads/piwheels.png (Piwheels logo) +[4]: https://opensource.com/article/18/10/piwheels-python-raspberrypi +[5]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4_0.jpg (Raspberry Pi 4) +[6]: https://www.raspberrypi.org/downloads/raspbian/ +[7]: http://piwheels.org +[8]: https://www.mythic-beasts.com/order/rpi +[9]: https://opensource.com/sites/default/files/uploads/pi-cloud.png (Mythic Beasts hosting service) +[10]: https://www.piwheels.org/project/pycparser +[11]: https://www.piwheels.org/project/PyYAML +[12]: https://www.piwheels.org/project/numpy +[13]: https://www.piwheels.org/project/cffi +[14]: https://www.piwheels.org/project/MarkupSafe +[15]: https://www.piwheels.org/project/future +[16]: https://www.piwheels.org/project/aiohttp +[17]: https://www.piwheels.org/project/cryptography +[18]: https://www.piwheels.org/project/home-assistant-frontend +[19]: https://www.piwheels.org/project/multidict +[20]: https://piwheels.org/project/urllib3/ +[21]: https://opensource.com/sites/default/files/uploads/pyvers2019.png (Data from piwheels on Python versions used over time) +[22]: https://blog.piwheels.org/piwheels-stats-for-2019/ +[23]: https://blog.piwheels.org/how-to-work-out-the-missing-dependencies-for-a-python-package/ +[24]: https://opensource.com/sites/default/files/uploads/numpy-deps.png (numpy dependencies) +[25]: https://www.piwheels.org/project/numpy/ +[26]: https://blog.piwheels.org/ +[27]: https://twitter.com/piwheels +[28]: https://github.com/piwheels/ From 41b815b26883c112122b6b1b7065933445a0d4f8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 11 Jan 2020 22:17:31 +0800 Subject: [PATCH 524/676] TSL --- .../tech/20190406 Run a server with Git.md | 240 ------------------ .../tech/20190406 Run a server with Git.md | 226 +++++++++++++++++ 2 files changed, 226 insertions(+), 240 deletions(-) delete mode 100644 sources/tech/20190406 Run a server with Git.md create mode 100644 translated/tech/20190406 Run a server with Git.md diff --git a/sources/tech/20190406 Run a server with Git.md b/sources/tech/20190406 Run a server with Git.md deleted file mode 100644 index 7387669ac0..0000000000 --- a/sources/tech/20190406 Run a server with Git.md +++ /dev/null @@ -1,240 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Run a server with Git) -[#]: via: (https://opensource.com/article/19/4/server-administration-git) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/seth) - -Run a server with Git -====== -Thanks to Gitolite, you can manage a Git server with Git. Learn how in -our series about little-known Git uses. -![computer servers processing data][1] - -As I've tried to demonstrate in this series leading up to Git's 14th anniversary on April 7, [Git][2] can do a wide range of things beyond tracking source code. Believe it or not, Git can even manage your Git server, so you can, more or less, run a Git server with Git itself. - -Of course, this involves a lot of components beyond everyday Git, not the least of which is [Gitolite][3], the backend application managing the fiddly bits that you configure using Git. The great thing about Gitolite is that, because it uses Git as its frontend interface, it's easy to integrate Git server administration within the rest of your Git-based workflow. Gitolite provides precise control over who can access specific repositories on your server and what permissions they have. You can manage that sort of thing yourself with the usual Linux system tools, but it takes a lot of work if you have more than just one or two repos across a half-dozen users. - -Gitolite's developers have done the hard work to make it easy for you to provide many users with access to your Git server without giving them access to your entire environment—and you can do it all with Git. - -What Gitolite is _not_ is a GUI admin and user panel. That sort of experience is available with the excellent [Gitea][4] project, but this article focuses on the simple elegance and comforting familiarity of Gitolite. - -### Install Gitolite - -Assuming your Git server runs Linux, you can install Gitolite with your package manager ( **yum** on CentOS and RHEL, **apt** on Debian and Ubuntu, **zypper** on OpenSUSE, and so on). For example, on RHEL: - - -``` -`$ sudo yum install gitolite3` -``` - -Many repositories still have older versions of Gitolite for legacy support, but the current version is version 3. - -You must have passwordless SSH access to your server. You can use a password to log in if you prefer, but Gitolite relies on SSH keys, so you must configure the option to log in with keys. If you don't know how to configure a server for passwordless SSH access, go learn how to do that first (the [Setting up SSH key authentication][5] section of Steve Ovens's Ansible article explains it well). It's an essential part of secure server administration—as well as of running Gitolite. - -### Configure a Git user - -Without Gitolite, if a person requests access to a Git repository you host on a server, you have to provide that person with a user account. Git provides a special shell, the **git-shell** , which is an ultra-specific shell that performs only Git tasks. This lets you have users who can access your server only through the filter of a very limited shell environment. - -That solution works, but it usually means a user gains access to all repositories on your server unless you have a very good schema for group permissions and maintain those permissions strictly whenever a new repository is created. It also requires a lot of manual configuration at the system level, an area usually reserved for a specific tier of sysadmins and not necessarily the person usually in charge of Git repositories. - -Gitolite sidesteps this issue entirely by designating one username for every person who needs access to any repository. By default, the username is **git** , and because Gitolite's documentation assumes that's what is used, it's a good default to keep when you're learning the tool. It's also a well-known convention for anyone who's ever used GitLab or GitHub or any other Git hosting service. - -Gitolite calls this user the _hosting user_. Create an account on your server to act as the hosting user (I'll stick with **git** because that's the convention): - - -``` -` $ sudo adduser --create-home git` -``` - -For you to control the **git** user account, it must have a valid public SSH key that belongs to you. You should already have this set up, so **cp** your public key ( _not your private key_ ) to the **git** user's home directory: - - -``` -$ sudo cp ~/.ssh/id_ed25519.pub /home/git/ -$ sudo chown git:git /home/git/id_ed25519.pub -``` - -If your public key doesn't end with the extension **.pub** , Gitolite will not use it, so rename the file accordingly. Change to that user account to run Gitolite's setup: - - -``` -$ sudo su - git -$ gitolite setup --pubkey id_ed25519.pub -``` - -After the setup script runs, the **git** home's user directory will have a **repositories** directory, which (for now) contains the files **git-admin.git** and **testing.git**. That's all the setup the server requires, so log out. - -### Use Gitolite - -Managing Gitolite is a matter of editing text files in a Git repository, specifically **gitolite-admin.git**. You won't SSH into your server for Git administration, and Gitolite encourages you not to try. The repositories you and your users store on the Gitolite server are _bare_ repositories, so it's best to stay out of them. - - -``` -$ git clone [git@example.com][6]:gitolite-admin.git gitolite-admin.git -$ cd gitolite-admin.git -$ ls -1 -conf -keydir -``` - -The **conf** directory in this repository contains a file called **gitolite.conf**. Open it in a text editor or use **cat** to view its contents: - - -``` -repo gitolite-admin -RW+ = id_ed22519 - -repo testing -RW+ = @all -``` - -You may have an idea of what this configuration file does: **gitolite-admin** represents this repository, and the owner of the **id_ed25519** key has read, write, and Git administrative privileges. In other words, rather than mapping users to normal local Unix users (because all your users log in using the **git** hosting user identity), Gitolite maps users to SSH keys listed in the **keydir** directory. - -The **testing.git** repository gives full permissions to everyone with access to the server using special group notation. - -#### Add users - -If you want to add a user called **alice** to your Git server, the person Alice must send you her public SSH key. Gitolite uses whatever is to the left of the **.pub** extension as the identifier for your Git users. Rather than using the default key name values, give keys a name indicative of the key owner. If a user has more than one key (e.g., one for her laptop, one for her desktop), you can use subdirectories to avoid file name collisions. For instance, the key Alice uses from her laptop might come to you as the default **id_rsa.pub** , so rename it **alice.pub** or similar (or let the users name the key according to their local user accounts on their computers), and place it into the **gitolite-admin.git/keydir/work/laptop/** directory. If she sends you another key from her desktop, name it **alice.pub** (the same as the previous one) and add it to **keydir/work/desktop/**. Another key might go into **keydir/home/desktop/** , and so on. Gitolite recursively searches **keydir** for a **.pub** file matching a repository "user" and treats any match as the same identity. - -When you add keys to the **keydir** directory, you must commit them back to your server. This is such an easy thing to forget that there's a real argument here for using an automated Git application like [**Sparkleshare**][7] so any change is committed back to your Gitolite admin immediately. The first time you forget to commit and push—and waste three hours of your time and your user's time troubleshooting—you'll see that Gitolite is the perfect justification for using Sparkleshare. - - -``` -$ git add keydir -$ git commit -m 'added alice-laptop-0.pub' -$ git push origin HEAD -``` - -Alice, by default, gains access to the **testing.git** directory so she can test connectivity and functionality with that. - -#### Set permissions - -As with users, directory permissions and groups are abstracted away from the normal Unix tools you might be used to (or find information about online). Permissions to projects are granted in the **gitolite.conf** file in **gitolite-admin.git/conf** directory. There are four levels of permissions: - - * **R** allows read-only. A user with **R** permissions on a repository may clone it, and that's all. - * **RW** allows a user to perform a fast-forward push of a branch, create new branches, and create new tags. More or less, this one feels like a "normal" Git repository to most users. - * **RW+** allows Git actions that are potentially destructive. A user can perform normal fast-forward pushes, as well as rewind pushes, do rebases, and delete branches and tags. This may or may not be something you want to grant to all contributors on a project. - * **-** explicitly denies access to a repository. This is essentially the same as a user not being listed in the repository's configuration. - - - -Create a new repository or modify an existing repository's permissions by adjusting **gitolite.conf**. For instance, to give Alice permissions to administrate a new repository called **widgets.git** : - - -``` -repo gitolite-admin -RW+ = id_ed22519 - -repo testing -RW+ = @all - -repo widgets -RW+ = alice -``` - -Now Alice—and Alice alone—can clone the repo: - - -``` -[alice]$ git clone [git@example.com][6]:widgets.git -Cloning into 'widgets'... -warning: You appear to have cloned an empty repository. -``` - -On her initial push, Alice must use the **-u** option to send her branch to the empty repository (as she would have to do with any Git host). - -To make user management easier, you can define groups of repositories: - - -``` -@qtrepo = widgets -@qtrepo = games - -repo gitolite-admin -RW+ = id_ed22519 - -repo testing -RW+ = @all - -repo @qtrepo -RW+ = alice -``` - -Just as you can create group repositories, you can group users. One user group exists by default: **@all**. As you might expect, it includes all users, without exception. You can create your own: - - -``` -@qtrepo = widgets -@qtrepo = games - -@developers = alice bob - -repo gitolite-admin -RW+ = id_ed22519 - -repo testing -RW+ = @all - -repo @qtrepo -RW+ = @developers -``` - -As with adding or modifying key files, any change to the **gitolite.conf** file must be committed and pushed to take effect. - -### Create a repository - -By default, Gitolite assumes repository creation happens from the top down. For instance, a project manager with access to the Git server creates a project repository and, through the Gitolite administration repo, adds developers. - -In practice, you might prefer to grant users permission to create repositories. Gitolite calls these "wild repos" (I'm not sure whether that's commentary on how the repos come into being or a reference to the wildcard characters required by the configuration file to let it happen). Here's an example: - - -``` -@managers = alice bob - -repo foo/CREATOR/[a-z]..* -C = @managers -RW+ = CREATOR -RW = WRITERS -R = READERS -``` - -The first line defines a group of users: the group is called **@managers** and contains users **alice** and **bob**. The next line sets up a wildcard allowing repositories that do not yet exist to be created in a directory called **foo** followed by a subdirectory named for the user creating the repo. For example: - - -``` -[alice]$ git clone [git@example.com][6]:foo/alice/cool-app.git -Cloning into cool-app'... -Initialized empty Git repository in /home/git/repositories/foo/alice/cool-app.git -warning: You appear to have cloned an empty repository. -``` - -There are some mechanisms for the creator of a wild repo to define who can read and write to their repository, but they're limited in scope. For the most part, Gitolite assumes that a specific set of users governs project permission. One solution is to grant all users access to **gitolite-admin** using a Git hook to require manager approval to merge changes into the master branch. - -### Learn more - -Gitolite has many more features than what this introductory article covers, so try it out. The [documentation][8] is excellent, and once you read through it, you can customize your Gitolite server to provide your users whatever level of control you are comfortable with. Gitolite is a low-maintenance, simple system that you can install, set up, and then more or less forget about. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/server-administration-git - -作者:[Seth Kenlon (Red Hat, Community Moderator)][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/server_data_system_admin.png?itok=q6HCfNQ8 (computer servers processing data) -[2]: https://git-scm.com/ -[3]: http://gitolite.com -[4]: http://gitea.io -[5]: Setting%20up%20SSH%20key%20authentication -[6]: mailto:git@example.com -[7]: https://opensource.com/article/19/4/file-sharing-git -[8]: http://gitolite.com/gitolite/quick_install.html diff --git a/translated/tech/20190406 Run a server with Git.md b/translated/tech/20190406 Run a server with Git.md new file mode 100644 index 0000000000..c52295591e --- /dev/null +++ b/translated/tech/20190406 Run a server with Git.md @@ -0,0 +1,226 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run a server with Git) +[#]: via: (https://opensource.com/article/19/4/server-administration-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/seth) + +使用 Git 来管理 Git 服务器 +====== + +> 借助 Gitolite,你可以使用 Git 来管理 Git 服务器。在我们的系列中了解这些鲜为人知的 Git 用途。 + +![computer servers processing data][1] + +正如我在系列文章中演示的那样,[Git][2] 除了跟踪源代码外,还可以做很多事情。信不信由你,Git 甚至可以管理你的 Git 服务器,因此你可以或多或少地使用 Git 本身运行 Git 服务器。 + +当然,这涉及除日常使用 Git 之外的许多组件,其中最重要的是 [Gitolite][3],该后端应用程序可以管理你使用 Git 的每个细小的配置。Gitolite 的优点在于,由于它使用 Git 作为其前端接口,因此很容易将 Git 服务器管理集成到其他基于 Git 的工作流中。Gitolite 可以精确控制谁可以访问你服务器上的特定存储库以及他们具有哪些权限。你可以使用常规的 Linux 系统工具自行管理此类事务,但是如果在六个用户中只有一个或两个以上的仓库,则需要大量的工作。 + +Gitolite 的开发人员做了艰苦的工作,使你可以轻松地为许多用户提供对你的 Git 服务器的访问权,而又不让他们访问你的整个环境 —— 而这一切,你可以使用 Git 来完成全部工作。 + +Gitolite 并`不是` 图形化的管理员和用户面板。优秀的 [Gitea][4] 项目可提供这种经验,但是本文重点介绍 Gitolite 的简单优雅和令人舒适的熟悉感。 + +### 安装 Gitolite + +假设你的 Git 服务器运行 Linux,则可以使用包管理器安装 Gitolite(在 CentOS 和 RHEL 上为 `yum`,在 Debian 和 Ubuntu 上为 `apt`,在 OpenSUSE 上为 `zypper` 等)。例如,在 RHEL 上: + +``` +$ sudo yum install gitolite3 +``` + +许多发行版的存储库仍提供的是旧版本的 Gitolite,但当前版本为版本 3。 + +你必须具有对服务器的无密码 SSH 访问权限。如果愿意,你可以使用密码登录服务器,但是 Gitolite 依赖于 SSH 密钥,因此必须配置使用密钥登录的选项。如果你不知道如何配置服务器以进行无密码 SSH 访问,请首先学习如何进行操作(Steve Ovens 的 Ansible 文章的[设置 SSH 密钥身份验证][5]部分对此进行了很好的说明)。这是加强服务器管理的安全以及运行 Gitolite 的重要组成部分。 + +### 配置 Git 用户 + +如果没有 Gitolite,则如果某人请求访问你在服务器上托管的 Git 存储库,则必须向该人提供用户帐户。Git 提供了一个特殊的外壳,即 `git-shell`,这是一个仅执行 Git 任务的特别特定的 shell。这可以让你有个只能通过非常受限的 Shell 环境的过滤器来访问服务器的用户。 + +该解决方案可行,但通常意味着用户可以访问服务器上的所有存储库,除非你具有用于组权限的良好模式,并在创建新存储库时严格保持这些权限。这种方式还需要在系统级别进行大量手动配置,这通常是为特定级别的系统管理员保留的区域,而不一定是通常负责 Git 存储库的人员。 + +Gitolite 通过为需要访问任何存储库的每个人指定一个用户名来完全回避此问题。 默认情况下,用户名是 `git`,并且由于 Gitolite 的文档假定使用的是它,因此在学习该工具时保留它是一个很好的默认设置。对于曾经使用过 GitLab 或 GitHub 或任何其他 Git 托管服务的人来说,这也是一个众所周知的约定。 + +Gitolite 将此用户称为**托管用户**。在服务器上创建一个帐户以充当托管用户(我习惯使用 `git`,因为这是惯例): + +``` +$ sudo adduser --create-home git +``` + +为了控制该 `git` 用户帐户,该帐户必须具有属于你的有效 SSH 公钥。你应该已经进行了设置,因此复制你的公钥(**不是你的私钥**)添加到 `git` 用户的家目录中: + +``` +$ sudo cp ~/.ssh/id_ed25519.pub /home/git/ +$ sudo chown git:git /home/git/id_ed25519.pub +``` + +如果你的公钥不以扩展名 `.pub` 结尾,则 Gitolite 不会使用它,因此请相应地重命名该文件。切换为该用户帐户以运行 Gitolite 的安装程序: + +``` +$ sudo su - git +$ gitolite setup --pubkey id_ed25519.pub +``` + +安装脚本运行后,`git` 的家用户目录将有一个 `repository` 目录,该目录(目前)包含文件 `git-admin.git` 和 `testing.git`。这就是该服务器所需的全部设置,现在请登出 `git` 用户。 + +### 使用 Gitolite + +管理 Gitolite 就是编辑 Git 存储库中的文本文件,尤其是 `gitolite-admin.git`。你不会通过 SSH 进入服务器来进行 Git 管理,并且 Gitolite 也建议你不要这样尝试。你和你的用户存储在 Gitolite 服务器上的存储库是个**裸**存储库,因此最好不要使用它们。 + +``` +$ git clone git@example.com:gitolite-admin.git gitolite-admin.git +$ cd gitolite-admin.git +$ ls -1 +conf +keydir +``` + +该存储库中的 `conf` 目录包含一个名为 `gitolite.conf` 的文件。在文本编辑器中打开它,或使用`cat`查看其内容: + +``` +repo gitolite-admin + RW+ = id_ed22519 + +repo testing + RW+ = @all +``` + +你可能对该配置文件的功能有所了解:`gitolite-admin` 代表此存储库,并且 `id_ed25519` 密钥的所有者具有读取、写入和 Git 管理权限。换句话说,不是将用户映射到普通的本地 Unix 用户(因为所有用户都使用 `git` 用户托管用户身份),而是将用户映射到 `keydir` 目录中列出的 SSH 密钥。 + +`testing.git` 存储库使用特殊组符号为访问服务器的每个人提供了全部权限。 + +#### 添加用户 + +如果要向 Git 服务器添加一个名为 `alice` 的用户,Alice 必须向你发送她的 SSH 公钥。Gitolite 使用 `.pub` 扩展名左边的任何内容作为该 Git 用户的标识符。不要使用默认的密钥名称值,而是给密钥指定一个指示密钥所有者的名称。如果用户有多个密钥(例如,一个用于笔记本电脑,一个用于台式机),则可以使用子目录来避免文件名冲突。例如,Alice 在笔记本电脑上使用的密钥可能是默认的 `id_rsa.pub`,因此将其重命名为`alice.pub` 或类似名称(或让用户根据其计算机上的本地用户帐户来命名密钥),然后将其放入 `gitolite-admin.git/keydir/work/laptop/` 目录中。如果她从她的桌面发送了另一个密钥,命名为 `alice.pub`(与上一个相同),然后将其添加到 `keydir/home/desktop/` 中。另一个密钥可能放到 `keydir/home/desktop/` 中,依此类推。Gitolite 递归地在 `keydir` 中搜索与存储库“用户”匹配的 `.pub` 文件,并将所有匹配项视为相同的身份。 + +当你将密钥添加到 `keydir` 目录时,必须将它们提交回服务器。这是一件很容易忘记的事情,这里有一个使用自动化的 Git 应用程序(例如 [Sparkleshare] [7])的真正的理由,因此任何更改都将立即提交给你的 Gitolite 管理员。第一次忘记提交和推送,在浪费了三个小时的时间以及用户的故障排除时间之后,你会发现 Gitolite 是使用 Sparkleshare 的完美理由。 + +``` +$ git add keydir +$ git commit -m 'added alice-laptop-0.pub' +$ git push origin HEAD +``` + +默认情况下,Alice 可以访问 `testing.git` 目录,因此她可以使用该目录测试连接性和功能。 + +#### 设置权限 + +与用户一样,目录权限和组也是从你可能习惯的的常规 Unix 工具中抽象出来的(或可从在线信息查找)。在`gitolite-admin.git/conf` 目录中的 `gitolite.conf` 文件中授予对项目的权限。权限分为四个级别: + +* `R` 允许只读。在存储库上具有 `R` 权限的用户可以克隆它,仅此而已。 +* `RW` 允许用户执行分支的快进推送、创建新分支和创建新标签。对于大多数用户来说,这个或多或少感觉就像一个“普通”的 Git 存储库。 +* `RW+` 允许可能具有破坏性的 Git 动作。用户可以执行常规的快进推送、回滚推送、变基以及删除分支和标签。你可能想要或不希望将其授予项目中的所有贡献者。 +* `-` 明确拒绝访问存储库。这与未在存储库的配置中列出的用户相同。 + +通过调整 `gitolite.conf` 来创建一个新的存储库或修改现有存储库的权限。例如,授予 Alice 权限来管理一个名为 `widgets.git` 的新存储库: + +``` +repo gitolite-admin + RW+ = id_ed22519 + +repo testing + RW+ = @all + +repo widgets + RW+ = alice +``` + +现在,Alice(也仅 Alice 一个人)就可以克隆该存储库: + +``` +[alice]$ git clone git@example.com:widgets.git +Cloning into 'widgets'... +warning: You appear to have cloned an empty repository. +``` + +在第一次推送时,Alice 必须使用 `-u` 选项将其分支发送到空存储库(如同她在任何 Git 主机上做的一样)。 + +为了简化用户管理,你可以定义存储库组: + +``` +@qtrepo = widgets +@qtrepo = games + +repo gitolite-admin + RW+ = id_ed22519 + +repo testing + RW+ = @all + +repo @qtrepo + RW+ = alice +``` + +正如你可以创建组存储库一样,你也可以对用户进行分组。默认情况下存在一个用户组:`@all`。如你所料,它包括所有用户,无一例外。你也可以创建自己的组: + +``` +@qtrepo = widgets +@qtrepo = games + +@developers = alice bob + +repo gitolite-admin + RW+ = id_ed22519 + +repo testing + RW+ = @all + +repo @qtrepo + RW+ = @developers +``` + +与添加或修改密钥文件一样,对 `gitolite.conf` 文件的任何更改都必须提交并推送以生效。 + +### 创建存储库 + +默认情况下,Gitolite 假设存储库的创建是从上至下进行。例如,有权访问 Git 服务器的项目经理创建了一个项目存储库,并通过 Gitolite 管理仓库添加了开发人员。 + +实际上,你可能更愿意向用户授予创建存储库的权限。Gitolite 称这些为“野生仓库(通配仓库)wild repos”(我不确定这是关于仓库的形成方式的描述,还是指配置文件所需的通配符)。这是一个例子: + +``` +@managers = alice bob + +repo foo/CREATOR/[a-z]..* + C = @managers + RW+ = CREATOR + RW = WRITERS + R = READERS +``` + +第一行定义了一组用户:该组称为 `@managers`,其中包含用户 `alice` 和 `bob`。下一行设置了通配符允许创建尚不存在的存储库,放在名为 `foo` 的目录下的创建存储库的用户名的子目录中。例如: + +``` +[alice]$ git clone git@example.com:foo/alice/cool-app.git +Cloning into cool-app'... +Initialized empty Git repository in /home/git/repositories/foo/alice/cool-app.git +warning: You appear to have cloned an empty repository. +``` + +野生仓库的创建者可以使用一些机制来定义谁可以读取和写入其存储库,但是他们是被限定范围的。在大多数情况下,Gitolite 假定由一组特定的用户来管理项目权限。一种解决方案是使用 Git 挂钩授予所有用户对 `gitolite-admin` 的访问权限,以要求管理者批准将更改合并到 master 分支中。 + +### 了解更多 + +Gitolite 具有比此介绍性文章涵盖的更多功能,因此请尝试一下。其[文档][8]非常出色,一旦你通读了它,就可以自定义 Gitolite 服务器,以向用户提供你喜欢的任何级别的控制。Gitolite 是一种维护成本低、简单的系统,你可以安装、设置它,然后基本上就可以将其忘却。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/server-administration-git + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/server_data_system_admin.png?itok=q6HCfNQ8 (computer servers processing data) +[2]: https://git-scm.com/ +[3]: http://gitolite.com +[4]: http://gitea.io +[5]: Setting%20up%20SSH%20key%20authentication +[6]: mailto:git@example.com +[7]: https://opensource.com/article/19/4/file-sharing-git +[8]: http://gitolite.com/gitolite/quick_install.html From 8088857543ccc50aa24430c9481f64c85ae6d9ea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 12 Jan 2020 00:57:21 +0800 Subject: [PATCH 525/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200111=20Sync?= =?UTF-8?q?=20files=20across=20multiple=20devices=20with=20Syncthing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200111 Sync files across multiple devices with Syncthing.md --- ... across multiple devices with Syncthing.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20200111 Sync files across multiple devices with Syncthing.md diff --git a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md new file mode 100644 index 0000000000..75c6161189 --- /dev/null +++ b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sync files across multiple devices with Syncthing) +[#]: via: (https://opensource.com/article/20/1/sync-files-syncthing) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Sync files across multiple devices with Syncthing +====== +Learn how to sync files between devices with Syncthing in the first +article in our series on 20 ways to be more productive with open source +in 2020. +![Files in a folder][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Syncing files with Synthing + +Setting up a new machine is a pain. We all have our "standard setups" that we copy from machine to machine. And over the years, I've used a lot of ways to keep them in sync between machines. In the old days (and this will tell you how old I am), it was with floppy disks, then Zip disks, USB sticks, SCP, Rsync, Dropbox, ownCloud—you name it. And they never seemed to work right for me. + +Then I stumbled upon [Syncthing][2]. + +![syncthing console][3] + +Syncthing is a lightweight, peer-to-peer file-synchronization system. You don't need to pay for a service, you don't need a third-party server, and it's fast. Much faster, in my experience, than many of the "big names" in file synchronization. + +Syncthing is available for Linux, MacOS, Windows, and several flavors of BSD. There is also an Android app (but nothing official for iOS yet). There are even handy graphical frontends for all of the above (although I'm not going to cover those here). On Linux, there are packages available for most distributions, so installation is very straightforward. + +![Installing Syncthing on Ubuntu][4] + +When you start Syncthing the first time, it launches a web browser to configure the daemon. There's not much to do on the first machine, but it is a good chance to poke around the user interface (UI) a little bit. The most important thing to see is System ID under the **Actions** menu in the top-right. + +![Machine ID][5] + +Once the first machine is set up, repeat the installation on the second machine. In the UI, there will be a button on the lower-right labeled **Add Remote Device**. Click the button, and you will be presented with a box to enter a **Device ID and a Name**. Copy and paste the **Device ID** from the first machine and click **Save**. + +You should see a pop-up on the first node asking to add the second. Once you accept it, the new machine will show up on the lower-right of the first one. Share the default directory with the second machine. Click on **Default Folder** and then click the **Edit** button. There are four links at the top of the pop-up. Click on **Sharing** and then select the second machine. Click **Save** and look at the second machine. You should get a prompt to accept the shared directory. Once you accept that, it will start synchronizing files between the two machines. + +![Sharing a directory in Syncthing][6] + +Test it out by copying a file to the default directory (**/your/home/Share**) on one of the machines. It should show up on the other one very quickly. + +You can add as many directories as you want or need to the sharing, which is pretty handy. As you can see in the first image, I have one for **myconfigs**—that's where I keep my configuration files. When I get a new machine, I just install Syncthing, and if I tune a configuration on one, I don't have to update all of them—it happens automatically. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-files-syncthing + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://syncthing.net/ +[3]: https://opensource.com/sites/default/files/uploads/productivity_1-1.png (syncthing console) +[4]: https://opensource.com/sites/default/files/uploads/productivity_1-2.png (Installing Syncthing on Ubuntu) +[5]: https://opensource.com/sites/default/files/uploads/productivity_1-3.png (Machine ID) +[6]: https://opensource.com/sites/default/files/uploads/productivity_1-4.png (Sharing a directory in Syncthing) From fce1ce02e1e0a3d85dee495e6bfc2cdf4001d3df Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 12 Jan 2020 09:27:05 +0800 Subject: [PATCH 526/676] PRF @robsean --- ...urce interior design with Sweet Home 3D.md | 78 +++++++++---------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md b/translated/tech/20191016 Open source interior design with Sweet Home 3D.md index ebc4a3bc70..bfabda6d1e 100644 --- a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md +++ b/translated/tech/20191016 Open source interior design with Sweet Home 3D.md @@ -1,115 +1,111 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Open source interior design with Sweet Home 3D) [#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) [#]: author: (Seth Kenlon https://opensource.com/users/seth) - Sweet Home 3D 开放源码室内设计 +Sweet Home 3D 开放源码室内设计 ====== -在你去真实世界购物前,在虚拟世界中尝试家具布局,配色方案等等。 -![Several houses][1] + +> 在你去真实世界购物前,在虚拟世界中尝试家具布局、配色方案等等。 + +![](https://img.linux.net.cn/data/attachment/album/202001/12/092633eyc3c9f7u3gfgj4e.jpg) 这里有关于如何装饰房间的三大流派: - 1. 购买一堆家具,并把它们塞进房间。 - 2. 仔细测量每件家具,计算房间的理论容量,然后把它们全部塞进房间,忽略你在床上放置一个书架的事实。 - 3. 使用一台计算机进行预先可视化。 +1. 购买一堆家具,并把它们塞进房间。 +2. 仔细测量每件家具,计算房间的理论容量,然后把它们全部塞进房间,忽略你在床上放置一个书架的事实。 +3. 使用一台计算机进行预先可视化。 +之前,我还实践了鲜为人知的第四个方式:不要家具。然而,自从我成为一个远程工作者,我发现家庭办公需要一些便利的设施,像一张桌子和一张椅子,一个用于存放参考书和技术手册的书架等等。因此,我一直在制定一个使用实际的家具来迁移我的生活和工作空间的计划,在该*计划*上强调由实木制作,而不是牛奶箱子(或胶水和锯末板之类的东西)。我最不想做的一件事:从旧货市场淘到得宝贝带回家时,发现其进不了门,或者比另一件家具大很多。 - -从历史观点上说,我实践了鲜为人知的第四条原则:没有家具。然而,自从我成为一个远程工作者,我发现家庭办公需要一些便利的设施,像一张桌子和一张椅子,一个用于存放参考书和技术手册的书架等等。因此,我一直在制定一个使用实际的家具来迁移我的生活和工作空间的计划,在 _计划_ 上强调由实木制作,而不是牛奶箱子(或胶水和锯末,或同样的东西)。我最不想做的一件事:从旧货市场淘到得宝贝带回家时,发现其进不了门,或者比另一件家具大很多。 - -是时候做专业人士该做的事了。是时候视觉预览了。 +是时候做专业人士该做的事了,是时候做视觉预览了。 ### 开放源码室内设计 -[Sweet Home 3D][2] 是一个开放源码 (GPLv2) 室内设计应用程序,帮助你绘制你的住宅平面图,然后定义,重新调整大小以及安排家具。你可以使用精确的尺寸来完成这些,精确到一厘米以下,而不使用任何数学运算,仅使用简单的拖拽操作。当你完成后,你可以在 3D 中查看结果。如果你可以在一个 word 程序中创建一个基本的表格(不是家具类),你可以在 Sweet Home 3D 中规划你家的室内设计。 +[Sweet Home 3D][2] 是一个开源的(GPLv2)室内设计应用程序,可以帮助你绘制你的住宅平面图,然后定义、重新调整大小以及安排家具。你可以使用精确的尺寸来完成这些,精确到一厘米以下,而不使用任何数学运算,仅使用简单的拖拽操作就行。当你完成后,你可以以 3D 方式查看结果。在 Sweet Home 3D 中规划你家的室内设计,就和在 Word 程序中创建基本的表格一样简单。 ### 安装 -Sweet Home 3D 是一个 [Java][3] 应用程序,因此它是通用的。它运行在任何可以运行 Java 的操作系统上,包括 Linux ,Windows ,MacOS 和 BSD 。不用理会你的操作系统,你可以从网站 [下载][4] 应用程序。 +Sweet Home 3D 是一个 [Java][3] 应用程序,因此它是平台通用的。它运行在任何可以运行 Java 的操作系统上,包括 Linux、Windows、MacOS 和 BSD 。不用理会你的操作系统,你可以从网站[下载][4]该应用程序。 - * 在 Linux 上,[untar][5] 存档文件。在 SweetHome3D 文件上右键单击,并选择**属性**。在**权限**选项卡中,授予文件可执行权限。 - * 在 MacOS 和 Windows 上,展开存档文件并启动应用程序。当系统提示时,你必需授予它权限来在你的系统上运行。 +* 在 Linux 上,[untar][5] 存档文件。在 `SweetHome3D` 文件上右键单击,并选择**属性**。在**权限**选项卡中,授予文件可执行权限。 +* 在 MacOS 和 Windows 上,展开存档文件并启动应用程序。当系统提示时,你必需授予它权限来在你的系统上运行。 ![Sweet Home 3D permissions][6] -在 Linux 上,你也可以像一个 Snap 软件包一样安装 Sweet Home 3D ,前提是你已经安装并启用 **snapd** 。 +在 Linux 上,你也可以像一个 Snap 软件包一样安装 Sweet Home 3D ,前提是你已经安装并启用 **snapd**。 ### 成功的测量 -首先:打开你的卷尺。为充分利用 Sweet Home 3D ,你必须知道你计划生活空间的实际尺寸。你可能需要测量到毫米或1/16英寸;你知道你自己对变化幅度的容忍度。但是你必需获得基本的尺寸,包括材料墙壁和门窗。 +首先:打开你的卷尺。为充分利用 Sweet Home 3D,你必须知道你所计划的生活空间的实际尺寸。你可能需要测量精度到毫米或 1/16 英寸;你可以自己把握对偏差幅度的容忍度。但是你必需获得基本的尺寸,包括测量墙壁和门窗。 -用你最好的判断力来判断常识。例如,当测量门时,包括门框; - -虽然从技术上讲它不是 _门_ 本身的一部分,它可能是你不想用家具覆盖的墙壁空间的一部分。 +用你最好的判断力来判断常识。例如,当测量门时,包括门框;虽然从技术上讲它不是*门*本身的一部分,但它可能是你不想用家具遮挡的一部分墙壁空间。 ![Measure twice, execute once][7] -CC-SA-BY opensource.com - ### 创建一间房间 -当你第一次启动 Sweet Home 3D 时,它会以它的默认查看模式来打开一个空白的画布,蓝图视图在顶部面板中,3D 渲染在底部面板中。在我的 [Slackware][8] 桌面计算机上,这项工作非常友好,但是我的桌面计算机也是我的视频编辑和游戏计算机,所以它有一个极好的 3D 渲染显卡。在我的笔记本计算机上,这种视图模式是非常慢的。为了最好的性能(尤其是在一台计没有 3D 渲染的专用计算机上),转到窗口顶部的 **3D 视图** 菜单,并选择 **虚拟访问** 。这个视图模式基于虚拟访客的位置从地面视图渲染你的工作。这意味着你可以控制渲染的东西和时机。 +当你第一次启动 Sweet Home 3D 时,它会以其默认查看模式来打开一个空白的画布,蓝图视图在顶部面板中,3D 渲染在底部面板中。在我的 [Slackware][8] 桌面计算机上,它可以很好地工作,不过我的桌面计算机也是我的视频编辑和游戏计算机,所以它有一个极好的 3D 渲染显卡。在我的笔记本计算机上,这种视图模式是非常慢的。为了最好的性能(尤其是在一台计没有 3D 渲染的专用计算机上),转到窗口顶部的 **3D 视图** 菜单,并选择 **虚拟访问** 。这个视图模式基于虚拟访客的位置从地面视图渲染你的工作。这意味着你可以控制渲染的内容和时机。 -不顾你计算机的功率来切换到这个视图的有意义的,因为地表以上的 3D 渲染不比蓝图平面图向你提供更多有用的详细信息。在你更改视图模式后,你可以开始设计。 +不管你计算机是否强力,切换到这个视图的有意义的,因为地表以上的 3D 渲染不比蓝图平面图向你提供更多有用的详细信息。在你更改视图模式后,你可以开始设计。 -第一步是定义你家的墙壁。使用**创建墙壁**工具完成,在顶部工具栏的右侧找到 **手** 图标。绘制墙壁很简单:单击你想要墙壁开始的位置,单击以锚定位置,不断单击锚定,直到你的房间完成。 +第一步是定义你家的墙壁。使用**创建墙壁**工具完成,可以在顶部工具栏的**手形**图标右侧找到。绘制墙壁很简单:单击你想要墙壁开始的位置,单击以锚定位置,不断单击锚定,直到你的房间完成。 ![Drawing walls in Sweet Home 3D][9] -在你闭合墙壁后,按**Esc**来退出工具。 +在你闭合墙壁后,按 `Esc` 来退出工具。 #### 定义一间房间 -Sweet Home 3D 在你如何创建墙壁的问题上是灵活的。你可以先绘制你房子的外部边界,然后再细分内部,或者你可以绘制每个房间作为结成一体的"容器",最终形成你房子所占的空间量。这种灵活性是能做到的,因为在现实生活中和在 Sweet Home 3D 中,墙壁并不总是定义一间房间。为定义一间房间,使用在顶部工具栏的**创建墙壁** 按钮右侧的 **创建房间** 按钮。 +Sweet Home 3D 在你如何创建墙壁的问题上是灵活的。你可以先绘制你房子的外部边界,然后再细分内部,或者你可以绘制每个房间作为结成一体的“容器”,最终形成你房子所占的空间量。这种灵活性是能做到的,因为在现实生活中和在 Sweet Home 3D 中,墙壁并不总是用来定义一间房间。为定义一间房间,使用在顶部工具栏的**创建墙壁**按钮右侧的**创建房间**按钮。 -如果房间的地板空间是通过四面墙所定义,你们你需要做的全部的定义是像一间房间一样在四面墙壁内双击来圈占地方。Sweet Home 3D 将定义空间为一间房间,并根据你的喜好,以英尺或米为单位向你提供房间的面积。 +如果房间的地板空间是通过四面墙所定义,你需要做的全部的定义是像一间房间一样在四面墙壁内双击来圈占地方。Sweet Home 3D 将定义该空间为一间房间,并根据你的喜好,以英尺或米为单位向你提供房间的面积。 对于不规则的房间,你必需使用每次单击来手动定义房间的每个墙角。根据房间形状的复杂性,你可能不得不进行试验来发现你是否需要从你的原点来顺时针或逆时针工作,以避免奇怪的莫比斯条形地板。不过,一般来说,定义一间房间的地板空间是简单的。 ![Defining rooms in Sweet Home 3D][10] -在你给定房间一层地板后,你可以更改到 **箭头** 工具,并在房间上双击来给予它一个名称。你也可以设置地板,墙壁,天花板和踢脚板的颜色及纹理。 +在你给定房间一层地板后,你可以更改到**箭头**工具,并在房间上双击来给予它一个名称。你也可以设置地板、墙壁、天花板和踢脚线的颜色及纹理。 ![Modifying room floors, ceilings, etc. in Sweet Home 3D][11] -默认情况下,这些都不会在蓝图视图中渲染。为启用在你蓝图面板中的房间渲染,转到 **文件** 菜单并选择 **首选项** 。在 **首选项** 面板中,设置 **平面图中房间渲染** 为 **地板颜色或纹理** 。 +默认情况下,这些都不会在蓝图视图中渲染。为启用在你蓝图面板中的房间渲染,转到**文件**菜单并选择**首选项**。在**首选项**面板中,设置**平面图中房间渲染**为**地板颜色或纹理**。 ### 门和窗 -在你完成基本的地板平面图后,你可以长期地切换到 **箭头** 工具。 +在你完成基本的地板平面图后,你可以长期地切换到**箭头**工具。 -你可以在 Sweet Home 3D 的左栏中的 **门和窗** 类别下找到门和窗。你有很多选择,所以选择最接近你家的东西。 +你可以在 Sweet Home 3D 的左栏中的**门和窗**类别下找到门和窗。你有很多选择,所以选择最接近你家的东西。 ![Moving a door in Sweet Home 3D][12] -为放置一扇门或窗到你的平面图中,在你的蓝图平面图中的合适的墙壁上拖拽门或窗。为调整它的位置和大小,双击门或窗。 +为放置一扇门或窗到你的平面图中,在你的蓝图平面图中的合适的墙壁上拖拽门或窗。要调整它的位置和大小,请双击门或窗。 ### 添加家具 -随着基本计划完成,部分工作感觉像 _工作_ 结束了!从这点继续,你可以玩弄家具布置以及其它装饰。 +随着基本平面图完成,这部分工作感觉像是结束了!从这点继续,你可以摆弄家具布置以及其它装饰。 -你可以在左栏中找到家具,按每个计划的房间来组织。你可以拖拽任何项目到你的蓝图平面图中,当你的鼠标悬停在项目的区域上时,使用可视化工具控制方向和大小。在任何项目上双击双击来调整它的颜色和成品表面。 +你可以在左栏中找到家具,按预期的方式来组织每个房间。你可以拖拽任何项目到你的蓝图平面图中,当你的鼠标悬停在项目的区域上时,使用可视化工具控制方向和大小。在任何项目上双击双击来调整它的颜色和成品表面。 -### 访问和导出 +### 查看和导出 -为了看看你未来的家将会看起来是什么样子,在你的蓝图视图中拖拽"人"图标到一个房间中。 +为了看看你未来的家将会看起来是什么样子,在你的蓝图视图中拖拽“人”图标到一个房间中。 ![Sweet Home 3D rendering][13] -你可以在现实主义和仅感受空间感之间找到自己的平衡,只要你的想象力是你唯一的限制。你可以从 Sweet Home 3D [下载页面][4] 获取附加的有用的资源来添加到你的家中。你甚至可以使用 **库编辑器** 应用程序创建你自己的家具和纹理,它们可以从项目网站有选择地下载。 +你可以在现实和空间感受之间找到自己的平衡,你的想象力是你唯一的限制。你可以从 Sweet Home 3D [下载页面][4]获取附加的有用的资源来添加到你的家中。你甚至可以使用**库编辑器**应用程序创建你自己的家具和纹理,它可以从该项目的网站下载。 Sweet Home 3D 可以导出你的蓝图平面图为 SVG 格式,以便在 [Inkscape][14] 中使用,并且它可以导出你的 3D 模型为 OBJ 格式,以便在 [Blender][15] 中使用。为导出你的蓝图,转到**平面图**菜单,并选择**导出为 SVG 格式**。为导出一个 3D 模型,转到 **3D 视图** 菜单并选择**导出为 OBJ 格式**。 -你也可以拍摄你家的"快照,以便于不打开 Sweet Home 3D 而参考你的想法。为创建一个快照,转到 **3D视图** 菜单并选择 **创建照片**。快照是按照蓝图视图中的人的图标的角度展现的,因此按照需要调整,然后在 **创建照片** 窗口中单击 **创建** 按钮。 如果你对快照满意,单击 **保存** 。 +你也可以拍摄你家的"快照,以便于不打开 Sweet Home 3D 而回顾你的想法。为创建一个快照,转到 **3D 视图**菜单并选择**创建照片**。快照是按照蓝图视图中的人的图标的角度展现的,因此按照需要调整,然后在**创建照片**窗口中单击**创建**按钮。如果你对快照满意,单击**保存**。 ### 甜蜜的家 -在 Sweet Home 3D 中有更多的特色。你可以添加一片天空和一片草坪,为你的照片定位光线,设置天花板高度,给你房子添加另一楼层等等。不管你打算租一套公寓,还是买一套房子—或是(还)尚不存在的房子,Sweet Home 3D 是一款简单迷人的应用程序,当你匆忙购买家具时,它可以娱乐并帮助你做出更好的购买选择。因此,你终于可以停止在厨房的柜台上吃早餐以及蹲在地上工作。 +在 Sweet Home 3D 中有更多的特色。你可以添加一片天空和一片草坪,为你的照片定位光线,设置天花板高度,给你房子添加另一楼层等等。不管你是打算租一套公寓,还是买一套房子,或是(尚)不存在的房子,Sweet Home 3D 是一款简单迷人的应用程序,当你匆忙购买家具时,它可以帮助你快乐地做出更好的购买选择。因此,你终于可以停止在厨房的柜台上吃早餐以及蹲在地上工作了。 -------------------------------------------------------------------------------- @@ -118,7 +114,7 @@ via: https://opensource.com/article/19/10/interior-design-sweet-home-3d 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9cbad661076712210ebe606cdbb80d3dcf7a2839 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 12 Jan 2020 09:29:37 +0800 Subject: [PATCH 527/676] PUB @robsean https://linux.cn/article-11774-1.html --- ...20191016 Open source interior design with Sweet Home 3D.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191016 Open source interior design with Sweet Home 3D.md (99%) diff --git a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md b/published/20191016 Open source interior design with Sweet Home 3D.md similarity index 99% rename from translated/tech/20191016 Open source interior design with Sweet Home 3D.md rename to published/20191016 Open source interior design with Sweet Home 3D.md index bfabda6d1e..814f0bdb23 100644 --- a/translated/tech/20191016 Open source interior design with Sweet Home 3D.md +++ b/published/20191016 Open source interior design with Sweet Home 3D.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11774-1.html) [#]: subject: (Open source interior design with Sweet Home 3D) [#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 5a3a8442208994562e3494b29e5d5b5bc948624c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 13 Jan 2020 00:52:44 +0800 Subject: [PATCH 528/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200112=20What?= =?UTF-8?q?=20I=20learned=20going=20from=20prison=20to=20Python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200112 What I learned going from prison to Python.md --- ...t I learned going from prison to Python.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20200112 What I learned going from prison to Python.md diff --git a/sources/tech/20200112 What I learned going from prison to Python.md b/sources/tech/20200112 What I learned going from prison to Python.md new file mode 100644 index 0000000000..84dfa73ecb --- /dev/null +++ b/sources/tech/20200112 What I learned going from prison to Python.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What I learned going from prison to Python) +[#]: via: (https://opensource.com/article/20/1/prison-to-python) +[#]: author: (Shadeed "Sha" Wallace-Stepter https://opensource.com/users/shastepter) + +What I learned going from prison to Python +====== +How open source programming can offer opportunities after incarceration. +![Programming books on a shelf][1] + +Less than a year ago, I was in San Quentin State Prison serving a life sentence. + +In my junior year in high school, I shot a man while robbing him. Now, it took a while for me to see or even admit that what I did was wrong, but after going through a jury trial and seeing the devastating consequences of my actions, I knew that I needed to make a change, and I did. And although it was a great thing that I had changed, I had still shot a man and nearly killed him. And there are consequences to doing something like that, and rightfully so. So at the age of 18, I was sentenced to life in prison. + +Now prison is a terrible place; I do not recommend it. But I had to go and so I went. I’ll spare you the details, but you can rest assured it’s a place where there isn’t much incentive to change, and many people pick up more bad habits than they went in with. + +I’m one of the lucky ones. While I was in prison, something different happened. I started to imagine a future for myself beyond the prison bars where, up until that point, I had spent all of my adult life. + +Now YOU think about this: I’m black, with nothing more than a high school education. I had no work history, and if I ever were to leave prison, I would be a convicted felon upon my release. And I think I’m being fair when I say that the first thought for an employer who sees this profile is not "I need to hire this person." + +My options weren’t clear, but my mind was made up. I needed to do something to survive that wouldn’t look anything like my life before prison. + +### A path to Python + +Eventually, I wound up in San Quentin State Prison, and I had no idea how lucky I was to be there. San Quentin offered several self-help and education programs. These [rehabilitation opportunities][2] ensured prisoners had skills that helped them avoid being repeat offenders upon release. + +As part of one of these programs, I met [Jessica McKellar][3] in 2017 through her work with the San Quentin Media Program. Jessica is an enthusiast of the programming language [Python][4], and she started to sell me on how great Python is and how it’s the perfect language to learn for someone just starting out. And this is where the story becomes stranger than fiction. + +  + +> Thanks [@northbaypython][5] for letting [@ShaStepter][6] and me reprise our [@pycon][7] keynotes to get them recorded. I'm honored to share: +> +> From Prison to Python: +> +> Mass Decarceration: If We Don't Hire People With Felony Convictions, Who Will? [pic.twitter.com/Kpjo8d3ul6][8] +> +> — Jessica McKellar (@jessicamckellar) [November 5, 2019][9] + +  + +Jessica told me about these Python video tutorials that she did for a company called [O’Reilly Media][10], that they were online, and how great it would be if I could get access to them. Unfortunately, internet access in prison isn’t a thing. But, I had met this guy named Tim O’Reilly, who had recently come to San Quentin. It turns out that, after his visit, Tim had donated a ton of content from his company, O’Reilly Media, to the prison’s programming class. I wound up getting my hands on a tablet that had Jessica’s Python tutorials on it and learned how to code using those Python tutorials. + +It was incredible. Total strangers with a very different background and life from my own had connected the dots in a way that led to me learning to code. + +### The love of the Python community + +After this point, I started meeting with Jessica pretty frequently, and she began to tell me about the open source community. What I learned is that, on a fundamental level, open source is about fellowship and collaboration. It works so well because no one is excluded. + +And for me, someone who struggled to see where they fit, what I saw was a very basic form of love—love by way of collaboration and acceptance, love by way of access, love by way of inclusion. And my spirit yearned to be a part of it. So I continued my education with Python, and, unfortunately, I wasn’t able to get more tutorials, but I was able to draw from the vast wealth of written knowledge that has been compiled by the open source community. I read anything that even mentioned Python, from paperback books to obscure magazine articles, and I used the tablet that I had to solve the Python problems that I read about. + +My passion for Python and programming wasn’t something that many of my peers shared. Aside from the very small group of people who were in the prison’s programming class, no one else that I knew had ever mentioned programming; it’s just not on the average prisoner’s radar. I believe that this is due to the perception that programming isn’t accessible to people who have experienced incarceration, especially if you are a person of color. + +### Life with Python outside of prison + +Then, on August 17, 2018, I got the surprise of my life. Then-Governor Jerry Brown commuted my 27-years-to-life sentence, and I was released from prison after serving almost 19 years. + +But here’s the reality of my situation and why I believe that programming and the open source community are so valuable. I am a 37-year-old, black, convicted felon, with no work history, who just served 18 years in prison. There aren’t many professions that exist that would prevent me from being at the mercy of the stigmas and biases that inevitably accompany my criminal past. But one of the few exceptions is programming. + +The people who are now returning back to society after incarceration are in desperate need of inclusion, but when the conversation turns to diversity in the workplace and how much it’s needed, you really don’t hear this group being mentioned or included. + +  + +> What else: +> +> 1\. Background checks: ask how they are used at your company. +> +> 2\. Entry-level roles: remove fake, unnecessary prerequisites that will exclude qualified people with records. +> +> 3\. Active outreach: partner with local re-entry programs to create hiring pipelines. [pic.twitter.com/WnzdEUTuxr][11] +> +> — Jessica McKellar (@jessicamckellar) [May 12, 2019][12] + +  + +So with that, I want to humbly challenge all of the programmers and members of the open source community to expand your thinking around inclusion and diversity. I proudly stand before you today as the representative of a demographic that most people don’t think about—formerly incarcerated people. But we exist, and we are eager to prove our value, and, above all else, we are looking to be accepted. Many challenges await us upon our reentry back into society, and I ask that you allow us to have the opportunity to demonstrate our worth. Welcome us, accept us, and, more than anything else, include us. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/prison-to-python + +作者:[Shadeed "Sha" Wallace-Stepter][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shastepter +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_programming_languages.jpg?itok=KJcdnXM2 (Programming books on a shelf) +[2]: https://www.dailycal.org/2019/02/27/san-quentin-rehabilitation-programs-offer-inmates-education-a-voice/ +[3]: https://twitter.com/jessicamckellar?lang=en +[4]: https://www.python.org/ +[5]: https://twitter.com/northbaypython?ref_src=twsrc%5Etfw +[6]: https://twitter.com/ShaStepter?ref_src=twsrc%5Etfw +[7]: https://twitter.com/pycon?ref_src=twsrc%5Etfw +[8]: https://t.co/Kpjo8d3ul6 +[9]: https://twitter.com/jessicamckellar/status/1191601209917837312?ref_src=twsrc%5Etfw +[10]: http://shop.oreilly.com/product/110000448.do +[11]: https://t.co/WnzdEUTuxr +[12]: https://twitter.com/jessicamckellar/status/1127640222504636416?ref_src=twsrc%5Etfw From 47cae5389da7cf4d305b6ca36f25dfb8bb0bd097 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 13 Jan 2020 00:53:18 +0800 Subject: [PATCH 529/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200112=20Use=20?= =?UTF-8?q?Stow=20for=20configuration=20management=20of=20multiple=20machi?= =?UTF-8?q?nes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200112 Use Stow for configuration management of multiple machines.md --- ...uration management of multiple machines.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20200112 Use Stow for configuration management of multiple machines.md diff --git a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md new file mode 100644 index 0000000000..68a1eb0ebc --- /dev/null +++ b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Stow for configuration management of multiple machines) +[#]: via: (https://opensource.com/article/20/1/configuration-management-stow) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use Stow for configuration management of multiple machines +====== +Learn how to use Stow to manage configurations across machines in the +second article in our series on 20 ways to be more productive with open +source in 2020. +![A person programming][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Manage symlinks with Stow + +Yesterday, I explained how I keep my files in sync across multiple machines with [Syncthing][2]. But that's only one of the tools I use to keep my configurations consistent. The other is a seemingly simple tool called [Stow][3]. + +![Stow help screen][4] + +Stow manages symlinks. By default, it makes symlinks from the directory it is in to the directory below it. There are also options to set a source and target directory, but I don't usually use them. + +As I mentioned in the Syncthing [article][5], I use Syncthing to keep a directory called **myconfigs** consistent across all of my machines. The **myconfigs** directory has several subdirectories underneath it. Each subdirectory contains the configuration files for one of the applications I use regularly. + +![myconfigs directory][6] + +On each machine, I change to the **myconfigs** directory and run **stow -S <directory name>** to symlink the files inside the directory to my home directory. For example, under the **vim** directory, I have my **.vimrc** and **.vim** directories. On each machine, I run **stow -S vim** to create the symlinks **~/.vimrc** and **~/.vim**. When I make a change to my Vim configuration on one machine, it applies to ALL of my machines. + +Sometimes, though, I need something machine-specific, which is why I have directories like **msmtp-personal** and **msmtp-elastic** (my employer). Since my **msmtp** SMTP client needs to know what email server to relay through, and each one has different setups and credentials, I can use Stow to swap between the two by "unstowing" one with the **-D** flag and then putting the other in place. + +![Unstow one, stow the other][7] + +Sometimes I find myself adding files to a configuration. For that, there is the "restow" option with **-R**. For example, I like to use a specific font when I use Vim as a graphical application and not a console. The **.gvimrc** file lets me set options that apply only to the graphical version, in addition to the standard **.vimrc** file. When I first set this up, I moved **~/.gvimrc** to **~/myconfigs/vim** and then ran **stow -R vim**, which unlinks and relinks everything in that directory. + +Stow lets me switch between several configurations with a simple command line and, in combination with Syncthing, I can be sure that I have the setup I like for the tools I use ready to go, no matter where I am or where I make changes. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/configuration-management-stow + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://syncthing.net/ +[3]: https://www.gnu.org/software/stow/ +[4]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png (Stow help screen) +[5]: https://opensource.com/article/20/1/20-productivity-tools-syncthing +[6]: https://opensource.com/sites/default/files/uploads/productivity_2-2.png (myconfigs directory) +[7]: https://opensource.com/sites/default/files/uploads/productivity_2-3.png (Unstow one, stow the other) From 773790f4d732b098da0a4de7b1de6cc4dd2a2d18 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 13 Jan 2020 09:00:41 +0800 Subject: [PATCH 530/676] translating --- ...ic sequences with the Linux seq command.md | 165 ------------------ ...ic sequences with the Linux seq command.md | 153 ++++++++++++++++ 2 files changed, 153 insertions(+), 165 deletions(-) delete mode 100644 sources/tech/20200107 Generating numeric sequences with the Linux seq command.md create mode 100644 translated/tech/20200107 Generating numeric sequences with the Linux seq command.md diff --git a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md b/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md deleted file mode 100644 index 7ae48a2785..0000000000 --- a/sources/tech/20200107 Generating numeric sequences with the Linux seq command.md +++ /dev/null @@ -1,165 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Generating numeric sequences with the Linux seq command) -[#]: via: (https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Generating numeric sequences with the Linux seq command -====== -The Linux seq command can generate lists of numbers and at lightning speed. It's easy to use and flexible, too. -[Jamie][1] [(CC BY 2.0)][2] - -One of the easiest ways to generate a list of numbers in Linux is to use the **seq** (sequence) command. In its simplest form, **seq** will take a single number and then list all the numbers from 1 to that number. For example: - -``` -$ seq 5 -1 -2 -3 -4 -5 -``` - -Unless directed otherwise, **seq** always starts with 1. You can start a sequence with a different number by inserting it before the final number. - -``` -$ seq 3 5 -3 -4 -5 -``` - -### Specifying an increment - -You can also specify an increment. Say you want to list multiples of 3. Specify your starting point (first 3 in this example), increment (second 3) and end point (18). - -[][3] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][3] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -``` -$ seq 3 3 18 -3 -6 -9 -12 -15 -18 -``` - -You can elect to go from larger to smaller numbers by using a negative increment (i.e., a decrement). - -``` -$ seq 18 -3 3 -18 -15 -12 -9 -6 -3 -``` - -The **seq** command is also very fast. You can probably generate a list of a million numbers in under 10 seconds. - -Advertisement - -``` -$ time seq 1000000 -1 -2 -3 -… -… -999998 -999999 -1000000 - -real 0m9.290s <== 9+ seconds -user 0m0.020s -sys 0m0.899s -``` - -## Using a separator - -Another very useful option is to use a separator. Instead of listing a single number on each line, you can insert commas, colons or some other characters. The -s option followed by the character you wish to use. - -``` -$ seq -s: 3 3 18 -3:6:9:12:15:18 -``` - -In fact, if you simply want your numbers to be listed on a single line, you can use a blank as your separator in place of the default linefeed. - -**[ Also see [Invaluable tips and tricks for troubleshooting Linux][4]. ]** - -``` -$ seq -s' ' 3 3 18 -3 6 9 12 15 18 -``` - -### Getting to the math - -It may seem like a big leap to go from generating a sequence of numbers to doing math, but given the right separators, **seq** can easily prepare calculations that you can pass to **bc**. For example: - -``` -$ seq -s* 5 | bc -120 -``` - -What is going on in this command? Let’s take a look. First, **seq** is generating a list of numbers and using * as the separator. - -``` -$ seq -s* 5 -1*2*3*4*5 -``` - -It’s then passing the string to the calculator (**bc**) which promptly multiplies the numbers. And you can do a fairly extensive calculation in a fraction of a second. - -``` -$ time seq -s* 117 | bc -39699371608087208954019596294986306477904063601683223011297484643104\ -22041758630649341780708631240196854767624444057168110272995649603642\ -560353748940315749184568295424000000000000000000000000000 - -real 0m0.003s -user 0m0.004s -sys 0m0.000s -``` - -### Limitations - -You only get to choose one separator, so your calculations will be very limited. Use **bc** by itself for more complicated math. In addition, **seq** only works with numbers. To generate a sequence of single letters, use a command like this instead: - -``` -$ echo {a..g} -a b c d e f g -``` - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://creativecommons.org/licenses/by/2.0/ -[2]: https://creativecommons.org/licenses/by/2.0/legalcode -[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[4]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md b/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md new file mode 100644 index 0000000000..0b12dfb508 --- /dev/null +++ b/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Generating numeric sequences with the Linux seq command) +[#]: via: (https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 Linux seq 命令生成数字序列 +====== +Linux seq 命令可以以闪电般的速度生成数字列表。它易于使用而且灵活。 +[Jamie][1] [(CC BY 2.0)][2] + +在 Linux 中生成数字列表的最简单方法之一是使用 **seq**(sequence)命令。最简单的形式是,**seq** 接收一个数字,并输出从 1 到该数字的列表。例如: + +``` +$ seq 5 +1 +2 +3 +4 +5 +``` + +除非另有指定,否则 **seq** 始终以 1 开头。你可以在最终数字前面插上不同数字开始。 + +``` +$ seq 3 5 +3 +4 +5 +``` + +### 指定增量 + +你还可以指定增量。假设你要列出 3 的倍数。指定起点(在此示例中为第一个 3 ),增量(第二个 3)和终点(18)。 + +``` +$ seq 3 3 18 +3 +6 +9 +12 +15 +18 +``` + +你可以选择使用负增量(即减量)将数字从大变小。 + +``` +$ seq 18 -3 3 +18 +15 +12 +9 +6 +3 +``` + +**seq** 命令也非常快。你或许可以在 10 秒内生成一百万个数字的列表。 + +Advertisement + +``` +$ time seq 1000000 +1 +2 +3 +… +… +999998 +999999 +1000000 + +real 0m9.290s <== 9+ seconds +user 0m0.020s +sys 0m0.899s +``` + +## 使用分隔符 + +另一个非常有用的选项是使用分隔符。你可以插入逗号,冒号或其他一些字符,而不是在每行上列出单个数字。-s 选项后跟要使用的字符。 + +``` +$ seq -s: 3 3 18 +3:6:9:12:15:18 +``` + +实际上,如果只是希望将数字列在一行上,那么可以使用空格代替默认的换行符。 + +``` +$ seq -s' ' 3 3 18 +3 6 9 12 15 18 +``` + +### 开始数学运算 + +从生成数字序列到进行数学运算似乎是一个巨大的飞跃,但是有了正确的分隔符,**seq** 可以轻松地传递给 **bc** 进行计算。例如: + +``` +$ seq -s* 5 | bc +120 +``` + +该命令中发生了什么?让我们来看看。首先,**seq** 生成一个数字列表,并使用 \* 作为分隔符。 + +``` +$ seq -s* 5 +1*2*3*4*5 +``` + +然后,它将字符串传递给计算器 (**bc**),计算器立即将数字相乘。你可以在不到一秒的时间内进行相当广泛的计算。 + +``` +$ time seq -s* 117 | bc +39699371608087208954019596294986306477904063601683223011297484643104\ +22041758630649341780708631240196854767624444057168110272995649603642\ +560353748940315749184568295424000000000000000000000000000 + +real 0m0.003s +user 0m0.004s +sys 0m0.000s +``` + +### 局限性 + +你只能选择一个分隔符,因此计算将非常有限。单独使用 **bc** 可进行更复杂的数学运算。此外,**seq** 仅适用于数字。要生成单个字母序列,请改用如下命令: + +``` +$ echo {a..g} +a b c d e f g +``` + +加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://creativecommons.org/licenses/by/2.0/ +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 0bd08ea3ea61f05e9c26a8a5d88480ebb7dae16a Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 13 Jan 2020 09:05:58 +0800 Subject: [PATCH 531/676] translating --- ...0200111 Sync files across multiple devices with Syncthing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md index 75c6161189..d662fc1a78 100644 --- a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md +++ b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 753e745388fb59dcf9ef49365286c9f9987b132a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 09:06:51 +0800 Subject: [PATCH 532/676] PRF @geekpi --- ...VLC More Awesome With These Simple Tips.md | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md index 7363cb7992..350fa16604 100644 --- a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md +++ b/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Make VLC More Awesome With These Simple Tips) @@ -10,20 +10,19 @@ 这些简单的技巧使 VLC 更加出色 ====== -如果 [VLC][1] 不是最好的播放器,那它是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。 +如果 [VLC][1] 不是最好的播放器,那它也是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。 你可以进行许多复杂的任务,如直播视频、捕捉设备等。只需打开菜单,你就可以看到它有多少选项。 -它的 FOSS 页面有一个详细的教程,讨论一些[专业的 VLC 技巧][3],但这些对于普通用户太复杂。 +我们有一个详细的教程,讨论一些[专业的 VLC 技巧][3],但这些对于普通用户太复杂。 -这就是为什么我写另一篇文章的原因,来向你展示一些可以在 VLC 中使用的简单技巧。 +这就是为什么我要写另一篇文章的原因,来向你展示一些可以在 VLC 中使用的简单技巧。 ### 使用这些简单技巧让 VLC 做更多事 -Let’s see what can you do with VLC other than just playing a video file. 让我们看看除了播放视频文件之外,你还可以使用 VLC 做什么。 -#### 1\. 使用 VLC 观看 YouTube 视频 +#### 1、使用 VLC 观看 YouTube 视频 ![][4] @@ -31,65 +30,60 @@ Let’s see what can you do with VLC other than just playing a video file. 是的,在 VLC 上流式传输 YouTube 视频是非常容易的。 -只需启动 VLC 播放器,前往媒体设置,然后单击 ”**Open Network Stream**“ 或使用快捷方式 **CTRL + N**。 +只需启动 VLC 播放器,前往媒体设置,然后单击 ”Open Network Stream“ 或使用快捷方式 `CTRL + N`。 ![][6] -接下来,你只需要粘贴要观看的视频的 URL。有一些选项可以调整,但通常你无需担心这些。如果你好奇,你可以点击 ”**Advanced options**“ 来探索。 +接下来,你只需要粘贴要观看的视频的 URL。有一些选项可以调整,但通常你无需担心这些。如果你好奇,你可以点击 ”Advanced options“ 来探索。 你还可以通过这种方式向 YouTube 视频添加字幕。然而,[一个更简单的带字幕观看 Youtube 视频的办法是使用 Penguin 字幕播放器][7]。 -#### 2\. 将视频转换为不同格式 +#### 2、将视频转换为不同格式 ![][8] 你可以[在 Linux 命令行使用 ffmpeg 转换视频][9]。你还可以使用图形工具,如 [HandBrake 转换视频格式][10]。 -但是,如果你不想用一个单独的应用转码视频,你可以使用 VLC 播放器来完成该工作。 +但是,如果你不想用一个单独的应用来转码视频,你可以使用 VLC 播放器来完成该工作。 -为此,只需点击 VLC 上的媒体选项,然后单击 **Convert/Save**,或者在 VLC 播放器处于活动状态时按下快捷键 CTRL + R。 +为此,只需点击 VLC 上的媒体选项,然后单击 “Convert/Save”,或者在 VLC 播放器处于活动状态时按下快捷键 `CTRL + R`。接下来,你需要从计算机/硬盘或者 URL 导入你想保存/转换的的视频。 -接下来,你需要从计算机/硬盘或者 URL 导入你想保存/转换的的视频。 - -不管什么来源,只需选择文件后点击 ”**Convert/Save**“ 按钮 - -你现在会看到另外一个窗口给你更改 ”**Profile**“ 设置。点击并选择你想转换的格式(并保存)。 +不管是什么来源,只需选择文件后点击 “Convert/Save” 按钮。你现在会看到另外一个窗口可以更改 “Profile” 设置。点击并选择你想转换的格式(并保存)。 你还可以在转换之前通过在屏幕底部设置目标文件夹来更改转换文件的存储路径。 -#### 3\. 从源录制音频/视频 +#### 3、从源录制音频/视频 ![Vlc Advanced Controls][11] 你是否想在 VLC 播放器中录制正在播放的音频/视频? -如果是的话,有一个简单的解决方案。只需**通过 View,然后点击 ”Advanced Controls“**。 +如果是的话,有一个简单的解决方案。只需通过 “View”,然后点击 “Advanced Controls”。 完成后,你会看到一个新按钮(包括 VLC 播放器中的红色录制按钮)。 -#### 4\. 自动下载字幕 +#### 4、自动下载字幕 ![][12] -是的,你可以[使用 VLC 自动下载字幕][13]。你甚至不必在单独的网站上查找字幕。你只需点击 **View->VLSub**。 +是的,你可以[使用 VLC 自动下载字幕][13]。你甚至不必在单独的网站上查找字幕。你只需点击 +“View”->“VLSub”。 默认情况下,它是禁用的,因此当你单击该选项时,它会被激活,并允许你搜索/下载想要的字幕。 [VLC 还能让你使用简单的键盘快捷键同步字幕][14] -#### 5\. 截图 +#### 5、截图 ![][15] -你可以在观看视频时使用 VLC 获取一些视频的截图/图像。 - -你只需在视频播放/暂停时右击播放器,你会看到一组选项,点击 **Video->Take Snapshot**。 +你可以在观看视频时使用 VLC 获取一些视频的截图/图像。你只需在视频播放/暂停时右击播放器,你会看到一组选项,点击 “Video”->“Take Snapshot”。 如果安装了旧版本,你可能在右键时看到截图选项。 #### 额外技巧:给视频添加音频/视频效果 -在菜单中,进入 ”**Tools**“ 选项。单击 ”**Effects and Filters**“,或者在 VLC 播放器窗口中按 **CTRL + E** 打开选项。 +在菜单中,进入 “Tools” 选项。单击 “Effects and Filters”,或者在 VLC 播放器窗口中按 `CTRL + E` 打开选项。 好了,你可以观察你给视频添加的音频和视频效果了。你也许无法实时看到效果,因此你需要调整并保存来看发生了什么。 @@ -108,7 +102,7 @@ via: https://itsfoss.com/simple-vlc-tips/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ad881c80d06f0bf4e17d7e676e08359696bede69 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 09:08:08 +0800 Subject: [PATCH 533/676] PUB @geekpi https://linux.cn/article-11776-1.html --- ...20191214 Make VLC More Awesome With These Simple Tips.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191214 Make VLC More Awesome With These Simple Tips.md (97%) diff --git a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md b/published/20191214 Make VLC More Awesome With These Simple Tips.md similarity index 97% rename from translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md rename to published/20191214 Make VLC More Awesome With These Simple Tips.md index 350fa16604..3bb170df03 100644 --- a/translated/tech/20191214 Make VLC More Awesome With These Simple Tips.md +++ b/published/20191214 Make VLC More Awesome With These Simple Tips.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11776-1.html) [#]: subject: (Make VLC More Awesome With These Simple Tips) [#]: via: (https://itsfoss.com/simple-vlc-tips/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) @@ -10,6 +10,8 @@ 这些简单的技巧使 VLC 更加出色 ====== +![](https://img.linux.net.cn/data/attachment/album/202001/13/090635eu9va9999rr4ue92.jpeg) + 如果 [VLC][1] 不是最好的播放器,那它也是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。 你可以进行许多复杂的任务,如直播视频、捕捉设备等。只需打开菜单,你就可以看到它有多少选项。 From 622d09bde11060169652ebba0b1ae948989a7ab1 Mon Sep 17 00:00:00 2001 From: qianmingtian <40565099+qianmingtian@users.noreply.github.com> Date: Mon, 13 Jan 2020 13:10:30 +0800 Subject: [PATCH 534/676] Translating by qianmingtian --- ...d eMail With a List of User Accounts Expiring in -X- Days.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index 1b3330a6e8..efc52e33f9 100644 --- a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qianmingtian) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c36faf34d18c4363c7011a8bb6e9bcb7cbe86c24 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 15:13:06 +0800 Subject: [PATCH 535/676] PRF @lxbwolf --- ... Lessons learned from programming in Go.md | 116 +++++++++--------- 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/translated/tech/20191210 Lessons learned from programming in Go.md b/translated/tech/20191210 Lessons learned from programming in Go.md index 0c17e142a8..aeef69681e 100644 --- a/translated/tech/20191210 Lessons learned from programming in Go.md +++ b/translated/tech/20191210 Lessons learned from programming in Go.md @@ -1,63 +1,65 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Lessons learned from programming in Go) [#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) [#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) -Go 编程中的经验教训 +Go 并发编程中的经验教训 ====== -通过学习如何定位并发处理的陷阱来避免未来处理这些问题时的困境。 -![Goland gopher illustration][1] -在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。[Mode.net][2] 公司系统每天要处理实时、快速和灵活的以毫秒为单位动态路由数据包的全球专用网络和数据,需要高度并发的系统。这个动态路由是基于网络状态的,而这个过程需要考虑众多因素,我们只考虑关系链的监控。在我们的环境中,调用关系链监控可以是任何跟网络调用关系链有关的状态和当前属性(如链接延迟)。 +> 通过学习如何定位并发处理的陷阱来避免未来处理这些问题时的困境。 + +![](https://img.linux.net.cn/data/attachment/album/202001/13/150539n217ak1vcf717uzx.jpg) + +在复杂的分布式系统进行任务处理时,你通常会需要进行并发的操作。在 [Mode.net][2] 公司,我们每天都要和实时、快速和灵活的软件打交道。而没有一个高度并发的系统,就不可能构建一个毫秒级的动态地路由数据包的全球专用网络。这个动态路由是基于网络状态的,尽管这个过程需要考虑众多因素,但我们的重点是链路指标。在我们的环境中,链路指标可以是任何跟网络链接的状态和当前属性(如链接延迟)有关的任何内容。 ### 并发探测链接监控 -[H.A.L.O.][4] (Hop-by-Hop Adaptive Link-State Optimal Routing,译注:逐跳自适应链路状态最佳路由),我们的动态路由算法部分依赖于链路度量来计算路由表。 这些指标由位于每个PoP(译注:存活节点)上的独立组件收集。PoP是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有不止一个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探针。 +我们的动态路由算法 [H.A.L.O.][4](逐跳自适应链路状态最佳路由Hop-by-Hop Adaptive Link-State Optimal Routing)部分依赖于链路指标来计算路由表。这些指标由位于每个 PoP(存活节点Point of Presence)上的独立组件收集。PoP 是表示我们的网络中单个路由实体的机器,通过链路连接并分布在我们的网络拓扑中的各个位置。某个组件使用网络数据包探测周围的机器,周围的机器回复数据包给前者。从接收到的探测包中可以获得链路延迟。由于每个 PoP 都有不止一个临近节点,所以这种探测任务实质上是并发的:我们需要实时测量每个临近连接点的延迟。我们不能串行地处理;为了计算这个指标,必须尽快处理每个探测。 ![latency computation graph][6] -### 序列号和重置:一个记录场景 +### 序列号和重置:一个重新排列场景 -我们的探测组件互相发送和接收数据包并依靠序列号进行数据包处理。旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号 0 来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们只考虑了始终从 0 开始递增的序列号。组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,直到排到重置之前用到的值之前,它后面的包都会被忽略掉。 +我们的探测组件互相发送和接收数据包,并依靠序列号进行数据包处理。这旨在避免处理重复的包或顺序被打乱的包。我们的第一个实现依靠特殊的序列号 0 来重置序列号。这个数字仅在组件初始化时使用。主要的问题是我们考虑了递增的序列号总是从 0 开始。在该组件重启后,包的顺序可能会重新排列,某个包的序列号可能会轻易地被替换成重置之前使用过的值。这意味着,后继的包都会被忽略掉,直到排到重置之前用到的序列值。 ### UDP 握手和有限状态机 -这里的问题是重启前后的序列号是否一致。有几种方法可以解决这个问题,经过讨论,我们选择了实现一个带有清晰状态定义的三向交握协议。这个握手过程在初始化时通过链接建立 session。这样可以确保节点通过同一个 session 进行通信且使用了适当的序列号。 +这里的问题是该组件重启前后的序列号是否一致。有几种方法可以解决这个问题,经过讨论,我们选择了实现一个带有清晰状态定义的三步握手协议。这个握手过程在初始化时通过链接建立会话。这样可以确保节点通过同一个会话进行通信且使用了适当的序列号。 为了正确实现这个过程,我们必须定义一个有清晰状态和过渡的有限状态机。这样我们就可以正确管理握手过程中的所有极端情况。 ![finite state machine diagram][7] -session ID 由握手的初始化程序生成。一个完整的交换顺序如下: +会话 ID 由握手的初始化程序生成。一个完整的交换顺序如下: - 1. sender 发送一个 **SYN (ID)** 数据包。 - 2. receiver 存储接收到的 **ID** 并发送一个 **SYN-ACK (ID)**. - 3. sender 接收到 **SYN-ACK (ID)** _并发送一个 **ACK (ID)**_。它还发送一个从序列号 0 开始的数据包。 - 4. receiver 检查最后接收到的 **ID**,如果 ID 匹配,_则接受 **ACK (ID)**_。它还开始接受序列号为 0 的数据包。 +1. 发送者发送一个 `SYN(ID)` 数据包。 +2. 接收者存储接收到的 `ID` 并发送一个 `SYN-ACK(ID)`。 +3. 发送者接收到 `SYN-ACK(ID)` 并发送一个 `ACK(ID)`。它还发送一个从序列号 0 开始的数据包。 +4. 接收者检查最后接收到的 `ID`,如果 ID 匹配,则接受 `ACK(ID)`。它还开始接受序列号为 0 的数据包。 ### 处理状态超时 基本上,每种状态下你都需要处理最多三种类型的事件:链接事件、数据包事件和超时事件。这些事件会并发地出现,因此你必须正确处理并发。 - * 链接事件包括连接和断开,连接时会初始化一个链接 session,断开时会断开一个已建立的 seesion。 - * 数据包事件是控制数据包 **(SYN/SYN-ACK/ACK)** 或只是探测响应。 - * 超时事件在当前 session 状态的预定超时时间到期后触发。 +* 链接事件包括网络连接或网络断开的变化,相应的初始化一个链接会话或断开一个已建立的会话。 +* 数据包事件是控制数据包(`SYN`/`SYN-ACK`/`ACK`)或只是探测响应。 +* 超时事件在当前会话状态的预定超时时间到期后触发。 -这里面临的最主要的问题是如何处理并发超时到期和其他事件。这里很容易陷入死锁和资源竞争的陷阱。 +这里面临的最主要的问题是如何处理并发的超时到期和其他事件。这里很容易陷入死锁和资源竞争的陷阱。 ### 第一种方法 -本项目使用的语言是 [Golang][8]. 它确实提供了原生的同步机制,如自带的 channel 和锁,并且能够使用轻量级线程来进行并发处理。 +本项目使用的语言是 [Golang][8]。它确实提供了原生的同步机制,如自带的通道和锁,并且能够使用轻量级线程来进行并发处理。 ![gophers hacking together][9] -gopher 们聚众狂欢 +*gopher 们聚众狂欢* -首先,你可以设计两个分别表示我们的 **Session** 和 **Timeout Handlers** 的结构体。 +首先,你可以设计两个分别表示我们的会话和超时处理程序的结构体。 ```go type Session struct {   @@ -74,14 +76,14 @@ type TimeoutHandler struct {   } ``` -**Session** 标识连接 session,内有表示 session ID、临近的连接点的 IP 和当前 session 状态的字段。 +`Session` 标识连接会话,内有表示会话 ID、临近的连接点的 IP 和当前会话状态的字段。 -**TimeoutHandler** 包含回调函数、对应的 session、持续时间和指向调度计时器的 timer 指针。 +`TimeoutHandler` 包含回调函数、对应的会话、持续时间和指向调度计时器的指针。 -每一个临近连接点的 session 都包含一个保存调度 `TimeoutHandler` 的全局 map。 +每一个临近连接点的会话都包含一个保存调度 `TimeoutHandler` 的全局映射。 ``` -`SessionTimeout map[Session]*TimeoutHandler` +SessionTimeout map[Session]*TimeoutHandler ``` 下面方法注册和取消超时: @@ -118,7 +120,7 @@ func CreateTimeoutHandler(callback func(Session), session Session, duration int) } ``` -超时 handler 创建后,会在经过了设置的 _duration_ 时间(秒)后执行回调函数。然而,有些事件会使你重新调度一个超时 handler(与 **SYN** 状态时的处理一样 — 每 3 秒一次)。 +超时处理程序创建后,会在经过了设置的 `duration` 时间(秒)后执行回调函数。然而,有些事件会使你重新调度一个超时处理程序(与 `SYN` 状态时的处理一样,每 3 秒一次)。 为此,你可以让回调函数重新调度一次超时: @@ -134,25 +136,25 @@ func synCallback(session Session) {   } ``` -这次回调在新的超时 handler 中重新调度自己,并更新全局 map **sessionTimeout**。 +这次回调在新的超时处理程序中重新调度自己,并更新全局映射 `sessionTimeout`。 ### 数据竞争和引用 -你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,在 *duration* 时间内 sleep,然后检查是否执行了回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 +你的解决方案已经有了。可以通过检查计时器到期后超时回调是否执行来进行一个简单的测试。为此,注册一个超时,休眠 `duration` 秒,然后检查是否执行了回调的处理。执行这个测试后,最好取消预定的超时时间(因为它会重新调度),这样才不会在下次测试时产生副作用。 -令人惊讶的是,这个简单的测试发现了这个解决方案中的一个 bug。使用 cancel 方法来取消超时并没有正确处理。以下顺序的事件会导致数据资源竞争: +令人惊讶的是,这个简单的测试发现了这个解决方案中的一个问题。使用 `cancel` 方法来取消超时并没有正确处理。以下顺序的事件会导致数据资源竞争: - 1. 你有一个已调度的超时 handler。 - 2. 线程 1: -a)你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个 session 状态(如 发送 **SYN** 后接收到一个 **SYN-ACK**) -b)你调用了 **timeout.Cancel()**,这个函数调用了 **timer.Stop()**。(请注意,Golang 计时器的 stop 不会终止一个已过期的计时器。) - 3. 线程 2: -a)在调用 cancel 之前,计时器已过期,回调即将执行。 -b)执行回调,它调度一次新的超时并更新全局 map。 - 4. 线程 1: -a)切换到新的 session 状态并注册新的超时,更新全局 map。 +1. 你有一个已调度的超时处理程序。 +2. 线程 1: + 1. 你接收到一个控制数据包,现在你要取消已注册的超时并切换到下一个会话状态(如发送 `SYN` 后接收到一个 `SYN-ACK`) + 2. 你调用了 `timeout.Cancel()`,这个函数调用了 `timer.Stop()`。(请注意,Golang 计时器的停止不会终止一个已过期的计时器。) +3. 线程 2: + 1. 在取消调用之前,计时器已过期,回调即将执行。 + 2. 执行回调,它调度一次新的超时并更新全局映射。 +4. 线程 1: + 1. 切换到新的会话状态并注册新的超时,更新全局映射。 -两个线程同时更新超时 map。最终结果是你无法取消注册的超时,然后你也会丢失对线程 2 重新调度的超时的引用。这导致 handler 在一段时间内持续执行和重新调度,出现非预期行为。 +两个线程并发地更新超时映射。最终结果是你无法取消注册的超时,然后你也会丢失对线程 2 重新调度的超时的引用。这导致处理程序在一段时间内持续执行和重新调度,出现非预期行为。 ### 锁也解决不了问题 @@ -169,15 +171,15 @@ func (timeout* TimeoutHandler) Register() {   } ``` -现在的区别就是全局 map 的更新是同步的,但是这还是不能阻止在你调用 **timeout.Cancel() ** 后回调的执行 — 这种情况出现在调度计时器过期了但是还没有拿到锁的时候。你还是会丢失一个已注册的超时的引用。 +现在的区别就是全局映射的更新是同步的,但是这还是不能阻止在你调用 `timeout.Cancel()` 后回调的执行 —— 这种情况出现在调度计时器过期了但是还没有拿到锁的时候。你还是会丢失一个已注册的超时的引用。 -### 使用取消 channel +### 使用取消通道 -你可以使用取消 channel,而不必依赖不能阻止到期的计时器执行的 golang 函数 **timer.Stop()**。 +你可以使用取消通道,而不必依赖不能阻止到期的计时器执行的 golang 函数 `timer.Stop()`。 这是一个略有不同的方法。现在你可以不用再通过回调进行递归地重新调度;而是注册一个死循环,这个循环接收到取消信号或超时事件时终止。 -新的 **Register()** 产生一个新的 go 协程,这个协程在在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用方一个取消 channel,用来控制循环的终止。 +新的 `Register()` 产生一个新的 go 线程,这个线程在超时后执行你的回调,并在前一个超时执行后调度新的超时。返回给调用方一个取消通道,用来控制循环的终止。 ```go func (timeout *TimeoutHandler) Register() chan struct{} {   @@ -208,9 +210,9 @@ func (timeout* TimeoutHandler) Cancel() {   } ``` -这个方法提供了你注册的所有超时的取消 channel。对 cancel 的一次调用向 channel 发送一个空结构体并触发取消操作。然而,这并不能解决前面的问题;可能在你通过 channel 调用 cancel 超时线程还没有拿到锁之前,超时时间就已经到了。 +这个方法给你注册的所有超时提供了取消通道。一个取消调用向通道发送一个空结构体并触发取消操作。然而,这并不能解决前面的问题;可能在你通过通道取消之前以及超时线程拿到锁之前,超时时间就已经到了。 -这里的解决方案是,在拿到锁之后,检查一下超时范围内的取消 channel。 +这里的解决方案是,在拿到锁**之后**,检查一下超时范围内的取消通道。 ```go   case _ = <- time.AfterFunc(time.Duration(timeout.duration) * time.Second):   @@ -236,15 +238,15 @@ func (timeout* TimeoutHandler) Cancel() {   请阅读上面的代码,试着自己找到它。考虑下描述的所有函数的并发调用。 -这里的问题在取消 channel 本身。我们创建的是无缓冲 channel,即发送是阻塞调用。当你在一个超时 handler 中调用取消函数时,只有在该 handler 被取消后才能继续处理。问题出现在,当你有多个调用请求到同一个取消 channel 时,这时一个取消请求只被处理一次。当多个事件同时取消同一个超时 handler 时,如链接断开或控制包事件,很容易出现这种情况。这会导致死锁,可能会使应用程序 halt。 +这里的问题在取消通道本身。我们创建的是无缓冲通道,即发送的是阻塞调用。当你在一个超时处理程序中调用取消函数时,只有在该处理程序被取消后才能继续处理。问题出现在,当你有多个调用请求到同一个取消通道时,这时一个取消请求只被处理一次。当多个事件同时取消同一个超时处理程序时,如连接断开或控制包事件,很容易出现这种情况。这会导致死锁,可能会使应用程序停机。 ![gophers on a wire, talking][11] -有人在听吗? +*有人在听吗?* -已获得 Trevor Forrey 授权。 +(已获得 Trevor Forrey 授权。) -这里的解决方案是创建 channel 时指定大小至少为 1,这样向 channel 发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会阻塞后续的取消调用。 +这里的解决方案是创建通道时指定缓存大小至少为 1,这样向通道发送数据就不会阻塞,也显式地使发送变成非阻塞的,避免了并发调用。这样可以确保取消操作只发送一次,并且不会阻塞后续的取消调用。 ```go func (timeout* TimeoutHandler) Cancel() {   @@ -266,27 +268,27 @@ func (timeout* TimeoutHandler) Cancel() {   #### 在非同步的情况下更新共享数据 -这似乎是个很明显的问题,但如果并发更新发生在不同的位置,就很难发现。结果就是数据竞争,由于一个更新会覆盖另一个,因此对同一数据的多次更新中会有某些更新丢失。在我们的案例中,我们是在同时更新同一个共享 map 里的调度超时引用。有趣的是,(如果 Go 检测到在同一个 map 对象上的并发读写,会抛出 fatal 错误 — 你可以尝试下运行 Go 的[数据竞争检测器](https://golang.org/doc/articles/race_detector.html))。这最终会导致丢失超时引用,且无法取消给定的超时。当有必要时,永远不要忘记使用锁。 +这似乎是个很明显的问题,但如果并发更新发生在不同的位置,就很难发现。结果就是数据竞争,由于一个更新会覆盖另一个,因此对同一数据的多次更新中会有某些更新丢失。在我们的案例中,我们是在同时更新同一个共享映射里的调度超时引用。(有趣的是,如果 Go 检测到在同一个映射对象上的并发读写,会抛出致命错误 — 你可以尝试下运行 Go 的[数据竞争检测器](https://golang.org/doc/articles/race_detector.html))。这最终会导致丢失超时引用,且无法取消给定的超时。当有必要时,永远不要忘记使用锁。 ![gopher assembly line][13] -不要忘记同步 gopher 们的工作 +*不要忘记同步 gopher 们的工作* #### 缺少条件检查 -在不能仅依赖锁的独占性的情况下,就需要进行条件检查。我们遇到的场景稍微有点不一样,但是核心思想跟[条件变量][14]是一样的。假设有个经典的一个生产者和多个消费者使用一个共享队列的场景,生产者可以将一个元素添加到队列并唤醒所有消费者。这个唤醒调用意味着队列中的数据是可访问的,并且由于队列是共享的,消费者必须通过锁来进行同步访问。每个消费者都可能拿到锁;然而,你仍然需要检查队列中是否有元素。因为在你拿到锁的瞬间并不知道队列的状态,所以还是需要进行条件检查。 +在不能仅依赖锁的独占性的情况下,就需要进行条件检查。我们遇到的场景稍微有点不一样,但是核心思想跟[条件变量][14]是一样的。假设有个一个生产者和多个消费者使用一个共享队列的经典场景,生产者可以将一个元素添加到队列并唤醒所有消费者。这个唤醒调用意味着队列中的数据是可访问的,并且由于队列是共享的,消费者必须通过锁来进行同步访问。每个消费者都可能拿到锁;然而,你仍然需要检查队列中是否有元素。因为在你拿到锁的瞬间并不知道队列的状态,所以还是需要进行条件检查。 -在我们的例子中,超时 handler 收到了计时器到期时发出的「唤醒」调用,但是它仍需要检查是否已向其发送了取消信号,然后才能继续执行回调。 +在我们的例子中,超时处理程序收到了计时器到期时发出的“唤醒”调用,但是它仍需要检查是否已向其发送了取消信号,然后才能继续执行回调。 ![gopher boot camp][15] -如果你要唤醒多个 gopher,可能就需要进行条件检查 +*如果你要唤醒多个 gopher,可能就需要进行条件检查* #### 死锁 -当一个线程被卡住,无限期地等待一个唤醒信号,但是这个信号永远不会到达时,就会发生这种情况。死锁可以通过让你的整个程序 halt 来彻底杀死你的应用。 +当一个线程被卡住,无限期地等待一个唤醒信号,但是这个信号永远不会到达时,就会发生这种情况。死锁可以通过让你的整个程序停机来彻底杀死你的应用。 -在我们的案例中,这种情况的发生是由于多次发送请求到一个非缓冲且阻塞的 channel。这意味着向 channel 发送数据只有在从这个 channel 接收完数据后才能 return。我们的超时线程循环迅速从取消 channel 接收信号;然而,在接收到第一个信号后,它将跳出循环,并且再也不会从这个 channel 读取数据。其他的调用会一直被卡住。为避免这种情况,你需要仔细检查代码,谨慎处理阻塞调用,并确保不会发生线程饥饿。我们例子中的解决方法是使取消调用成为非阻塞调用 — 我们不需要阻塞调用。 +在我们的案例中,这种情况的发生是由于多次发送请求到一个非缓冲且阻塞的通道。这意味着向通道发送数据只有在从这个通道接收完数据后才能返回。我们的超时线程循环迅速从取消通道接收信号;然而,在接收到第一个信号后,它将跳出循环,并且再也不会从这个通道读取数据。其他的调用会一直被卡住。为避免这种情况,你需要仔细检查代码,谨慎处理阻塞调用,并确保不会发生线程饥饿。我们例子中的解决方法是使取消调用成为非阻塞调用 — 我们不需要阻塞调用。 -------------------------------------------------------------------------------- @@ -295,7 +297,7 @@ via: https://opensource.com/article/19/12/go-common-pitfalls 作者:[Eduardo Ferreira][a] 选题:[lujun9972][b] 译者:[lxbwolf](https://github.com/lxbwolf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0bec37da27bfe29e70dd019bc8ee083f94fe8ac1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 15:15:06 +0800 Subject: [PATCH 536/676] PUB @lxbwolf https://linux.cn/article-11778-1.html --- .../20191210 Lessons learned from programming in Go.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191210 Lessons learned from programming in Go.md (99%) diff --git a/translated/tech/20191210 Lessons learned from programming in Go.md b/published/20191210 Lessons learned from programming in Go.md similarity index 99% rename from translated/tech/20191210 Lessons learned from programming in Go.md rename to published/20191210 Lessons learned from programming in Go.md index aeef69681e..3c5e495b89 100644 --- a/translated/tech/20191210 Lessons learned from programming in Go.md +++ b/published/20191210 Lessons learned from programming in Go.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lxbwolf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11778-1.html) [#]: subject: (Lessons learned from programming in Go) [#]: via: (https://opensource.com/article/19/12/go-common-pitfalls) [#]: author: (Eduardo Ferreira https://opensource.com/users/edufgf) From 35320cdc6d9098c684ddde01089a3435a7f67114 Mon Sep 17 00:00:00 2001 From: qianmingtian Date: Mon, 13 Jan 2020 21:06:23 +0800 Subject: [PATCH 537/676] Translated by qianmingtian --- ...t of User Accounts Expiring in -X- Days.md | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) rename {sources => translated}/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md (62%) diff --git a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md similarity index 62% rename from sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md rename to translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index efc52e33f9..77fcbeed2b 100644 --- a/sources/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -7,30 +7,30 @@ [#]: via: (https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days +使用Bash 脚本发送包含 “X” 天内到期的用户账号列表的电子邮件 ====== -The password enforcement policy is common to all operating systems and applications. +密码强制策略对所有操作系统和应用程序都是通用的。 -If you want to **[implement a password enforcement policy on Linux][1]**, go to the following article. +如果要 **[在Linux上实现密码强制策略][1]** ,请参阅以下文章。 -The password enforcement policy will be enforced by most companies by default, but the time period will be different depending on the company’s requirements. +默认情况下,大多数公司都会强制执行密码强制策略,但根据公司的要求,密码的时间周期会有所不同。 -Usually everyone uses a 90-days password cycle. +通常每个人都使用 90 天的密码周期。 -The user will only **[change the password][2]** on some of the servers they use, and they won’t change the password on the servers they don’t use often. +用户只会在他们使用的一些服务器上 **[更改密码][2]**,而不会在他们不经常使用的服务器上更改密码。 -In particular, most team forget to change the service account password, which can lead to breaking regular jobs even if they are configured to work with **[SSH key-based authentication][3]**. +特别地,大多数团队忘记更改服务帐户密码,这可能导致日常工作的中断,即使他们配置有 **[SSH基于密钥的身份验证][3]** 。 -SSH key-based authentication and **[cronjobs][4]** will not work if the user account password expires. +如果用户帐户密码过期,基于SSH密钥的身份验证和 **[cronjobs][4]** 将不起作用。 -To avoid this situation, we have created a **[shell script][5]** that sends you a list of user accounts that expire within 10 days. +为了避免这种情况,我们创建了一个 **[shell脚本][5]** 来向您发送 10 天内到期的用户帐户列表。 -There are two **[bash scripts][6]** included in this tutorial that will help you collect information about user expiration days on your system. +本教程中包含两个 **[bash脚本][6]** 可以帮助您收集系统中用户到期日的信息。 -### 1) Bash Script to Check List of User Accounts Expiring in 10 Days +### 1) 检查10天后到期的用户帐户列表 -This script will help you to check the list of user accounts that expire in 10 days on your terminal. +此脚本将帮助您检查终端上 10 天内到期的用户帐户列表。 ``` # vi /opt/script/user-password-expiry.sh @@ -54,13 +54,13 @@ cat /tmp/user-expiry.txt | awk '$2 <= 10' > /tmp/user-expiry-1.txt cat /tmp/user-expiry-1.txt | column -t ``` -Set an executable Linux file permission to **“user-password-expiry.sh”** file. +将文件 **“user password expiry.sh”** 设置为 Linux 可执行文件权限。 ``` # chmod +x /opt/script/user-password-expiry.sh ``` -You will get an output like the one below. But the username and days may be different +你将得到如下输出,但用户与天数可能不同。 ``` # sh /opt/script/user-password-expiry.sh @@ -73,10 +73,9 @@ u2 9 u3 3 u4 5 ``` +### 2) 发送包含 10 天内到期的用户帐户列表的电子邮件 -### 2) Bash Script to Send eMail With a List of User Accounts Expiring in 10 Days - -This script will send a mail with a list of user accounts expiring in 10 days. +此脚本将发送一封包含 10 天内到期的用户帐户列表的邮件。 ``` # vi /opt/script/user-password-expiry-mail.sh @@ -104,20 +103,20 @@ rm $MESSAGE rm $MESSAGE1 ``` -Set an executable Linux file permission to **“user-password-expiry-mail.sh”** file. +将文件 **“user-password-expiry-mail.sh”** 设置为 Linux 可执行文件权限。 ``` # chmod +x /opt/script/user-password-expiry-mail.sh ``` -Finally add a **[cronjob][4]** to automate this. It runs once in a day at 8AM. +最后,添加一个 **[cronjob][4]** 去自动执行脚本。每天早上 8 点运行一次。 ``` # crontab -e 0 8 * * * /bin/bash /opt/script/user-password-expiry-mail.sh ``` -You will receive a mail similar to the first shell script output. +你将收到一封与第一个脚本输出类似的电子邮件。 -------------------------------------------------------------------------------- @@ -125,13 +124,14 @@ via: https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qianmingtian][c] 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 +[c]: https://github.com/qianmingtian [1]: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ [2]: https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-users-password-in-linux-using-shell-script/ [3]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ From f468498a3ba5289890df1293056eaa8dc924bcec Mon Sep 17 00:00:00 2001 From: cycoe Date: Mon, 13 Jan 2020 21:07:47 +0800 Subject: [PATCH 538/676] Translating by cycoe --- ... jumping to your Python platformer game.md | 161 +++++++++--------- 1 file changed, 80 insertions(+), 81 deletions(-) rename {sources => translated}/tech/20191205 Add jumping to your Python platformer game.md (52%) diff --git a/sources/tech/20191205 Add jumping to your Python platformer game.md b/translated/tech/20191205 Add jumping to your Python platformer game.md similarity index 52% rename from sources/tech/20191205 Add jumping to your Python platformer game.md rename to translated/tech/20191205 Add jumping to your Python platformer game.md index 5c4ec0507e..0487cc1491 100644 --- a/sources/tech/20191205 Add jumping to your Python platformer game.md +++ b/translated/tech/20191205 Add jumping to your Python platformer game.md @@ -7,28 +7,27 @@ [#]: via: (https://opensource.com/article/19/12/jumping-python-platformer-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Add jumping to your Python platformer game +为你的 Python 平台类游戏添加跳跃功能 ====== -Learn how to fight gravity with jumping in this installment on -programming video games with Python's Pygame module. -![Arcade games][1] +在本期使用 Python Pygame 模块编写视频游戏中,学会如何使用跳跃来对抗重力。 +![游戏厅中的游戏][1] -In the [previous article][2] in this series, you simulated gravity, but now you need to give your player a way to fight against gravity by jumping. +在本系列的 [前一篇文章][2] 中,你已经模拟了重力。但现在,你需要赋予你的角色跳跃的能力来对抗重力。 -A jump is a temporary reprieve from gravity. For a few moments, you jump _up_ instead of falling down, the way gravity is pulling you. But once you hit the peak of your jump, gravity kicks in again and pulls you back down to earth. +跳跃是对重力作用的暂时延缓。在这一小段时间里,你是向_上_跳,而不是被重力拉着向下落。但你一旦到达了跳跃的最高点,重力就会重新发挥作用,将你拉回地面。 -In code, this translates to variables. First, you must establish variables for the player sprite so that Python can track whether or not the sprite is jumping. Once the player sprite is jumping, then gravity is applied to the player sprite again, pulling it back down to the nearest object. +在代码中,跳跃被表示为变量。首先,你需要为玩家对象建立一个变量,使得 Python 能够跟踪对象是否正在跳跃中。一旦玩家对象开始跳跃,他就会再次受到重力的作用,并被拉回最近的物体。 -### Setting jump state variables +### 设置跳跃状态变量 -You must add two new variables to your Player class: +你需要为你的 Player 类添加两个新变量: - * One to track whether your player is jumping or not, determined by whether or not your player sprite is standing on solid ground - * One to bring the player back down to the ground + * 一个是为了跟踪你的角色是否正在跳跃中,可通过你的玩家对象是否站在坚实的地面来确定 + * 一个是为了将玩家带回地面 -Add these variables to your **Player** class. In the following code, the lines above the comment are for context, so just add the final two lines: +将如下两个变量添加到你的 **Player** 类中。在下方的代码中,注释前的部分用于提示上下文,因此只需要添加最后两行: ``` @@ -36,20 +35,20 @@ Add these variables to your **Player** class. In the following code, the lines a                 self.movey = 0                 self.frame = 0                 self.health = 10 -                # gravity variables here +                # 此处是重力相关变量                 self.collide_delta = 0                 self.jump_delta = 6 ``` -The first variable (**collide_delta**) is set to 0 because, in its natural state, the player sprite is not in a mid-jump. The other variable (**jump_delta**) is set to 6 to prevent the sprite from bouncing (actually, jumping) when it first lands in the game world. When you've finished this article's examples, try setting it to 0 to see what happens. +第一个变量 **collide_delta** 被设为 0 是因为在正常状态下,玩家对象没有处在跳跃中的状态。另一个变量 **jump_delta** 被设为 6,是为了防止对象在第一次进入游戏世界时就发生反弹(实际上就是跳跃)。当你完成了本篇文章的示例,尝试把该变量设为 0 看看会发生什么。 -### Colliding mid-jump +### 跳跃中的碰撞 -If you jump on a trampoline, your jumps are pretty impressive. But what would happen if you jumped into a wall? (Don't try it to find out!) Your jump, no matter how impressively it started, would end very quickly when you collide with something much larger and much more solid than you. +如果你是跳到一个蹦床上,那你的跳跃一定非常优美。但是如果你是跳向一面墙会发生什么呢?(千万不要去尝试!)不管你的起跳多么令人印象深刻,当你撞到比你更大更硬的物体时,你都会立马停下。(译注:原理参考动量守恒定律) -To mimic this in your video game, you must set the **self.collide_delta** variable to 0 whenever your player sprite collides with something, like the ground. If **self.collide_delta** is anything other than 0, then your player is jumping, and your player can't jump when it hits a wall or the ground. +为了在你的视频游戏中模拟这一点,你需要在你的玩家对象与地面等东西发生碰撞时,将 **self.collide_delta** 变量设为 0。如果你的 **self.collide_delta** 不是 0 而是其它的什么值,那么你的玩家就会发生跳跃,并且当你的玩家与墙或者地面发生碰撞时无法跳跃。 -In the **update** function of your **Player** class, modify the ground collision block to look like this: +在你的 **Player** 类的 **update** 方法中,将地面碰撞相关代码块修改为如下所示: ``` @@ -57,54 +56,54 @@ In the **update** function of your **Player** class, modify the ground collision         for g in ground_hit_list:             self.movey = 0             self.rect.y = worldy-ty-ty -            self.collide_delta = 0 # stop jumping +            self.collide_delta = 0 # 停止跳跃             if self.rect.y > g.rect.y:                 self.health -=1                 print(self.health) ``` -This code block checks for collisions happening between the ground sprites and the player sprite. In the event of a collision, it sets the Y-position of the player to a value equal to the height of the game window (**worldy**) minus the height of a tile minus the height of another tile (so that the player sprite appears to be standing on top of the ground and not in the middle of it). It also sets **self.collide_delta** to 0 so that the program is aware that the player is not in mid-jump. Additionally, it sets **self.movey** to 0 so that the program is aware that the player is not being pulled by gravity (it's a quirk of game physics that you don't need to continue to pull your player toward earth once the player has been grounded). +这段代码块检查了地面对象和玩家对象之间发生的碰撞。当发生碰撞时,它会将玩家 Y 方向的坐标值设置为游戏窗口的高度减去一个瓷贴的高度再减去另一个瓷贴的高度。以此保证了玩家对象是站在地面**上**,而不是嵌在地面里。同时它也将 **self.collide_delta** 设为 0,使得程序能够知道玩家未处在跳跃中。除此之外,它将 **self.movey** 设为 0,使得程序能够知道玩家当前未受到重力的牵引作用(这是游戏物理引擎的奇怪之处,一旦玩家落地,也就没有必要继续将玩家拉向地面)。 -The **if** statement detects whether the player has descended _below_ the level of the ground; if so, it deducts health points as a penalty. This assumes that you want your player to lose health points for falling off the world. That's not strictly necessary; it's just a common convention in platformers. More than likely, you want this event to trigger something, though, or else your real-world player will be stuck playing a game with a sprite that's fallen off the screen. An easy recovery is to set **self.rect.y** to 0 again so that when the player sprite falls off the world, it respawns at the top of the world and falls back onto solid ground. +此处 **if** 语句用来检测玩家是否已经落到地面之_下_,如果是,那就扣除一点生命值作为惩罚。此处假定了你希望当你的玩家落到地图之外时失去生命值。这个设定不是必需的,它只是平台类游戏的一种惯例。更有可能的是,你希望这个事件能够触发另一些事件,或者说是一种能够让你的现实世界玩家沉迷于让对象掉到屏幕之外的东西。一种简单的恢复方式是在玩家对象掉落到地图之外时,将 **self.rect.y** 重新设置为 0,这样它就会在地图上方重新生成,并落到坚实的地面上。 -### Hitting the ground +### 撞向地面 -Your simulated gravity wants your player's Y-axis movement to be 0 or more. To create a jump, write code that sends your player sprite off solid ground and into the air. +模拟的重力使你玩家的 Y 坐标不断增大(译注:此处原文中为 0,但在 Pygame 中越靠下方 Y 坐标应越大)。要实现跳跃,完成如下代码使你的玩家对象离开地面,飞向空中。 -In the **update** function of your **Player** class, add a temporary reprieve from gravity: +在你的 **Player** 类的 **update** 方法中,添加如下代码来暂时延缓重力的作用: ```         if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2 -            self.movey -= 33  # how high to jump +            self.movey -= 33  # 跳跃的高度             self.collide_delta += 6             self.jump_delta    += 6 ``` -According to this code, a jump sends the player sprite 33 pixels into the air. It's _negative_ 33 because a lower number in Pygame means it's closer to the top of the screen. +根据此代码所示,跳跃使玩家对象向空中移动了 33 个像素。此处是_负_ 33 是因为在 Pygame 中,越小的数代表距离屏幕顶端越近。 -This event is conditional, though. It only happens if **self.collide_delta** is less than 6 (its default value established in the **init** function of your **Player** sprite) and if **self.jump_delta** is less than 6. This condition prevents the player from triggering another jump until it collides with a platform. In other words, it prevents mid-air jumps. +不过此事件视条件而定,只有当 **self.collide_delta** 小于 6(缺省值定义在你 **Player** 类的 **init** 方法中)并且 **self.jump_delta** 也于 6 的时候才会发生。此条件能够保证直到玩家碰到一个平台,才能触发另一次跳跃。换言之,它能够阻止空中二段跳。 -You don't have to prevent mid-air jumps, or you can allow for mid-air jumps under special conditions; for instance, if a player obtains a special loot item, then you could grant it the ability to perform mid-air jumps until the next time it is hit by an enemy. +在某些特殊条件下,你可能不想阻止空中二段跳,或者说你允许玩家进行空中二段跳。举个栗子,如果玩家获得了某个战利品,那么在他被敌人攻击到之前,都能够拥有空中二段跳的能力。 -When you've finished this article's examples, try setting **self.collide_delta** and **self.jump_delta** to 0 for a 100% chance to jump in mid-air. +当你完成本篇文章中的示例,尝试将 **self.collide_delta** 和 **self.jump_delta** 设置为 0,从而获得百分之百的几率触发空中二段跳。 -### Landing on a platform +### 在平台上着陆 -So far, you've defined an anti-gravity condition for when the player sprite hits the ground, but the game code keeps platforms and the ground in separate lists. (As with so many choices made in this article, that's not strictly necessary, and you can experiment with treating the ground as just another platform.) To enable a player sprite to stand on top of a platform, you must detect a collision between the player sprite and a platform sprite and then perform the same actions as you did for a ground collision. Place this code into your **update** function: +目前你已经定义了再玩家对象摔落地面时的抵抗重力条件,但此时你的游戏代码仍保持平台与地面置于不同的列表中(就像本文中做的很多其他选择一样,这个设定并不是必需的,你可以尝试将地面作为另一种平台)。为了允许玩家对象站在平台之上,你必须像检测地面碰撞一样,检测玩家对象与平台对象之间的碰撞。将如下代码放于你的 **update** 方法中: ```         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False)         for p in plat_hit_list: -            self.collide_delta = 0 # stop jumping +            self.collide_delta = 0 # 跳跃结束             self.movey = 0 ``` -There's one additional concern, though: platforms hang in the air, meaning the player can interact with them by approaching them from either the top or the bottom. +但此处还有一点需要考虑:平台悬在空中,也就意味着玩家可以通过从上面或者从下面接触平台来与之互动。 -It's up to you how you want the platforms to react to your player. It's not uncommon to block a player from accessing a platform from below. Add this code to the above code block to treat platforms as a sort of ceiling or pergola, such that the player sprite can jump onto a platform as long as it jumps higher than the platform's topside, but obstructs the player when it tries to jump from beneath: +确定平台如何与玩家互动取决于你,阻止玩家从下方到达平台也并不稀奇。将如下代码加到上方的代码块中,使得平台表现得像天花板或者说是藤架。只有在玩家对象跳得比平台上沿更高时才能跳到平台上,但会阻止玩家从平台下方跳上来: ``` @@ -114,17 +113,17 @@ It's up to you how you want the platforms to react to your player. It's not unco                 self.rect.y = p.rect.y-ty ``` -The first clause of this **if** statement blocks the player from accessing a platform when the player sprite is directly under the platform. It does this by detecting that the player sprite's position is greater (in Pygame, that means lower on the screen, from top to bottom), and then sets the player sprite's new Y position to its current Y position plus the height of a tile, effectively keeping the player one tile's height away from ever passing through a platform from beneath it. +此处 **if** 语句代码块的第一个子句阻止玩家对象从平台正下方跳到平台上。如果它检测到玩家对象的坐标比平台更大(在 Pygame 中,坐标更大意味着在屏幕的更下方),那么将玩家对象新的 Y 坐标设置为当前平台的 Y 坐标加上一个瓷贴的高度。实际效果就是保证玩家对象距离平台一个瓷贴的高度,防止其从下方穿过平台。 -The **else** clause does the opposite. If the program is running this code, then the player sprite's Y position is _not_ greater than the platforms, meaning that the player sprite is falling from the sky (either because it has been freshly spawned there or because the player has jumped). In this event, the player sprite's position is set to the position of the platform minus one tile's height (because, remember, in Pygame, lower numbers mean something is higher up on the screen). This keeps the player on top of the platform unless it jumps or walks off of it. +**else** 子句做了相反的事情。当程序运行到此处时,如果玩家对象的 Y 坐标_不_比平台的更大,意味着玩家对象是从空中落下(不论是由于玩家刚刚从此处生成,或者是玩家执行了跳跃)。在这种情况下,玩家对象的 Y 坐标被设为平台的 Y 坐标减去一个瓷贴的高度(切记,在 Pygame 中更小的 Y 坐标代表在屏幕上的更高处)。这样就能保证玩家在平台_上_,除非他从平台上跳下来或者走下来。 -You can experiment with other ways of dealing with sprite and platform interaction. For instance, maybe the player is assumed to be "in front" of the platforms and can seamlessly jump through them to stand on top of one. Or a platform could slow a player's leap but not block it entirely. You can even mix and match by grouping platforms into different lists. +你也可以尝试其他的方式来处理玩家与平台之间的互动。举个栗子,也许玩家对象被设定为处在平台的“前面”,他能够无障碍地跳跃穿过平台并站在上面。或者你可以设计一种平台会减缓而又不完全阻止玩家的跳跃过程。甚至你可以通过将不同平台分到不同列表中来混合搭配使用。 -### Triggering a jump +### 触发一次跳跃 -Your code now simulates all the necessary jump conditions, but it still lacks a jump trigger. Your player sprite's **self.jump_delta** is set to 6 initially, and the jump update code is triggered only when it's less than 6. +目前为此,你的代码已经模拟了所有必需的跳跃条件,但仍缺少一个跳跃触发器。你的玩家对象的 **self.jump_delta** 初始值被设置为 6,只有当它比 6 小时才会触发更新跳跃的代码。 -To trigger a new setting for the jumping variable, create a **jump** function in your **Player** class that sets the **self.jump_delta** to less than 6, causing gravity to be temporarily reprieved by sending your player sprite 33 pixels into the air: +为跳跃变量设置一个新的设置方法,在你的 **Player** 类中创建一个 **jump** 方法,并将 **self.jump_delta** 设为小于 6 的值。通过使玩家对象向空中移动 33 个像素,来暂时减缓重力的作用。 ``` @@ -132,17 +131,17 @@ To trigger a new setting for the jumping variable, create a **jump** function in         self.jump_delta = 0 ``` -That's all the **jump** function requires, believe it or not. The rest happens in the **update** function, and you've already written that code. +不管你相信与否,这就是 **jump** 方法的全部。剩余的部分在 **update** 方法中,你已经在前面实现了相关代码。 -There's one last thing to do before jumping is functional in your game. If you can't think of what it is, try playing your game to see how jumping works for you. +要使你游戏中的跳跃功能生效,还有最后一件事情要做。如果你想不起来是什么,运行游戏并观察跳跃是如何生效的。 -The problem is that nothing in your main loop is calling the **jump** function. You made a placeholder keypress for it early on, but right now, all the jump key does is print **jump** to the terminal. +问题就在于你的主循环中没有调用 **jump** 方法。先前你已经为该方法创建了一个按键占位符,现在,跳跃键所做的就是将 **jump** 打印到终端。 -### Calling the jump function +### 调用 jump 方法 -In your main loop, change the result of the Up arrow from printing a debug statement to calling the **jump** function. +在你的主循环中,将_上_方向键的效果从打印一条调试语句,改为调用 **jump** 方法。 -Notice that the **jump** function, like the **update** function, needs to know about collisions, so you have to tell it which **plat_list** to use. +注意此处,与 **update** 方法类似,**jump** 方法也需要检测碰撞,因此你需要告诉它使用哪个 **plat_list**。 ``` @@ -150,13 +149,13 @@ Notice that the **jump** function, like the **update** function, needs to know a                 player.jump(plat_list) ``` -If you would rather use the Spacebar for jumping, set the key to **pygame.K_SPACE** instead of **pygame.K_UP**. Alternately, you can use both (as separate **if** statements) so that the player has a choice. +如果你倾向于使用空格键作为跳跃键,使用 **pygame.K_SPACE** 替代 **pygame.K_UP** 作为按键。另一种选择,你可以同时使用两种方式(使用单独的 **if** 语句),给玩家多一种选择。 -Try your game now. In the next article, you'll make your world scroll. +现在来尝试你的游戏吧!在下一篇文章中,你将让你的游戏卷动起来。 -![Pygame platformer][3] +![Pygame 平台类游戏][3] -Here's all the code so far: +以下是目前为止的所有代码: ``` @@ -184,7 +183,7 @@ Objects ''' class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     + # x 坐标,y 坐标,图像宽度,图像高度,图像文件     def __init__(self,xloc,yloc,imgw,imgh,img):         pygame.sprite.Sprite.__init__(self)         self.image = pygame.image.load(os.path.join('images',img)).convert() @@ -195,7 +194,7 @@ class Platform(pygame.sprite.Sprite): class Player(pygame.sprite.Sprite):     ''' -    Spawn a player +    生成一个玩家     '''     def __init__(self):         pygame.sprite.Sprite.__init__(self) @@ -227,34 +226,34 @@ class Player(pygame.sprite.Sprite):             def control(self,x,y):         ''' -        control player movement +        控制玩家移动         '''         self.movex += x         self.movey += y             def update(self):         ''' -        Update sprite position +        更新对象位置         '''                 self.rect.x = self.rect.x + self.movex         self.rect.y = self.rect.y + self.movey -        # moving left +        # 向左移动         if self.movex < 0:             self.frame += 1             if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani] -        # moving right +        # 向右移动         if self.movex > 0:             self.frame += 1             if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] -        # collisions +        # 碰撞         enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False)         for enemy in enemy_hit_list:             self.health -= 1 @@ -286,7 +285,7 @@ class Player(pygame.sprite.Sprite):             class Enemy(pygame.sprite.Sprite):     ''' -    Spawn an enemy +    生成一个敌人     '''     def __init__(self,x,y,img):         pygame.sprite.Sprite.__init__(self) @@ -302,7 +301,7 @@ class Enemy(pygame.sprite.Sprite):                     def move(self):         ''' -        enemy movement +        敌人移动         '''         distance = 80         speed = 8 @@ -337,9 +336,9 @@ class Enemy(pygame.sprite.Sprite): class Level():     def bad(lvl,eloc):         if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # 生成敌人 +            enemy_list = pygame.sprite.Group() # 创建敌人组 +            enemy_list.add(enemy)              # 将敌人添加到敌人组                     if lvl == 2:             print("Level " + str(lvl) ) @@ -392,8 +391,8 @@ Setup worldx = 960 worldy = 720 -fps = 40 # frame rate -ani = 4  # animation cycles +fps = 40 # 帧率 +ani = 4  # 动画循环 clock = pygame.time.Clock() pygame.init() main = True @@ -406,7 +405,7 @@ ALPHA = (0,255,0) world = pygame.display.set_mode([worldx,worldy]) backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() backdropbox = world.get_rect() -player = Player() # spawn player +player = Player() # 生成玩家 player.rect.x = 0 player.rect.y = 0 player_list = pygame.sprite.Group() @@ -418,8 +417,8 @@ eloc = [] eloc = [200,20] gloc = [] #gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] -tx = 64 #tile size -ty = 64 #tile size +tx = 64 # 瓷贴尺寸 +ty = 64 # 瓷贴尺寸 i=0 while i <= (worldx/tx)+tx: @@ -431,7 +430,7 @@ ground_list = Level.ground( 1,gloc,tx,ty ) plat_list = Level.platform( 1,tx,ty ) ''' -Main loop +主循环 ''' while main == True:     for event in pygame.event.get(): @@ -464,26 +463,26 @@ while main == True: #    world.fill(BLACK)     world.blit(backdrop, backdropbox) -    player.gravity() # check gravity +    player.gravity() # 检查重力     player.update() -    player_list.draw(world) #refresh player position -    enemy_list.draw(world)  # refresh enemies -    ground_list.draw(world)  # refresh enemies -    plat_list.draw(world)   # refresh platforms +    player_list.draw(world) # 刷新玩家位置 +    enemy_list.draw(world)  # 刷新敌人 +    ground_list.draw(world)  # 刷新地面 +    plat_list.draw(world)   # 刷新平台     for e in enemy_list:         e.move()     pygame.display.flip()     clock.tick(fps) ``` -This is the 7th installment in an ongoing series about creating video games in [Python 3][4] using the [Pygame][5] module. Previous articles are: +本期是使用 [Pygame][5] 模块在 [Python 3][4] 中创建视频游戏连载系列的第 7 期。往期文章为: - * [Learn how to program in Python by building a simple dice game][6] - * [Build a game framework with Python using the Pygame module][7] - * [How to add a player to your Python game][8] - * [Using Pygame to move your game character around][9] - * [What's a hero without a villain? How to add one to your Python game][10] - * [Simulate gravity in your Python game][2] + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][6] + * [使用 Python 和 Pygame 模块构建一个游戏框架][7] + * [如何在你的 Python 游戏中添加一个玩家][8] + * [用 Pygame 使你的游戏角色移动起来][9] + * [如何向你的 Python 游戏中添加一个敌人][10] + * [在你的 Python 游戏中模拟重力][2] @@ -493,7 +492,7 @@ via: https://opensource.com/article/19/12/jumping-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[cycoe](https://github.com/cycoe) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fe1ad6440223a95d0726e563c47b1ef1b29d178a Mon Sep 17 00:00:00 2001 From: cycoe Date: Mon, 13 Jan 2020 21:10:23 +0800 Subject: [PATCH 539/676] Translated by cycoe --- ... jumping to your Python platformer game.md | 161 +++++++++--------- 1 file changed, 80 insertions(+), 81 deletions(-) rename {sources => translated}/tech/20191205 Add jumping to your Python platformer game.md (52%) diff --git a/sources/tech/20191205 Add jumping to your Python platformer game.md b/translated/tech/20191205 Add jumping to your Python platformer game.md similarity index 52% rename from sources/tech/20191205 Add jumping to your Python platformer game.md rename to translated/tech/20191205 Add jumping to your Python platformer game.md index 5c4ec0507e..0487cc1491 100644 --- a/sources/tech/20191205 Add jumping to your Python platformer game.md +++ b/translated/tech/20191205 Add jumping to your Python platformer game.md @@ -7,28 +7,27 @@ [#]: via: (https://opensource.com/article/19/12/jumping-python-platformer-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Add jumping to your Python platformer game +为你的 Python 平台类游戏添加跳跃功能 ====== -Learn how to fight gravity with jumping in this installment on -programming video games with Python's Pygame module. -![Arcade games][1] +在本期使用 Python Pygame 模块编写视频游戏中,学会如何使用跳跃来对抗重力。 +![游戏厅中的游戏][1] -In the [previous article][2] in this series, you simulated gravity, but now you need to give your player a way to fight against gravity by jumping. +在本系列的 [前一篇文章][2] 中,你已经模拟了重力。但现在,你需要赋予你的角色跳跃的能力来对抗重力。 -A jump is a temporary reprieve from gravity. For a few moments, you jump _up_ instead of falling down, the way gravity is pulling you. But once you hit the peak of your jump, gravity kicks in again and pulls you back down to earth. +跳跃是对重力作用的暂时延缓。在这一小段时间里,你是向_上_跳,而不是被重力拉着向下落。但你一旦到达了跳跃的最高点,重力就会重新发挥作用,将你拉回地面。 -In code, this translates to variables. First, you must establish variables for the player sprite so that Python can track whether or not the sprite is jumping. Once the player sprite is jumping, then gravity is applied to the player sprite again, pulling it back down to the nearest object. +在代码中,跳跃被表示为变量。首先,你需要为玩家对象建立一个变量,使得 Python 能够跟踪对象是否正在跳跃中。一旦玩家对象开始跳跃,他就会再次受到重力的作用,并被拉回最近的物体。 -### Setting jump state variables +### 设置跳跃状态变量 -You must add two new variables to your Player class: +你需要为你的 Player 类添加两个新变量: - * One to track whether your player is jumping or not, determined by whether or not your player sprite is standing on solid ground - * One to bring the player back down to the ground + * 一个是为了跟踪你的角色是否正在跳跃中,可通过你的玩家对象是否站在坚实的地面来确定 + * 一个是为了将玩家带回地面 -Add these variables to your **Player** class. In the following code, the lines above the comment are for context, so just add the final two lines: +将如下两个变量添加到你的 **Player** 类中。在下方的代码中,注释前的部分用于提示上下文,因此只需要添加最后两行: ``` @@ -36,20 +35,20 @@ Add these variables to your **Player** class. In the following code, the lines a                 self.movey = 0                 self.frame = 0                 self.health = 10 -                # gravity variables here +                # 此处是重力相关变量                 self.collide_delta = 0                 self.jump_delta = 6 ``` -The first variable (**collide_delta**) is set to 0 because, in its natural state, the player sprite is not in a mid-jump. The other variable (**jump_delta**) is set to 6 to prevent the sprite from bouncing (actually, jumping) when it first lands in the game world. When you've finished this article's examples, try setting it to 0 to see what happens. +第一个变量 **collide_delta** 被设为 0 是因为在正常状态下,玩家对象没有处在跳跃中的状态。另一个变量 **jump_delta** 被设为 6,是为了防止对象在第一次进入游戏世界时就发生反弹(实际上就是跳跃)。当你完成了本篇文章的示例,尝试把该变量设为 0 看看会发生什么。 -### Colliding mid-jump +### 跳跃中的碰撞 -If you jump on a trampoline, your jumps are pretty impressive. But what would happen if you jumped into a wall? (Don't try it to find out!) Your jump, no matter how impressively it started, would end very quickly when you collide with something much larger and much more solid than you. +如果你是跳到一个蹦床上,那你的跳跃一定非常优美。但是如果你是跳向一面墙会发生什么呢?(千万不要去尝试!)不管你的起跳多么令人印象深刻,当你撞到比你更大更硬的物体时,你都会立马停下。(译注:原理参考动量守恒定律) -To mimic this in your video game, you must set the **self.collide_delta** variable to 0 whenever your player sprite collides with something, like the ground. If **self.collide_delta** is anything other than 0, then your player is jumping, and your player can't jump when it hits a wall or the ground. +为了在你的视频游戏中模拟这一点,你需要在你的玩家对象与地面等东西发生碰撞时,将 **self.collide_delta** 变量设为 0。如果你的 **self.collide_delta** 不是 0 而是其它的什么值,那么你的玩家就会发生跳跃,并且当你的玩家与墙或者地面发生碰撞时无法跳跃。 -In the **update** function of your **Player** class, modify the ground collision block to look like this: +在你的 **Player** 类的 **update** 方法中,将地面碰撞相关代码块修改为如下所示: ``` @@ -57,54 +56,54 @@ In the **update** function of your **Player** class, modify the ground collision         for g in ground_hit_list:             self.movey = 0             self.rect.y = worldy-ty-ty -            self.collide_delta = 0 # stop jumping +            self.collide_delta = 0 # 停止跳跃             if self.rect.y > g.rect.y:                 self.health -=1                 print(self.health) ``` -This code block checks for collisions happening between the ground sprites and the player sprite. In the event of a collision, it sets the Y-position of the player to a value equal to the height of the game window (**worldy**) minus the height of a tile minus the height of another tile (so that the player sprite appears to be standing on top of the ground and not in the middle of it). It also sets **self.collide_delta** to 0 so that the program is aware that the player is not in mid-jump. Additionally, it sets **self.movey** to 0 so that the program is aware that the player is not being pulled by gravity (it's a quirk of game physics that you don't need to continue to pull your player toward earth once the player has been grounded). +这段代码块检查了地面对象和玩家对象之间发生的碰撞。当发生碰撞时,它会将玩家 Y 方向的坐标值设置为游戏窗口的高度减去一个瓷贴的高度再减去另一个瓷贴的高度。以此保证了玩家对象是站在地面**上**,而不是嵌在地面里。同时它也将 **self.collide_delta** 设为 0,使得程序能够知道玩家未处在跳跃中。除此之外,它将 **self.movey** 设为 0,使得程序能够知道玩家当前未受到重力的牵引作用(这是游戏物理引擎的奇怪之处,一旦玩家落地,也就没有必要继续将玩家拉向地面)。 -The **if** statement detects whether the player has descended _below_ the level of the ground; if so, it deducts health points as a penalty. This assumes that you want your player to lose health points for falling off the world. That's not strictly necessary; it's just a common convention in platformers. More than likely, you want this event to trigger something, though, or else your real-world player will be stuck playing a game with a sprite that's fallen off the screen. An easy recovery is to set **self.rect.y** to 0 again so that when the player sprite falls off the world, it respawns at the top of the world and falls back onto solid ground. +此处 **if** 语句用来检测玩家是否已经落到地面之_下_,如果是,那就扣除一点生命值作为惩罚。此处假定了你希望当你的玩家落到地图之外时失去生命值。这个设定不是必需的,它只是平台类游戏的一种惯例。更有可能的是,你希望这个事件能够触发另一些事件,或者说是一种能够让你的现实世界玩家沉迷于让对象掉到屏幕之外的东西。一种简单的恢复方式是在玩家对象掉落到地图之外时,将 **self.rect.y** 重新设置为 0,这样它就会在地图上方重新生成,并落到坚实的地面上。 -### Hitting the ground +### 撞向地面 -Your simulated gravity wants your player's Y-axis movement to be 0 or more. To create a jump, write code that sends your player sprite off solid ground and into the air. +模拟的重力使你玩家的 Y 坐标不断增大(译注:此处原文中为 0,但在 Pygame 中越靠下方 Y 坐标应越大)。要实现跳跃,完成如下代码使你的玩家对象离开地面,飞向空中。 -In the **update** function of your **Player** class, add a temporary reprieve from gravity: +在你的 **Player** 类的 **update** 方法中,添加如下代码来暂时延缓重力的作用: ```         if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2 -            self.movey -= 33  # how high to jump +            self.movey -= 33  # 跳跃的高度             self.collide_delta += 6             self.jump_delta    += 6 ``` -According to this code, a jump sends the player sprite 33 pixels into the air. It's _negative_ 33 because a lower number in Pygame means it's closer to the top of the screen. +根据此代码所示,跳跃使玩家对象向空中移动了 33 个像素。此处是_负_ 33 是因为在 Pygame 中,越小的数代表距离屏幕顶端越近。 -This event is conditional, though. It only happens if **self.collide_delta** is less than 6 (its default value established in the **init** function of your **Player** sprite) and if **self.jump_delta** is less than 6. This condition prevents the player from triggering another jump until it collides with a platform. In other words, it prevents mid-air jumps. +不过此事件视条件而定,只有当 **self.collide_delta** 小于 6(缺省值定义在你 **Player** 类的 **init** 方法中)并且 **self.jump_delta** 也于 6 的时候才会发生。此条件能够保证直到玩家碰到一个平台,才能触发另一次跳跃。换言之,它能够阻止空中二段跳。 -You don't have to prevent mid-air jumps, or you can allow for mid-air jumps under special conditions; for instance, if a player obtains a special loot item, then you could grant it the ability to perform mid-air jumps until the next time it is hit by an enemy. +在某些特殊条件下,你可能不想阻止空中二段跳,或者说你允许玩家进行空中二段跳。举个栗子,如果玩家获得了某个战利品,那么在他被敌人攻击到之前,都能够拥有空中二段跳的能力。 -When you've finished this article's examples, try setting **self.collide_delta** and **self.jump_delta** to 0 for a 100% chance to jump in mid-air. +当你完成本篇文章中的示例,尝试将 **self.collide_delta** 和 **self.jump_delta** 设置为 0,从而获得百分之百的几率触发空中二段跳。 -### Landing on a platform +### 在平台上着陆 -So far, you've defined an anti-gravity condition for when the player sprite hits the ground, but the game code keeps platforms and the ground in separate lists. (As with so many choices made in this article, that's not strictly necessary, and you can experiment with treating the ground as just another platform.) To enable a player sprite to stand on top of a platform, you must detect a collision between the player sprite and a platform sprite and then perform the same actions as you did for a ground collision. Place this code into your **update** function: +目前你已经定义了再玩家对象摔落地面时的抵抗重力条件,但此时你的游戏代码仍保持平台与地面置于不同的列表中(就像本文中做的很多其他选择一样,这个设定并不是必需的,你可以尝试将地面作为另一种平台)。为了允许玩家对象站在平台之上,你必须像检测地面碰撞一样,检测玩家对象与平台对象之间的碰撞。将如下代码放于你的 **update** 方法中: ```         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False)         for p in plat_hit_list: -            self.collide_delta = 0 # stop jumping +            self.collide_delta = 0 # 跳跃结束             self.movey = 0 ``` -There's one additional concern, though: platforms hang in the air, meaning the player can interact with them by approaching them from either the top or the bottom. +但此处还有一点需要考虑:平台悬在空中,也就意味着玩家可以通过从上面或者从下面接触平台来与之互动。 -It's up to you how you want the platforms to react to your player. It's not uncommon to block a player from accessing a platform from below. Add this code to the above code block to treat platforms as a sort of ceiling or pergola, such that the player sprite can jump onto a platform as long as it jumps higher than the platform's topside, but obstructs the player when it tries to jump from beneath: +确定平台如何与玩家互动取决于你,阻止玩家从下方到达平台也并不稀奇。将如下代码加到上方的代码块中,使得平台表现得像天花板或者说是藤架。只有在玩家对象跳得比平台上沿更高时才能跳到平台上,但会阻止玩家从平台下方跳上来: ``` @@ -114,17 +113,17 @@ It's up to you how you want the platforms to react to your player. It's not unco                 self.rect.y = p.rect.y-ty ``` -The first clause of this **if** statement blocks the player from accessing a platform when the player sprite is directly under the platform. It does this by detecting that the player sprite's position is greater (in Pygame, that means lower on the screen, from top to bottom), and then sets the player sprite's new Y position to its current Y position plus the height of a tile, effectively keeping the player one tile's height away from ever passing through a platform from beneath it. +此处 **if** 语句代码块的第一个子句阻止玩家对象从平台正下方跳到平台上。如果它检测到玩家对象的坐标比平台更大(在 Pygame 中,坐标更大意味着在屏幕的更下方),那么将玩家对象新的 Y 坐标设置为当前平台的 Y 坐标加上一个瓷贴的高度。实际效果就是保证玩家对象距离平台一个瓷贴的高度,防止其从下方穿过平台。 -The **else** clause does the opposite. If the program is running this code, then the player sprite's Y position is _not_ greater than the platforms, meaning that the player sprite is falling from the sky (either because it has been freshly spawned there or because the player has jumped). In this event, the player sprite's position is set to the position of the platform minus one tile's height (because, remember, in Pygame, lower numbers mean something is higher up on the screen). This keeps the player on top of the platform unless it jumps or walks off of it. +**else** 子句做了相反的事情。当程序运行到此处时,如果玩家对象的 Y 坐标_不_比平台的更大,意味着玩家对象是从空中落下(不论是由于玩家刚刚从此处生成,或者是玩家执行了跳跃)。在这种情况下,玩家对象的 Y 坐标被设为平台的 Y 坐标减去一个瓷贴的高度(切记,在 Pygame 中更小的 Y 坐标代表在屏幕上的更高处)。这样就能保证玩家在平台_上_,除非他从平台上跳下来或者走下来。 -You can experiment with other ways of dealing with sprite and platform interaction. For instance, maybe the player is assumed to be "in front" of the platforms and can seamlessly jump through them to stand on top of one. Or a platform could slow a player's leap but not block it entirely. You can even mix and match by grouping platforms into different lists. +你也可以尝试其他的方式来处理玩家与平台之间的互动。举个栗子,也许玩家对象被设定为处在平台的“前面”,他能够无障碍地跳跃穿过平台并站在上面。或者你可以设计一种平台会减缓而又不完全阻止玩家的跳跃过程。甚至你可以通过将不同平台分到不同列表中来混合搭配使用。 -### Triggering a jump +### 触发一次跳跃 -Your code now simulates all the necessary jump conditions, but it still lacks a jump trigger. Your player sprite's **self.jump_delta** is set to 6 initially, and the jump update code is triggered only when it's less than 6. +目前为此,你的代码已经模拟了所有必需的跳跃条件,但仍缺少一个跳跃触发器。你的玩家对象的 **self.jump_delta** 初始值被设置为 6,只有当它比 6 小时才会触发更新跳跃的代码。 -To trigger a new setting for the jumping variable, create a **jump** function in your **Player** class that sets the **self.jump_delta** to less than 6, causing gravity to be temporarily reprieved by sending your player sprite 33 pixels into the air: +为跳跃变量设置一个新的设置方法,在你的 **Player** 类中创建一个 **jump** 方法,并将 **self.jump_delta** 设为小于 6 的值。通过使玩家对象向空中移动 33 个像素,来暂时减缓重力的作用。 ``` @@ -132,17 +131,17 @@ To trigger a new setting for the jumping variable, create a **jump** function in         self.jump_delta = 0 ``` -That's all the **jump** function requires, believe it or not. The rest happens in the **update** function, and you've already written that code. +不管你相信与否,这就是 **jump** 方法的全部。剩余的部分在 **update** 方法中,你已经在前面实现了相关代码。 -There's one last thing to do before jumping is functional in your game. If you can't think of what it is, try playing your game to see how jumping works for you. +要使你游戏中的跳跃功能生效,还有最后一件事情要做。如果你想不起来是什么,运行游戏并观察跳跃是如何生效的。 -The problem is that nothing in your main loop is calling the **jump** function. You made a placeholder keypress for it early on, but right now, all the jump key does is print **jump** to the terminal. +问题就在于你的主循环中没有调用 **jump** 方法。先前你已经为该方法创建了一个按键占位符,现在,跳跃键所做的就是将 **jump** 打印到终端。 -### Calling the jump function +### 调用 jump 方法 -In your main loop, change the result of the Up arrow from printing a debug statement to calling the **jump** function. +在你的主循环中,将_上_方向键的效果从打印一条调试语句,改为调用 **jump** 方法。 -Notice that the **jump** function, like the **update** function, needs to know about collisions, so you have to tell it which **plat_list** to use. +注意此处,与 **update** 方法类似,**jump** 方法也需要检测碰撞,因此你需要告诉它使用哪个 **plat_list**。 ``` @@ -150,13 +149,13 @@ Notice that the **jump** function, like the **update** function, needs to know a                 player.jump(plat_list) ``` -If you would rather use the Spacebar for jumping, set the key to **pygame.K_SPACE** instead of **pygame.K_UP**. Alternately, you can use both (as separate **if** statements) so that the player has a choice. +如果你倾向于使用空格键作为跳跃键,使用 **pygame.K_SPACE** 替代 **pygame.K_UP** 作为按键。另一种选择,你可以同时使用两种方式(使用单独的 **if** 语句),给玩家多一种选择。 -Try your game now. In the next article, you'll make your world scroll. +现在来尝试你的游戏吧!在下一篇文章中,你将让你的游戏卷动起来。 -![Pygame platformer][3] +![Pygame 平台类游戏][3] -Here's all the code so far: +以下是目前为止的所有代码: ``` @@ -184,7 +183,7 @@ Objects ''' class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     + # x 坐标,y 坐标,图像宽度,图像高度,图像文件     def __init__(self,xloc,yloc,imgw,imgh,img):         pygame.sprite.Sprite.__init__(self)         self.image = pygame.image.load(os.path.join('images',img)).convert() @@ -195,7 +194,7 @@ class Platform(pygame.sprite.Sprite): class Player(pygame.sprite.Sprite):     ''' -    Spawn a player +    生成一个玩家     '''     def __init__(self):         pygame.sprite.Sprite.__init__(self) @@ -227,34 +226,34 @@ class Player(pygame.sprite.Sprite):             def control(self,x,y):         ''' -        control player movement +        控制玩家移动         '''         self.movex += x         self.movey += y             def update(self):         ''' -        Update sprite position +        更新对象位置         '''                 self.rect.x = self.rect.x + self.movex         self.rect.y = self.rect.y + self.movey -        # moving left +        # 向左移动         if self.movex < 0:             self.frame += 1             if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani] -        # moving right +        # 向右移动         if self.movex > 0:             self.frame += 1             if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] -        # collisions +        # 碰撞         enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False)         for enemy in enemy_hit_list:             self.health -= 1 @@ -286,7 +285,7 @@ class Player(pygame.sprite.Sprite):             class Enemy(pygame.sprite.Sprite):     ''' -    Spawn an enemy +    生成一个敌人     '''     def __init__(self,x,y,img):         pygame.sprite.Sprite.__init__(self) @@ -302,7 +301,7 @@ class Enemy(pygame.sprite.Sprite):                     def move(self):         ''' -        enemy movement +        敌人移动         '''         distance = 80         speed = 8 @@ -337,9 +336,9 @@ class Enemy(pygame.sprite.Sprite): class Level():     def bad(lvl,eloc):         if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # 生成敌人 +            enemy_list = pygame.sprite.Group() # 创建敌人组 +            enemy_list.add(enemy)              # 将敌人添加到敌人组                     if lvl == 2:             print("Level " + str(lvl) ) @@ -392,8 +391,8 @@ Setup worldx = 960 worldy = 720 -fps = 40 # frame rate -ani = 4  # animation cycles +fps = 40 # 帧率 +ani = 4  # 动画循环 clock = pygame.time.Clock() pygame.init() main = True @@ -406,7 +405,7 @@ ALPHA = (0,255,0) world = pygame.display.set_mode([worldx,worldy]) backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() backdropbox = world.get_rect() -player = Player() # spawn player +player = Player() # 生成玩家 player.rect.x = 0 player.rect.y = 0 player_list = pygame.sprite.Group() @@ -418,8 +417,8 @@ eloc = [] eloc = [200,20] gloc = [] #gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] -tx = 64 #tile size -ty = 64 #tile size +tx = 64 # 瓷贴尺寸 +ty = 64 # 瓷贴尺寸 i=0 while i <= (worldx/tx)+tx: @@ -431,7 +430,7 @@ ground_list = Level.ground( 1,gloc,tx,ty ) plat_list = Level.platform( 1,tx,ty ) ''' -Main loop +主循环 ''' while main == True:     for event in pygame.event.get(): @@ -464,26 +463,26 @@ while main == True: #    world.fill(BLACK)     world.blit(backdrop, backdropbox) -    player.gravity() # check gravity +    player.gravity() # 检查重力     player.update() -    player_list.draw(world) #refresh player position -    enemy_list.draw(world)  # refresh enemies -    ground_list.draw(world)  # refresh enemies -    plat_list.draw(world)   # refresh platforms +    player_list.draw(world) # 刷新玩家位置 +    enemy_list.draw(world)  # 刷新敌人 +    ground_list.draw(world)  # 刷新地面 +    plat_list.draw(world)   # 刷新平台     for e in enemy_list:         e.move()     pygame.display.flip()     clock.tick(fps) ``` -This is the 7th installment in an ongoing series about creating video games in [Python 3][4] using the [Pygame][5] module. Previous articles are: +本期是使用 [Pygame][5] 模块在 [Python 3][4] 中创建视频游戏连载系列的第 7 期。往期文章为: - * [Learn how to program in Python by building a simple dice game][6] - * [Build a game framework with Python using the Pygame module][7] - * [How to add a player to your Python game][8] - * [Using Pygame to move your game character around][9] - * [What's a hero without a villain? How to add one to your Python game][10] - * [Simulate gravity in your Python game][2] + * [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][6] + * [使用 Python 和 Pygame 模块构建一个游戏框架][7] + * [如何在你的 Python 游戏中添加一个玩家][8] + * [用 Pygame 使你的游戏角色移动起来][9] + * [如何向你的 Python 游戏中添加一个敌人][10] + * [在你的 Python 游戏中模拟重力][2] @@ -493,7 +492,7 @@ via: https://opensource.com/article/19/12/jumping-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[cycoe](https://github.com/cycoe) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b01f40ea8d95136e54416029b39237baecc1ce0a Mon Sep 17 00:00:00 2001 From: qianmingtian <40565099+qianmingtian@users.noreply.github.com> Date: Mon, 13 Jan 2020 21:12:03 +0800 Subject: [PATCH 540/676] Translated and fixed a space by qianmingtian --- ...d eMail With a List of User Accounts Expiring in -X- Days.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index 77fcbeed2b..1e073e3051 100644 --- a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -28,7 +28,7 @@ 本教程中包含两个 **[bash脚本][6]** 可以帮助您收集系统中用户到期日的信息。 -### 1) 检查10天后到期的用户帐户列表 +### 1) 检查 10 天后到期的用户帐户列表 此脚本将帮助您检查终端上 10 天内到期的用户帐户列表。 From 759e2c8180270e8a9e3ca80f4818b74eb9333b0a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 21:17:58 +0800 Subject: [PATCH 541/676] APL --- .../tech/20200105 PaperWM- tiled window management for GNOME.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md index dab0726417..a110310251 100644 --- a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md +++ b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (PaperWM: tiled window management for GNOME) From 3309887a712ae7253bbdad911d99dff64ced4599 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 21:30:43 +0800 Subject: [PATCH 542/676] PRF @geekpi --- ...erWM- tiled window management for GNOME.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md index a110310251..7693b5446a 100644 --- a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md +++ b/translated/tech/20200105 PaperWM- tiled window management for GNOME.md @@ -10,13 +10,15 @@ PaperWM:GNOME 下的平铺窗口管理 ====== -当我开始在个人计算机上使用 Linux 时,令我兴奋的第一件事就是轻巧的窗口管理器,这主要是因为当时我的笔记本电脑只有有 32MB 的内存,且没有其他可使用的内存。 +![](https://img.linux.net.cn/data/attachment/album/202001/13/212936hsk572f4jrsj2jsh.jpg) -接着我开始接触 [xmonad][1] 之类的平铺窗口管理器!我可以用键盘管理窗口了!它们太快了!我可以通过编写 Haskell 程序来配置 xmonad!我可以用各种有趣的方式自定义所有内容(例如使用 [dmenu][2] 作为启动器)!这些年来,我用过 3,4 个不同的平铺窗口管理器,它们很有趣。 +当我开始在个人计算机上使用 Linux 时,首先令我兴奋的就是轻巧的窗口管理器,这主要是因为当时我的笔记本电脑只有有 32MB 的内存,其它的都运行不了了。 -大约 6 年前,我觉得配置平铺窗口管理器对我来说不再是一件有趣的事情,因此转而使用 Ubuntu 桌面环境 Gnome。 (现在,我的笔记本电脑中的内存增加了 500 倍,这要快得多 :) ) +接着我开始接触 [xmonad][1] 之类的平铺窗口管理器!我可以用键盘管理窗口了!它们是如此之快!我可以通过编写 Haskell 程序来配置 xmonad!我可以用各种有趣的方式自定义所有内容(例如使用 [dmenu][2] 作为启动器)!这些年来,我用过 3、4 个不同的平铺窗口管理器,它们都很有趣。 -我使用 Gnome 已有很长时间了,但是我仍然有点想念平铺窗口管理器。六个月前,一个朋友告诉我有关 [PaperWM][3] 的消息,它使你可以在 Gnome中 平铺窗口!我立即安装了它,并从那时起我一直在使用它。 +大约 6 年前,我觉得配置平铺窗口管理器对我来说不再是一件有趣的事情,因此转而使用 Ubuntu 桌面环境 Gnome。(现在,我的笔记本电脑中的内存增加了 500 倍,这要快得多 :) ) + +我使用 Gnome 已有很长时间了,但是我仍然有点想念平铺窗口管理器。六个月前,一个朋友告诉我有关 [PaperWM][3] 的消息,它使你可以在 Gnome 中平铺窗口!我立即安装了它,并从那时起我一直在使用它。 ### PaperWM:Gnome 下的平铺窗口管理 @@ -26,7 +28,7 @@ PaperWM:GNOME 下的平铺窗口管理 ### “Paper” 表示你的所有窗户都在一行中 -PaperWM 的主要思想是将所有窗口排成一行,这实际上与传统的平铺窗口管理器大不相同,在传统的平铺窗口管理器中,你可以按任意方式平铺窗口。这是我写这篇博客时在几个窗口之间切换/调整大小的 gif 图像(有一个浏览器和两个终端窗口): +PaperWM 的主要想法是将所有窗口排成一行,这实际上与传统的平铺窗口管理器大不相同,在传统的平铺窗口管理器中,你可以按任意方式平铺窗口。这是我写这篇博客时在几个窗口之间切换/调整大小的 gif 图像(有一个浏览器和两个终端窗口): ![][4] @@ -38,16 +40,14 @@ PaperWM 的 Github README 链接了此视频:,它 还有很多其他功能,但这是我使用的功能: - * 在窗口之间左右移动(`Super + ,`, `Super + .`) -  * 按顺序向左/向右移动窗口(`Super+Shift+,`,`Super+Shift+.`) -  * 全屏显示窗口(`Super + f`) -  * 缩小窗口(`Super + r`) - - +* 在窗口之间左右移动(`Super + ,`、`Super + .`) +* 按顺序向左/向右移动窗口(`Super+Shift+,`、`Super+Shift+.`) +* 全屏显示窗口(`Super + f`) +* 缩小窗口(`Super + r`) ### 我喜欢不需要配置的工具 -我在笔记本上使用 PaperWM 已经6个月了,我真的很喜欢它!即使它是可配置(通过编写 Javascript 配置文件),我也非常欣赏它,它自带我想要的功能,我无需研究如何去配置。 +我在笔记本上使用 PaperWM 已经 6 个月了,我真的很喜欢它!即使它是可配置(通过编写 Javascript 配置文件),我也非常欣赏它,它自带我想要的功能,我无需研究如何去配置。 [fish shell][5] 是另一个类似的令人愉悦的工具,我基本上没有配置 fish(除了设置环境变量等),我真的很喜欢它的默认功能。 @@ -58,7 +58,7 @@ via: https://jvns.ca/blog/2020/01/05/paperwm/ 作者:[Julia Evans][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3218e4aa8b7e9e4871dd2c2ce3b9606c0d005408 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 21:38:16 +0800 Subject: [PATCH 543/676] PUB @geekpi https://linux.cn/article-11779-1.html --- .../20200105 PaperWM- tiled window management for GNOME.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200105 PaperWM- tiled window management for GNOME.md (98%) diff --git a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md b/published/20200105 PaperWM- tiled window management for GNOME.md similarity index 98% rename from translated/tech/20200105 PaperWM- tiled window management for GNOME.md rename to published/20200105 PaperWM- tiled window management for GNOME.md index 7693b5446a..ea412dae95 100644 --- a/translated/tech/20200105 PaperWM- tiled window management for GNOME.md +++ b/published/20200105 PaperWM- tiled window management for GNOME.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11779-1.html) [#]: subject: (PaperWM: tiled window management for GNOME) [#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/) [#]: author: (Julia Evans https://jvns.ca/) From 6608f4dfc7bb89c4df675a9a77578f5d0e6a7287 Mon Sep 17 00:00:00 2001 From: qianmingtian <40565099+qianmingtian@users.noreply.github.com> Date: Mon, 13 Jan 2020 22:09:24 +0800 Subject: [PATCH 544/676] Translating by qianmingtian --- ...09 Huawei-s Linux Distribution openEuler is Available Now.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md index 93c4330b52..6f762fd0a2 100644 --- a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md +++ b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qianmingtian) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 21922e846dd44a124f1c9b409dd626f66356dda1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 22:39:55 +0800 Subject: [PATCH 545/676] PRF @robsean --- ...21 Simulate gravity in your Python game.md | 416 +++++++++--------- 1 file changed, 205 insertions(+), 211 deletions(-) diff --git a/translated/tech/20191121 Simulate gravity in your Python game.md b/translated/tech/20191121 Simulate gravity in your Python game.md index fd02e851d6..e220aca3ff 100644 --- a/translated/tech/20191121 Simulate gravity in your Python game.md +++ b/translated/tech/20191121 Simulate gravity in your Python game.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Simulate gravity in your Python game) @@ -9,91 +9,87 @@ 在你的 Python 游戏中模拟引力 ====== -学习如何使用 Python 的 Pygame 模块编程电脑游戏,并开始操作引力。 -![Cosmic stars in outer space][1] -真实的世界充满了运动和生活。物理学使得真实的生活如此忙碌和动态。物理学是物质在空间中运动的方式。既然一个电脑游戏世界没有物质,它也就没有物理学规律,使用游戏程序员不得不 _模拟_ 物理学。 +> 学习如何使用 Python 的 Pygame 模块编程电脑游戏,并开始操作引力。 -从大多数电脑游戏来说,这里基本上仅有物理学的两个方向是重要的:引力和碰撞。 +![](https://img.linux.net.cn/data/attachment/album/202001/13/223923k6t4zmvvmo6tfmmg.png) -当你[添加一个敌人][2]到你的游戏中时,你实现了一下碰撞检测,但是这篇文章添加更多的东西,因为引力需要碰撞检测。想想为什么引力可能涉及碰撞。如果你不能想到任何原因,不要担心—当你通过示例代码工作时,它将变得明显。 +真实的世界充满了运动和生活。物理学使得真实的生活如此忙碌和动态。物理学是物质在空间中运动的方式。既然一个电脑游戏世界没有物质,它也就没有物理学规律,使用游戏程序员不得不*模拟*物理学。 -引力在真实世界中的是有质量的物体来相互吸引的趋势。物体(质量)越大,它施加越大的引力作用。在电脑游戏物理学中,你不必创建质量足够大的物体来证明引力的正确;你可以在电脑游戏世界本身中仅编程一个物体落向假设的最大的对象的倾向。 +从大多数电脑游戏来说,这里基本上仅有两个方面的物理学是重要的:引力和碰撞。 + +当你[添加一个敌人][2]到你的游戏中时,你实现了一些碰撞检测,但是这篇文章要添加更多的东西,因为引力需要碰撞检测。想想为什么引力可能涉及碰撞。如果你不能想到任何原因,不要担心 —— 它会随着你开发示例代码工作而且显然。 + +在真实世界中的引力是有质量的物体来相互吸引的倾向性。物体(质量)越大,它施加越大的引力作用。在电脑游戏物理学中,你不必创建质量足够大的物体来证明引力的正确;你可以在电脑游戏世界本身中仅编程一个物体落向假设的最大的对象的倾向。 ### 添加一个引力函数 -记住你的玩家已经有一个属性来决定动作。使用这个属性来将玩家精灵拉向屏幕底部。 +记住你的玩家已经有了一个决定动作的属性。使用这个属性来将玩家精灵拉向屏幕底部。 在 Pygame 中,较高的数字更接近屏幕的底部边缘。 -在真实的世界中,引力影响一切。然而,在平台中,引力是有选择性的—如果你添加引力到你的整个游戏世界,你所有平台都将掉到地上。作为替换,你仅添加引力到你的玩家和敌人精灵中。 - -首先,在你的 **Player** 类中添加一个 **引力** 函数: +在真实的世界中,引力影响一切。然而,在平台游戏中,引力是有选择性的 —— 如果你添加引力到你的整个游戏世界,你的所有平台都将掉到地上。反之,你可以仅添加引力到你的玩家和敌人精灵中。 +首先,在你的 `Player` 类中添加一个 `gravity` 函数: ```     def gravity(self): -        self.movey += 3.2 # how fast player falls +        self.movey += 3.2 # 玩家掉落的多快 ``` 这是一个简单的函数。首先,不管你的玩家是否想运动,你设置你的玩家垂直运动。也就是说,你已经编程你的玩家总是在下降。这基本上就是引力。 -为使引力函数生效,你必需在你的主循环中调用它。这样,当每一个时钟滴答作响时,Python 应用下落运动到你玩家。 +为使引力函数生效,你必须在你的主循环中调用它。这样,当每一个处理循环时,Python 都应用下落运动到你的玩家。 在这代码中,添加第一行到你的循环中: - ``` -    player.gravity() # check gravity +    player.gravity() # 检查引力     player.update() ``` -启动你的游戏来看看会发生什么。注意,因为它快速地发生:你是玩家从天空上下落,恰好从你的游戏屏幕落下。 +启动你的游戏来看看会发生什么。要注意,因为它发生的很快:你是玩家从天空上下落,马上掉出了你的游戏屏幕。 你的引力模拟是工作的,但是,也许太好了。 作为一次试验,尝试更改你玩家下落的速度。 -### 添加一个地板到引力 +### 给引力添加一个地板 -你的游戏没有办法发现你的角色掉落出世界的问题。在一些游戏中,如果一个玩家掉落出世界,该精灵被删除,并在新的位置重生。在其它的游戏中,玩家丢失分数或一条生命。当一个玩家掉落出世界时,不管你想发生什么,你必需能够侦测出玩家何时消失在屏幕外。 +你的游戏没有办法发现你的角色掉落出世界的问题。在一些游戏中,如果一个玩家掉落出世界,该精灵被删除,并在某个新的位置重生。在另一些游戏中,玩家会丢失分数或一条生命。当一个玩家掉落出世界时,不管你想发生什么,你必须能够侦测出玩家何时消失在屏幕外。 -在 Python 中,要检查一个条件,你可以使用一个 **if** 语句。 +在 Python 中,要检查一个条件,你可以使用一个 `if` 语句。 -你必需查看你玩家**是否**正在掉落,以及你的玩家掉落到什么程度。如果你的玩家掉落到屏幕的底部,那么你可以做 _一些事情_ 。 为保持事情简单,设置玩家精灵的位置为底部边缘上方20像素。 - -使你的 **引力** 函数看起来像这样: +你必需查看你玩家**是否**正在掉落,以及你的玩家掉落的程度。如果你的玩家掉落到屏幕的底部,那么你可以做*一些事情*。简化一下,设置玩家精灵的位置为底部边缘上方 20 像素。 +使你的 `gravity` 函数看起来像这样: ```     def gravity(self): -        self.movey += 3.2 # how fast player falls +        self.movey += 3.2 # 玩家掉落的多快                 if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty ``` -然后,启动你的游戏。你的精灵仍然下落,但是它停在屏幕的底部。不过,你也许不能 _看到_ 你在地面层下的精灵。一个简单的解决方法是,在精灵碰撞游戏世界的底部后,通过添加另一个 **-ty** 到它的新 Y 位置,从而使你的精灵弹跳更高: - +然后,启动你的游戏。你的精灵仍然下落,但是它停在屏幕的底部。不过,你也许不能*看到*你在地面层之上的精灵。一个简单的解决方法是,在精灵碰撞游戏世界的底部后,通过添加另一个 `-ty` 到它的新 Y 位置,从而使你的精灵弹跳到更高处: ```     def gravity(self): -        self.movey += 3.2 # how fast player falls +        self.movey += 3.2 # 玩家掉落的多快                 if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty-ty ``` -现在你的玩家在屏幕底部弹跳,恰好在你地面层精灵的后面。 +现在你的玩家在屏幕底部弹跳,恰好在你地面精灵上面。 你的玩家真正需要的是反抗引力的方法。引力问题是,你不能反抗它,除非你有一些东西来推开引力作用。因此,在接下来的文章中,你将添加地面和平台碰撞以及跳跃能力。在这期间,尝试应用引力到敌人精灵。 - 到目前为止,这里是全部的代码: - ``` #!/usr/bin/env python3 # draw a world @@ -106,7 +102,7 @@ # GNU All-Permissive License # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved.  This file is offered as-is, +# notice and this notice are preserved. This file is offered as-is, # without any warranty. import pygame @@ -118,163 +114,163 @@ Objects ''' class Platform(pygame.sprite.Sprite): -    # x location, y location, img width, img height, img file     -    def __init__(self,xloc,yloc,imgw,imgh,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)).convert() -        self.image.convert_alpha() -        self.rect = self.image.get_rect() -        self.rect.y = yloc -        self.rect.x = xloc + # x location, y location, img width, img height, img file + def __init__(self,xloc,yloc,imgw,imgh,img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)).convert() + self.image.convert_alpha() + self.rect = self.image.get_rect() + self.rect.y = yloc + self.rect.x = xloc class Player(pygame.sprite.Sprite): -    ''' -    Spawn a player -    ''' -    def __init__(self): -        pygame.sprite.Sprite.__init__(self) -        self.movex = 0 -        self.movey = 0 -        self.frame = 0 -        self.health = 10 -        self.score = 1 -        self.images = [] -        for i in range(1,9): -            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() -            img.convert_alpha() -            img.set_colorkey(ALPHA) -            self.images.append(img) -            self.image = self.images[0] -            self.rect  = self.image.get_rect() + ''' + Spawn a player + ''' + def __init__(self): + pygame.sprite.Sprite.__init__(self) + self.movex = 0 + self.movey = 0 + self.frame = 0 + self.health = 10 + self.score = 1 + self.images = [] + for i in range(1,9): + img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() + img.convert_alpha() + img.set_colorkey(ALPHA) + self.images.append(img) + self.image = self.images[0] + self.rect = self.image.get_rect() -    def gravity(self): -        self.movey += 3.2 # how fast player falls -        -        if self.rect.y > worldy and self.movey >= 0: -            self.movey = 0 -            self.rect.y = worldy-ty-ty -        -    def control(self,x,y): -        ''' -        control player movement -        ''' -        self.movex += x -        self.movey += y -        -    def update(self): -        ''' -        Update sprite position -        ''' + def gravity(self): + self.movey += 3.2 # how fast player falls + + if self.rect.y > worldy and self.movey >= 0: + self.movey = 0 + self.rect.y = worldy-ty-ty + + def control(self,x,y): + ''' + control player movement + ''' + self.movex += x + self.movey += y + + def update(self): + ''' + Update sprite position + ''' -        self.rect.x = self.rect.x + self.movex -        self.rect.y = self.rect.y + self.movey + self.rect.x = self.rect.x + self.movex + self.rect.y = self.rect.y + self.movey -        # moving left -        if self.movex < 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[self.frame//ani] + # moving left + if self.movex < 0: + self.frame += 1 + if self.frame > ani*3: + self.frame = 0 + self.image = self.images[self.frame//ani] -        # moving right -        if self.movex > 0: -            self.frame += 1 -            if self.frame > ani*3: -                self.frame = 0 -            self.image = self.images[(self.frame//ani)+4] + # moving right + if self.movex > 0: + self.frame += 1 + if self.frame > ani*3: + self.frame = 0 + self.image = self.images[(self.frame//ani)+4] -        # collisions -        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) -        for enemy in enemy_hit_list: -            self.health -= 1 -            print(self.health) + # collisions + enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) + for enemy in enemy_hit_list: + self.health -= 1 + print(self.health) -        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) -        for g in ground_hit_list: -            self.health -= 1 -            print(self.health) + ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) + for g in ground_hit_list: + self.health -= 1 + print(self.health) class Enemy(pygame.sprite.Sprite): -    ''' -    Spawn an enemy -    ''' -    def __init__(self,x,y,img): -        pygame.sprite.Sprite.__init__(self) -        self.image = pygame.image.load(os.path.join('images',img)) -        #self.image.convert_alpha() -        #self.image.set_colorkey(ALPHA) -        self.rect = self.image.get_rect() -        self.rect.x = x -        self.rect.y = y -        self.counter = 0 -        -    def move(self): -        ''' -        enemy movement -        ''' -        distance = 80 -        speed = 8 + ''' + Spawn an enemy + ''' + def __init__(self,x,y,img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)) + #self.image.convert_alpha() + #self.image.set_colorkey(ALPHA) + self.rect = self.image.get_rect() + self.rect.x = x + self.rect.y = y + self.counter = 0 + + def move(self): + ''' + enemy movement + ''' + distance = 80 + speed = 8 -        if self.counter >= 0 and self.counter <= distance: -            self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: -            self.rect.x -= speed -        else: -            self.counter = 0 + if self.counter >= 0 and self.counter <= distance: + self.rect.x += speed + elif self.counter >= distance and self.counter <= distance*2: + self.rect.x -= speed + else: + self.counter = 0 -        self.counter += 1 + self.counter += 1 class Level(): -    def bad(lvl,eloc): -        if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # add enemy to group -            -        if lvl == 2: -            print("Level " + str(lvl) ) + def bad(lvl,eloc): + if lvl == 1: + enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy + enemy_list = pygame.sprite.Group() # create enemy group + enemy_list.add(enemy) # add enemy to group + + if lvl == 2: + print("Level " + str(lvl) ) -        return enemy_list + return enemy_list -    def loot(lvl,lloc): -        print(lvl) + def loot(lvl,lloc): + print(lvl) -    def ground(lvl,gloc,tx,ty): -        ground_list = pygame.sprite.Group() -        i=0 -        if lvl == 1: -            while i < len(gloc): -                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') -                ground_list.add(ground) -                i=i+1 + def ground(lvl,gloc,tx,ty): + ground_list = pygame.sprite.Group() + i=0 + if lvl == 1: + while i < len(gloc): + ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') + ground_list.add(ground) + i=i+1 -        if lvl == 2: -            print("Level " + str(lvl) ) + if lvl == 2: + print("Level " + str(lvl) ) -        return ground_list + return ground_list -    def platform(lvl,tx,ty): -        plat_list = pygame.sprite.Group() -        ploc = [] -        i=0 -        if lvl == 1: -            ploc.append((0,worldy-ty-128,3)) -            ploc.append((300,worldy-ty-256,3)) -            ploc.append((500,worldy-ty-128,4)) + def platform(lvl,tx,ty): + plat_list = pygame.sprite.Group() + ploc = [] + i=0 + if lvl == 1: + ploc.append((0,worldy-ty-128,3)) + ploc.append((300,worldy-ty-256,3)) + ploc.append((500,worldy-ty-128,4)) -            while i < len(ploc): -                j=0 -                while j <= ploc[i][2]: -                    plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') -                    plat_list.add(plat) -                    j=j+1 -                print('run' + str(i) + str(ploc[i])) -                i=i+1 + while i < len(ploc): + j=0 + while j <= ploc[i][2]: + plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png') + plat_list.add(plat) + j=j+1 + print('run' + str(i) + str(ploc[i])) + i=i+1 -        if lvl == 2: -            print("Level " + str(lvl) ) + if lvl == 2: + print("Level " + str(lvl) ) -        return plat_list + return plat_list ''' Setup @@ -283,12 +279,12 @@ worldx = 960 worldy = 720 fps = 40 # frame rate -ani = 4  # animation cycles +ani = 4 # animation cycles clock = pygame.time.Clock() pygame.init() main = True -BLUE  = (25,25,200) +BLUE = (25,25,200) BLACK = (23,23,23 ) WHITE = (254,254,254) ALPHA = (0,255,0) @@ -312,8 +308,8 @@ ty = 64 #tile size i=0 while i <= (worldx/tx)+tx: -    gloc.append(i*tx) -    i=i+1 + gloc.append(i*tx) + i=i+1 enemy_list = Level.bad( 1, eloc ) ground_list = Level.ground( 1,gloc,tx,ty ) @@ -323,45 +319,45 @@ plat_list = Level.platform( 1,tx,ty ) Main loop ''' while main == True: -    for event in pygame.event.get(): -        if event.type == pygame.QUIT: -            pygame.quit(); sys.exit() -            main = False + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit(); sys.exit() + main = False -        if event.type == pygame.KEYDOWN: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                print("LEFT") -                player.control(-steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                print("RIGHT") -                player.control(steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                print('jump') + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_LEFT or event.key == ord('a'): + print("LEFT") + player.control(-steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + print("RIGHT") + player.control(steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + print('jump') -        if event.type == pygame.KEYUP: -            if event.key == pygame.K_LEFT or event.key == ord('a'): -                player.control(steps,0) -            if event.key == pygame.K_RIGHT or event.key == ord('d'): -                player.control(-steps,0) -            if event.key == pygame.K_UP or event.key == ord('w'): -                print('jump') + if event.type == pygame.KEYUP: + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(-steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + print('jump') -            if event.key == ord('q'): -                pygame.quit() -                sys.exit() -                main = False + if event.key == ord('q'): + pygame.quit() + sys.exit() + main = False -    world.blit(backdrop, backdropbox) -    player.gravity() # check gravity -    player.update() -    player_list.draw(world) -    enemy_list.draw(world) -    ground_list.draw(world) -    plat_list.draw(world) -    for e in enemy_list: -        e.move() -    pygame.display.flip() -    clock.tick(fps) + world.blit(backdrop, backdropbox) + player.gravity() # check gravity + player.update() + player_list.draw(world) + enemy_list.draw(world) + ground_list.draw(world) + plat_list.draw(world) + for e in enemy_list: + e.move() + pygame.display.flip() + clock.tick(fps) ``` * * * @@ -375,8 +371,6 @@ while main == True: * [如何向你的 Python 游戏中添加一个敌人][2] * [在 Pygame 游戏中放置平台][9] - - -------------------------------------------------------------------------------- via: https://opensource.com/article/19/11/simulate-gravity-python @@ -384,7 +378,7 @@ via: https://opensource.com/article/19/11/simulate-gravity-python 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -394,8 +388,8 @@ via: https://opensource.com/article/19/11/simulate-gravity-python [2]: https://opensource.com/article/18/5/pygame-enemy [3]: https://www.python.org/ [4]: https://www.pygame.org -[5]: https://opensource.com/article/17/10/python-101 -[6]: https://opensource.com/article/17/12/game-framework-python -[7]: https://opensource.com/article/17/12/game-python-add-a-player -[8]: https://opensource.com/article/17/12/game-python-moving-player -[9]: https://opensource.com/article/18/7/put-platforms-python-game +[5]: https://linux.cn/article-9071-1.html +[6]: https://linux.cn/article-10850-1.html +[7]: https://linux.cn/article-10858-1.html +[8]: https://linux.cn/article-10874-1.html +[9]: https://linux.cn/article-10883-1.html From 5cb14926d2c1d394bf9da7746c85d586a9cb8345 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 22:40:22 +0800 Subject: [PATCH 546/676] PUB @robsean https://linux.cn/article-11780-1.html --- .../20191121 Simulate gravity in your Python game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191121 Simulate gravity in your Python game.md (99%) diff --git a/translated/tech/20191121 Simulate gravity in your Python game.md b/published/20191121 Simulate gravity in your Python game.md similarity index 99% rename from translated/tech/20191121 Simulate gravity in your Python game.md rename to published/20191121 Simulate gravity in your Python game.md index e220aca3ff..e69c8a86ce 100644 --- a/translated/tech/20191121 Simulate gravity in your Python game.md +++ b/published/20191121 Simulate gravity in your Python game.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11780-1.html) [#]: subject: (Simulate gravity in your Python game) [#]: via: (https://opensource.com/article/19/11/simulate-gravity-python) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 26e965e2c3dd8d416ed59f1613f00500471152bf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 22:48:46 +0800 Subject: [PATCH 547/676] PRF --- published/20191121 Simulate gravity in your Python game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20191121 Simulate gravity in your Python game.md b/published/20191121 Simulate gravity in your Python game.md index e69c8a86ce..309dbf2091 100644 --- a/published/20191121 Simulate gravity in your Python game.md +++ b/published/20191121 Simulate gravity in your Python game.md @@ -385,11 +385,11 @@ via: https://opensource.com/article/19/11/simulate-gravity-python [a]: https://opensource.com/users/seth [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmic.jpg?itok=bE94WtN- (Cosmic stars in outer space) -[2]: https://opensource.com/article/18/5/pygame-enemy +[2]: https://linux.cn/article-10883-1.html [3]: https://www.python.org/ [4]: https://www.pygame.org [5]: https://linux.cn/article-9071-1.html [6]: https://linux.cn/article-10850-1.html [7]: https://linux.cn/article-10858-1.html [8]: https://linux.cn/article-10874-1.html -[9]: https://linux.cn/article-10883-1.html +[9]: https://linux.cn/article-10902-1.html From 0e93ba1e8549748664271e32ef44dc4e6cf96496 Mon Sep 17 00:00:00 2001 From: qianmingtian Date: Mon, 13 Jan 2020 23:21:50 +0800 Subject: [PATCH 548/676] Translated by qianmingtian --- ...Distribution openEuler is Available Now.md | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md index 93c4330b52..ea6b5d24a5 100644 --- a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md +++ b/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qianmingtian) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,58 +7,59 @@ [#]: via: (https://itsfoss.com/openeuler/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Huawei’s Linux Distribution openEuler is Available Now! +华为的linux发行版 openEuler 可以使用了! ====== -Huawei offers a CentOS based enterprise Linux distribution called EulerOS. Recently, Huawei has released a community edition of EulerOS called [openEuler][1]. +华为提供了一个基于 CentOS 的企业 Linux 发行版 EulerOS 。最近,华为发布了一个名为 [openEuler][1] 的 EulerOS 社区版。 -The source code of openEuler is released as well. You won’t find it on Microsoft owned GitHub – the source code is available at [Gitee][2], a Chinese [alternative of GitHub][3]. +openEuler 的源代码也被发布了。你在微软旗下的 GitHub 上找不到它——源代码可以在 [Gitee][2] 找到,这是一个中文的 [GitHub 的替代品][3] 。 -There are two separate repositories, one for the [source code][2] and the other as a [package source][4] to store software packages that help to build the OS. +它有两个独立的存储库,一个用于存储[源代码][2],另一个作为[包源][4] 存储有助于构建操作系统的软件包。 -![][5] +![][5] -The openEuler infrastructure team shared their experience to make the source code available: +openuler 基础架构团队分享了他们使源代码可用的经验: -> We are very excited at this moment. It was hard to imagine that we will manage thousands of repositories. And to ensure that they can be compiled successfully, we would like to thank all those who participated in contributing +>我们现在很兴奋。很难想象我们会管理成千上万的仓库。为了确保它们能被成功地编译,我们要感谢所有参与贡献的人。 -### openEuler is a Linux distribution based on CentOS +### openEuler 是基于 CentOS 的 Linux 发行版 -Like EulerOS, openEuler OS is also based on [CentOS][6] but is further developed by Huawei Technologies for enterprise applications. +与 EulerOS 一样,openEuler OS 也是基于 [CentOS][6],但华为技术有限公司为企业应用进一步开发了该操作系统。 -It is tailored for ARM64 architecture servers and Huawei claims to have made changes to boost its performance. You can read more about it at [Huawei’s dev blog][7]. +它是为 ARM64 架构的服务器量身定做的,同时华为声称已经做了一些改变来提高其性能。你可以在[华为发展博客][7]上了解更多。 ![][8] -At the moment, as per the official openEuler announcement, there are more than 50 contributors with nearly 600 commits for openEuler. -The contributors made it possible to make the source code available to the community. +目前,根据 openEuler 的官方声明,有 50 多名贡献者为 openEuler 贡献了近 600 个提交。 -It is also worth noting that the repositories also include two new projects (or sub-projects) associated with it, [iSulad][9] **and A-Tune**. +贡献者使源代码对社区可用成为可能。 -A-Tune is an AI-based OS tuning software and iSulad is a lightweight container runtime daemon that is designed for IoT and Cloud infrastructure, as mentioned on [Gitee][2]. +值得注意的是,存储库还包括两个与之相关的新项目(或子项目),[iSulad][9] 和 **A-Tune**。 -Also, the official [announcement post][10] mentioned that these systems are built on the Huawei Cloud through script automation. So, that is definitely something interesting. +A-Tune 是一个基于 AI 的操作系统调优软件, iSulad 是一个轻量级的容器运行时守护进程,如[Gitee][2]中提到的那样,它是为物联网和云基础设施设计的。 -### Downloading openEuler +另外,官方的[公告][10]提到,这些系统是在华为云上通过脚本自动化构建的。这确实十分有趣。 + +### 下载 openEuler ![][11] -As of now, you won’t find the documentation for it in English – so you will have to wait for it or choose to help them with the [documentation][12]. +到目前为止,你找不到它的英文文档,所以你必须等待或选择通过[文档][12]帮助他们。 -You can download the ISO directly from its [official website][13] to test it out: +你可以直接从它的[官方网站][13]下载 ISO 来测试它: -[Download openEuler][13] +[下载 openEuler ][13] -### What do you think of Huawei openEuler? +### 你认为华为的 openEuler 怎么样? -As per cnTechPost, Huawei had announced that EulerOS would become open source under the new name openEuler. +据 cnTechPost 报道,华为曾宣布 EulerOS 将以新名字 openEuler 成为开源软件。 -At this point, it’s not clear if openEuler is replacing EulerOS or both will exist together like CentOS (community edition) and Red Hat (commercial edition). +目前还不清楚 openEuler 是否会取代 EulerOS ,或者两者会像 CentOS (社区版)和 Red Hat (商业版)一样同时存在。 -I haven’t tested it yet so I cannot say if openEuler is suitable for English speaking users or not. +我还没有测试过它,所以我不能说 openEuler 是否适合英文用户。 -Are you willing to give this a try? In case you’ve already tried it out, feel free to let me know your experience with it in the comments below. +你愿意试一试吗?如果你已经尝试过了,欢迎在下面的评论中告诉我你的体验。 -------------------------------------------------------------------------------- @@ -66,13 +67,14 @@ via: https://itsfoss.com/openeuler/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qianmingtian][c] 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://itsfoss.com/author/ankush/ [b]: https://github.com/lujun9972 +[c]: (https://github.com/qianmingtian) [1]: https://openeuler.org/en/ [2]: https://gitee.com/openeuler [3]: https://itsfoss.com/github-alternatives/ From 6ded4c1e208b94712515a232db00fa7e35307e0c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 23:21:58 +0800 Subject: [PATCH 549/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qianmingtian 恭喜你完成了第一篇翻译 --- ...t of User Accounts Expiring in -X- Days.md | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index 1e073e3051..a7264d60c7 100644 --- a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -1,40 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days) [#]: via: (https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -使用Bash 脚本发送包含 “X” 天内到期的用户账号列表的电子邮件 +使用 Bash 脚本发送包含几天内到期的用户账号列表的电子邮件 ====== -密码强制策略对所有操作系统和应用程序都是通用的。 +![](https://img.linux.net.cn/data/attachment/album/202001/13/232047vfxkrr47mn7eapda.jpg) -如果要 **[在Linux上实现密码强制策略][1]** ,请参阅以下文章。 +密码强制策略对所有操作系统和应用程序都是通用的。如果要[在 Linux 上实现密码强制策略][1],请参阅以下文章。 -默认情况下,大多数公司都会强制执行密码强制策略,但根据公司的要求,密码的时间周期会有所不同。 +默认情况下,大多数公司都会强制执行密码强制策略,但根据公司的要求,密码的时间周期会有所不同。通常每个人都使用 90 天的密码周期。用户只会在他们使用的一些服务器上[更改密码][2],而不会在他们不经常使用的服务器上更改密码。 -通常每个人都使用 90 天的密码周期。 +特别地,大多数团队忘记更改服务帐户密码,这可能导致日常工作的中断,即使他们配置有[基于 SSH 密钥的身份验证][3]。如果用户帐户密码过期,基于SSH密钥的身份验证和 [cronjob][4] 将不起作用。 -用户只会在他们使用的一些服务器上 **[更改密码][2]**,而不会在他们不经常使用的服务器上更改密码。 +为了避免这种情况,我们创建了一个 [shell 脚本][5]来向你发送 10 天内到期的用户帐户列表。 -特别地,大多数团队忘记更改服务帐户密码,这可能导致日常工作的中断,即使他们配置有 **[SSH基于密钥的身份验证][3]** 。 - -如果用户帐户密码过期,基于SSH密钥的身份验证和 **[cronjobs][4]** 将不起作用。 - -为了避免这种情况,我们创建了一个 **[shell脚本][5]** 来向您发送 10 天内到期的用户帐户列表。 - -本教程中包含两个 **[bash脚本][6]** 可以帮助您收集系统中用户到期日的信息。 +本教程中包含两个 [bash 脚本][6]可以帮助你收集系统中用户到期天数的信息。 ### 1) 检查 10 天后到期的用户帐户列表 -此脚本将帮助您检查终端上 10 天内到期的用户帐户列表。 +此脚本将帮助你在终端上检查 10 天内到期的用户帐户列表。 ``` # vi /opt/script/user-password-expiry.sh +``` +``` #!/bin/sh /tmp/user-expiry-1.txt /tmp/user-expiry.txt @@ -54,7 +50,7 @@ cat /tmp/user-expiry.txt | awk '$2 <= 10' > /tmp/user-expiry-1.txt cat /tmp/user-expiry-1.txt | column -t ``` -将文件 **“user password expiry.sh”** 设置为 Linux 可执行文件权限。 +将文件 `user-password-expiry.sh` 设置为可执行的 Linux 文件权限。 ``` # chmod +x /opt/script/user-password-expiry.sh @@ -73,18 +69,21 @@ u2 9 u3 3 u4 5 ``` + ### 2) 发送包含 10 天内到期的用户帐户列表的电子邮件 此脚本将发送一封包含 10 天内到期的用户帐户列表的邮件。 ``` # vi /opt/script/user-password-expiry-mail.sh +``` +``` #!/bin/sh SUBJECT="Information About User Password Expiration on "`date`"" MESSAGE="/tmp/user-expiry.txt" MESSAGE1="/tmp/user-expiry-1.txt" -TO="[email protected]" +TO="magesh.m@rentacenter.com" echo "-------------------------------------------------" >> $MESSAGE1 echo "UserName The number of days the password expires" >> $MESSAGE1 echo "-------------------------------------------------" >> $MESSAGE1 @@ -103,13 +102,13 @@ rm $MESSAGE rm $MESSAGE1 ``` -将文件 **“user-password-expiry-mail.sh”** 设置为 Linux 可执行文件权限。 +将文件 `user-password-expiry-mail.sh` 设置为可执行的 Linux 文件权限。 ``` # chmod +x /opt/script/user-password-expiry-mail.sh ``` -最后,添加一个 **[cronjob][4]** 去自动执行脚本。每天早上 8 点运行一次。 +最后,添加一个 [cronjob][4] 去自动执行脚本。每天早上 8 点运行一次。 ``` # crontab -e @@ -125,14 +124,14 @@ via: https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[qianmingtian][c] -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 [c]: https://github.com/qianmingtian -[1]: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ +[1]: https://linux.cn/article-11709-1.html [2]: https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-users-password-in-linux-using-shell-script/ [3]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ [4]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ From 55a7462779e2e3f63029040fc61ef75b061f8665 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 13 Jan 2020 23:23:21 +0800 Subject: [PATCH 550/676] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qianmingtian 本文首发地址: https://linux.cn/article-11781-1.html 你的 LCTT 专页地址: https://linux.cn/lctt/qianmingtian 请注册以领取 LCCN: https://lctt.linux.cn/ --- ...eMail With a List of User Accounts Expiring in -X- Days.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md (98%) diff --git a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md b/published/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md similarity index 98% rename from translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md rename to published/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md index a7264d60c7..9a46a42281 100644 --- a/translated/tech/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md +++ b/published/20200110 Bash Script to Send eMail With a List of User Accounts Expiring in -X- Days.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11781-1.html) [#]: subject: (Bash Script to Send eMail With a List of User Accounts Expiring in “X” Days) [#]: via: (https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From bf643db505d3ef992fcb4a83c946cbab81434d47 Mon Sep 17 00:00:00 2001 From: qianmingtian Date: Mon, 13 Jan 2020 23:29:29 +0800 Subject: [PATCH 551/676] Translated by qianmigntian and Creat a folder of news to store article --- ...0109 Huawei-s Linux Distribution openEuler is Available Now.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md (100%) diff --git a/sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md similarity index 100% rename from sources/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md rename to translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md From bfb7d22eed4fd29929dabdd7ca7dccd33b065c8d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:55:18 +0800 Subject: [PATCH 552/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200114=2016=20P?= =?UTF-8?q?laces=20to=20Buy=20a=20Pre-installed=20Linux=20Laptop=20Online?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md --- ...Buy a Pre-installed Linux Laptop Online.md | 368 ++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md diff --git a/sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md b/sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md new file mode 100644 index 0000000000..c57b44dfd3 --- /dev/null +++ b/sources/tech/20200114 16 Places to Buy a Pre-installed Linux Laptop Online.md @@ -0,0 +1,368 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (16 Places to Buy a Pre-installed Linux Laptop Online) +[#]: via: (https://www.2daygeek.com/buy-linux-laptops-computers-online/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +16 Places to Buy a Pre-installed Linux Laptop Online +====== + +Linux runs on most hardware these days, but most retailers do not have Linux operating systems pre-installed on their hardware. + +Gone are the days when users would only buy a Windows OS pre-installed laptop. + +Over the years, developers have purchased many Linux laptops as they work on major Linux applications related to Docker, Kubernetes, AI, cloud-native computing and machine learning. + +But now-a-days users are eager to buy a Linux laptop instead of Windows, which allows many vendors to choose Linux OS. + +### Why Pre-installed Linux? + +Now-a-days normal users also started using Linux OS because of its open source nature, security and reliability. + +But most of the retailers around the world do not sell Linux operating system pre-installed. + +It is difficult for Linux aspirants to find the compatible hardware and drivers to get Linux OS installed. + +So, we recommend to have Linux OS pre-installed computers instead of figuring out compatibility issues. + +Here we list the top 16 (not in particular order) manufacturer/vendor best known for preloaded Linux OS computers. + +### 1) Dell + +Dell is a US multinational computer technology company that commenced to sell and distribute pre-installed Ubuntu Linux computers for several years now. + +Initially it was started on 2012 as a community project called Sputnik. + +The strong community support to the project became a product. Over the year they launched the first Dell XPS 13 Developer Edition (Sputnik 3) after fixing some major issues in Sputnik 1 and Sputnik 2. + +[![][1]][2] + +They sells Red hat Enterprise Linux and Ubuntu Linux-based laptop for business use, developers and sysadmins. + +All systems are preloaded with Ubuntu but few of them were certified to install Red Hat Enterprise Linux 7.5 and RHEL 8. + +I hope you can install other distro as well if you want to run but i didn’t try it. + +The signature Linux products of Dell are **[XPS developer edition][3]**, **[Precision mobile workstation][4]** and Precision tower workstation. + + * **Availability:** Worldwide + * **Product Details:** [Dell Linux Systems][5] + + + +### 2) System 76 + +**[System76][6]** is an American computer manufacturer based in Denver, Colorado specializing in the sale of notebooks, desktops, and servers. + +From the year 2003, Sytem76 started to computers with the Linux operating system installed. + +They developed Linux distribution named Pop!_OS based on Ubuntu using the GNOME Desktop Environment for developers and professionals. + +[![][1]][7] + +The products are categorized majorly based on portability, storage, graphics and CPU performance. + +Lower laptop model Galago Pro is costing around $950 and higher models such as Adder WS and Serval WS are costing around $2000. + +They provide Destops(Thelio variants) in range of $800 to $2600. + +They also sell mini servers(Meerkat) ranges from $500 and Larger Servers(Jackal, Ibex and Starling) with preloaded Ubuntu ranges from $3000. + +They provide the laptop with the coreboot open source firmware, which is an alternative to the proprietary BIOS firmware. + +System76 ships their products to 60 countries all around the world in Africa, Europe, Asia, North America, South America, Australia and Zealandia. + + * **Availability:** To 60 countries worldwide + * **Product Details:** [System76][8] + + + +### 3) Purism + +Purism is a US-based company that commenced its operation in 2014. + +It manufactures the Librem personal computing devices with a focus on software freedom, computer security, and Internet privacy. + +[![][1]][9] + +Purism sell their products with PureOS installed, a Linux distribution based on Debain developed by purism. + +They sell multiple customized products such as Laptops, Tablets, Smartphones, Server and Librem key. + + * **Availability:** Worldwide + * **Product Details:** [Purism][10] + + + +### 4) Slimbook + +**[Slimbook][11]** commenced their operation in 2015 based in spain. + +It is a Linux friendly product that offers Laptops, Desktops, Mini Pc’s,All in one PC’s and Servers. + +[![][1]][12] + +It sell their products with with preloaded variety of Linux distributions, windows or both. + +They were the first to sell KDE OS installed. It is ideal for Linux beginners, since it is easy to use and easy to learn. + +The Laptop body is made of metal alloy based on aluminum and magnesium. + + * **Availability:** Worldwide + * **Product Details:** [Slimbook][13] + + + +### 5) Tuxedo Computers + +Tuxedo computers a german based company sells notebooks, desktops and mini computers with preloaded Linux. + +Their products desktop cost starts from around 480EUR, mini computers starts from 430EUR and notebooks starts from around 815EUR. + +They have both intel and AMD processors and come up with 5 years warranty and lifetime support. + +TUXEDO Computers are individually built computers and PCs being fully Linux-suitable. They sell their products to most part of Europe and USA. + + * **Availability:** Ships to many countries + * **Product Details:** [Tuxedo Computers][14] + + + +### 6) ThinkPenguin + +ThinkPengine is a US based company started their operation in 2008 to improve support for GNU/Linux and other free software operating systems. + +They sell desktops, notebooks, network equipment, storage devices, printers, scanners and other accessories that are compatible with Linux. + +They provide warranty from 90days to 3years based on the products. + + * **Availability:** Worldwide + * **Product Details:** [ThinkPenguin][15] + + + +### 7) Emperor Linux + +EmperorLinux is a US based company,since 1999 they provides Linux laptops with full hardware support under Linux. + +They offers Linux laptops with unique features such as Molecule RD3D using Sharp’s ground-breaking Auto-Stereo 3D display, Panasonic’s ToughBook line of rugged & semi-rugged Linux laptops. + +They also sell fully-functional Linux tablets, the Raven tablet (based on the ThinkPad X series). + + * **Availability:** USA (International shipping is available upon request). + * **Product Details:** [Emperor Linux][16] + + + +### 8) ZaReason + +ZaReason opened for business in the year 2007 based in US. + +They mainly focuses on R&D labs, businesses both small and large, universities and people’s homes. + +It has a long career building hardware for different distros such as Debian, Fedora, Ubuntu, Kubuntu, Edubuntu and Linux Mint Preloaded. + +[![][1]][17] + +And customer can even choose Linux disros of their choose other than specified. + +Their laptop ranges from $999 to $1699. Their desktop and mini computers ranges from $499 to $1199. + +They do sell desktop specific for game lovers (Gamebox9400). + +Default warranty will be for a year. Additional cost includes for extending the warranty till 3 years. + + * **Availability:** USA and Canada + * **Product Details:** [ZaReason][18] + + + +### 9) LAC Portland + +LAC(Los Alamos Computers) Portland is a US based company, provides Linux-based computers configured and supported by GNU and Linux professionals since 2000. + +They sell Lenovo desktops(ThinkCentre and ThinkStation) ranges from $845 to $2215 and laptops(ThinkPad) ranges from $926 to $2380. + +They install and sell Linux distors such as Ubuntu, Linux Mint, Debain, Fedora, CentOS, Scientific Linux, Open SUSE and Free DOS. + +They provide five years hardware and labor warranty with on-site support options backed worldwide by Lenovo. + + * **Availability:** USA + * **Product Details:** [LAC Portland][19] + + + +### 10) Entroware + +Entroware is a UK based company specialized in providing Ubuntu based computing solutions and services since early 2014 based on customers requirements. + +They sell Ubuntu and Ubuntu MATE powered Desktops, Laptops, and Servers using modern and high quality components. + +[![][1]][20] + +They do sell mini computers and All-in-one computers. + +Desktop ranges from $499 to $1900, laptops ranges from $740 to $1900 and server ranges from $1150 to $2000. + +They also sell accessories such as OS recovery drive, external hard drive, etc. + +The default warranty is for 3 years, they have three warranty plans for which additional may include. They also provide software support. + +Entroware currently ships to UK, Republic of Ireland, France, Germany, Italy and Spain. + + * **Availability:** UK and other European countries (Republic of Ireland, France, Germany, Italy and Spain). + * **Product Details:** [Entroware][21] + + + +### 11) Vikings + +Viking is based in Germany, sells Libre-friendly hardware certified by the Free Software Foundation with preinstalled Debian, Trisquel or Parabola Linux based on customer requirement. + +They sell desktops, laptops, servers, routers, mainboards, key generators, PCI cards and usb sound adaptors compatible with Linux. + +The Linux laptops and desktops by Vikings come with core boot or Libreboot. + +Their desktop ranges from 895EUR, laptop ranges from 250EUR and servers ranges from 990EUR. + +They provide refurbished/used parts: mainboard, CPU(s) with rigorous testing of all parts and also gives a comprehensive guarantee for all parts of the system. + +Their product warranty varies from 1year to 3year, with subsequent additional charges. + +They ship to all part of the world with very few exceptions such as North Korea. + + * **Availability:** Worldwide + * **Product Details:** [Viking][22] + + + +### 12) Juno Computers + +Juno Computers is company based in UK comes with pre-installed elementary OS or Ubuntu. + +They provide an application known as Kronos which allows for quick and easy installation of commercial applications such as Chrome, Dropbox, Spotify, Skype, etc. + +Their laptop ranges from $945/357EUR to $999/933EUR and mini PC ranges around $549/490EUR. + +They provide a 1-year limited warranty on all manufacture problems. + +Currently they ship to mainland USA, some Canadian provinces, and most part of the world includes South Africa, Asia and Europe. + + * **Availability:** Worldwide + * **Product Details:** [Juno Computers][23] + + + +### 13) Pine64 + +Pine64 is a US based community platform that offers laptops (**[Pinebooks][24]**), Pine Phones, Pine Watches(PineTime), Single board computers and other compatible Linux accessories. + +It commenced its operation in the year 2016 powered by ARM devices. + +[![][1]][25] + +The laptops ranges from $100 to $200. + +All single board and accessories sold on the Pine store are entitled to a 30 days Limited Warranty against defects in materials and workmanship, but provide online support through their forum. + +They almost ship to most part of the country, refer site shipping policy for more details. + + * **Availability:** Worldwide + * **Product Details:** [Pine64][26] + + + +### 14) Libiquity + +Libiquity is a US based company with R&D investments and its own personal computer brand since 2011. + +They offer laptop(Taurinus X200) preloaded with Trisquel and comes with ProteanOS, a free/libre and open source embedded operating system distribution endorsed by Free Software Foundation. + +Laptop ranges starts from $375. Product comes with limited warrant of 1 year. Currently their shipping are limited to US. + + * **Availability:** US + * **Product Details:** [Libiquity][27] + + + +### 15) LinuxCertified + +LinuxCertified an US based company offers lenovo desktops and laptops with Linux distros preinstalled. + +Various preloaded Linux distros offered are Ubuntu, Fedora, Open SUSE, CentOS, Redhat Enterprise Linux and Oracle Enterprise Linux. + +Desktops(ThinkStation) ranges from $899 to $2199 and laptops(Z1, LC series) ranges from $899 to $2199. + +Product warranty is for one year. They ship their product within US. + + * **Availability:** Worldwide + * **Product Details:** [LinuxCertified][28] + + + +### 16) Star Labs + +**[Star Labs][29]** was created by a group of Linux users, who created the ultimate Linux laptop for their own use. + +It’s based in the United Kingdom which sells laptops with Linux pre-installed. + +[![][1]][30] + +Star Labs offer a range of laptops designed and built specifically for Linux. + +All of their laptops come with a choice of Ubuntu Linux, Linux Mint or Zorin OS pre-installed. + +It is not limited to the above three distributions, and you can install any Linux distros on their hardware, and it runs flawlessly. + + * **Availability:** Worldwide + * **Product Details:** [Star Labs][31] + + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/buy-linux-laptops-computers-online/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.2daygeek.com/wp-content/uploads/2020/01/dell-xps-13-developer-deition-2.png +[3]: https://www.linuxtechnews.com/dells-new-xps-13-developer-edition-is-powered-by-the-10th-generation/ +[4]: https://www.linuxtechnews.com/dell-launches-three-new-dell-precision-developer-editions-laptops-preloaded-with-ubuntu-linux/ +[5]: https://www.dell.com/en-us/work/shop/overview/cp/linuxsystems +[6]: https://www.linuxtechnews.com/system76-has-announced-new-gazelle-laptops/ +[7]: https://www.2daygeek.com/wp-content/uploads/2020/01/system76-1.jpg +[8]: https://system76.com/laptops +[9]: https://www.2daygeek.com/wp-content/uploads/2020/01/librem-1.jpg +[10]: https://puri.sm/products/ +[11]: https://www.linuxtechnews.com/slimbook-is-offering-a-new-laptop-called-slimbook-pro-x/ +[12]: https://www.2daygeek.com/wp-content/uploads/2020/01/slimbook.jpg +[13]: https://slimbook.es/en/comparison-slimbook-pro-x-with-other-ultrabooks +[14]: https://www.tuxedocomputers.com/en/Linux-Hardware/Linux-Notebooks.tuxedo +[15]: https://www.thinkpenguin.com/catalog/notebook-computers-gnu-linux-2 +[16]: http://www.emperorlinux.com/systems/ +[17]: https://www.2daygeek.com/wp-content/uploads/2020/01/zareason-1.jpg +[18]: https://zareason.com/Laptops/ +[19]: https://shop.lacpdx.com/laptops/ +[20]: https://www.2daygeek.com/wp-content/uploads/2020/01/entroware.jpg +[21]: https://www.entroware.com/store/laptops +[22]: https://store.vikings.net/libre-friendly-hardware/x200-ryf-certfied +[23]: https://junocomputers.com/store/ +[24]: https://www.linuxtechnews.com/pinebook-pro-199-linux-laptop-pre-orders-ansi-iso-keyboards/ +[25]: https://www.2daygeek.com/wp-content/uploads/2020/01/Pinebook_Pro-photo-1.jpg +[26]: https://store.pine64.org/ +[27]: https://shop.libiquity.com/ +[28]: https://www.linuxcertified.com/linux_laptops.html +[29]: https://www.linuxtechnews.com/star-labs-offering-a-range-of-linux-laptops-with-zorin-os-15-pre-installed/ +[30]: https://www.2daygeek.com/wp-content/uploads/2020/01/starlabs-1.jpg +[31]: https://earth.starlabs.systems/pages/laptops From cd647dc917170514127d397669929ffcbb675e9b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:55:46 +0800 Subject: [PATCH 553/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200113=20How=20?= =?UTF-8?q?to=20setup=20a=20DNS=20server=20with=20bind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200113 How to setup a DNS server with bind.md --- ...113 How to setup a DNS server with bind.md | 387 ++++++++++++++++++ 1 file changed, 387 insertions(+) create mode 100644 sources/tech/20200113 How to setup a DNS server with bind.md diff --git a/sources/tech/20200113 How to setup a DNS server with bind.md b/sources/tech/20200113 How to setup a DNS server with bind.md new file mode 100644 index 0000000000..897dc825a8 --- /dev/null +++ b/sources/tech/20200113 How to setup a DNS server with bind.md @@ -0,0 +1,387 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to setup a DNS server with bind) +[#]: via: (https://fedoramagazine.org/how-to-setup-a-dns-server-with-bind/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +How to setup a DNS server with bind +====== + +![][1] + +The Domain Name System, or DNS, as it’s more commonly known, translates or converts domain names into the IP addresses associated with that domain. DNS is the reason you are able to find your favorite website by name instead of typing an IP address into your browser. This guide shows you how to configure a Master DNS system and one client. + +Here are system details for the example used in this article: + +``` +dns01.fedora.local (192.168.1.160 ) - Master DNS server +client.fedora.local (192.168.1.136 ) - Client +``` + +### DNS server configuration + +Install the bind packages using sudo: + +``` +$ sudo dnf install bind bind-utils -y +``` + +The _/etc/named.conf_ configuration file is provided by the _bind_ package to allow you to configure the DNS server. + +Edit the _/etc/named.conf_ file: + +``` +sudo vi /etc/named.conf +``` + +Look for the following line: + +``` +listen-on port 53 { 127.0.0.1; }; +``` + +Add the IP address of your Master DNS server as follows: + +``` +listen-on port 53 { 127.0.0.1; 192.168.1.160; }; +``` + +Look for the next line: + +``` +allow-query { localhost; }; +``` + +Add your local network range. The example system uses IP addresses in the 192.168.1.X range. This is specified as follows: + +``` +allow-query { localhost; 192.168.1.0/24; }; +``` + +Specify a forward and reverse zone. Zone files are simply text files that have the DNS information, such as IP addresses and host-names, on your system. The forward zone file makes it possible for the translation of a host-name to its IP address. The reverse zone file does the opposite. It allows a remote system to translate an IP address to the host name. + +Look for the following line at the bottom of the /etc/named.conf file: + +``` +include "/etc/named.rfc1912.zones"; +``` + +Here, you’ll specify the zone file information _**directly above that line**_ as follows: + +``` +zone "dns01.fedora.local" IN { +type master; +file "forward.fedora.local"; +allow-update { none; }; +}; + +zone "1.168.192.in-addr.arpa" IN { +type master; +file "reverse.fedora.local"; +allow-update { none; }; +}; +``` + +The _forward.fedora.local_ and the file _reverse.fedora.local_ are just the names of the zone files you will be creating. They can be called anything you like. + +Save and exit. + +#### Create the zone files + +Create the forward and reverse zone files you specified in the /etc/named.conf file: + +``` +$ sudo vi /var/named/forward.fedora.local +``` + +Add the following lines: + +``` +$TTL 86400 +@ IN SOA dns01.fedora.local. root.fedora.local. ( + 2011071001 ;Serial + 3600 ;Refresh + 1800 ;Retry + 604800 ;Expire + 86400 ;Minimum TTL +) +@ IN NS dns01.fedora.local. +@ IN A 192.168.1.160 +dns01 IN A 192.168.1.160 +client IN A 192.168.1.136 +``` + +Everything in _**bold**_ is specific to your environment. Save the file and exit. Next, edit the _reverse.fedora.local_ file: + +``` +$ sudo vi /var/named/reverse.fedora.local +``` + +Add the following lines: + +``` +$TTL 86400 +@ IN SOA dns01.fedora.local. root.fedora.local. ( + 2011071001 ;Serial + 3600 ;Refresh + 1800 ;Retry + 604800 ;Expire + 86400 ;Minimum TTL +) +@ IN NS dns01.fedora.local. +@ IN PTR fedora.local. +dns01 IN A 192.168.1.160 +client IN A 192.168.1.136 +160 IN PTR dns01.fedora.local. +136 IN PTR client.fedora.local. +``` + +Everything in _**bold**_ is also specific to your environment. Save the file and exit. + +You’ll also need to configure SELinux and add the correct ownership for the configuration files. + +``` +sudo chgrp named -R /var/named +sudo chown -v root:named /etc/named.conf +sudo restorecon -rv /var/named +sudo restorecon /etc/named.conf +``` + +Configure the firewall: + +``` +sudo firewall-cmd --add-service=dns --perm +sudo firewall-cmd --reload +``` + +#### Check the configuration for any syntax errors + +``` +sudo named-checkconf /etc/named.conf +``` + +Your configuration is valid if no output or errors are returned. + +Check the forward and reverse zone files. + +``` +$ sudo named-checkzone forward.fedora.local /var/named/forward.fedora.local + +$ sudo named-checkzone reverse.fedora.local /var/named/reverse.fedora.local +``` + +You should see a response of OK: + +``` +zone forward.fedora.local/IN: loaded serial 2011071001 +OK + +zone reverse.fedora.local/IN: loaded serial 2011071001 +OK +``` + +#### Enable and start the DNS service + +``` +$ sudo systemctl enable named +$ sudo systemctl start named +``` + +#### Configuring the resolv.conf file + +Edit the _/etc/resolv.conf_ file: + +``` +$ sudo vi /etc/resolv.conf +``` + +Look for your current name server line or lines. On the example system, a cable modem/router is serving as the name server and so it currently looks like this: + +``` +nameserver 192.168.1.1 +``` + +This needs to be changed to the IP address of the Master DNS server: + +``` +nameserver 192.168.1.160 +``` + +Save your changes and exit. + +Unfortunately there is one caveat to be aware of. NetworkManager overwrites the _/etc/resolv.conf_ file if the system is rebooted or networking gets restarted. This means you will lose all of the changes that you made. + +To prevent this from happening, make _/etc/resolv.conf_ immutable: + +``` +$ sudo chattr +i /etc/resolv.conf +``` + +If you want to set it back and allow it to be overwritten again: + +``` +$ sudo chattr -i /etc/resolv.conf +``` + +#### Testing the DNS server + +``` +$ dig fedoramagazine.org +``` + +``` +; <<>> DiG 9.11.13-RedHat-9.11.13-2.fc30 <<>> fedoramagazine.org +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8391 +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 6 + +;; OPT PSEUDOSECTION: + ; EDNS: version: 0, flags:; udp: 4096 + ; COOKIE: c7350d07f8efaa1286c670ab5e13482d600f82274871195a (good) + ;; QUESTION SECTION: + ;fedoramagazine.org. IN A + +;; ANSWER SECTION: + fedoramagazine.org. 50 IN A 35.197.52.145 + +;; AUTHORITY SECTION: + fedoramagazine.org. 86150 IN NS ns05.fedoraproject.org. + fedoramagazine.org. 86150 IN NS ns02.fedoraproject.org. + fedoramagazine.org. 86150 IN NS ns04.fedoraproject.org. + +;; ADDITIONAL SECTION: + ns02.fedoraproject.org. 86150 IN A 152.19.134.139 + ns04.fedoraproject.org. 86150 IN A 209.132.181.17 + ns05.fedoraproject.org. 86150 IN A 85.236.55.10 + ns02.fedoraproject.org. 86150 IN AAAA 2610:28:3090:3001:dead:beef:cafe:fed5 + ns05.fedoraproject.org. 86150 IN AAAA 2001:4178:2:1269:dead:beef:cafe:fed5 + + ;; Query time: 830 msec + ;; SERVER: 192.168.1.160#53(192.168.1.160) + ;; WHEN: Mon Jan 06 08:46:05 CST 2020 + ;; MSG SIZE rcvd: 266 +``` + +There are a few things to look at to verify that the DNS server is working correctly. Obviously getting the results back are important, but that by itself doesn’t mean the DNS server is actually doing the work. + +The QUERY, ANSWER, and AUTHORITY fields at the top should show non-zero as it in does in our example: + +``` +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 6 +``` + +And the SERVER field should have the IP address of your DNS server: + +``` +;; SERVER: 192.168.1.160#53(192.168.1.160) +``` + +In case this is the first time you’ve run the _dig_ command, notice how it took 830 milliseconds for the query to complete: + +``` +;; Query time: 830 msec +``` + +If you run it again, the query will run much quicker: + +``` +$ dig fedoramagazine.org +``` + +``` +;; Query time: 0 msec +;; SERVER: 192.168.1.160#53(192.168.1.160) +``` + +### Client configuration + +The client configuration will be a lot simpler. + +Install the bind utilities: + +``` +$ sudo dnf install bind-utils -y +``` + +Edit the /etc/resolv.conf file and configure the Master DNS as the only name server: + +``` +$ sudo vi /etc/resolv.conf +``` + +This is how it should look: + +``` +nameserver 192.168.1.160 +``` + +Save your changes and exit. Then, make the _/etc/resolv.conf_ file immutable to prevent it from be overwritten and going back to its default settings: + +``` +$ sudo chattr +i /etc/resolv.conf +``` + +#### Testing the client + +You should get the same results as you did from the DNS server: + +``` +$ dig fedoramagazine.org +``` + +``` +; <<>> DiG 9.11.13-RedHat-9.11.13-2.fc30 <<>> fedoramagazine.org +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8391 +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 6 + +;; OPT PSEUDOSECTION: + ; EDNS: version: 0, flags:; udp: 4096 + ; COOKIE: c7350d07f8efaa1286c670ab5e13482d600f82274871195a (good) + ;; QUESTION SECTION: + ;fedoramagazine.org. IN A + +;; ANSWER SECTION: + fedoramagazine.org. 50 IN A 35.197.52.145 + +;; AUTHORITY SECTION: + fedoramagazine.org. 86150 IN NS ns05.fedoraproject.org. + fedoramagazine.org. 86150 IN NS ns02.fedoraproject.org. + fedoramagazine.org. 86150 IN NS ns04.fedoraproject.org. + +;; ADDITIONAL SECTION: + ns02.fedoraproject.org. 86150 IN A 152.19.134.139 + ns04.fedoraproject.org. 86150 IN A 209.132.181.17 + ns05.fedoraproject.org. 86150 IN A 85.236.55.10 + ns02.fedoraproject.org. 86150 IN AAAA 2610:28:3090:3001:dead:beef:cafe:fed5 + ns05.fedoraproject.org. 86150 IN AAAA 2001:4178:2:1269:dead:beef:cafe:fed5 + + ;; Query time: 1 msec + ;; SERVER: 192.168.1.160#53(192.168.1.160) + ;; WHEN: Mon Jan 06 08:46:05 CST 2020 + ;; MSG SIZE rcvd: 266 +``` + +Make sure the SERVER output has the IP Address of your DNS server. + +Your DNS server is now ready to use and all requests from the client should be going through your DNS server now! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-setup-a-dns-server-with-bind/ + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/dns-server-bind-1-816x345.png From 139dc9f8c316463b2407f431e8e42f033c3ec70c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:56:24 +0800 Subject: [PATCH 554/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200114=20LMMS:?= =?UTF-8?q?=20A=20Free=20&=20Open=20Source=20Digital=20Audio=20Workstation?= =?UTF-8?q?=20(DAW)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md --- ... Source Digital Audio Workstation (DAW).md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md diff --git a/sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md b/sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md new file mode 100644 index 0000000000..1b3358f7bd --- /dev/null +++ b/sources/tech/20200114 LMMS- A Free - Open Source Digital Audio Workstation (DAW).md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LMMS: A Free & Open Source Digital Audio Workstation (DAW)) +[#]: via: (https://itsfoss.com/lmms/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +LMMS: A Free & Open Source Digital Audio Workstation (DAW) +====== + +_**In this week’s Linux application highlight, we take a look at a free and open-source DAW that helps make music with most of the essential features offered.**_ + +### LMMS: A Free & Open Source Software To Help Make Music + +[LMMS][1] is a cross-platform open source [DAW][2] hosted on [GitHub][3]. It is completely free to use and you do not need to purchase any kind of license to use it. + +If you’re curious, there’s no specific full-form for “LMMS” acronym but you can consider it along the lines of “**Let’s Make Music**” or formerly known as “**Linux MultiMedia Studio**” as stated in one of their [official forum post][4] years back. + +So, with the help of LMMS, you should be able to work on making music on Linux. + +Of course, you should not expect a free DAW to replace a full-fledged professional DAW bundled with proprietary plugins – but for starters, it isn’t a bad one. + +![][5] + +If you’re used to other DAWs, it might take a while to get comfortable with the user interface. For instance, I’ve used [Studio One][6] and [Mixcraft][7] as a beginner – so the UI of LMMS looked different. + +But, the good news is – you get a [detailed official documentation][8] of LMMS. So, if you have trouble learning how it works, simply refer to the official documentation available on their [website][1]. + +**Recommended Read:** + +![][9] + +#### [Best Audio Editors For Linux][10] + +These awesome free and open source audio editors let you create awesome music in Linux. Check out the list of top Linux audio editors. + +### Features of LMMS + +![][11] + +Just like any other DAW, you will find plugins, samples to use, instruments, and MIDI support. However, it is indeed a long list of features. So, instead of taking a whole day explaining it, let me highlight all the necessary features that LMMS provides. + + * Ability to add notes within the project without needing a separate note-taking app + * Bundled free plugins to use + * Note playback via MIDI or typing keyboard + * MIDI Editor + * Separate editor for instruments + * Track Automation support + * 64-bit VST instrument support (for wine-based VSTs) + * Built-in synthesizers that include some popular emulators for Yamaha and Roland + * Feature-rich audio plugins built-in + * Demo projects to easily get started + * Several samples included + * Native multisample support for SoundFont (SF2), Giga (GIG) and Gravis UltraSound (GUS) formats for high-quality instrument patches and banks (only if it’s relevant for your work) + * [LADSPA][12] plugin support + * You will also find the essential delay/reverb/compressor/limiter and distortion tools built-in + * Spectrum analyzer + + + +You can find some extensive [documentation on using LMMS][8]. If you face any difficulties, LMMS also has its [own forum][13] where you can ask for help. + +### Installing LMMS on Linux + +![][14] + +You can also find LMMS listed in the software center of your distribution- however, it might not feature the latest version. + +To get the latest LMMS version, you can download the .**AppImage** file from the [official download page][15]. If you want to take a look at the latest or previous releases on GitHub, you can find those in their [releases][16] section. + +If you want to use the AppImage file, you can refer to our guide on [using AppImage file][17]. + +You may also try [installing the Flatpak package][18] available on [Flathub][19]. + +[Download LMMS][15] + +### My Thoughts On LMMS + +![][20] + +Even though this is a feature-rich free and open-source DAW – personally, I found the UX a little dull. + +Of course, technically, it offers quite a lot of features and this could be useful for anyone who does not want to break their wallet to produce music. And, after all, it is an open-source solution. + +If you want a full-fledged professional DAW using the VST plugins, you might just hold on to Windows/Mac (if you’re used to it) because you still need to utilize Wine on Linux in order to make sure that the 64-bit VSTs work. + +**Wrapping Up** + +That being said, I’m not a professional music producer – so feel free to explore LMMS on Linux and make the most out of it without spending a penny. + +If you’ve used LMMS (or any similar DAW), let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lmms/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://lmms.io/ +[2]: https://en.wikipedia.org/wiki/Digital_audio_workstation +[3]: https://github.com/LMMS/lmms +[4]: https://lmms.io/forum/viewtopic.php?t=5908 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/lmms-screenshot.png?ssl=1 +[6]: https://www.presonus.com/products/studio-one/ +[7]: https://acoustica.com/mixcraft +[8]: https://docs.lmms.io/user-manual/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors.jpeg?fit=800%2C450&ssl=1 +[10]: https://itsfoss.com/best-audio-editors-linux/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/lmms-project.png?ssl=1 +[12]: https://www.ladspa.org/ +[13]: https://lmms.io/forum/ +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/lmms-setup.jpg?ssl=1 +[15]: https://lmms.io/download#linux +[16]: https://github.com/LMMS/lmms/releases +[17]: https://itsfoss.com/use-appimage-linux/ +[18]: https://itsfoss.com/flatpak-guide/ +[19]: https://flathub.org/apps/details/io.lmms.LMMS +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/lmms-midi-editor.png?ssl=1 From 075737d8223d57a0b4752b81a1d08e86993c500b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:57:16 +0800 Subject: [PATCH 555/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200113=20Keep?= =?UTF-8?q?=20your=20email=20in=20sync=20with=20OfflineIMAP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200113 Keep your email in sync with OfflineIMAP.md --- ...eep your email in sync with OfflineIMAP.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/tech/20200113 Keep your email in sync with OfflineIMAP.md diff --git a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md new file mode 100644 index 0000000000..1cd8370870 --- /dev/null +++ b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keep your email in sync with OfflineIMAP) +[#]: via: (https://opensource.com/article/20/1/sync-email-offlineimap) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Keep your email in sync with OfflineIMAP +====== +Mirroring your email to a local folder is the first step in taming your +message pileup. Learn how in the third article in our series on 20 ways +to be more productive with open source in 2020. +![email or newsletters via inbox and browser][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Sync your email locally with OfflineIMAP + +I have a love/hate relationship with email. I love the way it allows me to communicate with people all over the world. But, like many of you, I get a lot of mail, much of it from lists as well as spammers, advertisers, and the like. And it builds up. + +![The OfflineIMAP "blinkenlights" UI][2] + +Almost all the tools I've tried (outside of the big mail providers) that work really well with large amounts of mail have one thing in common: they all rely on a local copy of your mail stored in [Maildir][3] format. And the most useful tool for that is [OfflineIMAP][4]. OfflineIMAP is a Python script that mirrors IMAP mailboxes to a local Maildir folder tree. I use it to create a local copy of my mail and keep it in sync. Most Linux distributions include it, and it is available via Python's pip package manager. + +The sample minimal configuration file is a good template to start with; begin by copying it to **~/.offlineimaprc**. Mine looks something like this: + + +``` +[general] +accounts = LocalSync +ui=Quiet +autorefresh=30 + +[Account LocalSync] +localrepository = LocalMail +remoterepository = MirrorIMAP + +[Repository MirrorIMAP] +type = IMAP +remotehost = my.mail.server +remoteuser = myusername +remotepass = mypassword +auth_mechanisms = LOGIN +createfolder = true +ssl = yes +sslcacertfile = OS-DEFAULT + +[Repository LocalMail] +type = Maildir +localfolders = ~/Maildir +sep = . +createfolder = true +``` + +What my configuration does is define two repositories: the remote IMAP server and the local Maildir folder. There is also the **Account** that tells OfflineIMAP what to sync when it runs. You can define multiple accounts linked to different repositories. This allows you to copy from one IMAP server to another as a backup, in addition to making a copy locally. + +The first run of OfflineIMAP will take a while if you have a lot of mail. But once it is done, future runs take a _lot_ less time. You can also run OfflineIMAP as a cron job (my preference) or as a daemon constantly syncing between repositories. The documentation covers all of this, as well as advanced configuration options for things like Gmail. + +Now that my mail is copied locally, there is a whole range of tools I can work with to speed up searching, filing, and managing mail. And I'll talk about that tomorrow. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-email-offlineimap + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) +[2]: https://opensource.com/sites/default/files/uploads/productivity_3-1.png (The OfflineIMAP "blinkenlights" UI) +[3]: https://en.wikipedia.org/wiki/Maildir +[4]: http://www.offlineimap.org/ From d8a14df8bdc22c8d4ac484714a578eba34fdddc6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:57:54 +0800 Subject: [PATCH 556/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200113=20setV:?= =?UTF-8?q?=20A=20Bash=20function=20to=20maintain=20Python=20virtual=20env?= =?UTF-8?q?ironments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md --- ...to maintain Python virtual environments.md | 303 ++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md diff --git a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md new file mode 100644 index 0000000000..0a1192bccf --- /dev/null +++ b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -0,0 +1,303 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (setV: A Bash function to maintain Python virtual environments) +[#]: via: (https://opensource.com/article/20/1/setv-bash-function) +[#]: author: (Sachin Patil https://opensource.com/users/psachin) + +setV: A Bash function to maintain Python virtual environments +====== +Get to know setV, a lightweight Python virtual environment manager and +alternative to virtualenvwrapper. +![Coding on a computer][1] + +For more than a year, [setV][2] has been hidden away within my [bash_scripts][3] project, but it's time for it to become public. setV is a Bash function I use as an alternative to [virtualenvwrapper][4]. It provides basic features that enable you to do things such as: + + * Use Python 3 by default + * Create a new virtual environment + * Create a new virtual environment using a custom Python path with **-p** (or **\--python**) + * Delete an existing virtual environment + * List all existing virtual environment + * Use Tab completion (in case you don't remember the virtual environment name) + + + +### Installation + +To install setV, download the script: + + +``` +`curl https://gitlab.com/psachin/setV/raw/master/install.sh` +``` + +Review the script, and then run it: + + +``` +`sh ./install.sh` +``` + +When you install setV, the installation script asks you to source **~/.bashrc** or **~/.bash_profile**. Be sure to do that. + +### Usage + +The basic command is **setv**. + +#### Create a virtual environment: + + +``` +setv --new rango  # setv -n rango + +# Or using a custom Python binary path +setv --new --python /opt/python/python3 rango  # setv -n -p /opt/python/python3 rango +``` + +#### Activate an existing environment: + + +``` +setv VIRTUAL_ENVIRONMENT_NAME + +# For example +setv rango +``` + +#### List all virtual environments: + + +``` +setv --list +# or +setv [TAB] [TAB] +``` + +#### Delete a virtual environment: + + +``` +`setv --delete rango` +``` + +#### Switch to another virtual environment: + + +``` +# Assuming you are in 'rango', switch to 'tango' using +setv tango +``` + +#### Tab Completion + +If you don't fully remember the virtual environment's name, Bash-like Tab completion works for virtual environment names. + +### Get involved + +setV is open source under the GNU [GPLv3][5], and contributions are welcome. To learn more, visit the Contribute section of setV's [README][6] in its GitLab repository. + +### The setV script + + +``` +#!/usr/bin/env bash +# setV - A Lightweight Python virtual environment manager. +# Author: Sachin (psachin) <[iclcoolster@gmail.com][7]> +# Author's URL: +# +# License: GNU GPL v3, See LICENSE file +# +# Configure(Optional): +# Set `SETV_VIRTUAL_DIR_PATH` value to your virtual environments +# directory-path. By default it is set to '~/virtualenvs/' +# +# Usage: +# Manual install: Added below line to your .bashrc or any local rc script(): +# --- +# source /path/to/virtual.sh +# --- +# +# Now you can 'activate' the virtual environment by typing +# $ setv <YOUR VIRTUAL ENVIRONMENT NAME> +# +# For example: +# $ setv rango +# +# or type: +# setv [TAB] [TAB]  (to list all virtual envs) +# +# To list all your virtual environments: +# $ setv --list +# +# To create new virtual environment: +# $ setv --new new_virtualenv_name +# +# To delete existing virtual environment: +# $ setv --delete existing_virtualenv_name +# +# To deactivate, type: +# $ deactivate + +# Path to virtual environment directory +SETV_VIRTUAL_DIR_PATH="$HOME/virtualenvs/" +# Default python version to use. This decides whether to use `virtualenv` or `python3 -m venv` +SETV_PYTHON_VERSION=3  # Defaults to Python3 +SETV_PY_PATH=$(which python${SETV_PYTHON_VERSION}) + +function _setvcomplete_() +{ +    # Bash-autocompletion. +    # This ensures Tab-auto-completions work for virtual environment names. +    local cmd="${1##*/}" # to handle command(s). +                         # Not necessary as such. 'setv' is the only command + +    local word=${COMP_WORDS[COMP_CWORD]} # Words thats being completed +    local xpat='${word}'                 # Filter pattern. Include +                                         # only words in variable '$names' +    local names=$(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') # Virtual environment names + +    COMPREPLY=($(compgen -W "$names" -X "$xpat" -- "$word")) # compgen generates the results +} + +function _setv_help_() { +    # Echo help/usage message +    echo "Usage: setv [OPTIONS] [NAME]" +    echo Positional argument: +    echo -e "NAME                       Activate virtual env." +    echo Optional arguments: +    echo -e "-l, --list                 List all Virtual Envs." +    echo -e "-n, --new NAME             Create a new Python Virtual Env." +    echo -e "-d, --delete NAME          Delete existing Python Virtual Env." +    echo -e "-p, --python PATH          Python binary path." +} + +function _setv_custom_python_path() +{ +    if [ -f "${1}" ]; +    then +        if [ "`expr $1 : '.*python\\([2,3]\\)'`" = "3" ]; +        then +            SETV_PYTHON_VERSION=3 +        else +            SETV_PYTHON_VERSION=2 +        fi +        SETV_PY_PATH=${1} +        _setv_create $2 +    else +        echo "Error: Path ${1} does not exist!" +    fi +} + +function _setv_create() +{ +    # Creates new virtual environment if ran with -n|--new flag +    if [ -z ${1} ]; +    then +        echo "You need to pass virtual environment name" +        _setv_help_ +    else +        echo "Creating new virtual environment with the name: $1" + +        if [ ${SETV_PYTHON_VERSION} -eq 3 ]; +        then +            ${SETV_PY_PATH} -m venv ${SETV_VIRTUAL_DIR_PATH}${1} +        else +            virtualenv -p ${SETV_PY_PATH} ${SETV_VIRTUAL_DIR_PATH}${1} +        fi + +        echo "You can now activate the Python virtual environment by typing: setv ${1}" +    fi +} + +function _setv_delete() +{ +    # Deletes virtual environment if ran with -d|--delete flag +    # TODO: Refactor +    if [ -z ${1} ]; +    then +        echo "You need to pass virtual environment name" +        _setv_help_ +    else +        if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; +        then +            read -p "Really delete this virtual environment(Y/N)? " yes_no +            case $yes_no in +                Y|y) rm -rvf ${SETV_VIRTUAL_DIR_PATH}${1};; +                N|n) echo "Leaving the virtual environment as it is.";; +                *) echo "You need to enter either Y/y or N/n" +            esac +        else +            echo "Error: No virtual environment found by the name: ${1}" +        fi +    fi +} + +function _setv_list() +{ +    # Lists all virtual environments if ran with -l|--list flag +    echo -e "List of virtual environments you have under ${SETV_VIRTUAL_DIR_PATH}:\n" +    for virt in $(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') +    do +        echo ${virt} +    done +} + +function setv() { +    # Main function +    if [ $# -eq 0 ]; +    then +        _setv_help_ +    elif [ $# -le 3 ]; +    then +        case "${1}" in +            -n|--new) _setv_create ${2};; +            -d|--delete) _setv_delete ${2};; +            -l|--list) _setv_list;; +            *) if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; +               then +                   # Activate the virtual environment +                   source ${SETV_VIRTUAL_DIR_PATH}${1}/bin/activate +               else +                   # Else throw an error message +                   echo "Sorry, you don't have any virtual environment with the name: ${1}" +                   _setv_help_ +               fi +               ;; +        esac +    elif [ $# -le 5 ]; +    then +        case "${2}" in +            -p|--python) _setv_custom_python_path ${3} ${4};; +            *) _setv_help_;; +        esac +    fi +} + +# Calls bash-complete. The compgen command accepts most of the same +# options that complete does but it generates results rather than just +# storing the rules for future use. +complete  -F _setvcomplete_ setv +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/setv-bash-function + +作者:[Sachin Patil][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/psachin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://gitlab.com/psachin/setV +[3]: https://github.com/psachin/bash_scripts +[4]: https://virtualenvwrapper.readthedocs.org/ +[5]: https://gitlab.com/psachin/setV/blob/master/LICENSE +[6]: https://gitlab.com/psachin/setV/blob/master/ReadMe.org +[7]: mailto:iclcoolster@gmail.com From 7d946a5580087bec358a2bf18add6885852c84ae Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 14 Jan 2020 00:58:20 +0800 Subject: [PATCH 557/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200113=20Use=20?= =?UTF-8?q?this=20script=20to=20create,=20save,=20and=20run=20different=20?= =?UTF-8?q?rsync=20configurations=20via=20named=20profiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md --- ...rsync configurations via named profiles.md | 380 ++++++++++++++++++ 1 file changed, 380 insertions(+) create mode 100644 sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md diff --git a/sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md b/sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md new file mode 100644 index 0000000000..3b4e5fc6e4 --- /dev/null +++ b/sources/tech/20200113 Use this script to create, save, and run different rsync configurations via named profiles.md @@ -0,0 +1,380 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this script to create, save, and run different rsync configurations via named profiles) +[#]: via: (https://opensource.com/article/20/1/create-save-run-rsync-configurations) +[#]: author: (Petr Beránek https://opensource.com/users/pberanek) + +Use this script to create, save, and run different rsync configurations via named profiles +====== +A quick explanation of the rpf script. +![Person drinking a hat drink at the computer][1] + +The **rpf** script allows you to create, save, and run different rsync configurations via named profiles. + +For example, create a new profile named **backup** by typing **rpf -c backup**. Assume that the username is **user**. + +**rpf** creates the following directories: + + * **/home/user/.rpf** + * **/home/user/.rpf/shared** where you can place config files shared by multiple profiles + * **/home/user/.rpf/profiles** where all profiles are saved as subdirectories + + + +**rpf** also created **/home/user/.rpf/profiles/backup** that contains the files **conf** and **excluded**. + +The **conf** file defines rsync's configuration: + + +``` +# rsync config template +# +# Write each rsync option on separate line. For option details see man rsync. +# Empty lines and lines starting with # are ignored. Dynamic references +# (e.g. using command substitution) are not supported. +# +# Config files shared between different profiles should be saved in +# /home/user/.rpf/shared +# +# Example configuration: +# +\--verbose +\--archive +\--human-readable +# exclude all files that match pattern in: +\--exclude-from=/home/user/.rpf/profiles/backup/exclude +\--relative +# perform trial run, make no changes +\--dry-run +# source, e.g. +/home/user +# destination, e.g. +/mnt/usb_drive/users_backup +``` + +Now you can edit, add, or remove rsync options as needed. + +In **exclude**, you can define paths or patterns of files and directories you want to exclude from the transfer. To exclude **Trash** and **Downloads**, add the following lines: + + +``` +\- /home/user/.local/share/Trash +\- /home/user/Downloads +``` + +Or to transfer only **Documents** and **Projects** and exclude everything else: + + +``` +\+ /home/user/Documents +\+ /home/user/Projects +\- ** +``` + +For subtler pattern configurations, see the FILTER RULES section of **man rsync**, or Google for tutorials. + +When you are ready, you can start rsync transfer by typing **rpf backup**. + +That's it. + +For additional **rpf** options, see **rpf --help**. + +### Security + +Please be aware that **rpf** is not secure against code injection in the **conf** file. Any additional code (e.g., **; ./run_evil_script**) will also be executed. Therefore, protect your **.rpf/** config directory from malicious users by implementing appropriate permissions. Moreover, exploiting this behavior can lead to unexpected side effects. + +### The script + + +``` +#!/usr/bin/env bash +# +# Simple rsync profiler +# +# Author: [petrberanek.mail@gmail.com][2] (Petr Beranek) +# +# For usage details type `rpf --help' +# + +set -o errexit +set -o nounset + +__name=$(basename "${0}") +__version="0.1" + +config_dir="${HOME}/.rpf" +profiles_dir="${config_dir}/profiles" +shared_dir="${config_dir}/shared" +help="\ +Usage: ${__name} [OPTION...] PROFILE_NAME + +${__name} is simple rsync profiler that stores your different rsync +configurations in named profiles. + +Options: +    -c, --create-profile PROFILE_NAME   create new profile (profile data +                            are stored in ${config_dir}/PROFILE_NAME). +                            Profile name can contain alphanumeric +                            characters only. +    -s, --show-profile-config PROFILE_NAME  show content of profile +                            configuration file (stored in +                            ${config_dir}/PROFILE_NAME) +    -l, --list-profiles     list all available profiles +    -h, --help              show this help + +Example: +    Create new profile by typing +    ${__name} -c PROFILE_NAME + +    edit its config files stored by default in +    ${profiles_dir}/PROFILE_NAME + +    and then run it by typing +    ${__name} PROFILE_NAME + +    That's it. + +${__name} comes with ABSOLUTELY NO WARRANTY. This is free software, +and you are welcome to redistribute it under certain conditions. See +the GNU General Public Licence for details. + +Email bug reports or enhancement requests to [petrberanek.mail@gmail.com][2]. +" + +create_profile() { +    # Create dir with given profile name and with default content. +    # +    # Arguments: $1 -- profile name +    # +    # Creates files: conf, exclude +    # +    # If dir with the same name already exists, exits with error. +    # + +    local profile_name="${1}" +    local profile_dir="${profiles_dir}/${profile_name}" + +    # create default rpf dirs if missing +    if [[ ! -d "${profiles_dir}" ]]; then +        echo "Creating ${profiles_dir}" +        mkdir --parents "${profiles_dir}" +    fi +    if [[ ! -d "${shared_dir}" ]]; then +        echo "Creating ${shared_dir}" +        mkdir --parents "${shared_dir}" +    fi + +    # don't overwrite existing profile +    if [[ -d "${profile_dir}" ]]; then +        echo "${__name}: error: profile already exists." +        exit 1 +    fi + +    echo "Creating ${profile_dir}" +    mkdir "${profile_dir}" + +    # create `conf' template +    local conf="${profile_dir}/conf" +    echo "Creating ${conf}" +    cat << EOF > "${conf}" +# rsync config template +# +# Write each rsync option on separate line. For details see man rsync. +# Empty lines and lines starting with # are ignored. Dynamic references +# (e.g. using command substitution) are not supported. +# +# Config files shared between different profiles should be saved in +# ${shared_dir} +# +# Example configuration: +# +\--verbose +\--archive +\--human-readable +# file with patterns of files and directories in source excluded +# from transfer +\--exclude-from="${profiles_dir}/${profile_name}/exclude" +\--relative +# perform trial run, make no changes +\--dry-run +# source, e.g. +${HOME} +# destination, e.g. +/mnt/usb_drive/my_backup +EOF + +    # create `exclude' template +    local exclude="${profile_dir}/exclude" +    echo "Creating ${exclude}" +    cat << EOF > "${exclude}" +# \\`exclude' template +# +# Lines starting with # or ; are ignored. For details see man rsync, +# section FILTER RULES. +# +EOF + +    # all done +    echo "OK" +    echo "Edit profile config files in ${profile_dir} to fit your needs." +} + +list_profiles() { +    # Show all available rpf profiles. +    # +    # Assumes that all dirs in $profiles_dir are profiles. +    # + +    for item in "${profiles_dir}"/*; do +        if [[ -d "${item}" ]]; then +            basename "${item}" +        fi +    done +} + +show_help() { echo "${help}"; } + +show_profile_config() { +    # Show configuration file for given profile. +    # +    # Arguments: $1 -- profile name +    # + +    local profile_name="${1}" +    less "${profiles_dir}/${profile_name}/conf" +} + +check_profile_name() { +    # Check that name is not empty and contains alphanumeric chars only. +    # +    # Arguments: $1 -- profile name +    # +    # If test fails, exits with error. +    # + +    if [[ -z "${1}" ]]; then +        echo "${__name}: error: empty profile name." +        exit 1 +    elif [[ "${1}" =~ [^a-zA-Z0-9] ]]; then +        echo "${__name}: error: non-alphanumeric characters in profile name." +        exit 1 +    fi +} + +check_profile_exists() { +    # Check that $profile_name exists and is a directory. +    # +    # Arguments: $1 -- profile name +    # +    # If test fails, exits with error. +    # + +    local profile_name="${1}" +    if [[ ! -d "${profiles_dir}/${profile_name}" ]]; then +        echo "${__name}: error: profile ${profile_name} does not exist." +        exit 1 +    fi +} + +check_num_args() { +    # Check that value of $1 = number of arguments (excluding $1) +    # +    # Arguments: $1 -- limit (positive int) +    # +    # If test fails, exits with error. +    # + +    local num_args=$(( ${#} - 1 ))  # do not count $1 in total num of args +    if [[ "${1}" -ne "${num_args}" ]]; then +        echo "${__name}: error: expected num args: ${1}, received: $num_args" +        exit 1 +    fi +} + +run_rsync() { +    # Run rsync with configuration coresponding to given profile name. +    # +    # Arguments: $1 -- profile name +    # + +    local profile_name="${1}" +    local visual_div="==============================" +    local parsed_args +    parsed_args=$(grep --invert-match '^#' "${profiles_dir}/${profile_name}/conf" \ +                    | tr '\n' ' ') + +    # Print debug info +    echo "${visual_div}" +    echo "${__name} version: ${__version}" +    echo "args: ${parsed_args}" +    echo "${visual_div}" + +    # Expand $parsed_args - each item from conf file becomes rsync argument +    # shellcheck disable=SC2086 +    rsync ${parsed_args} +} + +if [[ "${#}" == 0 ]]; then +    show_help +    exit 1 +fi +while [[ "${#}" -gt 0 ]]; do +    case "${1}" in +        -c | --create-profile) +            check_num_args 2 "${@}" +            shift +            check_profile_name "${1:-}" # If $1 is not declared, set it empty. +            create_profile "${1}" +            exit 0;; +        -s | --show-profile-config) +            check_num_args 2 "${@}" +            shift +            check_profile_name "${1:-}" +            check_profile_exists "${1}" +            show_profile_config "${1}" +            exit 0;; +        -l | --list-profiles) +            check_num_args 1 "${@}" +            list_profiles +            exit 0;; +        -h | --help) +            check_num_args 1 "${@}" +            show_help +            exit 0;; +        -*) +            echo "${__name}: error: unknown option \\`${1}'" +            exit 1;; +        *) +            check_num_args 1 "${@}" +            check_profile_name "${1:-}" +            check_profile_exists "${1}" +            run_rsync "${1}" +            exit 0;; +    esac +    shift +done +``` + +* * * + +This was originally published in [Petr Beranek's GitHub repository][3] and it is licensed under GPLv3. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/create-save-run-rsync-configurations + +作者:[Petr Beránek][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/pberanek +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: mailto:petrberanek.mail@gmail.com +[3]: https://github.com/beranep/rpf From 3a1a4153bef23632ef52e57e97615d89c75cd9a0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 14 Jan 2020 08:57:20 +0800 Subject: [PATCH 558/676] translated --- ...Python web API with Pyramid and Cornice.md | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) rename {sources => translated}/tech/20200106 How to write a Python web API with Pyramid and Cornice.md (52%) diff --git a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md similarity index 52% rename from sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md rename to translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md index eaab46c5bc..ae3afc22af 100644 --- a/sources/tech/20200106 How to write a Python web API with Pyramid and Cornice.md +++ b/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -7,21 +7,20 @@ [#]: via: (https://opensource.com/article/20/1/python-web-api-pyramid-cornice) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) -How to write a Python web API with Pyramid and Cornice +如何使用 Pyramid 和 Cornice 编写 Python Web API ====== -Use Pyramid and Cornice to build and document scalable RESTful web -services. +使用 Pyramid 和 Cornice 构建可扩展的 RESTful Web 服务。 ![Searching for code][1] -[Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs. +[Python][2] 是一种高级的,面向对象的编程语言,它以其简单的语法而闻名。它一直是构建 RESTful API 的顶级编程语言之一。 -[Pyramid][3] is a Python web framework designed to scale up with an application: it's simple for simple applications but can grow for big, complex applications. Among other things, Pyramid powers PyPI, the Python package index. [Cornice][4] provides helpers to build and document REST-ish web services with Pyramid. +[Pyramid][3] 是一个 Python Web 框架,旨在随着应用的扩展而扩展:这对于简单的应用来说很简单,对于大型、复杂的应用也可以做到。Pyramid 为 PyPI (Python 软件包索引)提供了强大的支持。[Cornice][4] 提供了使用 Pyramid 构建 RESTful Web 服务的助手。 -This article will use the example of a web service to get famous quotes to show how to use these tools. +本文将使用 Web 服务的例子来获取名人名言,来展示如何使用这些工具。 -### Set up a Pyramid application +### 建立 Pyramid 应用 -Start by creating a virtual environment for your application and a file to hold the code: +首先为你的应用创建一个虚拟环境,并创建一个文件来保存代码: ``` @@ -33,9 +32,9 @@ $ source env/bin/activate (env) $ pip3 install cornice twisted ``` -### Import the Cornice and Pyramid modules +### 导入 Cornice 和 Pyramid 模块 -Import these modules with: +使用以下命令导入这些模块: ``` @@ -43,9 +42,9 @@ from pyramid.config import Configurator from cornice import Service ``` -### Define the service +### 定义服务 -Define the quotes service as a **Service** object: +将引用服务定义为 **Service** 对象: ``` @@ -54,9 +53,9 @@ QUOTES = Service(name='quotes',                  description='Get quotes') ``` -### Write the quotes logic +### 编写引用逻辑 -So far, this only supports **GET**ing quotes. Decorate the function with **QUOTES.get**; this is how you can tie in the logic to the REST service: +到目前为止,这仅支持 **GET** 获取名言。用 **QUOTES.get** 装饰函数。这是将逻辑绑定到 REST 服务的方法: ``` @@ -73,13 +72,13 @@ def get_quote(request):     } ``` -Note that unlike in other frameworks, the **get_quote** function is _not_ changed by the decorator. If you import this module, you can still call the function regularly and inspect the result. +请注意,与其他框架不同,装饰器_不能_更改 **get_quote** 函数。如果导入此模块,你仍然可以定期调用该函数并检查结果。 -This is useful when writing unit tests for Pyramid RESTful services. +在为 Pyramid RESTful 服务编写单元测试时,这很有用。 -### Define the application object +### 定义应用对象 -Finally, use **scan** to find all decorated functions and add them to the configuration:  +最后,使用 **scan** 查找所有修饰的函数并将其添加到配置中: ``` @@ -89,18 +88,18 @@ with Configurator() as config:     application = config.make_wsgi_app() ``` -The default for scan is to scan the current module. You can also give the name of a package if you want to scan all modules in a package. +默认扫描当前模块。如果要扫描软件包中的所有模块,你也可以提供软件包的名称。 -### Run the service +### 运行服务 -I use Twisted's WSGI server to run the application, but you can use any other [WSGI][5] server, like Gunicorn or uWSGI, if you want: +我使用 Twisted 的 WSGI 服务器运行该应用,但是如果需要,你可以使用任何其他 [WSGI][5] 服务器,例如 Gunicorn 或 uWSGI。 ``` `(env)$ python -m twisted web --wsgi=main.application` ``` -By default, Twisted's WSGI server runs on port 8080. You can test the service with [HTTPie][6]: +默认情况下,Twisted 的 WSGI 服务器运行在端口 8080 上。你可以使用 [HTTPie][6] 测试该服务: ``` @@ -129,11 +128,11 @@ X-Content-Type-Options: nosniff } ``` -### Why use Pyramid? +### 为什么要使用 Pyramid? -Pyramid is not the most popular framework, but it is used in some high-profile projects like [PyPI][7]. I like Pyramid because it is one of the frameworks that took unit testing seriously: because the decorators do not modify the function and there are no thread-local variables, functions are callable directly from unit tests. For example, functions that need access to the database will get it from the **request** object passed in via **request.config**. This allows a unit tester to put a mock (or real) database object in the request, instead of carefully setting globals, thread-local variables, or other framework-specific things. +Pyramid 不是最受欢迎的框架,但它已在 [PyPI][7] 等一些引人注目的项目中使用。我喜欢 Pyramid,因为它是认真对待单元测试的框架之一:因为装饰器不会修改函数并且没有线程局部变量,所以可以直接从单元测试中调用函数。例如,需要访问数据库的函数将从通过 **request.config** 传递的 **request.config** 对象中获取它。这允许单元测试人员将模拟(或真实)数据库对象放入请求中,而不用仔细设置全局变量,线程局部变量或其他特定于框架的东西。 -If you're looking for a well-tested library to build your next API, give Pyramid a try. You won't be disappointed. +如果你正在寻找一个经过测试的库来构建你接下来的 API,请尝试使用 Pyramid。你不会失望的。 -------------------------------------------------------------------------------- From d827e93709b6cbd73a92ced5e857ae5e81d76c1d Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 14 Jan 2020 09:02:35 +0800 Subject: [PATCH 559/676] translating --- ...se Stow for configuration management of multiple machines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md index 68a1eb0ebc..0d4a5f19d5 100644 --- a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md +++ b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a29479a75b4e81e5133d646b63a6e56cfb6bb622 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Tue, 14 Jan 2020 10:03:59 +0800 Subject: [PATCH 560/676] Update 20200112 What I learned going from prison to Python.md --- .../20200112 What I learned going from prison to Python.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200112 What I learned going from prison to Python.md b/sources/tech/20200112 What I learned going from prison to Python.md index 84dfa73ecb..93da6f1700 100644 --- a/sources/tech/20200112 What I learned going from prison to Python.md +++ b/sources/tech/20200112 What I learned going from prison to Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -84,7 +84,7 @@ via: https://opensource.com/article/20/1/prison-to-python 作者:[Shadeed "Sha" Wallace-Stepter][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 315c82742634f9de2047b0f3e9d7d40464f86673 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Tue, 14 Jan 2020 11:48:00 +0800 Subject: [PATCH 561/676] translating --- sources/tech/20200113 How to setup a DNS server with bind.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200113 How to setup a DNS server with bind.md b/sources/tech/20200113 How to setup a DNS server with bind.md index 897dc825a8..74cc32e747 100644 --- a/sources/tech/20200113 How to setup a DNS server with bind.md +++ b/sources/tech/20200113 How to setup a DNS server with bind.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 78bd977471aa002bd257e6f9bf960f164601b5a0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 15 Jan 2020 01:00:05 +0800 Subject: [PATCH 562/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Root?= =?UTF-8?q?=20User=20in=20Ubuntu:=20Important=20Things=20You=20Should=20Kn?= =?UTF-8?q?ow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md --- ...buntu- Important Things You Should Know.md | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md diff --git a/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md b/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md new file mode 100644 index 0000000000..247391ff82 --- /dev/null +++ b/sources/tech/20200115 Root User in Ubuntu- Important Things You Should Know.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Root User in Ubuntu: Important Things You Should Know) +[#]: via: (https://itsfoss.com/root-user-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Root User in Ubuntu: Important Things You Should Know +====== + +When you have just started using Linux, you’ll find many things that are different from Windows. One of those ‘different things’ is the concept of the root user. + +In this beginner series, I’ll explain a few important things about the root user in Ubuntu. + +**Please keep in mind that while I am writing this from Ubuntu user’s perspective, it should be valid for most Linux distributions.** + +You’ll learn the following in this article: + + * [Why root user is disabled in Ubuntu][1] + * [Using commands as root][2] + * [Switch to root user][3] + * [Unlock the root user][4] + + + +### What is root user? Why is it locked in Ubuntu? + +![][5] + +In Linux, there is always a super user called [root][6]. This is the super admin account that can do anything and everything with the system. It can access any file and run any command on your Linux system. + +With great power comes great responsibility. Root user gives you complete power over the system and hence it should be used with great cautious. Root user can access system files and run commands to make changes to the system configuration. And hence, an incorrect command may destroy the system. + +This is why [Ubuntu][7] and other Ubuntu-based distributions lock the root user by default to save you from accidental disasters. + +You don’t need to have root privilege for your daily tasks like moving file in your home directory, downloading files from internet, creating documents etc. + +_**Take this analogy for understanding it better. If you have to cut a fruit, you use a kitchen knife. If you have to cut down a tree, you have to use a saw. Now, you may use the saw to cut fruits but that’s not wise, is it?**_ + +Does this mean that you cannot be root in Ubuntu or use the system with root privileges? No, you can still have root access with the help of ‘sudo’ (explained in the next section). + +**Bottom line: +**Root user is too powerful to be used for regular tasks. This is why it is not recommended to use root all the time. You can still run specific commands with root. + +### How to run commands as root user in Ubuntu? + +![Image Credit: xkcd][8] + +You’ll need root privileges for some system specific tasks. For example, if you want to [update Ubuntu via command line][9], you cannot run the command as a regular user. It will give you permission denied error. + +``` +apt update +Reading package lists... Done +E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) +E: Unable to lock directory /var/lib/apt/lists/ +W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) +W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) +``` + +So, how do you run commands as root? The simple answer is to add sudo before the commands that require to be run as root. + +``` +sudo apt update +``` + +Ubuntu and many other Linux distributions use a special mechanism called sudo. Sudo is a program that controls access to running commands as root (or other users). + +Sudo is actually quite a versatile tool. It can be configured to allow a user to run all commands as root or only some commands as root. You can also configure if password is required for some commands or not to run it with sudo. It’s an extensive topic and maybe I’ll discuss it in details in another article. + +For the moment, you should know that [when you install Ubuntu][10], you are forced to create a user account. This user account works as the admin on your system and as per the default sudo policy in Ubuntu, it can run any command on your system with root privileges. + +The thing with sudo is that running **sudo doesn’t require root password but the user’s own password**. + +And this is why when you run a command with sudo, it asks for the password of the user who is running the sudo command: + +``` +[email protected]:~$ sudo apt update +[sudo] password for abhishek: +``` + +As you can see in the example above, user _abhishek_ was trying to run the ‘apt update’ command with _sudo_ and the system asked the password for _abhishek_. + +If you are absolutely new to Linux, you might be surprised that when you start typing your password in the terminal, nothing happens on the screen. This is perfectly normal because as the default security feature, nothing is displayed on the screen. Not even the asterisks (*). You type your password and press enter. + +**Bottom line: +**To run commands as root in Ubuntu, add sudo before the command. +When asked for password, enter your account’s password. +When you type the password on the screen, nothing is visible. Just keep on typing the password and press enter. + +### How to become root user in Ubuntu? + +You can use sudo to run the commands as root. However in situations, where you have to run several commands as root and you keep forogetting to add sudo before the commands, you may switch to root user temporarily. + +The sudo command allows you to simulate a root login shell with this command: + +``` +sudo -i +``` + +``` +[email protected]:~$ sudo -i +[sudo] password for abhishek: +[email protected]:~# whoami +root +[email protected]:~# +``` + +You’ll notice that when you switch to root, the shell command prompt changes from $ (dollar key sign) to # (pound key sign). This makes me crack a (lame) joke that pound is stronger than dollar. + +_**Though I have showed you how to become the root user, I must warn you that you should avoid using the system as root. It’s discouraged for a reason after all.**_ + +Another way to temporarily switch to root user is by using the su command: + +``` +sudo su +``` + +If you try to use the su command without sudo, you’ll encounter ‘su authentication failure’ error. + +You can go back to being the normal user by using the exit command. + +``` +exit +``` + +### How to enable root user in Ubuntu? + +By now you know that the root user is locked by default in Ubuntu based distributions. + +Linux gives you the freedom to do whatever you want with your system. Unlocking the root user is one of those freedoms. + +If, for some reasons, you decided to enable the root user, you can do so by setting up a password for it: + +``` +sudo passwd root +``` + +Again, this is not recommended and I won’t encourage you to do that on your desktop. If you forgot it, you won’t be able to [change the root password in Ubuntu][11] again. + +You can lock the root user again by removing the password: + +``` +sudo passwd -dl root +``` + +**In the end…** + +I hope you have a slightly better understanding of the root concept now. If you still have some confusion and questions about it, please let me know in the comments. I’ll try to answer your questions and might update the article as well. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/root-user-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: tmp.IrHYJBAqVn#what-is-root +[2]: tmp.IrHYJBAqVn#run-command-as-root +[3]: tmp.IrHYJBAqVn#become-root +[4]: tmp.IrHYJBAqVn#enable-root +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/root_user_ubuntu.png?ssl=1 +[6]: http://www.linfo.org/root.html +[7]: https://ubuntu.com/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/sudo_sandwich.png?ssl=1 +[9]: https://itsfoss.com/update-ubuntu/ +[10]: https://itsfoss.com/install-ubuntu/ +[11]: https://itsfoss.com/how-to-hack-ubuntu-password/ From 024c95a9e6b27345287ec0cad7fc43660fd918ff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 15 Jan 2020 01:00:41 +0800 Subject: [PATCH 563/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200114=20Organi?= =?UTF-8?q?ze=20your=20email=20with=20Notmuch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200114 Organize your email with Notmuch.md --- ...200114 Organize your email with Notmuch.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20200114 Organize your email with Notmuch.md diff --git a/sources/tech/20200114 Organize your email with Notmuch.md b/sources/tech/20200114 Organize your email with Notmuch.md new file mode 100644 index 0000000000..f881ff5ad9 --- /dev/null +++ b/sources/tech/20200114 Organize your email with Notmuch.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organize your email with Notmuch) +[#]: via: (https://opensource.com/article/20/1/organize-email-notmuch) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Organize your email with Notmuch +====== +Notmuch indexes, tags, and sorts your email. Learn how to use it in the +fourth article in our series on 20 ways to be more productive with open +source in 2020. +![Filing cabinet for organization][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Index your email with Notmuch + +Yesterday, I talked about how I use OfflineIMAP to [sync my mail][2] to my local machine. Today, I'll talk about how I preprocess all that mail before I read it. + +![Notmuch][3] + +[Maildir][4] is probably one of the most useful mail storage formats out there. And there are a LOT of tools to help with managing your mail. The one I keep coming back to is a little program called [Notmuch][5] that indexes, tags, and searches mail messages. And there are several programs that work with Notmuch to make it even easier to handle a large amount of mail. + +Most Linux distributions include Notmuch, and you can also get it for MacOS. Windows users can access it through Windows Subsystem for Linux ([WSL][6]), but it may require some additional tweaks. + +![Notmuch's first run][7] + +On Notmuch's very first run, it will ask you some questions and create a **.notmuch-config** file in your home directory. Next, index and tag all your mail by running **notmuch new**. You can verify it with **notmuch search tag:new**; this will find all messages with the "new" tag. That's probably a lot of mail since Notmuch uses the "new" tag to indicate messages that are new to it, so you'll want to clean that up. + +Run **notmuch search tag:unread** to find any unread messages; that should result in quite a lot less mail. To remove the "new" tag from messages you've already seen, run **notmuch tag -new not tag:unread**, which will search for all messages without the "unread" tag and remove the "new" tag from them. Now when you run **notmuch search tag:new**, it should show only the unread mail messages. + +Tagging messages in bulk is probably more useful, though, since manually updating tags at every run can be really tedious. The **\--batch** command-line option tells Notmuch to read multiple lines of commands and execute them. There is also the **\--input=filename** option, which reads commands from a file and applies them. I have a file called **tagmail.notmuch** that I use to add tags to mail that is "new"; it looks something like this: + + +``` +# Manage sent, spam, and trash folders +-unread -new folder:Trash +-unread -new folder:Spam +-unread -new folder:Sent + +# Note mail sent specifically to me (excluding bug mail) ++to-me to:kevin at sonney.com and tag:new and not tag:to-me + +# And note all mail sent from me ++sent from:kevin at sonney.com and tag:new and not tag:sent + +# Remove the new tag from messages +-new tag:new +``` + +I can then run **notmuch tag --input=tagmail.notmuch** to bulk-process my mail messages after running **notmuch new**, and then I can search on those tags as well. + +Notmuch also supports running pre- and post-new hooks. These scripts, stored in **Maildir/.notmuch/hooks**, define actions to run before (pre-new) and after (post-new) to index new mail with **notmuch new**. In yesterday's article, I talked about using [OfflineIMAP][8] to sync mail from my IMAP server. It's very easy to run it from the "pre-new" hook: + + +``` +#!/bin/bash +# Remove the new tag from messages that are still tagged as new +notmuch tag -new tag:new + +# Sync mail messages +offlineimap -a LocalSync -u quiet +``` + +You can also use the Python application [afew][9], which interfaces with the Notmuch database, to tag things like _Mailing List_ and _Spam_ for you. You can run afew from the post-new hook in a similar way: + + +``` +#!/bin/bash +# tag with my custom tags +notmuch tag --input=~/tagmail.notmuch + +# Run afew to tag new mail +afew -t -n +``` + +I recommend that when using afew to tag messages, you do NOT use the **[ListMailsFilter]** since some mail handlers add obscure or downright junk List-ID headers to mail messages (I'm looking at you, Google). + +![alot email client][10] + +At this point, any mail reader that supports Notmuch or Maildir can work with my email. I'll sometimes use [alot][11], a Notmuch-specific client, to read mail at the console, but it's not as fancy as some other mail readers. + +In the coming days, I'll show you some other mail clients that will likely integrate with tools you already use. In the meantime, check out some of the other tools that work with Maildir mailboxes—you might find a hidden gem I've not tried yet. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/organize-email-notmuch + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) +[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch) +[4]: https://en.wikipedia.org/wiki/Maildir +[5]: https://notmuchmail.org/ +[6]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[7]: https://opensource.com/sites/default/files/uploads/productivity_4-2.png (Notmuch's first run) +[8]: http://www.offlineimap.org/ +[9]: https://afew.readthedocs.io/en/latest/index.html +[10]: https://opensource.com/sites/default/files/uploads/productivity_4-3.png (alot email client) +[11]: https://github.com/pazz/alot From 633dd3a525b81e87caaa5fe5e6c18988852725f0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 15 Jan 2020 01:01:59 +0800 Subject: [PATCH 564/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200114=20What?= =?UTF-8?q?=20communities=20of=20practice=20can=20do=20for=20your=20organi?= =?UTF-8?q?zation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200114 What communities of practice can do for your organization.md --- ...f practice can do for your organization.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20200114 What communities of practice can do for your organization.md diff --git a/sources/tech/20200114 What communities of practice can do for your organization.md b/sources/tech/20200114 What communities of practice can do for your organization.md new file mode 100644 index 0000000000..886fc05201 --- /dev/null +++ b/sources/tech/20200114 What communities of practice can do for your organization.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What communities of practice can do for your organization) +[#]: via: (https://opensource.com/open-organization/20/1/why-build-community-of-practice) +[#]: author: (Tracy Buckner https://opensource.com/users/tracyb) + +What communities of practice can do for your organization +====== +In open organizations, fostering passionate communities can increase +collaboration, accelerate problem solving, and lead to greater +innovation. +![Lots of people in a crowd.][1] + +As I discussed in the [first part of this series][2], community is a fundamental principle in open organizations. In open organizations, people often define their roles, responsibilities, and affiliations through shared interests and passions—[not title, role, or position on an organizational chart][3]. + +So fostering and supporting communities of practice (CoPs) can be a great strategy for building a more open organization. Members of communities of practice interact regularly, discuss various topics, and solve problems collectively and collaboratively. These communities provide members with an opportunity to share their expertise, learn from others, and network with one another. + +As Luis Gonçalves states in [Learning Organisation][4]: + +> CoPs provide a shared context where members of the organisation can communicate and share information; stimulate learning through peer-to-peer mentoring, coaching, self-reflection, and collaboration; generate new knowledge; and initiate projects that develop tangible results. + +But those aren't the only value such communities can offer. Communities of practice can also enhance an organization in the following ways (summarized in Figure 1). + +**Decreased learning curves**. Many organizations face the challenge of rapidly increasing productivity of new employees (or members). This task becomes especially challenging in organizations where an employee's manager may be located in a different state, country, or region. Communities of practice offer new employees a network of connections they can tap into more quickly and easily. By joining a CoP, they can immediately access a network of experts and share resources, ask questions, and seek guidance outside the formal lines of the organizational chart. + +Members of communities of practice interact regularly, discuss various topics, and solve problems collectively and collaboratively. + +**Increased collaboration.** A recent survey from My Customer.com [shows][5] that 40 percent of company employees report not feeling adequately supported by their colleagues—because "different departments have their own agendas." A lack of collaboration between departments limits innovation and increases opportunities for miscommunication. Communities of practice encourage members from _all_ roles across _all_ departments to unite in sharing their expertise. This increases collaboration and reduces the threat of organizational silos. + +**Rapid problem-solving.** Communities of practice provide a centralized location for communication and resources useful for solving organizational or business problems. Enabling people to come together—regardless of their organizational reporting structure, location, and/or management structure—encourages problem-solving and can lead to faster resolution of those problems. + +**Enhanced innovation.** Researchers Pouwels and Koster [recently argued][6] that “collaboration contributes to innovation." CoPs provide a unique opportunity for members to collaborate on topics within their shared domains of interest and passion. This passion ignites a desire to discover new and innovative ways to solve problems and create new ideas. + +![Benefits of Communities of Practice][7] + +_Figure 1: Benefits of communities of practice. Courtesy of Tracy Buckner. CC BY-SA._ + +[Étienne Wenger][8], an educational theorist and proponent of communities of practice, said that learning doesn't only occur through a master; it also happens among apprentices. Communities of practice foster learning by connecting apprentices, while encouraging collaboration and offering an opportunity for creative problem-solving and innovation. + +In the final article of this series, I'll explain how you can reap these benefits by creating your own community of practice. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/1/why-build-community-of-practice + +作者:[Tracy Buckner][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/tracyb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_community2.png?itok=1blC7-NY (Lots of people in a crowd.) +[2]: https://opensource.com/open-organization/19/11/what-is-community-practice +[3]: https://opensource.com/open-organization/resources/open-org-definition +[4]: https://www.organisationalmastery.com/category/learning-organisation/ +[5]: https://www.mycustomer.com/experience/engagement/the-stats-that-prove-silos-are-your-biggest-cx-challenge +[6]: https://www.researchgate.net/profile/Ferry_Koster/publication/313659568_Inter-organizational_cooperation_and_organizational_innovativeness_A_comparative_study/links/59e64d510f7e9b13aca3c224/Inter-organizational-cooperation-and-organizational-innovativeness-A-comparative-study.pdf +[7]: https://opensource.com/sites/default/files/images/open-org/cop_benefits.png (Benefits of Communities of Practice) +[8]: https://en.wikipedia.org/wiki/%C3%89tienne_Wenger From 269d986ccda0b7b05bbcbfe6452a0cab33f5eb0a Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 15 Jan 2020 08:51:01 +0800 Subject: [PATCH 565/676] translated --- ... across multiple devices with Syncthing.md | 65 ------------------- ... across multiple devices with Syncthing.md | 63 ++++++++++++++++++ 2 files changed, 63 insertions(+), 65 deletions(-) delete mode 100644 sources/tech/20200111 Sync files across multiple devices with Syncthing.md create mode 100644 translated/tech/20200111 Sync files across multiple devices with Syncthing.md diff --git a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md b/sources/tech/20200111 Sync files across multiple devices with Syncthing.md deleted file mode 100644 index d662fc1a78..0000000000 --- a/sources/tech/20200111 Sync files across multiple devices with Syncthing.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Sync files across multiple devices with Syncthing) -[#]: via: (https://opensource.com/article/20/1/sync-files-syncthing) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Sync files across multiple devices with Syncthing -====== -Learn how to sync files between devices with Syncthing in the first -article in our series on 20 ways to be more productive with open source -in 2020. -![Files in a folder][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Syncing files with Synthing - -Setting up a new machine is a pain. We all have our "standard setups" that we copy from machine to machine. And over the years, I've used a lot of ways to keep them in sync between machines. In the old days (and this will tell you how old I am), it was with floppy disks, then Zip disks, USB sticks, SCP, Rsync, Dropbox, ownCloud—you name it. And they never seemed to work right for me. - -Then I stumbled upon [Syncthing][2]. - -![syncthing console][3] - -Syncthing is a lightweight, peer-to-peer file-synchronization system. You don't need to pay for a service, you don't need a third-party server, and it's fast. Much faster, in my experience, than many of the "big names" in file synchronization. - -Syncthing is available for Linux, MacOS, Windows, and several flavors of BSD. There is also an Android app (but nothing official for iOS yet). There are even handy graphical frontends for all of the above (although I'm not going to cover those here). On Linux, there are packages available for most distributions, so installation is very straightforward. - -![Installing Syncthing on Ubuntu][4] - -When you start Syncthing the first time, it launches a web browser to configure the daemon. There's not much to do on the first machine, but it is a good chance to poke around the user interface (UI) a little bit. The most important thing to see is System ID under the **Actions** menu in the top-right. - -![Machine ID][5] - -Once the first machine is set up, repeat the installation on the second machine. In the UI, there will be a button on the lower-right labeled **Add Remote Device**. Click the button, and you will be presented with a box to enter a **Device ID and a Name**. Copy and paste the **Device ID** from the first machine and click **Save**. - -You should see a pop-up on the first node asking to add the second. Once you accept it, the new machine will show up on the lower-right of the first one. Share the default directory with the second machine. Click on **Default Folder** and then click the **Edit** button. There are four links at the top of the pop-up. Click on **Sharing** and then select the second machine. Click **Save** and look at the second machine. You should get a prompt to accept the shared directory. Once you accept that, it will start synchronizing files between the two machines. - -![Sharing a directory in Syncthing][6] - -Test it out by copying a file to the default directory (**/your/home/Share**) on one of the machines. It should show up on the other one very quickly. - -You can add as many directories as you want or need to the sharing, which is pretty handy. As you can see in the first image, I have one for **myconfigs**—that's where I keep my configuration files. When I get a new machine, I just install Syncthing, and if I tune a configuration on one, I don't have to update all of them—it happens automatically. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/sync-files-syncthing - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) -[2]: https://syncthing.net/ -[3]: https://opensource.com/sites/default/files/uploads/productivity_1-1.png (syncthing console) -[4]: https://opensource.com/sites/default/files/uploads/productivity_1-2.png (Installing Syncthing on Ubuntu) -[5]: https://opensource.com/sites/default/files/uploads/productivity_1-3.png (Machine ID) -[6]: https://opensource.com/sites/default/files/uploads/productivity_1-4.png (Sharing a directory in Syncthing) diff --git a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md b/translated/tech/20200111 Sync files across multiple devices with Syncthing.md new file mode 100644 index 0000000000..e4bc076533 --- /dev/null +++ b/translated/tech/20200111 Sync files across multiple devices with Syncthing.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sync files across multiple devices with Syncthing) +[#]: via: (https://opensource.com/article/20/1/sync-files-syncthing) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Syncthing 在多个设备间同步文件 +====== +2020 年,在我们的 20 个使用开源提升生产力的系列文章中,首先了解如何使用 Syncthing 同步文件。 +![Files in a folder][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 Synthing 同步文件 + +置新机器很麻烦。我们都有在机器之间复制的“标准设置”。多年来,我使用了很多方法来使它们在计算机之间同步。在过去(这会告诉你我年纪有多大了),曾经是软盘、然后是 Zip 磁盘、U 盘、SCP、Rsync、Dropbox、ownCloud,你想到的都试过。但这些似乎对我都不够好。 + +然后我偶然发现了 [Syncthing][2]。 + +![syncthing console][3] + +Syncthing 是一个轻量级的点对点文件同步系统。你不需要为服务付费,也不需要第三方服务器,而且速度很快。以我的经验,比文件同步中的许多“大牌”要快得多。 + +Syncthing 可在 Linux、MacOS、Windows 和多种 BSD 中使用。还有一个 Android 应用(但尚无官方 iOS 版本)。以上所有终端都有方便的图形化前端(尽管我不会在这里介绍)。在 Linux 上,大多数发行版都有可用的软件包,因此安装非常简单。 + +![Installing Syncthing on Ubuntu][4] + +首次启动 Syncthing 时,它将启动 Web 浏览器以配置守护程序。第一台计算机上没有太多要做,但是这是一个很好的机会来介绍一下用户界面 (UI)。最重要的是在右上方的 **Actions** 菜单下的 “System ID”。 + +![Machine ID][5] + +设置第一台计算机后,请在第二台计算机上重复安装。在 UI 中,右下方将显示一个按钮,名为 **Add Remote Device**。单击按钮,你将会看到一个要求输入**设备 ID 和设备名**的框。从第一台计算机上复制并粘贴**设备 ID**,然后单击 **Save**。 + +你应该会在第一台上看到一个请求添加第二台的弹出窗口。接受后,新机器将显示在第一台机器的右下角。与第二台计算机共享默认目录。单击 **Default Folder**,然后单击 **Edit** 按钮。弹出窗口的顶部有四个链接。单击 **Sharing**,然后选择第二台计算机。单击 **Save**,然后查看第二台计算机。你会看到一个接受共享目录的提示。接受后,它将开始在两台计算机之间同步文件。 + +![Sharing a directory in Syncthing][6] + +测试从一台计算机上复制文件到默认目录(**/your/home/Share**)。它应该很快会在另一台上出现。 + +你可以根据需要添加任意数量的目录,这非常方便。如你在第一张图中所看到的,我有一个用于保存配置的 **myconfigs** 文件夹。当我买了一台新机器时,我只需安装 Syncthing,如果我在一台机器上调整了配置,我不必更新所有,它会自动更新。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-files-syncthing + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://syncthing.net/ +[3]: https://opensource.com/sites/default/files/uploads/productivity_1-1.png (syncthing console) +[4]: https://opensource.com/sites/default/files/uploads/productivity_1-2.png (Installing Syncthing on Ubuntu) +[5]: https://opensource.com/sites/default/files/uploads/productivity_1-3.png (Machine ID) +[6]: https://opensource.com/sites/default/files/uploads/productivity_1-4.png (Sharing a directory in Syncthing) From 2f97195dfc6e4d323771db85e669a52d25f09be4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 15 Jan 2020 09:02:17 +0800 Subject: [PATCH 566/676] translating --- .../tech/20200113 Keep your email in sync with OfflineIMAP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md index 1cd8370870..e4e1f1ba94 100644 --- a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md +++ b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fdbaeceba81281f21573c06ff2db9f81be806165 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 15 Jan 2020 09:12:23 +0800 Subject: [PATCH 567/676] Rename sources/tech/20200114 What communities of practice can do for your organization.md to sources/talk/20200114 What communities of practice can do for your organization.md --- ...4 What communities of practice can do for your organization.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200114 What communities of practice can do for your organization.md (100%) diff --git a/sources/tech/20200114 What communities of practice can do for your organization.md b/sources/talk/20200114 What communities of practice can do for your organization.md similarity index 100% rename from sources/tech/20200114 What communities of practice can do for your organization.md rename to sources/talk/20200114 What communities of practice can do for your organization.md From 903775bc5ee9f0b08d86bcf60b03a86f8429b776 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 15 Jan 2020 11:28:29 +0800 Subject: [PATCH 568/676] PRF @geekpi --- ...ic sequences with the Linux seq command.md | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md b/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md index 0b12dfb508..2a99b4b6b3 100644 --- a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md +++ b/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Generating numeric sequences with the Linux seq command) @@ -9,10 +9,12 @@ 使用 Linux seq 命令生成数字序列 ====== -Linux seq 命令可以以闪电般的速度生成数字列表。它易于使用而且灵活。 -[Jamie][1] [(CC BY 2.0)][2] -在 Linux 中生成数字列表的最简单方法之一是使用 **seq**(sequence)命令。最简单的形式是,**seq** 接收一个数字,并输出从 1 到该数字的列表。例如: +![](https://img.linux.net.cn/data/attachment/album/202001/15/112717drpb9nuwss84xebu.jpg) + +> Linux 的 seq 命令可以以闪电般的速度生成数字列表,而且它也易于使用而且灵活。 + +在 Linux 中生成数字列表的最简单方法之一是使用 `seq`(系列sequence)命令。其最简单的形式是,`seq` 接收一个数字参数,并输出从 1 到该数字的列表。例如: ``` $ seq 5 @@ -23,7 +25,7 @@ $ seq 5 5 ``` -除非另有指定,否则 **seq** 始终以 1 开头。你可以在最终数字前面插上不同数字开始。 +除非另有指定,否则 `seq` 始终以 1 开头。你可以在最终数字前面插上不同数字开始一个序列。 ``` $ seq 3 5 @@ -34,7 +36,7 @@ $ seq 3 5 ### 指定增量 -你还可以指定增量。假设你要列出 3 的倍数。指定起点(在此示例中为第一个 3 ),增量(第二个 3)和终点(18)。 +你还可以指定增量步幅。假设你要列出 3 的倍数。指定起点(在此示例中为第一个 3 ),增量(第二个 3)和终点(18)。 ``` $ seq 3 3 18 @@ -58,9 +60,7 @@ $ seq 18 -3 3 3 ``` -**seq** 命令也非常快。你或许可以在 10 秒内生成一百万个数字的列表。 - -Advertisement +`seq` 命令也非常快。你或许可以在 10 秒内生成一百万个数字的列表。 ``` $ time seq 1000000 @@ -78,9 +78,9 @@ user 0m0.020s sys 0m0.899s ``` -## 使用分隔符 +### 使用分隔符 -另一个非常有用的选项是使用分隔符。你可以插入逗号,冒号或其他一些字符,而不是在每行上列出单个数字。-s 选项后跟要使用的字符。 +另一个非常有用的选项是使用分隔符。你可以插入逗号、冒号或其他一些字符,而不是在每行上列出单个数字。`-s` 选项后跟要使用的字符。 ``` $ seq -s: 3 3 18 @@ -96,21 +96,21 @@ $ seq -s' ' 3 3 18 ### 开始数学运算 -从生成数字序列到进行数学运算似乎是一个巨大的飞跃,但是有了正确的分隔符,**seq** 可以轻松地传递给 **bc** 进行计算。例如: +从生成数字序列到进行数学运算似乎是一个巨大的飞跃,但是有了正确的分隔符,`seq` 可以轻松地传递给 `bc` 进行计算。例如: ``` $ seq -s* 5 | bc 120 ``` -该命令中发生了什么?让我们来看看。首先,**seq** 生成一个数字列表,并使用 \* 作为分隔符。 +该命令中发生了什么?让我们来看看。首先,`seq` 生成一个数字列表,并使用 `*` 作为分隔符。 ``` $ seq -s* 5 1*2*3*4*5 ``` -然后,它将字符串传递给计算器 (**bc**),计算器立即将数字相乘。你可以在不到一秒的时间内进行相当广泛的计算。 +然后,它将字符串传递给计算器(`bc`),计算器立即将数字相乘。你可以在不到一秒的时间内进行相当庞大的计算。 ``` $ time seq -s* 117 | bc @@ -125,15 +125,13 @@ sys 0m0.000s ### 局限性 -你只能选择一个分隔符,因此计算将非常有限。单独使用 **bc** 可进行更复杂的数学运算。此外,**seq** 仅适用于数字。要生成单个字母序列,请改用如下命令: +你只能选择一个分隔符,因此计算将非常有限。而单独使用 `bc` 可进行更复杂的数学运算。此外,`seq` 仅适用于数字。要生成单个字母的序列,请改用如下命令: ``` $ echo {a..g} a b c d e f g ``` -加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。 - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html @@ -141,7 +139,7 @@ via: https://www.networkworld.com/article/3511954/generating-numeric-sequences-w 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f562b347c6ebf6c067f8fc6cc3f9e951ad0c2aec Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 15 Jan 2020 11:29:01 +0800 Subject: [PATCH 569/676] PUB @geekpi https://linux.cn/article-11784-1.html --- ...Generating numeric sequences with the Linux seq command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200107 Generating numeric sequences with the Linux seq command.md (98%) diff --git a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md b/published/20200107 Generating numeric sequences with the Linux seq command.md similarity index 98% rename from translated/tech/20200107 Generating numeric sequences with the Linux seq command.md rename to published/20200107 Generating numeric sequences with the Linux seq command.md index 2a99b4b6b3..c04fc6ff3a 100644 --- a/translated/tech/20200107 Generating numeric sequences with the Linux seq command.md +++ b/published/20200107 Generating numeric sequences with the Linux seq command.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11784-1.html) [#]: subject: (Generating numeric sequences with the Linux seq command) [#]: via: (https://www.networkworld.com/article/3511954/generating-numeric-sequences-with-the-linux-seq-command.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From a8c19f772aceb32a5607c5f64001422cb29de015 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 15 Jan 2020 13:06:04 +0800 Subject: [PATCH 570/676] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @heguangzhi 要是这篇更严谨一些会更好 --- ...ll save Raspberry Pi users time in 2020.md | 82 +++++++++---------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md index 3b7ec879eb..9b3a7f9226 100644 --- a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md +++ b/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -1,89 +1,87 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How piwheels will save Raspberry Pi users time in 2020) [#]: via: (https://opensource.com/article/20/1/piwheels) [#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) - -piwheels 是如何在2020年节省树莓派用户的时间的 +piwheels 是如何为树莓派用户节省时间的 ====== -通过为树莓派提供预编译的 Python 包,piwheels 项目为用户节省了大量的时间和精力。![rainbow colors on pinwheels in the sun][1] -piwheels 自动为[PiPi][2]上的所有项目构建 Python wheels( 预编译的 Python包 ),即 Python 包索引,使用树莓派硬件确保其兼容性。这意味着,当树莓派用户想要使用 **pip**,安装一个Python库时,他们会得到一个现成的编译版本,并保证可以在树莓派上良好的工作。这使得树莓派用户更容易进入和开始他们的项目。 +> 通过为树莓派提供预编译的 Python 包,piwheels 项目为用户节省了大量的时间和精力。 + +![rainbow colors on pinwheels in the sun][1] + +piwheels 自动为 Python 包索引 [PiPi][2] 上的所有项目构建 Python wheels(预编译的 Python包),并使用了树莓派硬件以确保其兼容性。这意味着,当树莓派用户想要使用 `pip` 安装一个 Python 库时,他们会得到一个现成编译好的版本,并保证可以在树莓派上良好的工作。这使得树莓派用户更容易入门并开始他们的项目。 ![Piwheels logo][3] -当我在2018年10月写[piwheels:为树莓派提供快速 Python 包安装][4]时,piwheels 项目已经进入第一年,并且已经证明了其为树莓派用户节省大量时间和精力。但是这个项目已经进入第二年,它为树莓派提供了预编译的 Python 包走了更长的路。 +当我在 2018 年 10 月写 [piwheels:为树莓派提供快速 Python 包安装][4]时,那时 piwheels 项目已经有一年了,并且已经证明了其为树莓派用户节省大量时间和精力。但当这个项目进入第二年时,它为树莓派提供了预编译的 Python 包做了更多工作。 ![Raspberry Pi 4][5] ### 它是怎么工作的 -[Raspbian][6],树莓派的主要操作系统,预配置使用 piwheels,所以用户不需要做任何特殊的事情就可以使用piwheels。 +树莓派的主要操作系统 [Raspbian][6] 预配置使用了 piwheels,所以用户不需要做任何特殊的事情就可以使用 piwheels。 -配置文件(在 **/etc/pip.conf**)告诉 pip 使用[piwheels.org][7]作为 _附加索引_,因此 pip 首先查看PyPI,然后查看 piwheels。piwheels 网站位于树莓派 3的 hosts中,该项目建造的所有 wheels 都位于该派上。它每月提供100多万套服务——对于一台35美元的电脑来说还不错! +配置文件(在 `/etc/pip.conf`)告诉 `pip` 使用 [piwheels.org][7] 作*附加索引*,因此 `pip` 会首先查找 PyPI,然后查找 piwheels。piwheels 的网站被托管在一个树莓派 3 上,该项目构建的所有 wheels 都托管在该树莓派上。它每月提供 100 多万个软件包——这对于一台 35 美元的电脑来说还真不赖! -网站除了主要服务于树莓派以外,piwheels 项目还对使用其他七个派系统并构建软件包。有人运行 Raspbian Jessie,为 Python 3.4 建造 wheels,有人运行 Raspbian Stretch 为 Python 3.5,有人运行 Raspbian Buster 为 Python 3.7。该项目通常不支持其他 Python 版本。还有一个“合适的服务器”——运行 Postgres 数据库的虚拟机。由于 派3 只有1GB的内存,所以(非常大的)数据库不能在其上很好地运行,所以我们把它移到了虚拟机上。带 4GB 内存的 派4 可能是合适的,所以我们将来可能会用到它。 +除了提供网站服务的主树莓派以外,piwheels 项目还使用其他七个树莓派来构建软件包。其中一些运行 Raspbian Jessie,为 Python 3.4 构建 wheels;另外一些运行 Raspbian Stretch 为 Python 3.5 构建;还有一些运行 Raspbian Buster 为 Python 3.7 构建。该项目通常不支持其他 Python 版本。还有一个“合适的服务器”——一台运行 Postgres 数据库的虚拟机。由于树莓派 3 只有 1GB 的内存,所以(非常大的)数据库不能在其上很好地运行,所以我们把它移到了虚拟机上。带 4GB 内存的树莓派 4 可能是合用的,所以我们将来可能会用到它。 + +这些树莓派都在“派云”中的 IPv6 网络上——这是一项由总部位于剑桥的托管公司 [Mythic Beasts][8] 提供的卓越服务。 -派都在“派云”中的 IPv6 网络上——这是一项由总部位于剑桥的托管公司[Mythic Beasts][8]提供的卓越的服务。 ![Mythic Beasts hosting service][9] ### 下载和统计趋势 -每次下载 piwheels 文件时,它都会记录在数据库中。这提供了对什么包最受欢迎以及人们使用什么 Python 版本和操作系统的统计。我们没有太多来自用户代理的信息,但是因为 派1/Zero 的架构显示为 “armv6”,派2/3/4显示为“armv7”,所以我们可以将它们区分开来。 +每次下载 piwheels 文件时,它都会记录在数据库中。这提供了对什么包最受欢迎以及人们使用什么 Python 版本和操作系统的统计。我们没有太多来自用户代理的信息,但是因为树莓派 1/Zero 的架构显示为 “armv6”,树莓派 2/3/4 显示为 “armv7”,所以我们可以将它们区分开来。 -截至2019年12月中旬,从派风车下载的软件包超过1,400万个,仅2019年就有近900万个。 +截至 2019 年 12 月中旬,从 piwheels 下载的软件包超过 1400 万个,仅 2019 年就有近 900 万个。 -自项目开始以来最受欢迎的10个软件包是: +自项目开始以来最受欢迎的 10 个软件包是: - 1. [pycparser][10] (821,060 downloads) - 2. [PyYAML][11] (366,979) - 3. [numpy][12] (354,531) - 4. [cffi][13] (336,982) - 5. [MarkupSafe][14] (318,878) - 6. [future][15] (282,349) - 7. [aiohttp][16] (277,046) - 8. [cryptography][17] (276,167) - 9. [home-assistant-frontend][18] (266,667) - 10. [multidict][19] (256,185) + 1. [pycparser][10](821,060 个下载) + 2. [PyYAML][11](366,979 个下载) + 3. [numpy][12](354,531 个下载) + 4. [cffi][13](336,982 个下载) + 5. [MarkupSafe][14](318,878 个下载) + 6. [future][15](282,349 个下载) + 7. [aiohttp][16](277,046 个下载) + 8. [cryptography][17](276,167 个下载) + 9. [home-assistant-frontend][18](266,667 个下载) + 10. [multidict][19](256,185 个下载) +请注意,许多纯 Python 包,如 [urllib3][20],都是作为 PyPI 上的 wheels 提供的;因为这些是跨平台兼容的,所以通常不会从 piwheels 下载,因为 PyPI 优先。 - -请注意,许多纯 Python 包,如[urllib3][20],都是作为 PyPI 上的 wheels 提供的;因为这些是跨平台兼容的,所以通常不会从 piwheels 下载,因为PyPI优先。 - -随着时间的推移,我们也看到了使用哪些 Python 版本的趋势。这里显示了 Raspbian Buster 发布时从3.5版快速升级到了Python 3.7: +随着时间的推移,我们也看到了使用哪些 Python 版本的趋势。这里显示了 Raspbian Buster 发布时从 3.5 版快速升级到了 Python 3.7: ![Data from piwheels on Python versions used over time][21] +你可以在我们的这篇 [统计博文][22] 看到更多的统计趋势。 -你可以看到更多的统计趋势在[stats blog posts][22]。 +### 节省的时间 -### 节省时间 +每个包构建都被记录在数据库中,并且每个下载也被存储。交叉引用下载数和构建时间显示了节省了多少时间。一个例子是 numpy —— 最新版本大约需要 11 分钟来构建。 +迄今为止,piwheels 项目已经为用户节省了总计超过 165 年的构建时间。按照目前的使用率,piwheels 项目每天可以节省 200 多天。 -每个包构建都被记录在数据库中,并且每个下载也被存储。带有构建持续时间的交叉引用下载显示了节省了多少时间。一个例子是 numpy ——最新版本大约需要11分钟来构建。 - -迄今为止,piwheels 项目已经为用户节省了总计超过165年的构建时间。按照目前的使用率,piwheels 项目每天节省200多天。 - - -除了节省构建时间,拥有预编译的 wheels 也意味着人们不必安装各种开发工具来构建包。一些包需要其他apt包来访问共享库。弄清楚你需要哪一个可能会很痛苦,所以我们也让这一步变得容易了。首先,我们找到了这个过程,[在博客上记录了这个过程][23]。然后,我们将这个逻辑添加到构建过程中,这样当构建一个 wheels 时,它的依赖关系会被自动计算并添加到包的项目页面中: +除了节省构建时间,拥有预编译的 wheels 也意味着人们不必安装各种开发工具来构建包。一些包需要其他 apt 包来访问共享库。弄清楚你需要哪一个可能会很痛苦,所以我们也让这一步变得容易了。首先,我们找到了这个过程,[在博客上记录了这个过程][23]。然后,我们将这个逻辑添加到构建过程中,这样当构建一个 wheels 时,它的依赖关系会被自动计算并添加到包的项目页面中: ![numpy dependencies][24] -### 派风车的下一步是什么? +### piwheels 的下一步是什么? -今年,我们推出了项目页面(例如,[numpy][25),这是一种非常有用的方式,可以让人们以人类可读的方式查找项目信息。它们还使人们更容易报告问题,例如 piwheels 中缺少一个项目,或者他们下载的包有问题。 +今年,我们推出了项目页面(例如,[numpy][25]),这是一种非常有用的方式,可以让人们以人类可读的方式查找项目信息。它们还使人们更容易报告问题,例如 piwheels 中缺少一个项目,或者他们下载的包有问题。 -2020年初,我们计划对 piwheels 项目进行一些升级,以启用新的JSON应用编程接口,这样你就可以自动检查哪些版本可用,查找项目的依赖关系,等等。 +2020 年初,我们计划对 piwheels 项目进行一些升级,以启用新的 JSON 应用编程接口,这样你就可以自动检查哪些版本可用,查找项目的依赖关系,等等。 -下一次 Debian/Raspbian 升级要到2021年年中才会发生,所以在那之前我们不会开始为任何新的 Python 版本 制造 wheels。 +下一次 Debian/Raspbian 升级要到 2021 年年中才会发生,所以在那之前我们不会开始为任何新的 Python 版本构建 wheels。 -你可以在这个项目的[博客][26]上读到更多关于 piwheels 的信息,我将在2020年初在那里发表一篇2019年的综述。你也可以在推特上关注[@piwheels][27],在那里你可以看到每日和每月的统计数据以及任何达到的里程碑。 +你可以在这个项目的[博客][26]上读到更多关于 piwheels 的信息,我将在 2020 年初在那里发表一篇 2019 年的综述。你也可以在推特上关注 [@piwheels][27],在那里你可以看到每日和每月的统计数据以及任何达到的里程碑。 -当然,piwheels 是一个开源项目,你可以在[GitHub][28]上看到整个项目源代码。 +当然,piwheels 是一个开源项目,你可以在 [GitHub][28] 上看到整个项目源代码。 -------------------------------------------------------------------------------- @@ -92,7 +90,7 @@ via: https://opensource.com/article/20/1/piwheels 作者:[Ben Nuttall][a] 选题:[lujun9972][b] 译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2d28ac5fd922bc2f068c5144aecc7c8d1a3de642 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 15 Jan 2020 13:06:55 +0800 Subject: [PATCH 571/676] PUB @heguangzhi https://linux.cn/article-11786-1.html --- ... How piwheels will save Raspberry Pi users time in 2020.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200107 How piwheels will save Raspberry Pi users time in 2020.md (99%) diff --git a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md b/published/20200107 How piwheels will save Raspberry Pi users time in 2020.md similarity index 99% rename from translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md rename to published/20200107 How piwheels will save Raspberry Pi users time in 2020.md index 9b3a7f9226..2fc0aafef9 100644 --- a/translated/tech/20200107 How piwheels will save Raspberry Pi users time in 2020.md +++ b/published/20200107 How piwheels will save Raspberry Pi users time in 2020.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11786-1.html) [#]: subject: (How piwheels will save Raspberry Pi users time in 2020) [#]: via: (https://opensource.com/article/20/1/piwheels) [#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) From 4b21e11eb78c294f0893546af0cb818174d947bb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:53:06 +0800 Subject: [PATCH 572/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Develo?= =?UTF-8?q?p=20GUI=20apps=20using=20Flutter=20on=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md --- ...evelop GUI apps using Flutter on Fedora.md | 199 ++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md diff --git a/sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md b/sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md new file mode 100644 index 0000000000..afff65b34e --- /dev/null +++ b/sources/tech/20200115 Develop GUI apps using Flutter on Fedora.md @@ -0,0 +1,199 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Develop GUI apps using Flutter on Fedora) +[#]: via: (https://fedoramagazine.org/develop-gui-apps-using-flutter-on-fedora/) +[#]: author: (Carmine Zaccagnino https://fedoramagazine.org/author/carzacc/) + +Develop GUI apps using Flutter on Fedora +====== + +![][1] + +When it comes to app development frameworks, Flutter is the latest and greatest. Google seems to be planning to take over the entire GUI app development world with Flutter, starting with mobile devices, which are already perfectly supported. Flutter allows you to develop cross-platform GUI apps for multiple targets — mobile, web, and desktop — from a single codebase. + +This post will go through how to install the Flutter SDK and tools on Fedora, as well as how to use them both for mobile development and web/desktop development. + +### Installing Flutter and Android SDKs on Fedora + +To get started building apps with Flutter, you need to install + + * the Android SDK; + * the Flutter SDK itself; and, + * optionally, an IDE and its Flutter plugins. + + + +#### Installing the Android SDK + +Flutter requires the installation of the Android SDK with the entire [Android Studio][2] suite of tools. Google provides a _tar.gz_ archive. The Android Studio executable can be found in the _android-studio/bin_ directory and is called _studio.sh_. To run it, open a terminal, _cd_ into the aforementioned directory, and then run: + +``` +$ ./studio.sh +``` + +#### Installing the Flutter SDK + +Before you install Flutter you may want to consider what release channel you want to be on. + +The _stable_ channel is least likely to give you a headache if you just want to build a mobile app using mainstream Flutter features. + +On the other hand, you may want to use the latest features, especially for desktop and web app development. In that case, you might be better off installing either the latest version of the _beta_ or even the _dev_ channel. + +Either way, you can switch between channels after you install using the _flutter channel_ command explained later in the article. + +Head over to the [official SDK archive page][3] and download the latest installation bundle for the release channel most appropriate for your use case. + +The installation bundle is simply a _xz-_compressed tarball (_.tar.xz_ extension). You can extract it wherever you want, given that you add the _flutter/bin_ subdirectory to the _PATH_ environment variable. + +#### Installing the IDE plugins + +To install the plugin for [Visual Studio Code][4], you need to search for _Flutter_ in the _Extensions_ tab. Installing it will also install the _Dart_ plugin. + +The same will happen when you install the plugin for Android Studio by opening the _Settings_, then the _Plugins_ tab and installing the _Flutter_ plugin. + +### Using the Flutter and Android CLI Tools on Fedora + +Now that you’ve installed Flutter, here’s how to use the CLI tool. + +#### Upgrading and Maintaining Your Flutter Installations + +The _flutter doctor_ command is used to check whether your installation and related tools are complete and don’t require any further action. + +For example, the output you may get from _flutter doctor_ right after installing on Fedora is: + +``` +Doctor summary (to see all details, run flutter doctor -v): + +[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Linux, locale it_IT.UTF-8) + +[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2) + + ✗ Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses + +[!] Android Studio (version 3.5) + + ✗ Flutter plugin not installed; this adds Flutter specific functionality. + + ✗ Dart plugin not installed; this adds Dart specific functionality. + +[!] Connected device + + ! No devices available + +! Doctor found issues in 3 categories. +``` + +Of course the issue with the Android toolchain has to be resolved in order to build for Android. Run this command to accept the licenses: + +``` +$ flutter doctor --android-licenses +``` + +Use the _flutter channel_ command to switch channels after installation. It’s just like switching branches on Git (and that’s actually what it does). You use it in the following way: + +``` +$ flutter channel +``` + +…where you’d replace _<channel_name>_ with the release channel you want to switch to. + +After doing that, or whenever you feel the need to do it, you need to update your installation. You might consider running this every once in a while or when a major update comes out if you follow Flutter news. Run this command: + +``` +$ flutter upgrade +``` + +#### Building for Mobile + +You can build for Android very easily: the _flutter build_ command supports it by default, and it allows you to build both APKs and newfangled app bundles. + +All you need to do is to create a project with _flutter create_, which will generate some code for an example app and the necessary _android_ and _ios_ folders. + +When you’re done coding you can either run: + + * _flutter build apk_ or _flutter build appbundle_ to generate the necessary app files to distribute, or + * _flutter run_ to run the app on a connected device or emulator directly. + + + +When you run the app on a phone or emulator with _flutter run_, you can use the _R_ button on the keyboard to use _stateful hot reload_. This feature updates what’s displayed on the phone or emulator to reflect the changes you’ve made to the code without requiring a full rebuild. + +If you input a capital _R_ character to the debug console, you trigger a _hot restart_. This restart doesn’t preserve state and is necessary for bigger changes to the app. + +If you’re using a GUI IDE, you can trigger a hot reload using the _bolt_ icon button and a hot restart with the typical _refresh_ button. + +#### Building for the Desktop + +To build apps for the desktop on Fedora, use the [flutter-desktop-embedding][5] repository. The _flutter create_ command doesn’t have templates for desktop Linux apps yet. That repository contains examples of desktop apps and files required to build on desktop, as well as examples of plugins for desktop apps. + +To build or run apps for Linux, you also need to be on the _master_ release channel and enable Linux desktop app development. To do this, run: + +``` +$ flutter config --enable-linux-desktop +``` + +After that, you can use _flutter run_ to run the app on your development workstation directly, or run _flutter build linux_ to build a binary file in the _build/_ directory. + +If those commands don’t work, run this command in the project directory to generate the required files to build in the _linux/_ directory: + +``` +$ flutter create . +``` + +#### Building for the Web + +Starting with Flutter 1.12, you can build Web apps using Flutter with the mainline codebase, without having to use the _flutter_web_ forked libraries, but you have to be running on the _beta_ channel. + +If you are (you can switch to it using _flutter channel beta_ and _flutter upgrade_ as we’ve seen earlier), you need to enable web development by running _flutter config –enable-web_. + +After doing that, you can run _flutter run -d web_ and a local web server will be started from which you can access your app. The command returns the URL at which the server is listening, including the port number. + +You can also run _flutter build web_ to build the static website files in the _build/_ directory. + +If those commands don’t work, run this command in the project directory to generate the required files to build in the _web/_ directory: + +``` +$ flutter create . +``` + +### Packages for Installing Flutter + +Other distributions have packages or community repositories to install and update in a more straightforward and intuitive way. However, at the time of writing, no such thing exists for Flutter. If you have experience packaging RPMs for Fedora, consider contributing to [this GitHub repository][6] for [this COPR package][7]. + +The next step is learning Flutter. You can do that in a number of ways: + + * Read the good API reference documentation on the official site + * Watching some of the introductory video courses available online + * Read one of the many books out there today. _[Check out the author’s bio for a suggestion! — Ed.]_ + + + +* * * + +_Photo by [Randall Ruiz][8] on [Unsplash][9]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/develop-gui-apps-using-flutter-on-fedora/ + +作者:[Carmine Zaccagnino][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/carzacc/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/flutter-816x345.jpg +[2]: https://developer.android.com/studio +[3]: https://flutter.dev/docs/development/tools/sdk/releases?tab=linux +[4]: https://fedoramagazine.org/using-visual-studio-code-fedora/ +[5]: https://github.com/google/flutter-desktop-embedding +[6]: https://github.com/carzacc/flutter-copr +[7]: https://copr.fedorainfracloud.org/coprs/carzacc/flutter/ +[8]: https://unsplash.com/@ruizra?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[9]: https://unsplash.com/s/photos/flutter?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From 0d62e47c46ce814620f58368ba069f1004ca1aea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:54:04 +0800 Subject: [PATCH 573/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Organi?= =?UTF-8?q?ze=20and=20sync=20your=20calendar=20with=20khal=20and=20vdirsyn?= =?UTF-8?q?cer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md --- ... your calendar with khal and vdirsyncer.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md diff --git a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md new file mode 100644 index 0000000000..b78ad493af --- /dev/null +++ b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organize and sync your calendar with khal and vdirsyncer) +[#]: via: (https://opensource.com/article/20/1/open-source-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Organize and sync your calendar with khal and vdirsyncer +====== +Keeping and sharing a calendar can be a pain. Learn how to make it +easier in the fifth article in our series on 20 ways to be more +productive with open source in 2020. +![Calendar close up snapshot][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Keep track of your schedule with khal and vdirsyncer + +Calendars are a _pain_ to deal with, and finding good tooling is always hard. But I've made some progress since last year when I listed calendaring as [one of my "fails."][2] + +The most difficult thing about calendars today is that now they almost always need to be shared online in some way. The two most popular online calendars are Google Calendar and Microsoft Outlook/Exchange. Both are used heavily in corporate environments, which means my calendar has to support one or both options. + +![khal calendar][3] + +[Khal][4] is a console-based calendar that reads and writes VCalendar files. It's fairly easy to configure, but it does not support syncing with other applications. + +Fortunately, khal works with [vdirsyncer][5], a nifty command-line program that can synchronize online calendars (and contacts, which I'll talk about in a separate article) to your local drive. And yes, this includes uploading new events, too. + +![vdirsyncer][6] + +Vdirsyncer is a Python 3 program, and it can be installed via your package manager or pip. It can synchronize CalDAV, VCalendar/iCalendar, Google Calendar, and local files in a directory. Since I use Google Calendar, I'll use that as an example, although it is not the easiest thing to set up. + +Setting vdirsyncer up for Google is [well-documented][7], so I won't go into the nuts and bolts here. The important thing is to make sure your sync pairs are set up in a way that sets Google Calendar as the "winner" for conflict resolution. That is, if there are two updates to the same event, it needs to know which one takes precedence. Do so with something like this: + + +``` +[general] +status_path = "~/.calendars/status" + +[pair personal_sync] +a = "personal" +b = "personallocal" +collections = ["from a", "from b"] +conflict_resolution = "a wins" +metadata = ["color"] + +[storage personal] +type = "google_calendar" +token_file = "~/.vdirsyncer/google_calendar_token" +client_id = "google_client_id" +client_secret = "google_client_secret" + +[storage personallocal] +type = "filesystem" +path = "~/.calendars/Personal" +fileext = ".ics" +``` + +After the first sync of vdirsyncer, you will end up with a series of directories in the storage path. Each will contain several files, one for each entry in the calendar. The next step is to get them into khal. Start by running **khal configure** to do the initial setup. + +![Configuring khal][8] + +Now, running **khal interactive** will bring up the display shown at the beginning of this article. Typing **n** will bring up the New Event dialog. One small thing to note here: the calendars are named to match the directories that vdirsyncer creates, but you can change the khal config file to give them clearer names. Adding colors to entries based on which calendar they're on will also help you identify which is which on the list: + + +``` +[calendars] +[[personal]] +path = ~/.calendars/Personal/kevin@sonney.com/ +color = light magenta +[[holidays]] +path = ~/.calendars/Personal/cln2stbjc4hmgrrcd5i62ua0ctp6utbg5pr2sor1dhimsp31e8n6errfctm6abj3dtmg@virtual/ +color = light blue +[[birthdays]] +path = ~/.calendars/Personal/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual/ +color = brown +``` + +Now when you run **khal interactive**, each calendar will be colored to distinguish it from the others, and when you add a new entry, it will have a more descriptive name. + +![Adding a new calendar entry][9] + +The setup is a little tricky, but once it's done, khal with vdirsyncer gives you an easy way to manage calendar events and keep them in sync with your online services. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-calendar + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://opensource.com/article/19/1/productivity-tool-wish-list +[3]: https://opensource.com/sites/default/files/uploads/productivity_5-1.png (khal calendar) +[4]: https://khal.readthedocs.io/en/v0.9.2/index.html +[5]: https://github.com/pimutils/vdirsyncer +[6]: https://opensource.com/sites/default/files/uploads/productivity_5-2.png (vdirsyncer) +[7]: https://vdirsyncer.pimutils.org/en/stable/config.html#google +[8]: https://opensource.com/sites/default/files/uploads/productivity_5-3.png (Configuring khal) +[9]: https://opensource.com/sites/default/files/uploads/productivity_5-4.png (Adding a new calendar entry) From dc866e23883e5a37de9e8e8a92af2b4ccafeaf32 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:54:31 +0800 Subject: [PATCH 574/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Why=20?= =?UTF-8?q?everyone=20is=20talking=20about=20WebAssembly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 Why everyone is talking about WebAssembly.md --- ...y everyone is talking about WebAssembly.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20200115 Why everyone is talking about WebAssembly.md diff --git a/sources/tech/20200115 Why everyone is talking about WebAssembly.md b/sources/tech/20200115 Why everyone is talking about WebAssembly.md new file mode 100644 index 0000000000..80b5a83060 --- /dev/null +++ b/sources/tech/20200115 Why everyone is talking about WebAssembly.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why everyone is talking about WebAssembly) +[#]: via: (https://opensource.com/article/20/1/webassembly) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +Why everyone is talking about WebAssembly +====== +Learn more about the newest way to run any code in a web browser. +![Digital creative of a browser on the internet][1] + +If you haven’t heard of [WebAssembly][2] yet, then you will soon. It’s one of the industry’s best-kept secrets, but it’s everywhere. It’s supported by all the major browsers, and it’s coming to the server-side, too. It’s fast. It’s being used for gaming. It’s an open World Wide Web Consortium (W3C), the main international standards organization for the web, standard. It’s platform-neutral and can run on Linux, Macs, and Windows. + +"Wow," you may be saying, "this sounds like something I should learn to code in!" You’d be right, but you’d be wrong too; you don’t code in WebAssembly. Let’s take some time to learn about the technology that’s often fondly abbreviated to "Wasm." + +### Where did it come from? + +Going back about ten years, there was a growing recognition that the widely-used JavaScript wasn’t fast enough for many purposes. JavaScript was undoubtedly successful and convenient. It ran in any browser and enabled the type of dynamic web pages that we take for granted today. But it was a high-level language and wasn’t designed with compute-intensive workloads in mind. + +However, although engineers responsible for the leading web browsers were generally in agreement about the performance problem, they weren’t aligned on what to do about it. Two camps emerged. Google began its Native Client project and, later, its Portable Native Client variation, to focus on allowing games and other software written in C/C++ to run in a secure compartment within Chrome. Mozilla, meanwhile, won the backing of Microsoft for asm.js, an approach that updated the browser so it can run a low-level subset of JavaScript instructions very quickly (another project enabled the conversion of C/C++ code into these instructions). + +With neither camp gaining widespread adoption, the various parties agreed to join forces in 2015 around a new standard called WebAssembly that built on the basic approach taken by asm.js. [As CNET’s Stephen Shankland wrote at the time][3], "On today’s Web, the browser’s JavaScript translates those instructions into machine code. But with WebAssembly, the programmer does a lot of the work earlier in the process, producing a program that’s in between the two states. That frees the browser from a lot of the hard work of creating the machine code, but it also fulfills the promise of the Web—that software will run on any device with a browser regardless of the underlying hardware details." + +In 2017, Mozilla declared it to be a minimum viable product and brought it out of preview. All the main browsers had adopted it by the end of that year. [In December 2019][4], the WebAssembly Working Group published the three WebAssembly specifications as W3C recommendations. + +WebAssembly defines a portable binary code format for executable programs, a corresponding textual assembly language, and interfaces for facilitating interactions between such programs and their host environment. WebAssembly code runs within a low-level virtual machine that mimics the functionality of the many microprocessors upon which it can be run. Either through Just-In-Time (JIT) compilation or interpretation, the WebAssembly engine can perform at nearly the speed of code compiled for a native platform. + +### Why the interest now? + +Certainly, some of the recent interest in WebAssembly stems from that initial desire to run more compute-intensive code in browsers. Laptop users, in particular, are spending more and more of their time in a browser (or, in the case of Chromebooks, essentially all their time). This trend has created an urgency around removing barriers to running a broad range of applications within a browser. And one of those barriers is often some aspect of performance, which is what WebAssembly and its predecessors were originally conceived to address. + +However, WebAssembly isn’t just for browsers. In 2019, [Mozilla announced a project called WASI][5] (WebAssembly System Interface) to standardize how WebAssembly code interacts with operating systems outside of a browser context. With the combination of browser support for WebAssembly and WASI, compiled binaries will be able to run both within and without browsers, across different devices and operating systems, at near-native speeds. + +WebAssembly’s low overhead immediately makes it practical for use beyond browsers, but that’s arguably table stakes; there are obviously other ways to run applications that don’t introduce performance bottlenecks. Why use WebAssembly, specifically? + +One important reason is its portability. Widely used compiled languages like C++ and Rust are probably the ones most associated with WebAssembly today. However, [a wide range of other languages][6] compile to or have their virtual machines in WebAssembly. Furthermore, while WebAssembly [assumes certain prerequisites][7] for its execution environments, it is designed to execute efficiently on a variety of operating systems and instruction set architectures. WebAssembly code can, therefore, be written using a wide range of languages and run on a wide range of operating systems and processor types. + +Another WebAssembly advantage stems from the fact that code runs within a virtual machine. As a result, each WebAssembly module executes within a sandboxed environment, separated from the host runtime using fault isolation techniques. This implies, among other things, that applications execute in isolation from the rest of their host environment and can’t escape the sandbox without going through appropriate APIs. + +### WebAssembly in action + +What does all this mean in practice? + +One example of WebAssembly in action is [Enarx][8]. + +Enarx is a project that provides hardware independence for securing applications using Trusted Execution Environments (TEE). Enarx lets you securely deliver an application compiled into WebAssembly all the way into a cloud provider and execute it remotely. As Red Hat security engineer [Nathaniel McCallum puts it][9], "The way that we do this is, we take your application as inputs, and we perform an attestation process with the remote hardware. We validate that the remote hardware is, in fact, the hardware that it claims to be, using cryptographic techniques. The end result of that is not only an increased level of trust in the hardware that we’re speaking to; it’s also a session key, which we can then use to deliver encrypted code and data into this environment that we have just asked for cryptographic attestation on." + +Another example is OPA, the Open Policy Agent, which [announced][10] in November 2019 that you could [compile][11] their policy definition language, Rego, into WebAssembly. Rego lets you write logic to search and combine JSON/YAML data from different sources to ask questions like, "Is this API allowed?" + +OPA has been used to policy-enable software including, but not limited to, Kubernetes. Simplifying policy using tools like OPA [is considered an important step][12] for properly securing Kubernetes deployments across a variety of different environments. WebAssembly’s portability and built-in security features are a good match for these tools. + +Our last example is [Unity][13]. Remember, we mentioned at the beginning of the article that WebAssembly is used for gaming? Well, Unity, the cross-platform game engine, was an early adopter of WebAssembly, providing the first demo of Wasm running in browsers, and, since August 2018, [has used WebAssembly][14] as the output target for the Unity WebGL build target. + +These are just a few of the ways WebAssembly has already begun to make an impact. Find out more and keep up to date with all things Wasm at + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/webassembly + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://opensource.com/article/19/8/webassembly-speed-code-reuse +[3]: https://www.cnet.com/news/the-secret-alliance-that-could-give-the-web-a-massive-speed-boost/ +[4]: https://www.w3.org/blog/news/archives/8123 +[5]: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ +[6]: https://github.com/appcypher/awesome-wasm-langs +[7]: https://webassembly.org/docs/portability/ +[8]: https://enarx.io +[9]: https://enterprisersproject.com/article/2019/9/application-security-4-facts-confidential-computing-consortium +[10]: https://blog.openpolicyagent.org/tagged/webassembly +[11]: https://github.com/open-policy-agent/opa/tree/master/wasm +[12]: https://enterprisersproject.com/article/2019/11/kubernetes-reality-check-3-takeaways-kubecon +[13]: https://opensource.com/article/20/1/www.unity.com +[14]: https://blogs.unity3d.com/2018/08/15/webassembly-is-here/ From 86b4b65f4d9ebede609b20fd6bfa7f73daa4e220 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:55:02 +0800 Subject: [PATCH 575/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=206=20ha?= =?UTF-8?q?ndy=20Bash=20scripts=20for=20Git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200115 6 handy Bash scripts for Git.md --- .../20200115 6 handy Bash scripts for Git.md | 524 ++++++++++++++++++ 1 file changed, 524 insertions(+) create mode 100644 sources/tech/20200115 6 handy Bash scripts for Git.md diff --git a/sources/tech/20200115 6 handy Bash scripts for Git.md b/sources/tech/20200115 6 handy Bash scripts for Git.md new file mode 100644 index 0000000000..03464a840b --- /dev/null +++ b/sources/tech/20200115 6 handy Bash scripts for Git.md @@ -0,0 +1,524 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 handy Bash scripts for Git) +[#]: via: (https://opensource.com/article/20/1/bash-scripts-git) +[#]: author: (Bob Peterson https://opensource.com/users/bobpeterson) + +6 handy Bash scripts for Git +====== +These six Bash scripts will make your life easier when you're working +with Git repositories. +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +I wrote a bunch of Bash scripts that make my life easier when I'm working with Git repositories. Many of my colleagues say there's no need; that everything I need to do can be done with Git commands. While that may be true, I find the scripts infinitely more convenient than trying to figure out the appropriate Git command to do what I want. + +### 1\. gitlog + +**gitlog** prints an abbreviated list of current patches against the master version. It prints them from oldest to newest and shows the author and description, with **H** for **HEAD**, **^** for **HEAD^**, **2** for **HEAD~2,** and so forth. For example: + + +``` +$ gitlog +\-----------------------[ recovery25 ]----------------------- +(snip) +11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation + 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops + ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq + H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time +``` + +If I want to see what patches are on a different branch, I can specify an alternate branch: + + +``` +`$ gitlog recovery24` +``` + +### 2\. gitlog.id + +**gitlog.id** just prints the patch SHA1 IDs: + + +``` +$ gitlog.id +\-----------------------[ recovery25 ]----------------------- +56908eeb6940 2ca4a6b628a1 fc64ad5d99fe 02031a00a251 f6f38da7dd18 d8546e8f0023 fc3cc1f98f6b 12c3e0cb3523 76cce178b134 6fc1dce3ab9c 1b681ab074ca 26fed8de719b 802ff51a5670 49f67a512d8c f04f20193bbb 5f6afe809d23 2030521dc70e dada79b3be94 9b19a1e08161 78a035041d3e f03da011cae2 0d2b2e068fcd 2449976aa133 57dfb5e12ccd 53abedfdcf72 6fbdda3474b3 49544a547188 187032f7a63c 6f75dae23d93 95fc2a261b00 ebfb14ded191 f653ee9e414a 0e2911cb8111 73968b76e2e3 8a3e4cb5e92c a5f2da803b5b 7c9ef68388ed 71ca19d0cba8 340d27a33895 9b3c4e6efb10 d2e8c22be39b 9563e31f8bfd ebac7a38036c f703a3c27874 a3e86d2ef30e da3c604755b0 4525c2f5b46f a06a5b7dea02 8ba93c796d5c e8b5ff851bb9 +``` + +Again, it assumes the current branch, but I can specify a different branch if I want. + +### 3\. gitlog.id2 + +**gitlog.id2** is the same as **gitlog.id** but without the branch line at the top. This is handy for cherry-picking all patches from one branch to the current branch: + + +``` +$ # create a new branch +$ git branch --track origin/master +$ # check out the new branch I just created +$ git checkout recovery26 +$ # cherry-pick all patches from the old branch to the new one +$ for i in `gitlog.id2 recovery25` ; do git cherry-pick $i ;done +``` + +### 4\. gitlog.grep + +**gitlog.grep** greps for a string within that collection of patches. For example, if I find a bug and want to fix the patch that has a reference to function **inode_go_sync**, I simply do: + + +``` +$ gitlog.grep inode_go_sync +\-----------------------[ recovery25 - 50 patches ]----------------------- +(snip) +11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops +152:-static void inode_go_sync(struct gfs2_glock *gl) +153:+static int inode_go_sync(struct gfs2_glock *gl) +163:@@ -296,6 +302,7 @@ static void inode_go_sync(struct gfs2_glock *gl) + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation + 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops + ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq + H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time +``` + +So, now I know that patch **HEAD~9** is the one that needs fixing. I use **git rebase -i HEAD~10** to edit patch 9, **git commit -a --amend**, then **git rebase --continue** to make the necessary adjustments. + +### 5\. gitbranchcmp3 + +**gitbranchcmp3** lets me compare my current branch to another branch, so I can compare older versions of patches to my newer versions and quickly see what's changed and what hasn't. It generates a compare script (that uses the KDE tool [Kompare][2], which works on GNOME3, as well) to compare the patches that aren't quite the same. If there are no differences other than line numbers, it prints **[SAME]**. If there are only comment differences, it prints **[same]** (in lower case). For example: + + +``` +$ gitbranchcmp3 recovery24 +Branch recovery24 has 47 patches +Branch recovery25 has 50 patches + +(snip) +38 87eb6901607a 340d27a33895 [same] gfs2: drain the ail2 list after io errors +39 90fefb577a26 9b3c4e6efb10 [same] gfs2: clean up iopen glock mess in gfs2_create_inode +40 ba3ae06b8b0e d2e8c22be39b [same] gfs2: Do proper error checking for go_sync family of glops +41 2ab662294329 9563e31f8bfd [SAME] gfs2: use page_offset in gfs2_page_mkwrite +42 0adc6d817b7a ebac7a38036c [SAME] gfs2: don't use buffer_heads in gfs2_allocate_page_backing +43 55ef1f8d0be8 f703a3c27874 [SAME] gfs2: Improve mmap write vs. punch_hole consistency +44 de57c2f72570 a3e86d2ef30e [SAME] gfs2: Multi-block allocations in gfs2_page_mkwrite +45 7c5305fbd68a da3c604755b0 [SAME] gfs2: Fix end-of-file handling in gfs2_page_mkwrite +46 162524005151 4525c2f5b46f [SAME] Rafael Aquini's slab instrumentation +47              a06a5b7dea02 [    ] GFS2: Add go_get_holdtime to gl_ops +48              8ba93c796d5c [    ] gfs2: introduce new function remaining_hold_time and use it in dq +49              e8b5ff851bb9 [    ] gfs2: Allow rgrps to have a minimum hold time + +Missing from recovery25: +The missing: +Compare script generated at: /tmp/compare_mismatches.sh +``` + +### 6\. gitlog.find + +Finally, I have **gitlog.find**, a script to help me identify where the upstream versions of my patches are and each patch's current status. It does this by matching the patch description. It also generates a compare script (again, using Kompare) to compare the current patch to the upstream counterpart: + + +``` +$ gitlog.find +\-----------------------[ recovery25 - 50 patches ]----------------------- +(snip) +11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors +lo 5bcb9be74b2a Bob Peterson     gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode +fn 2c47c1be51fb Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops +lo feb7ea639472 Bob Peterson     gfs2: Do proper error checking for go_sync family of glops + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite +ms f3915f83e84c Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing +ms 35af80aef99b Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency +fn 39c3a948ecf6 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite +fn f53056c43063 Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite +fn 184b4e60853d Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation +   Not found upstream + 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops +   Not found upstream + ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq +   Not found upstream + H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time +   Not found upstream +Compare script generated: /tmp/compare_upstream.sh +``` + +The patches are shown on two lines, the first of which is your current patch, followed by the corresponding upstream patch, and a 2-character abbreviation to indicate its upstream status: + + * **lo** means the patch is in the local upstream Git repo only (i.e., not pushed upstream yet). + * **ms** means the patch is in Linus Torvald's master branch. + * **fn** means the patch is pushed to my "for-next" development branch, intended for the next upstream merge window. + + + +Some of my scripts make assumptions based on how I normally work with Git. For example, when searching for upstream patches, it uses my well-known Git tree's location. So, you will need to adjust or improve them to suit your conditions. The **gitlog.find** script is designed to locate [GFS2][3] and [DLM][4] patches only, so unless you're a GFS2 developer, you will want to customize it to the components that interest you. + +### Source code + +Here is the source for these scripts. + +#### 1\. gitlog + + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then +    branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +patches=0 +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done + +if [[ $branch =~ .*for-next.* ]] +then +    start=HEAD +#    start=origin/for-next +else +    start=origin/master +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +/usr/bin/echo "-----------------------[" $branch "]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do +    if [ $patches -eq 1 ]; then +        cnt=" ^" +    elif [ $patches -eq 0 ]; then +        cnt=" H" +    else +        if [ $patches -lt 10 ]; then +            cnt=" $patches" +        else +            cnt="$patches" +        fi +    fi +    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s %n" $i +    patches=$(echo $patches - 1 | bc) +done +#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" $tracking..$branch +#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" ^origin/master ^linux-gfs2/for-next $branch +``` + +#### 2\. gitlog.id + + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then +    branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +/usr/bin/echo "-----------------------[" $branch "]-----------------------" +git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 3\. gitlog.id2 + + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then +    branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` +git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 4\. gitlog.grep + + +``` +#!/bin/bash +param1=$1 +param2=$2 + +if test "x$param2" = x; then +    branch=`git branch -a | grep "*" | cut -d ' ' -f2` +    string=$param1 +else +    branch=$param1 +    string=$param2 +fi + +patches=0 +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done +/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do +    if [ $patches -eq 1 ]; then +        cnt=" ^" +    elif [ $patches -eq 0 ]; then +        cnt=" H" +    else +        if [ $patches -lt 10 ]; then +            cnt=" $patches" +        else +            cnt="$patches" +        fi +    fi +    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i +    /usr/bin/git show --pretty=email --patch-with-stat $i | grep -n "$string" +    patches=$(echo $patches - 1 | bc) +done +``` + +#### 5\. gitbranchcmp3 + + +``` +#!/bin/bash +# +# gitbranchcmp3 <old branch> [<new_branch>] +# +oldbranch=$1 +newbranch=$2 +script=/tmp/compare_mismatches.sh + +/usr/bin/rm -f $script +echo "#!/bin/bash" > $script +/usr/bin/chmod 755 $script +echo "# Generated by gitbranchcmp3.sh" >> $script +echo "# Run this script to compare the mismatched patches" >> $script +echo " " >> $script +echo "function compare_them()" >> $script +echo "{"  >> $script +echo "    git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script +echo "    git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script +echo "    kompare /tmp/gronk1 /tmp/gronk2" >> $script +echo "}" >> $script +echo " " >> $script + +if test "x$newbranch" = x; then +    newbranch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +declare -a oldsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$oldbranch | cut -d ' ' -f1 |paste -s -d ' '`) +declare -a newsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$newbranch | cut -d ' ' -f1 |paste -s -d ' '`) + +#echo "old: " $oldsha1s +oldcount=${#oldsha1s[@]} +echo "Branch $oldbranch has $oldcount patches" +oldcount=$(echo $oldcount - 1 | bc) +#for o in `seq 0 ${#oldsha1s[@]}`; do +#    echo -n ${oldsha1s[$o]} " " +#    desc=`git show $i | head -5 | tail -1|cut -b5-` +#done + +#echo "new: " $newsha1s +newcount=${#newsha1s[@]} +echo "Branch $newbranch has $newcount patches" +newcount=$(echo $newcount - 1 | bc) +#for o in `seq 0 ${#newsha1s[@]}`; do +#    echo -n ${newsha1s[$o]} " " +#    desc=`git show $i | head -5 | tail -1|cut -b5-` +#done +echo + +for new in `seq 0 $newcount`; do +    newsha=${newsha1s[$new]} +    newdesc=`git show $newsha | head -5 | tail -1|cut -b5-` +    oldsha="            " +    same="[    ]" +    for old in `seq 0 $oldcount`; do +        if test "${oldsha1s[$old]}" = "match"; then +            continue; +        fi +        olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` +        if test "$olddesc" = "$newdesc" ; then +            oldsha=${oldsha1s[$old]} +            #echo $oldsha +            git show $oldsha |tail -n +2 |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk1 +            git show $newsha |tail -n +2 |grep -v "index.*\\.\\." |grep -v "@@"  > /tmp/gronk2 +            diff /tmp/gronk1 /tmp/gronk2 &> /dev/null +            if [ $? -eq 0 ] ;then +# No differences +                same="[SAME]" +                oldsha1s[$old]="match" +                break +            fi +            git show $oldsha |sed -n '/diff/,$p' |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk1 +            git show $newsha |sed -n '/diff/,$p' |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk2 +            diff /tmp/gronk1 /tmp/gronk2 &> /dev/null +            if [ $? -eq 0 ] ;then +# Differences in comments only +                same="[same]" +                oldsha1s[$old]="match" +                break +            fi +            oldsha1s[$old]="match" +            echo "compare_them $oldsha $newsha" >> $script +        fi +    done +    echo "$new $oldsha $newsha $same $newdesc" +done + +echo +echo "Missing from $newbranch:" +the_missing="" +# Now run through the olds we haven't matched up +for old in `seq 0 $oldcount`; do +    if test ${oldsha1s[$old]} != "match"; then +        olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` +        echo "${oldsha1s[$old]} $olddesc" +        the_missing=`echo "$the_missing ${oldsha1s[$old]}"` +    fi +done + +echo "The missing: " $the_missing +echo "Compare script generated at: $script" +#git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 6\. gitlog.find + + +``` +#!/bin/bash +# +# Find the upstream equivalent patch +# +# gitlog.find +# +cwd=$PWD +param1=$1 +ubranch=$2 +patches=0 +script=/tmp/compare_upstream.sh +echo "#!/bin/bash" > $script +/usr/bin/chmod 755 $script +echo "# Generated by gitbranchcmp3.sh" >> $script +echo "# Run this script to compare the mismatched patches" >> $script +echo " " >> $script +echo "function compare_them()" >> $script +echo "{"  >> $script +echo "    cwd=$PWD" >> $script +echo "    git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script +echo "    cd ~/linux.git/fs/gfs2" >> $script +echo "    git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script +echo "    cd $cwd" >> $script +echo "    kompare /tmp/gronk1 /tmp/gronk2" >> $script +echo "}" >> $script +echo " " >> $script + +#echo "Gathering upstream patch info. Please wait." +branch=`git branch -a | grep "*" | cut -d ' ' -f2` +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +cd ~/linux.git +if test "X${ubranch}" = "X"; then +    ubranch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi +utracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` +# +# gather a list of gfs2 patches from master just in case we can't find it +# +#git log --abbrev-commit --pretty=format:"   %h %<|(32)%an %s" master |grep -i -e "gfs2" -e "dlm" > /tmp/gronk +git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/gfs2/ > /tmp/gronk.gfs2 +# ms = in Linus's master +git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/dlm/ > /tmp/gronk.dlm + +cd $cwd +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done +/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do +    if [ $patches -eq 1 ]; then +        cnt=" ^" +    elif [ $patches -eq 0 ]; then +        cnt=" H" +    else +        if [ $patches -lt 10 ]; then +            cnt=" $patches" +        else +            cnt="$patches" +        fi +    fi +    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i +    desc=`/usr/bin/git show --abbrev-commit -s --pretty=format:"%s" $i` +    cd ~/linux.git +    cmp=1 +    up_eq=`git log --reverse --abbrev-commit --pretty=format:"lo %h %<|(32)%an %s" $utracking..$ubranch | grep "$desc"` +# lo = in local for-next +    if test "X$up_eq" = "X"; then +        up_eq=`git log --reverse --abbrev-commit --pretty=format:"fn %h %<|(32)%an %s" master..$utracking | grep "$desc"` +# fn = in for-next for next merge window +        if test "X$up_eq" = "X"; then +            up_eq=`grep "$desc" /tmp/gronk.gfs2` +            if test "X$up_eq" = "X"; then +                up_eq=`grep "$desc" /tmp/gronk.dlm` +                if test "X$up_eq" = "X"; then +                    up_eq="   Not found upstream" +                    cmp=0 +                fi +            fi +        fi +    fi +    echo "$up_eq" +    if [ $cmp -eq 1 ] ; then +        UP_SHA1=`echo $up_eq|cut -d' ' -f2` +        echo "compare_them $UP_SHA1 $i" >> $script +    fi +    cd $cwd +    patches=$(echo $patches - 1 | bc) +done +echo "Compare script generated: $script" +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/bash-scripts-git + +作者:[Bob Peterson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bobpeterson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://kde.org/applications/development/org.kde.kompare +[3]: https://en.wikipedia.org/wiki/GFS2 +[4]: https://en.wikipedia.org/wiki/Distributed_lock_manager From 01bbc8aefef6bfbc83d2129aee4b2860f8b18bc8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:56:08 +0800 Subject: [PATCH 576/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=20Google?= =?UTF-8?q?=20Cloud=20launches=20Archive=20cold=20storage=20service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200116 Google Cloud launches Archive cold storage service.md --- ...d launches Archive cold storage service.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/talk/20200116 Google Cloud launches Archive cold storage service.md diff --git a/sources/talk/20200116 Google Cloud launches Archive cold storage service.md b/sources/talk/20200116 Google Cloud launches Archive cold storage service.md new file mode 100644 index 0000000000..cd395aafb5 --- /dev/null +++ b/sources/talk/20200116 Google Cloud launches Archive cold storage service.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Google Cloud launches Archive cold storage service) +[#]: via: (https://www.networkworld.com/article/3513903/google-cloud-launches-archive-cold-storage-service.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Google Cloud launches Archive cold storage service +====== +Archive will focus on long-term data retention and compete against AWS Glacier, Microsoft Cool Blob Storage, and IBM Cloud Storage. +Google + +Google Cloud announced the general availability of Archive, a long-term data retention service intended as an alternative to on-premises tape backup. + +Google pitches it as cold storage, meaning it is for data which is accessed less than once a year and has been stored for many years. Cold storage data is usually consigned to tape backup, which remains a [surprisingly successful][1] market despite repeated predictions of its demise. + +Of course, Google's competition has their own products. Amazon Web Services has Glacier, Microsoft has Cool Blob Storage, and IBM has Cloud Storage. Google also offers its own Coldline and Nearline cloud storage offerings; Coldline is designed for data a business expects to touch less than once a quarter, while Nearline is aimed at data that requires access less than once a month. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +With Archive, Google highlights a few differentiators from the competition and its own archival offerings. First, Google promises no delay on data retrieval, claiming millisecond latency. AWS can take minutes or hours. While Archive costs a little more than AWS and Azure – $1.23 per terabyte per month vs. $1 per terabyte per month for AWS and Azure – that’s due in part to the longer remit for an early deletion charge. Google offers 365 days compared with 180 days for AWS and Azure. + +"Having flexible storage options allows you to optimize your total cost of ownership while meeting your business needs," [wrote][3] Geoffrey Noer, Google Cloud storage product manager in a blog post announcing the service’s availability. "At Google Cloud, we think that you should have a range of straightforward storage options that allow you to more securely and reliably access your data when and where you need it, without performance bottlenecks or delays to your users." + +Archive is a store-and-forget service, where you keep stuff only because you have to. Tape replacement and archiving data under regulatory retention requirements are two of the most common use cases, according to Google. Other examples include long-term backups and original master copies of videos and images. + +The Archive class can also be combined with [Bucket Lock][4], Google Cloud’s data locking mechanism to prevent data from being modified, which is available to enterprises for meeting various data retention laws, according to Noer. + + * [Backup vs. archive: Why it’s important to know the difference][5] + * [How to pick an off-site data-backup method][6] + * [Tape vs. disk storage: Why isn’t tape dead yet?][7] + * [The correct levels of backup save time, bandwidth, space][8] + + + +The Archive class can be set up in dual-regions or multi-regions for geo-redundancy and offers checksum verification durability of "11 nines" – 99.999999999 percent. + +More information can be found [here][9]. + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3513903/google-cloud-launches-archive-cold-storage-service.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3263452/theres-still-a-lot-of-life-left-in-tape-backup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://cloud.google.com/blog/products/storage-data-transfer/archive-storage-class-for-coldest-data-now-available +[4]: https://cloud.google.com/storage/docs/bucket-lock +[5]: https://www.networkworld.com/article/3285652/storage/backup-vs-archive-why-its-important-to-know-the-difference.html +[6]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html +[7]: https://www.networkworld.com/article/3315156/storage/tape-vs-disk-storage-why-isnt-tape-dead-yet.html +[8]: https://www.networkworld.com/article/3302804/storage/the-correct-levels-of-backup-save-time-bandwidth-space.html +[9]: https://cloud.google.com/blog/products/storage-data-transfer/whats-cooler-than-being-cool-ice-cold-archive-storage +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world From d9a88d6603185cc9d9f67ded4ba32cccce883e10 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 16 Jan 2020 00:57:32 +0800 Subject: [PATCH 577/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200115=20Instan?= =?UTF-8?q?t,=20secure=20=E2=80=98teleportation=E2=80=99=20of=20data=20in?= =?UTF-8?q?=20the=20works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md --- ...re ‘teleportation- of data in the works.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md diff --git a/sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md b/sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md new file mode 100644 index 0000000000..d314baba66 --- /dev/null +++ b/sources/talk/20200115 Instant, secure ‘teleportation- of data in the works.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Instant, secure ‘teleportation’ of data in the works) +[#]: via: (https://www.networkworld.com/article/3512037/instant-secure-teleportation-of-data-in-the-works.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Instant, secure ‘teleportation’ of data in the works +====== +Quantum teleportation, where information is sent instantaneously, will secure the Internet, researchers say. Scientists are making progress. +Thinkstock + +Sending information instantly between two computer chips using quantum teleportation has been accomplished reliably for the first time, according to scientists from the University of Bristol, in collaboration with the Technical University of Denmark (DTU). Data was exchanged without any electrical or physical connection – a transmission method that may influence the next generation of ultra-secure data networks. + +Teleportation involves the moving of information instantaneously and securely. In the “Star Trek” series, fictional people move immediately from one place to another via teleportation. In the University of Bristol experiment, data is passed instantly via a single quantum state across two chips using light particles, or photons. Importantly, each of the two chips knows the characteristics of the other, because they’re entangled through quantum physics, meaning they therefore share a single physics-based state. + +The researchers involved in these successful silicon tests said they built the photon-based silicon chips in a lab and then used them to encode the quantum information in single particles. It was “a high-quality entanglement link across two chips, where photons on either chip share a single quantum state,” said Dan Llewellyn of University of Bristol in a [press release][1]. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +“These chips are able to encode quantum information in light generated inside the circuits and can process the quantum information,” the school stated. It claims a successful quantum teleportation of 91%, which is considered high quality. + +### Entanglement boosts data transmission + +Entanglement links to be used in data transmission are where information is conjoined, or entangled, so that the start of a link has the same state as the end of a link. The particles, and thus data, are at the beginning of the link and at the end of the link at the same time. + +The physics principle holds promise for data transmissions, in part because intrusion is easily seen; interference by a bad actor becomes obvious if the beginning state of the link and the end state are no longer the same. In other words, any change in one element means a change in the other, and that can be over distance, too. Additionally, the technique allows leaks to be stopped: Instant key destruction can occur at the actual moment of attempted interference. + +“Particles can be in two places at the same time, and they can even be entangled with twin particles, so that they can feel everything that happens to each other,” explained Jonas Schou Neergaard-Nielsen, a senior researcher at DTU, [in a 2015 story][3] about the university’s earlier teleportation exploration. “At the sub-microscopic level, where quantum mechanics rule, you find a completely different logic to what we are used to in our macroscopic reality,” Schou Neergaard-Nielsen said back in 2015. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +### Quantum chips gain momentum + +In the bigger picture, the area of quantum-based microprocessors is gaining momentum. It is thought, for example, that quantum-embedded chips could ultimately secure the internet of things. IoT security vendor Crypto Quantique has said that quantum chips could be made unclonable. Its solution uses a quantum method of [creating totally random keys][5] from the measurement of low currents on the silicon. It’s related to how electrons can leak through transistor gates. “Unforgeable hardware trust anchors [are] generated by the device,” Crypto Quantique explains on its website. “Our technology offers true randomness.” + +A secure quantum computing environment overall could have “profound impacts on modern society,” the University of Bristol said. And with the introduction of entangled physics states across networks, a highly secured “quantum internet could ultimately protect the world’s information from malicious attacks.” + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3512037/instant-secure-teleportation-of-data-in-the-works.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.bristol.ac.uk/news/2019/december/quantum-teleportation.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.dtu.dk/english/news/2015/01/dtu-physics-researchers-developing-tomorrows-teleportation?id=ece937e9-1402-437a-8f57-cc3124563bc8 +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: mailto:https://www.networkworld.com/article/3333808/quantum-embedded-chips-could-secure-iot.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 6f6eceb0a72a8fe315e56876d8ea6c1a8373e986 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 16 Jan 2020 08:57:57 +0800 Subject: [PATCH 578/676] translated --- ...uration management of multiple machines.md | 60 ------------------- ...uration management of multiple machines.md | 58 ++++++++++++++++++ 2 files changed, 58 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20200112 Use Stow for configuration management of multiple machines.md create mode 100644 translated/tech/20200112 Use Stow for configuration management of multiple machines.md diff --git a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md b/sources/tech/20200112 Use Stow for configuration management of multiple machines.md deleted file mode 100644 index 0d4a5f19d5..0000000000 --- a/sources/tech/20200112 Use Stow for configuration management of multiple machines.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Stow for configuration management of multiple machines) -[#]: via: (https://opensource.com/article/20/1/configuration-management-stow) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use Stow for configuration management of multiple machines -====== -Learn how to use Stow to manage configurations across machines in the -second article in our series on 20 ways to be more productive with open -source in 2020. -![A person programming][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Manage symlinks with Stow - -Yesterday, I explained how I keep my files in sync across multiple machines with [Syncthing][2]. But that's only one of the tools I use to keep my configurations consistent. The other is a seemingly simple tool called [Stow][3]. - -![Stow help screen][4] - -Stow manages symlinks. By default, it makes symlinks from the directory it is in to the directory below it. There are also options to set a source and target directory, but I don't usually use them. - -As I mentioned in the Syncthing [article][5], I use Syncthing to keep a directory called **myconfigs** consistent across all of my machines. The **myconfigs** directory has several subdirectories underneath it. Each subdirectory contains the configuration files for one of the applications I use regularly. - -![myconfigs directory][6] - -On each machine, I change to the **myconfigs** directory and run **stow -S <directory name>** to symlink the files inside the directory to my home directory. For example, under the **vim** directory, I have my **.vimrc** and **.vim** directories. On each machine, I run **stow -S vim** to create the symlinks **~/.vimrc** and **~/.vim**. When I make a change to my Vim configuration on one machine, it applies to ALL of my machines. - -Sometimes, though, I need something machine-specific, which is why I have directories like **msmtp-personal** and **msmtp-elastic** (my employer). Since my **msmtp** SMTP client needs to know what email server to relay through, and each one has different setups and credentials, I can use Stow to swap between the two by "unstowing" one with the **-D** flag and then putting the other in place. - -![Unstow one, stow the other][7] - -Sometimes I find myself adding files to a configuration. For that, there is the "restow" option with **-R**. For example, I like to use a specific font when I use Vim as a graphical application and not a console. The **.gvimrc** file lets me set options that apply only to the graphical version, in addition to the standard **.vimrc** file. When I first set this up, I moved **~/.gvimrc** to **~/myconfigs/vim** and then ran **stow -R vim**, which unlinks and relinks everything in that directory. - -Stow lets me switch between several configurations with a simple command line and, in combination with Syncthing, I can be sure that I have the setup I like for the tools I use ready to go, no matter where I am or where I make changes. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/configuration-management-stow - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) -[2]: https://syncthing.net/ -[3]: https://www.gnu.org/software/stow/ -[4]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png (Stow help screen) -[5]: https://opensource.com/article/20/1/20-productivity-tools-syncthing -[6]: https://opensource.com/sites/default/files/uploads/productivity_2-2.png (myconfigs directory) -[7]: https://opensource.com/sites/default/files/uploads/productivity_2-3.png (Unstow one, stow the other) diff --git a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md b/translated/tech/20200112 Use Stow for configuration management of multiple machines.md new file mode 100644 index 0000000000..1a31d9728a --- /dev/null +++ b/translated/tech/20200112 Use Stow for configuration management of multiple machines.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Stow for configuration management of multiple machines) +[#]: via: (https://opensource.com/article/20/1/configuration-management-stow) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Stow 管理多台机器配置 +====== +2020 年,在我们的 20 个使用开源提升生产力的系列文章中,让我们了解如何使用 Stow 跨机器管理配置。 +![A person programming][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 Stow 管理符号链接 + +昨天,我解释了如何使用 [Syncthing][2] 在多台计算机上保持文件同步。但是,这只是我用来保持配置一致性的工具之一。还有另一个简单的工具 [Stow][3]。 + +![Stow help screen][4] + +Stow 管理符号链接。默认情况下,它会链接目录到上一级目录。还有设置源和目标目录的选项,但我通常不使用它们。 + +正如我在 Syncthing 的[文章][5] 中提到的,我使用 Syncthing 来保持 **myconfigs** 目录在我所有的计算机上一致。**myconfigs** 目录下面有多个子目录。每个子目录包含我经常使用的应用之一的配置文件。 + +![myconfigs directory][6] + +在每台计算机上,我进入 **myconfigs** 目录,并运行 **stow -S <目录名称>** 以将目录中的文件符号链接到我的家目录。例如,在**vim** 目录下,我有 **.vimrc** 和 **.vim** 目录。在每台机器上,我运行 **stow -S vim** 来创建符号链接 **~/.vimrc** 和 **~/.vim**。当我在一台计算机上更改 Vim 配置时,它会应用到我的所有机器上。 + +然而,有时候,我需要一些特定于机器的配置,这就是为什么我有如 **msmtp-personal** 和 **msmtp-elastic**(我的雇主)这样的目录。由于我的 **msmtp** SMTP 客户端需要知道要中继的电子邮件服务器,并且每个服务器都有不同的设置和凭据,我会使用 **-D** 标志来取消链接,接着链接另外一个。 + +![Unstow one, stow the other][7] + +有时我要给配置添加文件。为此,有一个 **-R** 选项来”重新链接“。例如,我喜欢在图形化 Vim 中使用一种与控制台不同的特定字体。除了标准 **.vimrc** 文件,**.gvimrc** 文件能让我设置特定于图形化版本的选项。当我第一次设置它时,我移动 **~/.gvimrc** 到 **~/myconfigs/vim** 中,然后运行 **stow -R vim**,它取消链接并重新链接该目录中的所有内容。 + +Stow 让我使用一个简单的命令行在多种配置之间切换,并且,结合 Syncthing,我可以确保无论我身在何处或在哪里进行更改,我都有我喜欢的工具的设置。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/configuration-management-stow + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://syncthing.net/ +[3]: https://www.gnu.org/software/stow/ +[4]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png (Stow help screen) +[5]: https://opensource.com/article/20/1/20-productivity-tools-syncthing +[6]: https://opensource.com/sites/default/files/uploads/productivity_2-2.png (myconfigs directory) +[7]: https://opensource.com/sites/default/files/uploads/productivity_2-3.png (Unstow one, stow the other) From 727f9f185843c89928b73892f25d6053e7d711e3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 16 Jan 2020 09:02:46 +0800 Subject: [PATCH 579/676] translating --- sources/tech/20200114 Organize your email with Notmuch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200114 Organize your email with Notmuch.md b/sources/tech/20200114 Organize your email with Notmuch.md index f881ff5ad9..c9d5cac441 100644 --- a/sources/tech/20200114 Organize your email with Notmuch.md +++ b/sources/tech/20200114 Organize your email with Notmuch.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e2dac9f5f850122c10308733e3e8dc797b6dd861 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Thu, 16 Jan 2020 09:49:36 +0800 Subject: [PATCH 580/676] translating by hopefully2333 translating by hopefully2333 --- sources/tech/20200109 What-s HTTPS for secure computing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200109 What-s HTTPS for secure computing.md b/sources/tech/20200109 What-s HTTPS for secure computing.md index 364ff39b13..8a1d1d47e3 100644 --- a/sources/tech/20200109 What-s HTTPS for secure computing.md +++ b/sources/tech/20200109 What-s HTTPS for secure computing.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hopefully2333) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 01bf6238e63212205d88f4d66a6e0ec31fc757ab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 10:58:19 +0800 Subject: [PATCH 581/676] PRF @qianmingtian --- ...Distribution openEuler is Available Now.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md index ea6b5d24a5..0671c83bec 100644 --- a/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md +++ b/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -1,61 +1,60 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Huawei’s Linux Distribution openEuler is Available Now!) [#]: via: (https://itsfoss.com/openeuler/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -华为的linux发行版 openEuler 可以使用了! +外媒:华为的 Linux 发行版 openEuler 可以使用了! ====== -华为提供了一个基于 CentOS 的企业 Linux 发行版 EulerOS 。最近,华为发布了一个名为 [openEuler][1] 的 EulerOS 社区版。 +> 华为提供了一个基于 CentOS 的企业级 Linux 发行版 EulerOS。最近,华为发布了一个名为 [openEuler][1] 的 EulerOS 社区版。 -openEuler 的源代码也被发布了。你在微软旗下的 GitHub 上找不到它——源代码可以在 [Gitee][2] 找到,这是一个中文的 [GitHub 的替代品][3] 。 +openEuler 的源代码也一同发布了。你在微软旗下的 GitHub 上找不到它——源代码可以在 [Gitee][2] 找到,这是一个中文的 [GitHub 的替代品][3]。 -它有两个独立的存储库,一个用于存储[源代码][2],另一个作为[包源][4] 存储有助于构建操作系统的软件包。 +它有两个独立的存储库,一个用于存储[源代码][2];另一个作为[软件包的源代码][4],存储有助于构建该操作系统的软件包。 -![][5] +![][5] -openuler 基础架构团队分享了他们使源代码可用的经验: +openEuler 基础架构团队分享了他们使源代码可用的经验: ->我们现在很兴奋。很难想象我们会管理成千上万的仓库。为了确保它们能被成功地编译,我们要感谢所有参与贡献的人。 +> 我们现在很兴奋。很难想象我们会管理成千上万的仓库。为了确保它们能被成功地编译,我们要感谢所有参与贡献的人。 ### openEuler 是基于 CentOS 的 Linux 发行版 与 EulerOS 一样,openEuler OS 也是基于 [CentOS][6],但华为技术有限公司为企业应用进一步开发了该操作系统。 -它是为 ARM64 架构的服务器量身定做的,同时华为声称已经做了一些改变来提高其性能。你可以在[华为发展博客][7]上了解更多。 +它是为 ARM64 架构的服务器量身定做的,同时华为声称已经做了一些改变来提高其性能。你可以在[华为开发博客][7]上了解更多。 ![][8] - 目前,根据 openEuler 的官方声明,有 50 多名贡献者为 openEuler 贡献了近 600 个提交。 -贡献者使源代码对社区可用成为可能。 +贡献者们使源代码对社区可用成为可能。 -值得注意的是,存储库还包括两个与之相关的新项目(或子项目),[iSulad][9] 和 **A-Tune**。 +值得注意的是,存储库还包括两个与之相关的新项目(或子项目),[iSulad][9] 和 A-Tune。 -A-Tune 是一个基于 AI 的操作系统调优软件, iSulad 是一个轻量级的容器运行时守护进程,如[Gitee][2]中提到的那样,它是为物联网和云基础设施设计的。 +A-Tune 是一个基于 AI 的操作系统调优软件,iSulad 是一个轻量级的容器运行时守护进程,如在 [Gitee][2] 中提到的那样,它是为物联网和云基础设施设计的。 -另外,官方的[公告][10]提到,这些系统是在华为云上通过脚本自动化构建的。这确实十分有趣。 +另外,官方的[公告][10]提到,这些系统是在华为云上通过脚本自动构建的。这确实十分有趣。 ### 下载 openEuler ![][11] -到目前为止,你找不到它的英文文档,所以你必须等待或选择通过[文档][12]帮助他们。 +到目前为止,你找不到它的英文文档,所以你必须等待或选择通过(贡献)[文档][12]来帮助他们。 你可以直接从它的[官方网站][13]下载 ISO 来测试它: -[下载 openEuler ][13] +- [下载 openEuler ][13] ### 你认为华为的 openEuler 怎么样? 据 cnTechPost 报道,华为曾宣布 EulerOS 将以新名字 openEuler 成为开源软件。 -目前还不清楚 openEuler 是否会取代 EulerOS ,或者两者会像 CentOS (社区版)和 Red Hat (商业版)一样同时存在。 +目前还不清楚 openEuler 是否会取代 EulerOS ,或者两者会像 CentOS(社区版)和 Red Hat(商业版)一样同时存在。 我还没有测试过它,所以我不能说 openEuler 是否适合英文用户。 @@ -68,7 +67,7 @@ via: https://itsfoss.com/openeuler/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[qianmingtian][c] -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 098a84e15a550d4650bd7d8a6b16f5ac05342cdb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 10:59:34 +0800 Subject: [PATCH 582/676] PUB @qianmingtian https://linux.cn/article-11787-1.html --- ... Huawei-s Linux Distribution openEuler is Available Now.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20200109 Huawei-s Linux Distribution openEuler is Available Now.md (98%) diff --git a/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md b/published/20200109 Huawei-s Linux Distribution openEuler is Available Now.md similarity index 98% rename from translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md rename to published/20200109 Huawei-s Linux Distribution openEuler is Available Now.md index 0671c83bec..891902da7e 100644 --- a/translated/news/20200109 Huawei-s Linux Distribution openEuler is Available Now.md +++ b/published/20200109 Huawei-s Linux Distribution openEuler is Available Now.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11787-1.html) [#]: subject: (Huawei’s Linux Distribution openEuler is Available Now!) [#]: via: (https://itsfoss.com/openeuler/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 85dd526232006c2ec60e99cbb4087f177b090bb0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 12:05:29 +0800 Subject: [PATCH 583/676] PRF @geekpi --- ...Python web API with Pyramid and Cornice.md | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md index ae3afc22af..c6fc97c88a 100644 --- a/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md +++ b/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to write a Python web API with Pyramid and Cornice) @@ -9,12 +9,14 @@ 如何使用 Pyramid 和 Cornice 编写 Python Web API ====== -使用 Pyramid 和 Cornice 构建可扩展的 RESTful Web 服务。 -![Searching for code][1] -[Python][2] 是一种高级的,面向对象的编程语言,它以其简单的语法而闻名。它一直是构建 RESTful API 的顶级编程语言之一。 +> 使用 Pyramid 和 Cornice 构建和描述可扩展的 RESTful Web 服务。 -[Pyramid][3] 是一个 Python Web 框架,旨在随着应用的扩展而扩展:这对于简单的应用来说很简单,对于大型、复杂的应用也可以做到。Pyramid 为 PyPI (Python 软件包索引)提供了强大的支持。[Cornice][4] 提供了使用 Pyramid 构建 RESTful Web 服务的助手。 +![](https://img.linux.net.cn/data/attachment/album/202001/16/120352fcgeeccvfgt8sfvc.jpg) + +[Python][2] 是一种高级的、面向对象的编程语言,它以其简单的语法而闻名。它一直是构建 RESTful API 的顶级编程语言之一。 + +[Pyramid][3] 是一个 Python Web 框架,旨在随着应用的扩展而扩展:这可以让简单的应用很简单,也可以增长为大型、复杂的应用。此外,Pyramid 为 PyPI (Python 软件包索引)提供了强大的支持。[Cornice][4] 为使用 Pyramid 构建和描述 RESTful Web 服务提供了助力。 本文将使用 Web 服务的例子来获取名人名言,来展示如何使用这些工具。 @@ -22,7 +24,6 @@ 首先为你的应用创建一个虚拟环境,并创建一个文件来保存代码: - ``` $ mkdir tutorial $ cd tutorial @@ -36,7 +37,6 @@ $ source env/bin/activate 使用以下命令导入这些模块: - ``` from pyramid.config import Configurator from cornice import Service @@ -44,8 +44,7 @@ from cornice import Service ### 定义服务 -将引用服务定义为 **Service** 对象: - +将引用服务定义为 `Service` 对象: ``` QUOTES = Service(name='quotes', @@ -55,8 +54,7 @@ QUOTES = Service(name='quotes', ### 编写引用逻辑 -到目前为止,这仅支持 **GET** 获取名言。用 **QUOTES.get** 装饰函数。这是将逻辑绑定到 REST 服务的方法: - +到目前为止,这仅支持获取名言。用 `QUOTES.get` 装饰函数。这是将逻辑绑定到 REST 服务的方法: ``` @QUOTES.get() @@ -72,14 +70,13 @@ def get_quote(request):     } ``` -请注意,与其他框架不同,装饰器_不能_更改 **get_quote** 函数。如果导入此模块,你仍然可以定期调用该函数并检查结果。 +请注意,与其他框架不同,装饰器*不会*更改 `get_quote` 函数。如果导入此模块,你仍然可以定期调用该函数并检查结果。 在为 Pyramid RESTful 服务编写单元测试时,这很有用。 ### 定义应用对象 -最后,使用 **scan** 查找所有修饰的函数并将其添加到配置中: - +最后,使用 `scan` 查找所有修饰的函数并将其添加到配置中: ``` with Configurator() as config: @@ -94,14 +91,12 @@ with Configurator() as config: 我使用 Twisted 的 WSGI 服务器运行该应用,但是如果需要,你可以使用任何其他 [WSGI][5] 服务器,例如 Gunicorn 或 uWSGI。 - ``` -`(env)$ python -m twisted web --wsgi=main.application` +(env)$ python -m twisted web --wsgi=main.application ``` 默认情况下,Twisted 的 WSGI 服务器运行在端口 8080 上。你可以使用 [HTTPie][6] 测试该服务: - ``` (env) $ pip install httpie ... @@ -130,7 +125,7 @@ X-Content-Type-Options: nosniff ### 为什么要使用 Pyramid? -Pyramid 不是最受欢迎的框架,但它已在 [PyPI][7] 等一些引人注目的项目中使用。我喜欢 Pyramid,因为它是认真对待单元测试的框架之一:因为装饰器不会修改函数并且没有线程局部变量,所以可以直接从单元测试中调用函数。例如,需要访问数据库的函数将从通过 **request.config** 传递的 **request.config** 对象中获取它。这允许单元测试人员将模拟(或真实)数据库对象放入请求中,而不用仔细设置全局变量,线程局部变量或其他特定于框架的东西。 +Pyramid 并不是最受欢迎的框架,但它已在 [PyPI][7] 等一些引人注目的项目中使用。我喜欢 Pyramid,因为它是认真对待单元测试的框架之一:因为装饰器不会修改函数并且没有线程局部变量,所以可以直接从单元测试中调用函数。例如,需要访问数据库的函数将从通过 `request.config` 传递的 `request.config` 对象中获取它。这允许单元测试人员将模拟(或真实)数据库对象放入请求中,而不用仔细设置全局变量、线程局部变量或其他特定于框架的东西。 如果你正在寻找一个经过测试的库来构建你接下来的 API,请尝试使用 Pyramid。你不会失望的。 @@ -140,8 +135,8 @@ via: https://opensource.com/article/20/1/python-web-api-pyramid-cornice 作者:[Moshe Zadka][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a9d02b2f1c90e95cc4e14ade75b515681c6ec1f8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 12:05:49 +0800 Subject: [PATCH 584/676] PUB @geekpi https://linux.cn/article-11788-1.html --- ... How to write a Python web API with Pyramid and Cornice.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200106 How to write a Python web API with Pyramid and Cornice.md (98%) diff --git a/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md b/published/20200106 How to write a Python web API with Pyramid and Cornice.md similarity index 98% rename from translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md rename to published/20200106 How to write a Python web API with Pyramid and Cornice.md index c6fc97c88a..1ebcc920e9 100644 --- a/translated/tech/20200106 How to write a Python web API with Pyramid and Cornice.md +++ b/published/20200106 How to write a Python web API with Pyramid and Cornice.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11788-1.html) [#]: subject: (How to write a Python web API with Pyramid and Cornice) [#]: via: (https://opensource.com/article/20/1/python-web-api-pyramid-cornice) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 0051d1ef3dc1760a68c261e92d13725cb0b86679 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 21:50:11 +0800 Subject: [PATCH 585/676] PRF @cycoe --- ... jumping to your Python platformer game.md | 141 +++++++++--------- 1 file changed, 67 insertions(+), 74 deletions(-) diff --git a/translated/tech/20191205 Add jumping to your Python platformer game.md b/translated/tech/20191205 Add jumping to your Python platformer game.md index 0487cc1491..06fe32cdc0 100644 --- a/translated/tech/20191205 Add jumping to your Python platformer game.md +++ b/translated/tech/20191205 Add jumping to your Python platformer game.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (cycoe) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Add jumping to your Python platformer game) @@ -9,26 +9,25 @@ 为你的 Python 平台类游戏添加跳跃功能 ====== -在本期使用 Python Pygame 模块编写视频游戏中,学会如何使用跳跃来对抗重力。 -![游戏厅中的游戏][1] + +> 在本期使用 Python Pygame 模块编写视频游戏中,学会如何使用跳跃来对抗重力。 + +![](https://img.linux.net.cn/data/attachment/album/202001/16/214917c8mxn82fot82fx88.jpg) 在本系列的 [前一篇文章][2] 中,你已经模拟了重力。但现在,你需要赋予你的角色跳跃的能力来对抗重力。 -跳跃是对重力作用的暂时延缓。在这一小段时间里,你是向_上_跳,而不是被重力拉着向下落。但你一旦到达了跳跃的最高点,重力就会重新发挥作用,将你拉回地面。 +跳跃是对重力作用的暂时延缓。在这一小段时间里,你是向*上*跳,而不是被重力拉着向下落。但你一旦到达了跳跃的最高点,重力就会重新发挥作用,将你拉回地面。 -在代码中,跳跃被表示为变量。首先,你需要为玩家对象建立一个变量,使得 Python 能够跟踪对象是否正在跳跃中。一旦玩家对象开始跳跃,他就会再次受到重力的作用,并被拉回最近的物体。 +在代码中,这种变化被表示为变量。首先,你需要为玩家精灵建立一个变量,使得 Python 能够跟踪该精灵是否正在跳跃中。一旦玩家精灵开始跳跃,他就会再次受到重力的作用,并被拉回最近的物体。 ### 设置跳跃状态变量 -你需要为你的 Player 类添加两个新变量: +你需要为你的 `Player` 类添加两个新变量: - * 一个是为了跟踪你的角色是否正在跳跃中,可通过你的玩家对象是否站在坚实的地面来确定 + * 一个是为了跟踪你的角色是否正在跳跃中,可通过你的玩家精灵是否站在坚实的地面来确定 * 一个是为了将玩家带回地面 - - -将如下两个变量添加到你的 **Player** 类中。在下方的代码中,注释前的部分用于提示上下文,因此只需要添加最后两行: - +将如下两个变量添加到你的 `Player` 类中。在下方的代码中,注释前的部分用于提示上下文,因此只需要添加最后两行: ```                 self.movex = 0 @@ -40,16 +39,15 @@                 self.jump_delta = 6 ``` -第一个变量 **collide_delta** 被设为 0 是因为在正常状态下,玩家对象没有处在跳跃中的状态。另一个变量 **jump_delta** 被设为 6,是为了防止对象在第一次进入游戏世界时就发生反弹(实际上就是跳跃)。当你完成了本篇文章的示例,尝试把该变量设为 0 看看会发生什么。 +第一个变量 `collide_delta` 被设为 0 是因为在正常状态下,玩家精灵没有处在跳跃中的状态。另一个变量 `jump_delta` 被设为 6,是为了防止精灵在第一次进入游戏世界时就发生反弹(实际上就是跳跃)。当你完成了本篇文章的示例,尝试把该变量设为 0 看看会发生什么。 ### 跳跃中的碰撞 -如果你是跳到一个蹦床上,那你的跳跃一定非常优美。但是如果你是跳向一面墙会发生什么呢?(千万不要去尝试!)不管你的起跳多么令人印象深刻,当你撞到比你更大更硬的物体时,你都会立马停下。(译注:原理参考动量守恒定律) +如果你是跳到一个蹦床上,那你的跳跃一定非常优美。但是如果你是跳向一面墙会发生什么呢?(千万不要去尝试!)不管你的起跳多么令人印象深刻,当你撞到比你更大更硬的物体时,你都会立马停下。(LCTT 译注:原理参考动量守恒定律) -为了在你的视频游戏中模拟这一点,你需要在你的玩家对象与地面等东西发生碰撞时,将 **self.collide_delta** 变量设为 0。如果你的 **self.collide_delta** 不是 0 而是其它的什么值,那么你的玩家就会发生跳跃,并且当你的玩家与墙或者地面发生碰撞时无法跳跃。 - -在你的 **Player** 类的 **update** 方法中,将地面碰撞相关代码块修改为如下所示: +为了在你的视频游戏中模拟这一点,你需要在你的玩家精灵与地面等东西发生碰撞时,将 `self.collide_delta` 变量设为 0。如果你的 `self.collide_delta` 不是 0 而是其它的什么值,那么你的玩家就会发生跳跃,并且当你的玩家与墙或者地面发生碰撞时无法跳跃。 +在你的 `Player` 类的 `update` 方法中,将地面碰撞相关代码块修改为如下所示: ```         ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) @@ -57,42 +55,40 @@             self.movey = 0             self.rect.y = worldy-ty-ty             self.collide_delta = 0 # 停止跳跃 -            if self.rect.y > g.rect.y: -                self.health -=1 -                print(self.health) + if self.rect.y > g.rect.y: + self.health -=1 + print(self.health) ``` -这段代码块检查了地面对象和玩家对象之间发生的碰撞。当发生碰撞时,它会将玩家 Y 方向的坐标值设置为游戏窗口的高度减去一个瓷贴的高度再减去另一个瓷贴的高度。以此保证了玩家对象是站在地面**上**,而不是嵌在地面里。同时它也将 **self.collide_delta** 设为 0,使得程序能够知道玩家未处在跳跃中。除此之外,它将 **self.movey** 设为 0,使得程序能够知道玩家当前未受到重力的牵引作用(这是游戏物理引擎的奇怪之处,一旦玩家落地,也就没有必要继续将玩家拉向地面)。 +这段代码块检查了地面精灵和玩家精灵之间发生的碰撞。当发生碰撞时,它会将玩家 Y 方向的坐标值设置为游戏窗口的高度减去一个瓷砖的高度再减去另一个瓷砖的高度。以此保证了玩家精灵是站在地面*上*,而不是嵌在地面里。同时它也将 `self.collide_delta` 设为 0,使得程序能够知道玩家未处在跳跃中。除此之外,它将 `self.movey` 设为 0,使得程序能够知道玩家当前未受到重力的牵引作用(这是游戏物理引擎的奇怪之处,一旦玩家落地,也就没有必要继续将玩家拉向地面)。 -此处 **if** 语句用来检测玩家是否已经落到地面之_下_,如果是,那就扣除一点生命值作为惩罚。此处假定了你希望当你的玩家落到地图之外时失去生命值。这个设定不是必需的,它只是平台类游戏的一种惯例。更有可能的是,你希望这个事件能够触发另一些事件,或者说是一种能够让你的现实世界玩家沉迷于让对象掉到屏幕之外的东西。一种简单的恢复方式是在玩家对象掉落到地图之外时,将 **self.rect.y** 重新设置为 0,这样它就会在地图上方重新生成,并落到坚实的地面上。 +此处 `if` 语句用来检测玩家是否已经落到地面之*下*,如果是,那就扣除一点生命值作为惩罚。此处假定了你希望当你的玩家落到地图之外时失去生命值。这个设定不是必需的,它只是平台类游戏的一种惯例。更有可能的是,你希望这个事件能够触发另一些事件,或者说是一种能够让你的现实世界玩家沉迷于让精灵掉到屏幕之外的东西。一种简单的恢复方式是在玩家精灵掉落到地图之外时,将 `self.rect.y` 重新设置为 0,这样它就会在地图上方重新生成,并落到坚实的地面上。 ### 撞向地面 -模拟的重力使你玩家的 Y 坐标不断增大(译注:此处原文中为 0,但在 Pygame 中越靠下方 Y 坐标应越大)。要实现跳跃,完成如下代码使你的玩家对象离开地面,飞向空中。 - -在你的 **Player** 类的 **update** 方法中,添加如下代码来暂时延缓重力的作用: +模拟的重力使你玩家的 Y 坐标不断增大(LCTT 译注:此处原文中为 0,但在 Pygame 中越靠下方 Y 坐标应越大)。要实现跳跃,完成如下代码使你的玩家精灵离开地面,飞向空中。 +在你的 `Player` 类的 `update` 方法中,添加如下代码来暂时延缓重力的作用: ``` -        if self.collide_delta < 6 and self.jump_delta < 6: +        if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2             self.movey -= 33  # 跳跃的高度             self.collide_delta += 6             self.jump_delta    += 6 ``` -根据此代码所示,跳跃使玩家对象向空中移动了 33 个像素。此处是_负_ 33 是因为在 Pygame 中,越小的数代表距离屏幕顶端越近。 +根据此代码所示,跳跃使玩家精灵向空中移动了 33 个像素。此处是*负* 33 是因为在 Pygame 中,越小的数代表距离屏幕顶端越近。 -不过此事件视条件而定,只有当 **self.collide_delta** 小于 6(缺省值定义在你 **Player** 类的 **init** 方法中)并且 **self.jump_delta** 也于 6 的时候才会发生。此条件能够保证直到玩家碰到一个平台,才能触发另一次跳跃。换言之,它能够阻止空中二段跳。 +不过此事件视条件而定,只有当 `self.collide_delta` 小于 6(缺省值定义在你 `Player` 类的 `init` 方法中)并且 `self.jump_delta` 也于 6 的时候才会发生。此条件能够保证直到玩家碰到一个平台,才能触发另一次跳跃。换言之,它能够阻止空中二段跳。 在某些特殊条件下,你可能不想阻止空中二段跳,或者说你允许玩家进行空中二段跳。举个栗子,如果玩家获得了某个战利品,那么在他被敌人攻击到之前,都能够拥有空中二段跳的能力。 -当你完成本篇文章中的示例,尝试将 **self.collide_delta** 和 **self.jump_delta** 设置为 0,从而获得百分之百的几率触发空中二段跳。 +当你完成本篇文章中的示例,尝试将 `self.collide_delta` 和 `self.jump_delta` 设置为 0,从而获得百分之百的几率触发空中二段跳。 ### 在平台上着陆 -目前你已经定义了再玩家对象摔落地面时的抵抗重力条件,但此时你的游戏代码仍保持平台与地面置于不同的列表中(就像本文中做的很多其他选择一样,这个设定并不是必需的,你可以尝试将地面作为另一种平台)。为了允许玩家对象站在平台之上,你必须像检测地面碰撞一样,检测玩家对象与平台对象之间的碰撞。将如下代码放于你的 **update** 方法中: - +目前你已经定义了在玩家精灵摔落地面时的抵抗重力条件,但此时你的游戏代码仍保持平台与地面置于不同的列表中(就像本文中做的很多其他选择一样,这个设定并不是必需的,你可以尝试将地面作为另一种平台)。为了允许玩家精灵站在平台之上,你必须像检测地面碰撞一样,检测玩家精灵与平台精灵之间的碰撞。将如下代码放于你的 `update` 方法中: ```         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) @@ -103,27 +99,26 @@ 但此处还有一点需要考虑:平台悬在空中,也就意味着玩家可以通过从上面或者从下面接触平台来与之互动。 -确定平台如何与玩家互动取决于你,阻止玩家从下方到达平台也并不稀奇。将如下代码加到上方的代码块中,使得平台表现得像天花板或者说是藤架。只有在玩家对象跳得比平台上沿更高时才能跳到平台上,但会阻止玩家从平台下方跳上来: - +确定平台如何与玩家互动取决于你,阻止玩家从下方到达平台也并不稀奇。将如下代码加到上方的代码块中,使得平台表现得像天花板或者说是藤架。只有在玩家精灵跳得比平台上沿更高时才能跳到平台上,但会阻止玩家从平台下方跳上来: ``` -            if self.rect.y > p.rect.y: +            if self.rect.y > p.rect.y:                 self.rect.y = p.rect.y+ty             else:                 self.rect.y = p.rect.y-ty ``` -此处 **if** 语句代码块的第一个子句阻止玩家对象从平台正下方跳到平台上。如果它检测到玩家对象的坐标比平台更大(在 Pygame 中,坐标更大意味着在屏幕的更下方),那么将玩家对象新的 Y 坐标设置为当前平台的 Y 坐标加上一个瓷贴的高度。实际效果就是保证玩家对象距离平台一个瓷贴的高度,防止其从下方穿过平台。 +此处 `if` 语句代码块的第一个子句阻止玩家精灵从平台正下方跳到平台上。如果它检测到玩家精灵的坐标比平台更大(在 Pygame 中,坐标更大意味着在屏幕的更下方),那么将玩家精灵新的 Y 坐标设置为当前平台的 Y 坐标加上一个瓷砖的高度。实际效果就是保证玩家精灵距离平台一个瓷砖的高度,防止其从下方穿过平台。 -**else** 子句做了相反的事情。当程序运行到此处时,如果玩家对象的 Y 坐标_不_比平台的更大,意味着玩家对象是从空中落下(不论是由于玩家刚刚从此处生成,或者是玩家执行了跳跃)。在这种情况下,玩家对象的 Y 坐标被设为平台的 Y 坐标减去一个瓷贴的高度(切记,在 Pygame 中更小的 Y 坐标代表在屏幕上的更高处)。这样就能保证玩家在平台_上_,除非他从平台上跳下来或者走下来。 +`else` 子句做了相反的事情。当程序运行到此处时,如果玩家精灵的 Y 坐标*不*比平台的更大,意味着玩家精灵是从空中落下(不论是由于玩家刚刚从此处生成,或者是玩家执行了跳跃)。在这种情况下,玩家精灵的 Y 坐标被设为平台的 Y 坐标减去一个瓷砖的高度(切记,在 Pygame 中更小的 Y 坐标代表在屏幕上的更高处)。这样就能保证玩家在平台*上*,除非他从平台上跳下来或者走下来。 -你也可以尝试其他的方式来处理玩家与平台之间的互动。举个栗子,也许玩家对象被设定为处在平台的“前面”,他能够无障碍地跳跃穿过平台并站在上面。或者你可以设计一种平台会减缓而又不完全阻止玩家的跳跃过程。甚至你可以通过将不同平台分到不同列表中来混合搭配使用。 +你也可以尝试其他的方式来处理玩家与平台之间的互动。举个栗子,也许玩家精灵被设定为处在平台的“前面”,他能够无障碍地跳跃穿过平台并站在上面。或者你可以设计一种平台会减缓而又不完全阻止玩家的跳跃过程。甚至你可以通过将不同平台分到不同列表中来混合搭配使用。 ### 触发一次跳跃 -目前为此,你的代码已经模拟了所有必需的跳跃条件,但仍缺少一个跳跃触发器。你的玩家对象的 **self.jump_delta** 初始值被设置为 6,只有当它比 6 小时才会触发更新跳跃的代码。 +目前为此,你的代码已经模拟了所有必需的跳跃条件,但仍缺少一个跳跃触发器。你的玩家精灵的 `self.jump_delta` 初始值被设置为 6,只有当它比 6 小的时候才会触发更新跳跃的代码。 -为跳跃变量设置一个新的设置方法,在你的 **Player** 类中创建一个 **jump** 方法,并将 **self.jump_delta** 设为小于 6 的值。通过使玩家对象向空中移动 33 个像素,来暂时减缓重力的作用。 +为跳跃变量设置一个新的设置方法,在你的 `Player` 类中创建一个 `jump` 方法,并将 `self.jump_delta` 设为小于 6 的值。通过使玩家精灵向空中移动 33 个像素,来暂时减缓重力的作用。 ``` @@ -131,25 +126,24 @@         self.jump_delta = 0 ``` -不管你相信与否,这就是 **jump** 方法的全部。剩余的部分在 **update** 方法中,你已经在前面实现了相关代码。 +不管你相信与否,这就是 `jump` 方法的全部。剩余的部分在 `update` 方法中,你已经在前面实现了相关代码。 要使你游戏中的跳跃功能生效,还有最后一件事情要做。如果你想不起来是什么,运行游戏并观察跳跃是如何生效的。 -问题就在于你的主循环中没有调用 **jump** 方法。先前你已经为该方法创建了一个按键占位符,现在,跳跃键所做的就是将 **jump** 打印到终端。 +问题就在于你的主循环中没有调用 `jump` 方法。先前你已经为该方法创建了一个按键占位符,现在,跳跃键所做的就是将 `jump` 打印到终端。 ### 调用 jump 方法 -在你的主循环中,将_上_方向键的效果从打印一条调试语句,改为调用 **jump** 方法。 - -注意此处,与 **update** 方法类似,**jump** 方法也需要检测碰撞,因此你需要告诉它使用哪个 **plat_list**。 +在你的主循环中,将*上*方向键的效果从打印一条调试语句,改为调用 `jump` 方法。 +注意此处,与 `update` 方法类似,`jump` 方法也需要检测碰撞,因此你需要告诉它使用哪个 `plat_list`。 ```             if event.key == pygame.K_UP or event.key == ord('w'):                 player.jump(plat_list) ``` -如果你倾向于使用空格键作为跳跃键,使用 **pygame.K_SPACE** 替代 **pygame.K_UP** 作为按键。另一种选择,你可以同时使用两种方式(使用单独的 **if** 语句),给玩家多一种选择。 +如果你倾向于使用空格键作为跳跃键,使用 `pygame.K_SPACE` 替代 `pygame.K_UP` 作为按键。另一种选择,你可以同时使用两种方式(使用单独的 `if` 语句),给玩家多一种选择。 现在来尝试你的游戏吧!在下一篇文章中,你将让你的游戏卷动起来。 @@ -157,7 +151,6 @@ 以下是目前为止的所有代码: - ``` #!/usr/bin/env python3 # draw a world @@ -220,7 +213,7 @@ class Player(pygame.sprite.Sprite):     def gravity(self):         self.movey += 3.2 # how fast player falls         -        if self.rect.y > worldy and self.movey >= 0: +        if self.rect.y > worldy and self.movey >= 0:             self.movey = 0             self.rect.y = worldy-ty         @@ -233,23 +226,23 @@ class Player(pygame.sprite.Sprite):             def update(self):         ''' -        更新对象位置 +        更新精灵位置         '''                 self.rect.x = self.rect.x + self.movex         self.rect.y = self.rect.y + self.movey         # 向左移动 -        if self.movex < 0: +        if self.movex < 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[self.frame//ani]         # 向右移动 -        if self.movex > 0: +        if self.movex > 0:             self.frame += 1 -            if self.frame > ani*3: +            if self.frame > ani*3:                 self.frame = 0             self.image = self.images[(self.frame//ani)+4] @@ -263,7 +256,7 @@ class Player(pygame.sprite.Sprite):         for p in plat_hit_list:             self.collide_delta = 0 # stop jumping             self.movey = 0 -            if self.rect.y > p.rect.y: +            if self.rect.y > p.rect.y:                 self.rect.y = p.rect.y+ty             else:                 self.rect.y = p.rect.y-ty @@ -273,11 +266,11 @@ class Player(pygame.sprite.Sprite):             self.movey = 0             self.rect.y = worldy-ty-ty             self.collide_delta = 0 # stop jumping -            if self.rect.y > g.rect.y: +            if self.rect.y > g.rect.y:                 self.health -=1                 print(self.health)                 -        if self.collide_delta < 6 and self.jump_delta < 6: +        if self.collide_delta < 6 and self.jump_delta < 6:             self.jump_delta = 6*2             self.movey -= 33  # how high to jump             self.collide_delta += 6 @@ -308,22 +301,22 @@ class Enemy(pygame.sprite.Sprite):         self.movey += 3.2         -        if self.counter >= 0 and self.counter <= distance: +        if self.counter >= 0 and self.counter <= distance:             self.rect.x += speed -        elif self.counter >= distance and self.counter <= distance*2: +        elif self.counter >= distance and self.counter <= distance*2:             self.rect.x -= speed         else:             self.counter = 0                 self.counter += 1 -        if not self.rect.y >= worldy-ty-ty: +        if not self.rect.y >= worldy-ty-ty:             self.rect.y += self.movey         plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False)         for p in plat_hit_list:             self.movey = 0 -            if self.rect.y > p.rect.y: +            if self.rect.y > p.rect.y:                 self.rect.y = p.rect.y+ty             else:                 self.rect.y = p.rect.y-ty @@ -352,7 +345,7 @@ class Level():         ground_list = pygame.sprite.Group()         i=0         if lvl == 1: -            while i < len(gloc): +            while i < len(gloc):                 ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png')                 ground_list.add(ground)                 i=i+1 @@ -371,9 +364,9 @@ class Level():             ploc.append((300,worldy-ty-256,3))             ploc.append((500,worldy-ty-128,4)) -            while i < len(ploc): +            while i < len(ploc):                 j=0 -                while j <= ploc[i][2]: +                while j <= ploc[i][2]:                     plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'ground.png')                     plat_list.add(plat)                     j=j+1 @@ -417,11 +410,11 @@ eloc = [] eloc = [200,20] gloc = [] #gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] -tx = 64 # 瓷贴尺寸 -ty = 64 # 瓷贴尺寸 +tx = 64 # 瓷砖尺寸 +ty = 64 # 瓷砖尺寸 i=0 -while i <= (worldx/tx)+tx: +while i <= (worldx/tx)+tx:     gloc.append(i*tx)     i=i+1 @@ -482,9 +475,8 @@ while main == True: * [如何在你的 Python 游戏中添加一个玩家][8] * [用 Pygame 使你的游戏角色移动起来][9] * [如何向你的 Python 游戏中添加一个敌人][10] - * [在你的 Python 游戏中模拟重力][2] - - + * [在 Pygame 游戏中放置平台][11] + * [在你的 Python 游戏中模拟引力][2] -------------------------------------------------------------------------------- @@ -493,19 +485,20 @@ via: https://opensource.com/article/19/12/jumping-python-platformer-game 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[cycoe](https://github.com/cycoe) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/seth [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32 (Arcade games) -[2]: https://opensource.com/article/19/11/simulate-gravity-python +[2]: https://linux.cn/article-11780-1.html [3]: https://opensource.com/sites/default/files/uploads/pygame-jump.jpg (Pygame platformer) [4]: https://www.python.org/ [5]: https://www.pygame.org/ -[6]: https://opensource.com/article/17/10/python-101 -[7]: https://opensource.com/article/17/12/game-framework-python -[8]: https://opensource.com/article/17/12/game-python-add-a-player -[9]: https://opensource.com/article/17/12/game-python-moving-player -[10]: https://opensource.com/article/18/5/pygame-enemy +[6]: https://linux.cn/article-9071-1.html +[7]: https://linux.cn/article-10850-1.html +[8]: https://linux.cn/article-10858-1.html +[9]: https://linux.cn/article-10874-1.html +[10]: https://linux.cn/article-10883-1.html +[11]: https://linux.cn/article-10902-1.html From 419615b21b0d8d8cec51990d801bb5f41537f0a0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 21:50:43 +0800 Subject: [PATCH 586/676] PUB @cycoe https://linux.cn/article-11790-1.html --- .../20191205 Add jumping to your Python platformer game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191205 Add jumping to your Python platformer game.md (99%) diff --git a/translated/tech/20191205 Add jumping to your Python platformer game.md b/published/20191205 Add jumping to your Python platformer game.md similarity index 99% rename from translated/tech/20191205 Add jumping to your Python platformer game.md rename to published/20191205 Add jumping to your Python platformer game.md index 06fe32cdc0..d7195a008a 100644 --- a/translated/tech/20191205 Add jumping to your Python platformer game.md +++ b/published/20191205 Add jumping to your Python platformer game.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (cycoe) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11790-1.html) [#]: subject: (Add jumping to your Python platformer game) [#]: via: (https://opensource.com/article/19/12/jumping-python-platformer-game) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From f2e58086eb7e27ea6f2acbecb5d65b39969c688c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 16 Jan 2020 23:00:19 +0800 Subject: [PATCH 587/676] PRF&PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @chen-ni https://linux.cn/article-11791-1.html 翻译的很好! --- ... Still Using an ‘Outdated- Linux Kernel.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) rename {translated/tech => published}/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md (77%) diff --git a/translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md b/published/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md similarity index 77% rename from translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md rename to published/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md index b8af543814..4075e017a8 100644 --- a/translated/tech/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md +++ b/published/20191227 Explained- Why Your Distribution Still Using an ‘Outdated- Linux Kernel.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chen-ni) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11791-1.html) [#]: subject: (Explained! Why Your Distribution Still Using an ‘Outdated’ Linux Kernel?) [#]: via: (https://itsfoss.com/why-distros-use-old-kernel/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) @@ -10,7 +10,9 @@ 为什么你的发行版仍然在使用“过时的”Linux 内核? ====== -[检查一下你的系统所使用的 Linux 内核版本][1],你十有八九会发现,按照 Linux 内核官网提供的信息,该内核版本已经达到使用寿命终期了。 +![](https://img.linux.net.cn/data/attachment/album/202001/16/225806jbqyacu3loolobae.png) + +[检查一下你的系统所使用的 Linux 内核版本][1],你十有八九会发现,按照 Linux 内核官网提供的信息,该内核版本已经达到使用寿命终期(EOL)了。 一个软件一旦达到了使用寿命终期,那么就意味着它再也不会得到 bug 修复和维护了。 @@ -18,11 +20,11 @@ 下面将逐一解答这些问题。 -总结 - -上游内核维护与你的发行版的内核维护是两个不同的概念。 - -例如,根据 Linux 内核官网,Linux 内核 4.15 版本可能已经达到使用寿命终期了,但是在 2023 年 4 月之前,Ubuntu 18.04 长期维护版本将会继续使用这个版本,并通过向后移植安全补丁和修复 bug 来提供维护。 +> **总结** +> +> 上游内核维护与你的发行版的内核维护是两个不同的概念。 +> +> 例如,根据 Linux 内核官网,Linux 内核 4.15 版本可能已经达到使用寿命终期了,但是在 2023 年 4 月之前,Ubuntu 18.04 长期维护版本将会继续使用这个版本,并通过向后移植安全补丁和修复 bug 来提供维护。 ### 检查 Linux 内核版本,以及是否达到使用寿命终期 @@ -35,13 +37,11 @@ uname -r 我使用的是 Ubuntu 18.04,输出的 Linux 内核版本如下: ``` -[email protected]:~$ uname -r +abhishek@itsfoss:~$ uname -r 5.0.0-37-generic ``` -接下来,可以到 Linux 内核官网上看看哪些 Linux 内核版本仍然在维护状态。在网站主页上就可以看到相关信息。 - -[Linux 内核官网][2] +接下来,可以到 [Linux 内核官网][2]上看看哪些 Linux 内核版本仍然在维护状态。在网站主页上就可以看到相关信息。 你看到的内核版本状态应该类似于下图: @@ -53,7 +53,7 @@ uname -r 不幸的是,Linux 内核的生命周期没有任何规律可循。不是说常规的内核稳定发布版可以得到 X 月的维护、长期维护版本(LTS)可以得到 Y 年的维护。没有这回事。 -根据实际需求,可能会存在内核的多个 LTS 版本,其使用寿命终期各不相同。在[这个页面][5]上可以查到这些 LTS 版本的相关信息,包括推定的使用寿命终期。 +根据实际需求,可能会存在内核的多个 LTS 版本,其使用寿命终期各不相同。在[这个页面][5]上可以查到这些 LTS 版本的相关信息,包括计划的使用寿命终期。 那么问题来了:既然 Linux 内核官网上明确表示 5.0 版本的内核已经达到了使用寿命终期,Ubuntu 为什么还在提供这个内核版本呢? @@ -63,11 +63,11 @@ uname -r 你是否想过,为什么 Ubuntu/Debian/Fedora 等发行版被称为 Linux “发行版”?这是因为,它们“发行” Linux 内核。 -这些发行版会对 Linux 内核进行不同的修改,并添加各种 GUI 元素(包括桌面环境,显示服务器等)以及软件,然后再呈现给用户。 +这些发行版会对 Linux 内核进行不同的修改,并添加各种 GUI 元素(包括桌面环境、显示服务器等)以及软件,然后再呈现给用户。 按照通常的工作流,Linux 发行版会选择一个内核,提供给其用户,然后在接下来的几个月、几年中,甚至是达到内核的使用寿命终期之后,仍然会继续使用该内核。 -这样能够保障安全吗?其实是可以的,因为 _**发行版会通过向后移植全部的重要修补来维护内核**_。 +这样能够保障安全吗?其实是可以的,因为 **发行版会通过向后移植全部的重要修补来维护内核**。 换句话说,你的 Linux 发行版会确保 Linux 内核没有漏洞和 bug,并且已经通过向后移植获得了重要的新特性。在“过时的旧版本 Linux 内核”上,其实有着数以千计的改动。 @@ -83,13 +83,13 @@ uname -r 新的 Linux 内核稳定版本每隔 2 到 3 个月发布一次,有不少用户跃跃欲试。 -实话说,除非有十分充分的理由,否则不应该使用最新版本的稳定内核。你使用的发行版并不会提供这个选项,你也不能指望通过在键盘上敲出“_sudo apt give-me-the-latest-stable-kernel_”解决问题。 +实话说,除非有十分充分的理由,否则不应该使用最新版本的稳定内核。你使用的发行版并不会提供这个选项,你也不能指望通过在键盘上敲出 `sudo apt give-me-the-latest-stable-kernel` 解决问题。 -此外,手动[安装主流 Linux 内核版本][8]本身就是一个挑战。即使安装成功,之后每次发布 bug 修复的时候,负责更新内核的就会是你了。此外,当新内核达到使用寿命终期之后,你就有责任将它升级到更新的内核版本了。和常规的[Ubuntu 更新][9]不同,内核升级无法通过 apt upgrade 完成。 +此外,手动[安装主流 Linux 内核版本][8]本身就是一个挑战。即使安装成功,之后每次发布 bug 修复的时候,负责更新内核的就会是你了。此外,当新内核达到使用寿命终期之后,你就有责任将它升级到更新的内核版本了。和常规的 [Ubuntu 更新][9]不同,内核升级无法通过 `apt upgrade` 完成。 同样需要记住的是,切换到主流内核之后,可能就无法使用你的发行版提供的一些驱动程序和补丁了。 -正如 [Greg Kroah-Hartman][10]所言,“_**你能使用的最好的内核,就是别人在维护的内核。**_”除了你的 Linux 发行版之外,又有谁更胜任这份工作呢! +正如 [Greg Kroah-Hartman][10]所言,“**你能使用的最好的内核,就是别人在维护的内核。**”除了你的 Linux 发行版之外,又有谁更胜任这份工作呢! 希望你对这个主题已经有了更好的理解。下回发现你的系统正在使用的内核版本已经达到使用寿命终期的时候,希望你不会感到惊慌失措。 @@ -102,7 +102,7 @@ via: https://itsfoss.com/why-distros-use-old-kernel/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[chen-ni](https://github.com/chen-ni) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3f6b672ec7f97aeba6e30e9a9c852b44b66fd22c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 00:57:09 +0800 Subject: [PATCH 588/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Insigh?= =?UTF-8?q?ts=20into=20Why=20Hyperbola=20GNU/Linux=20is=20Turning=20into?= =?UTF-8?q?=20Hyperbola=20BSD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md --- ...GNU-Linux is Turning into Hyperbola BSD.md | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md diff --git a/sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md new file mode 100644 index 0000000000..68ede9acfa --- /dev/null +++ b/sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Insights into Why Hyperbola GNU/Linux is Turning into Hyperbola BSD) +[#]: via: (https://itsfoss.com/hyperbola-linux-bsd/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Insights into Why Hyperbola GNU/Linux is Turning into Hyperbola BSD +====== + +In late December 2019, [Hyperbola][1] [announced][2] that they would be making major changes to their project. They have decided to drop the Linux kernel in favor of forking the OpenBSD kernel. This announcement only came months after Project Trident [announced][3] that they were going in the opposite direction (from BSD to Linux). + +Hyperbola also plans to replace all software that is not GPL v3 compliant with new versions that are. + +To get more insight into the future of their new project, I interviewed **Andre, co-founder of Hyperbola**. + +### Why Hyperbola GNU/Linux Turned into Hyperbola BSD + +![][4] + +_**It’s FOSS: In your announcement, you state that the Linux kernel is “rapidly proceeding down an unstable path”. Could you explain what you mean by that?**_ + +**Andre:** First of all, it’s including the adaption of DRM features such as [HDCP][5] (High-bandwidth Digital Content Protection). Currently there is an option to disable it at build time, however there isn’t a policy that guarantees us that it will be optional forever. + +Historically, some features began as optional ones until they reached total functionality. Then they became forced and difficult to patch out. Even if this does not happen in the case of HDCP, we remain cautious about such implementations. + +Another of the reasons is that the _**Linux kernel is no longer getting proper hardening**_. [Grsecurity][6] stopped offering public patches several years ago, and we depended on that for our system’s security. Although we could use their patches still for a very expensive subscription, the subscription would be terminated if we chose to make those patches public. + +Such restrictions goes against the FSDG principles that require us to provide full source code, deblobbed, and unrestricted, to our users. + +KSPP is a project that was intended to upstream Grsec into the kernel, but thus far it has not come close to reaching Grsec / PaX level of kernel hardening. There also has not been many recent developments, which leads us to believe it is now an inactive project for the most part. + +Lastly, the interest in [allowing Rust modules][7] into the kernel are a problem for us, due to Rust trademark restrictions which prevent us from applying patches in our distribution without express permission. We patch to remove non-free software, unlicensed files, and enhancements to user-privacy anywhere it is applicable. We also expect our users to be able to re-use our code without any additional restrictions or permission required. + +This is also in part why we use UXP, a fully free browser engine and application toolkit without Rust, for our mail and browser applications. + +Due to these restrictions, and the concern that it may at some point become a forced build-time dependency for the kernel we needed another option. + +_**It’s FOSS: You also said in the announcement that you would be forking the OpenBSD kernel. Why did you pick the OpenBSD kennel over the FreeBSD, the DragonflyBSD kernel or the MidnightBSD kernel?**_ + +**Andre:** [OpenBSD][8] was chosen as our base for hard-forking because it’s a system that has always had quality code and security in mind. + +Some of their ideas which greatly interested us were new system calls, including pledge and unveil which adds additional hardening to userspace and the removal of the systrace system policy-enforcement tool. + +They also are known for [Xenocara][9] and [LibreSSL][10], both of which we had already been using after porting them to [GNU/Linux-libre][11]. We found them to be well written and generally more stable than Xorg/OpenSSL respectively. + +None of the other BSD implementations we are aware of have that level of security. We also were aware [LibertyBSD][12] has been working on liberating the OpenBSD kernel, which allowed us to use their patches to begin the initial development. + +_**It’s FOSS: Why fork the kernel in the first place? How will you keep the new kernel up-to-date with newer hardware support?**_ + +**Andre:** The kernel is one of the most important parts of any operating system, and we felt it is critical to start on a firm foundation moving forward. + +For the first version we plan to keep in synchronization with OpenBSD where it is possible. In future versions we may adapt code from other BSDs and even the Linux kernel where needed to keep up with hardware support and features. + +We are working in coordination with [Libreware Group][13] (our representative for business activities) and have plans to open our foundation soon. + +This will help to sustain development, hire future developers and encourage new enthusiasts for newer hardware support and code. We know that deblobbing isn’t enough because it’s a mitigation, not a solution for us. So, for that reason, we need to improve our structure and go to the next stage of development for our projects. + +_**It’s FOSS: You state that you plan to replace the parts of the OpenBSD kernel and userspace that are not GPL compatible or non-free with those that are. What percentage of the code falls into the non-GPL zone?**_ + +**Andre:** It’s around 20% in the OpenBSD kernel and userspace. + +Mostly, the non-GPL compatible licensed parts are under the Original BSD license, sometimes called the “4-clause BSD license” that contains a serious flaw: the “obnoxious BSD advertising clause”. It isn’t fatal, but it does cause practical problems for us because it generates incompatibility with our code and future development under GPLv3 and LGPLv3. + +The non-free files in OpenBSD include files without an appropriate license header, or without a license in the folder containing a particular component. + +If those files don’t contain a license to give users the four essential freedoms or if it has not been explicitly added in the public domain, it isn’t free software. Some developers think that code without a license is automatically in the public domain. That isn’t true under today’s copyright law; rather, all copyrightable works are copyrighted by default. + +The non-free firmware blobs in OpenBSD include various hardware firmwares. These firmware blobs occur in Linux kernel also and have been manually removed by the Linux-libre project for years following each new kernel release. + +They are typically in the form of a hex encoded binary and are provided to kernel developers without source in order to provide support for proprietary-designed hardware. These blobs may contain vulnerabilities or backdoors in addition to violating your freedom, but no one would know since the source code is not available for them. They must be removed to respect user freedom. + +_**It’s FOSS: I was talking with someone about HyperbolaBSD and they mentioned [HardenedBSD][14]. Have you considered HardenedBSD?**_ + +**Andre:** We had looked into HardenedBSD, but it was forked from FreeBSD. FreeBSD has a much larger codebase. While HardenedBSD is likely a good project, it would require much more effort for us to deblob and verify licenses of all files. + +We decided to use OpenBSD as a base to fork from instead of FreeBSD due to their past commitment to code quality, security, and minimalism. + +_**It’s FOSS: You mentioned UXP (or [Unified XUL Platform][15]). It appears that you are using [Moonchild’s fork of the pre-Servo Mozilla codebase][16] to create a suite of applications for the web. Is that about the size of it?**_ + +**Andre:** Yes. Our decision to use UXP was for several reasons. We were already rebranding Firefox as Iceweasel for several years to remove DRM, disable telemetry, and apply preset privacy options. However, it became harder and harder for us to maintain when Mozilla kept adding anti-features, removing user customization, and rapidly breaking our rebranding and privacy patches. + +After FF52, all XUL extensions were removed in favor of WebExt and Rust became enforced at compile time. We maintain several XUL addons to enhance user-privacy/security which would no longer work in the new engine. We also were concerned that the feature limited WebExt addons were introducing additional privacy issues. E.g. each installed WebExt addon contains a UUID which can be used to uniquely and precisely identify users (see [Bugzilla 1372288][17]). + +After some research, we discovered UXP and that it was regularly keeping up with security fixes without rushing to implement new features. They had already disabled telemetry in the toolkit and remain committed to deleting all of it from the codebase. + +We knew this was well-aligned with our goals, but still needed to apply a few patches to tweak privacy settings and remove DRM. Hence, we started creating our own applications on top of the toolkit. + +This has allowed us to go far beyond basic rebranding/deblobbing as we were doing before and create our own fully customized XUL applications. We currently maintain [Iceweasel-UXP][18], [Icedove-UXP][19] and [Iceape-UXP][20] in addition to sharing toolkit improvements back to UXP. + +_**It’s FOSS: In a [forum post][21], I noticed mentions of HyperRC, HyperBLibC, and hyperman. Are these forks or rewrites of current BSD tools to be GPL compliant?**_ + +**Andre:** They are forks of existing projects. + +Hyperman is a fork of our current package manager, pacman. As pacman does not currently work on BSD, and the minimal support it had in the past was removed in recent versions, a fork was required. Hyperman already has a working implementation using LibreSSL and BSD support. + +HyperRC will be a patched version of OpenRC init. HyperBLibC will be a fork from BSD LibC. + +_**It’s FOSS: Since the beginning of time, Linux has championed the GPL license and BSD has championed the BSD license. Now, you are working to create a BSD that is GPL licensed. How would you respond to those in the BSD community who don’t agree with this move?**_ + +**Andre:** We are aware that there are disagreements between the GPL and BSD world. There are even disagreements over calling our previous distribution “GNU/Linux” rather than simply “Linux”, since the latter definition ignores that the GNU userspace was created in 1984, several years prior to the Linux kernel being created by Linus Torvalds. It was the two different software combined that make a complete system. + +Some of the primary differences from BSD, is that the GPL requires that our source code must be made public, including future versions, and that it can only be used in tandem with compatibly licensed files. BSD systems do not have to share their source code publicly, and may bundle themselves with various licenses and non-free software without restriction. + +Since we are strong supporters of the Free Software Movement and wish that our future code remain in the public space always, we chose the GPL. + +_**It’s FOSS: I know at this point you are just starting the process, but do you have any idea who you might have a usable version of HyperbolaBSD available?**_ + +**Andre:** We expect to have an alpha release ready by 2021 (Q3) for initial testing. + +_**It’s FOSS: How long will you continue to support the current Linux version of Hyperbola? Will it be easy for current users to switch over to**_? + +**Andre:** As per our announcement, we will continue to support Hyperbola GNU/Linux-libre until 2022 (Q4). We expect there to be some difficulty in migration due to ABI changes, but will prepare an announcement and information on our wiki once it is ready. + +_**It’s FOSS: If someone is interested in helping you work on HyperbolaBSD, how can they go about doing that? What kind of expertise would you be looking for?**_ + +**Andre:** Anyone who is interested and able to learn is welcome. We need C programmers and users who are interested in improving security and privacy in software. Developers need to follow the FSDG principles of free software development, as well as the YAGNI principle which means we will implement new features only as we need them. + +Users can fork our git repository and submit patches to us for inclusion. + +_**It’s FOSS: Do you have any plans to support ZFS? What filesystems will you support?**_ + +**Andre:** [ZFS][22] support is not currently planned, because it uses the Common Development and Distribution License, version 1.0 (CDDL). This license is incompatible with all versions of the GNU General Public License (GPL). + +It would be possible to write new code under GPLv3 and release it under a new name (eg. HyperZFS), however there is no official decision to include ZFS compatibility code in HyperbolaBSD at this time. + +We have plans on porting BTRFS, JFS2, NetBSD’s CHFS, DragonFlyBSD’s HAMMER/HAMMER2 and the Linux kernel’s JFFS2, all of which have licenses compatible with GPLv3. Long term, we may also support Ext4, F2FS, ReiserFS and Reiser4, but they will need to be rewritten due to being licensed exclusively under GPLv2, which does not allow use with GPLv3. All of these file systems will require development and stability testing, so they will be in later HyperbolaBSD releases and not for our initial stable version(s). + +* * * + +I would like to thank Andre for taking the time to answer my questions and for revealing more about the future of HyperbolaBSD. + +What are your thoughts on Hyperbola switching to a BSD kernel? What do you think about a BSD being released under the GPL? Please let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][23]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/hyperbola-linux-bsd/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://www.hyperbola.info/ +[2]: https://www.hyperbola.info/news/announcing-hyperbolabsd-roadmap/ +[3]: https://itsfoss.com/bsd-project-trident-linux/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/hyperbola_linux_bsd.png?ssl=1 +[5]: https://patchwork.kernel.org/patch/10084131/ +[6]: https://grsecurity.net/ +[7]: https://lwn.net/Articles/797828/ +[8]: https://www.openbsd.org/ +[9]: https://www.xenocara.org/ +[10]: https://www.libressl.org/ +[11]: https://en.wikipedia.org/wiki/Linux-libre +[12]: https://libertybsd.net/ +[13]: https://en.libreware.info/ +[14]: https://hardenedbsd.org/ +[15]: http://thereisonlyxul.org/ +[16]: https://github.com/MoonchildProductions/UXP +[17]: https://bugzilla.mozilla.org/show_bug.cgi?id=1372288 +[18]: https://wiki.hyperbola.info/doku.php?id=en:project:iceweasel-uxp +[19]: https://wiki.hyperbola.info/doku.php?id=en:project:icedove-uxp +[20]: https://wiki.hyperbola.info/doku.php?id=en:project:iceape-uxp +[21]: https://forums.hyperbola.info/viewtopic.php?id=315 +[22]: https://itsfoss.com/what-is-zfs/ +[23]: https://reddit.com/r/linuxusersgroup From ea96b681141b1a5bc6b5d0d536bc1429f9e3eed3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 00:57:54 +0800 Subject: [PATCH 589/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=203=20op?= =?UTF-8?q?en=20source=20tools=20to=20manage=20your=20contacts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200116 3 open source tools to manage your contacts.md --- ...en source tools to manage your contacts.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/tech/20200116 3 open source tools to manage your contacts.md diff --git a/sources/tech/20200116 3 open source tools to manage your contacts.md b/sources/tech/20200116 3 open source tools to manage your contacts.md new file mode 100644 index 0000000000..eeb7877de1 --- /dev/null +++ b/sources/tech/20200116 3 open source tools to manage your contacts.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 open source tools to manage your contacts) +[#]: via: (https://opensource.com/article/20/1/sync-contacts-locally) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +3 open source tools to manage your contacts +====== +Access your contacts more quickly by syncing them locally. Learn how in +the sixth in our series on 20 ways to be more productive with open +source in 2020. +![Team communication, chat][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Open source tools for contact management + +In previous articles in this series, I explained how to synchronize your [mail][2] and [calendars][3] locally. Hopefully, that has sped up accessing your mail and calendar. Now I'll talk about contacts, which you can use to send mail and calendar invites. + +![abook][4] + +I have collected a lot of email addresses over the course of my, well, life so far. And managing all that data can be a bit of a pain. There are web-based services, but they aren't as fast as a local copy. + +A few days ago, I talked about [vdirsyncer][5] for managing calendars. Vdirsyncer also handles contacts using the CardDAV protocol. Vdirsyncer supports **google_contacts** and **carddav** to do contact synchronizations in addition to the **filesystem** store it uses for calendars, but the **fileext** setting will change, so you won't be trying to store contacts in calendar files. + +I added a configuration block to the config file and mirrored my contacts from Google. Extra steps are required to set it up. Once the Google setup is complete, the configuration is pretty simple: + + +``` +[pair address_sync] +a = "googlecard" +b = "localcard" +collections = ["from a", "from b"] +conflict_resolution = "a wins" + +[storage googlecard] +type = "google_contacts" +token_file = "~/.vdirsyncer/google_token" +client_id = "my_client_id" +client_secret = "my_client_secret" + +[storage localcard] +type = "filesystem" +path = "~/.calendars/Addresses/" +fileext = ".vcf" +``` + +Now when I run **vdirsyncer discover**, it finds my Google contacts, and **vdirsyncer sync** copies them to my local machine. But again, that's only half the story. Now I want to read and use the contacts. Enter [khard][6] and [abook][7]. + +![khard search][8] + +Why two applications? Each has its own use case, and in this case, more is better. Khard does for addresses what [khal][9] does for calendar entries. You'll probably want to install the latest release via pip if your distribution ships an older version. Once khard is installed, you need to create **~/.config/khard/khard.conf** because khard doesn't have a nifty configuration wizard the way khal does. Mine looks like this: + + +``` +[addressbooks] +[[addresses]] +path = ~/.calendars/Addresses/default/ + +[general] +debug = no +default_action = list +editor = vim, -i, NONE +merge_editor = vimdiff + +[contact table] +display = first_name +group_by_addressbook = no +reverse = no +show_nicknames = yes +show_uids = no +sort = last_name +localize_dates = yes + +[vcard] +preferred_version = 3.0 +search_in_source_files = yes +skip_unparsable = no +``` + +This defines the source address book (and gives it a friendly name), as well as what to display and what do use to edit contacts. Running **khard list** will list all the entries, and **khard list <[some@email.adr][10]>** will search for a specific entry. If you want to add or edit an entry, the **add** and **edit** commands launch the configured editor with the same basic template, the only difference being that the **add** template will be blank. + +![editing in khard][11] + +Abook requires you to import and export VCF files but offers some nice features for lookups. To convert your files to the abook format, first install abook and create the **~/.abook** default directory. Now tell abook to parse all the files and put them into the **~/.abook/addresses** file: + + +``` +apt install abook +ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses +``` + +Now run **abook**, and you'll have a very nice UI to browse, search, and edit the entries. Exporting them back to individual entries is a bit of a pain, so I do most of my edits with khard and have a cron job to import them into abook. + +Abook can also search on the command line and has a lot of documentation about integrating it with mail clients. For example, you can use abook for lookups in the [Notmuch][12] email client [alot][13] by adding some information to the **.config/alot/config** file: + + +``` +[accounts] +  [[Personal]] +     realname = Kevin Sonney +     address = [kevin@sonney.com][14] +     alias_regexp = kevin\[+.+@sonney.com][15] +     gpg_key = 7BB612C9 +     sendmail_command = msmtp --account=Personal -t +     # ~ expansion works +     sent_box = maildir://~/Maildir/Sent +     draft_box = maildir://~/Maildir/Drafts +    [[[abook]]] +        type = abook +``` + +And there you have it: fast lookup of your contacts to go with your mail and calendars! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-contacts-locally + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) +[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[3]: https://opensource.com/article/20/1/open-source-calendar +[4]: https://opensource.com/sites/default/files/uploads/productivity_6-1.png (abook) +[5]: https://github.com/pimutils/vdirsyncer +[6]: https://github.com/scheibler/khard +[7]: http://abook.sourceforge.net/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_6-2.png (khard search) +[9]: https://khal.readthedocs.io/en/v0.9.2/index.html +[10]: mailto:some@email.adr +[11]: https://opensource.com/sites/default/files/uploads/productivity_6-3.png (editing in khard) +[12]: https://opensource.com/article/20/1/organize-email-notmuch +[13]: https://github.com/pazz/alot +[14]: mailto:kevin@sonney.com +[15]: mailto:+.+@sonney.com From 0a8d926d5cb7f63509a8cf3327f2c1d077db55df Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 00:58:23 +0800 Subject: [PATCH 590/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=20Automa?= =?UTF-8?q?ting=20Helm=20deployments=20with=20Bash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200116 Automating Helm deployments with Bash.md --- ...6 Automating Helm deployments with Bash.md | 385 ++++++++++++++++++ 1 file changed, 385 insertions(+) create mode 100644 sources/tech/20200116 Automating Helm deployments with Bash.md diff --git a/sources/tech/20200116 Automating Helm deployments with Bash.md b/sources/tech/20200116 Automating Helm deployments with Bash.md new file mode 100644 index 0000000000..a8e8567b0b --- /dev/null +++ b/sources/tech/20200116 Automating Helm deployments with Bash.md @@ -0,0 +1,385 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automating Helm deployments with Bash) +[#]: via: (https://opensource.com/article/20/1/automating-helm-deployments-bash) +[#]: author: (Darin London https://opensource.com/users/dmlond) + +Automating Helm deployments with Bash +====== +This Bash script enables developers to focus on their code rather than +the deployment logic in each project. +![Person using a laptop][1] + +Some of our applications are hosted in a [Kubernetes][2] cluster, and we use GitLab Continuous Integration (CI) to automate deployments and Helm 2 to deploy our applications. Helm charts enable the storage of templates of Kubernetes object YAML files with variables that can be programmatically set from command-line arguments passed when the chart is used during deployments. This allows us to store critical secrets in GitLab-protected environment variables or in Hashicorp Vault and use them within the CI deployment job. + +Our deployment job uses a [Bash script to run the deployment process][3]. This Bash script presents a number of features that are valuable for use within a CI/CD environment: + + 1. It facilitates use outside of the CI/CD environment. GitLab CI and other CI systems store job steps as lines of executable shell code in a "script" section of a CI text file (.gitlab-ci.yml, for example). While this is useful to ensure basic executable steps can be stored without external dependencies, it prevents developers from using the same code in testing or manual deployment scenarios. In addition, many advanced features of the Bash system cannot be easily used in these script sections. + 2. It facilitates unit testing of important deployment processes. None of the CI systems provide a way of testing whether deployment logic performs as expected. Carefully constructed [Bash scripts can be unit tested with BATS][4]. + 3. It facilitates reuse of individual functions within the script. The last section uses a guard clause, **if [[ "${BASH_SOURCE[0]}" == "${0}" ]]**, which prevents the **run_main** function from being called when the script is not being executed. This allows the script to be sourced, which then allows users to make use of the many useful individual functions within it. This is crucial for proper BATS testing. + 4. It uses environment variables to protect sensitive information and make the script reusable across many projects and project application environments. GitLab CI makes many of these environment variables available when run by a GitLab CI runner. These must be manually set before using the script outside GitLab CI. + + + +The script performs all tasks required to deploy a Helm chart for an application to Kubernetes and waits for the deployment to be ready using kubectl and Helm. Helm runs with a local Tiller installation instead of running Tiller in the Kubernetes cluster. The Kubernetes **HELM_USER** and **HELM_PASSWORD** are used to log into the Kubernetes **CLUSTER_SERVER** and **PROJECT_NAMESPACE**. Tiller is started, Helm is initialized in client-only mode, and its repo is updated. The template is linted with Helm to ensure that syntax errors have not been accidentally committed. The template is then deployed in declarative mode, using **helm upgrade --install**. Helm waits for the deployment to be ready using the **\--wait flag**. + +The script ensures that certain template variables are set during the deployment and allows special project-specific variables to be specified in the GitLab CI **PROJECT_SPECIFIC_DEPLOY_ARGS** environment variable. All environment variables required in the deployment are checked early in the script execution, and the script exits with a non-zero exit status if any are missing. + +This script has been used in multiple GitLab CI-hosted projects. It has helped us focus on our code rather than the deployment logic in each project. + +### The script + + +``` +#!/bin/bash + +# MIT License +# +# Copyright (c) 2019 Darin London +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +log_level_for() +{ +  case "${1}" in +    "error") +      echo 1 +      ;; + +    "warn") +      echo 2 +      ;; + +    "debug") +      echo 3 +      ;; + +    "info") +      echo 4 +      ;; +    *) +      echo -1 +      ;; +  esac +} + +current_log_level() +{ +  log_level_for "${LOG_LEVEL}" +} + +error() +{ +  [ $(log_level_for "error") -le $(current_log_level) ] &&  echo "${1}" >&2 +} + +warn() +{ +  [ $(log_level_for "warn") -le $(current_log_level) ] &&  echo "${1}" >&2 +} + +debug() +{ +  [ $(log_level_for "debug") -le $(current_log_level) ] &&  echo "${1}" >&2 +} + +info() +{ +  [ $(log_level_for "info") -le $(current_log_level) ] &&  echo "${1}" >&2 +} + +check_required_environment() { +  local required_env="${1}" + +  for reqvar in $required_env +  do +    if [ -z "${!reqvar}" ] +    then +      error "missing ENVIRONMENT ${reqvar}!" +      return 1 +    fi +  done +} + +check_default_environment() { +  local required_env="${1}" + +  for varpair in $required_env +  do +    local manual_environment=$(echo "${varpair}" | cut -d':' -f1) +    local default_if_not_set=$(echo "${varpair}" | cut -d':' -f2) +    if [ -z "${!manual_environment}" ] && [ -z "${!default_if_not_set}" ] +    then +      error "missing default ENVIRONMENT, set ${manual_environment} or ${default_if_not_set}!" +      return 1 +    fi +  done +} + +dry_run() { +  [ ${DRY_RUN} ] && info "skipping for dry run" && return +  return 1 +} + +init_tiller() { +  info "initializing local tiller" +  dry_run && return + +  export TILLER_NAMESPACE=$PROJECT_NAMESPACE +  export HELM_HOST=localhost:44134 +  # +  # run tiller locally instead of in the cluster +  tiller --storage=secret & +  export TILLER_PID=$! +  sleep 1 +  kill -0 ${TILLER_PID} +  if [ $? -gt 0 ] +  then +    error "tiller not running!" +    return 1 +  fi +} + +init_helm() { +  info "initializing helm" +  dry_run && return + +  helm init --client-only +  if [ $? -gt 0 ] +  then +    error "could not initialize helm" +    return 1 +  fi +} + +init_helm_with_tiller() { +  init_tiller || return 1 +  init_helm || return 1 +  info "updating helm client repository information" +  dry_run && return +  helm repo update +  if [ $? -gt 0 ] +  then +    error "could not update helm repository information" +    return 1 +  fi +} + +decommission_tiller() { +  if [ -n "${TILLER_PID}" ] +  then +    kill ${TILLER_PID} +    if [ $? -gt 0 ] +    then +     return +    fi +  fi +} + +check_required_deploy_arg_environment() { +  [ -z "${PROJECT_SPECIFIC_DEPLOY_ARGS}" ] && return +  for reqvar in ${PROJECT_SPECIFIC_DEPLOY_ARGS} +  do +    if [ -z ${!reqvar} ] +    then +      error "missing Deployment ENVIRONMENT ${reqvar} required!" +      return 1 +    fi +  done +} + +project_specific_deploy_args() { +  [ -z "${PROJECT_SPECIFIC_DEPLOY_ARGS}" ] && echo "" && return + +  extraArgs='' +  for deploy_arg_key in ${PROJECT_SPECIFIC_DEPLOY_ARGS} +  do +    extraArgs="${extraArgs} --set $(echo "${deploy_arg_key}" | sed 's/__/\\./g' | tr '[:upper:]' '[:lower:]')=${!deploy_arg_key}" +  done + +  echo "${extraArgs}" +} + +check_required_cluster_login_environment() { +  check_required_environment "HELM_TOKEN HELM_USER PROJECT_NAMESPACE CLUSTER_SERVER" || return 1 +} + +cluster_login() { +  info "authenticating ${HELM_USER} in ${PROJECT_NAMESPACE}" +  dry_run && return + +  kubectl config set-cluster ci_kube --server="${CLUSTER_SERVER}" || return 1 +  kubectl config set-credentials "${HELM_USER}" --token="${HELM_TOKEN}" || return 1 +  kubectl config set-context ${PROJECT_NAMESPACE}-deploy  --cluster=ci_kube --namespace=${PROJECT_NAMESPACE} --user=${HELM_USER} || return 1 +  kubectl config use-context ${PROJECT_NAMESPACE}-deploy || return 1 +} + +lint_template() { +  info "linting template" +  dry_run && return + +  helm lint ${CI_PROJECT_DIR}/helm-chart/${CI_PROJECT_NAME} +} + +check_required_image_pull_environment() { +  if [ "${CI_PROJECT_VISIBILITY}" == "public" ] +  then +    check_required_environment "CI_REGISTRY CI_DEPLOY_USER CI_DEPLOY_PASSWORD" || return 1 +  fi +} + +image_pull_settings() { +  if [ "${CI_PROJECT_VISIBILITY}" == "public" ] +  then +    echo "" +  else +    echo "--set registry.root=${CI_REGISTRY} --set registry.secret.username=${CI_DEPLOY_USER} --set registry.secret.password=${CI_DEPLOY_PASSWORD}" +  fi +} + +deployment_name() { +  if [ -n "${DEPLOYMENT_NAME}" ] +  then +    echo "${DEPLOYMENT_NAME}" +  else +    echo "${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_NAME}" +  fi +} + +deploy_template() { +  info "deploying $(deployment_name) from template" +  if dry_run +  then +    info "helm upgrade --force --recreate-pods --debug --set image.repository=${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME} --set image.tag=${CI_COMMIT_SHORT_SHA} --set environment=${CI_ENVIRONMENT_NAME} --set-string git_commit=${CI_COMMIT_SHORT_SHA} --set git_ref=${CI_COMMIT_REF_SLUG} --set ci_job_id=${CI_JOB_ID} $(environment_url_settings) $(image_pull_settings) $(project_specific_deploy_args) --wait --install $(deployment_name) ${CI_PROJECT_DIR}/helm-chart/${CI_PROJECT_NAME}" +  else +    helm upgrade --force --recreate-pods --debug \ +    --set image.repository="${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME}" \ +    --set image.tag="${CI_COMMIT_SHORT_SHA}" \ +    --set environment="${CI_ENVIRONMENT_NAME}" \ +    --set-string git_commit="${CI_COMMIT_SHORT_SHA}" \ +    --set git_ref="${CI_COMMIT_REF_SLUG}" \ +    --set ci_job_id="${CI_JOB_ID}" \ +    $(image_pull_settings) \ +    $(project_specific_deploy_args) \ +    --wait \ +    --install $(deployment_name) ${CI_PROJECT_DIR}/helm-chart/${CI_PROJECT_NAME} +  fi +} + +get_pods() { +  kubectl get pods -l ci_job_id="${CI_JOB_ID}" +} + +watch_deployment() { +  local watch_deployment=$(deployment_name) +  if [ -n "${WATCH_DEPLOYMENT}" ] +  then +    watch_deployment="${WATCH_DEPLOYMENT}" +  fi +  info "waiting until deployment ${watch_deployment} is ready" +  dry_run && return + +  kubectl rollout status deployment/${watch_deployment} -w || return 1 +  sleep 5 +  get_pods || return 1 +  # see what has been deployed +  kubectl describe deployment -l app=${CI_PROJECT_NAME},environment=${CI_ENVIRONMENT_NAME},git_commit=${CI_COMMIT_SHORT_SHA} || return 1 +  if [ -n "${CI_ENVIRONMENT_URL}" ] +  then +    kubectl describe service -l app=${CI_PROJECT_NAME},environment=${CI_ENVIRONMENT_NAME} || return 1 +    kubectl describe route -l app=${CI_PROJECT_NAME},environment=${CI_ENVIRONMENT_NAME} || return 1 +  fi +} + +run_main() { +  check_required_environment "CI_PROJECT_NAME CI_PROJECT_DIR CI_COMMIT_REF_SLUG CI_REGISTRY_IMAGE CI_ENVIRONMENT_NAME CI_JOB_ID CI_COMMIT_SHORT_SHA" || return 1 +  check_default_environment "WATCH_DEPLOYMENT:CI_ENVIRONMENT_SLUG" || return 1 +  check_required_deploy_arg_environment || return 1 +  check_required_cluster_login_environment || return 1 +  check_required_image_pull_environment || return 1 +  cluster_login +  if [ $? -gt 0 ] +  then +    error "could not login kubectl" +    return 1 +  fi + +  init_helm_with_tiller +  if [ $? -gt 0 ] +  then +    error "could not initialize helm" +    return 1 +  fi + +  lint_template +  if [ $? -gt 0 ] +  then +    error "linting failed" +    return 1 +  fi + +  deploy_template +  if [ $? -gt 0 ] +  then +    error "could not deploy template" +    return 1 +  fi + +  watch_deployment +  if [ $? -gt 0 ] +  then +    error "could not watch deployment" +    return 1 +  fi + +  decommission_tiller +  info "ALL Complete!" +  return +} + +if [[ "${BASH_SOURCE[0]}" == "${0}" ]] +then +  run_main +  if [ $? -gt 0 ] +  then +    exit 1 +  fi +fi +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/automating-helm-deployments-bash + +作者:[Darin London][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dmlond +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://gist.github.com/dmlond/016ff7c3757fee00f9d02e36e6c0c298 +[4]: https://opensource.com/article/19/2/testing-bash-bats From 733c67ae8eec11897755fc93fd841b1a60f2f816 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 00:59:01 +0800 Subject: [PATCH 591/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=204=20co?= =?UTF-8?q?re=20skills=20to=20level-up=20your=20tech=20career=20in=202020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200116 4 core skills to level-up your tech career in 2020.md --- ...ls to level-up your tech career in 2020.md | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 sources/tech/20200116 4 core skills to level-up your tech career in 2020.md diff --git a/sources/tech/20200116 4 core skills to level-up your tech career in 2020.md b/sources/tech/20200116 4 core skills to level-up your tech career in 2020.md new file mode 100644 index 0000000000..e8385910d4 --- /dev/null +++ b/sources/tech/20200116 4 core skills to level-up your tech career in 2020.md @@ -0,0 +1,160 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 core skills to level-up your tech career in 2020) +[#]: via: (https://opensource.com/article/20/1/core-skills-tech-career) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +4 core skills to level-up your tech career in 2020 +====== +There is one category of skill you should focus on to advance your +career this year. Here's how. +![Two hands holding a resume with computer, clock, and desk chair ][1] + +We do a lot to level-up our careers. We learn new programming languages; we take on new projects at work; we work on side projects on the weekend; we contribute to open source communities. What if I were to tell you that, while these activities are helpful, there is one set of skills you should focus on if you truly want to advance your career. + +These skills go by many names, such as soft skills, non-technical skills, leadership skills, and people skills. Calling them soft or non-technical skills leads to the mistaken idea that they are easy. For some, these skills are incredibly difficult. Calling them leadership skills makes people think they don't need to put effort into developing them if they don't want to be a leader. + +I prefer to call them core or functional skills. These skills are part of the core of what makes us human, and it is hard to function without them. + +When we have these skills, we can: + + * Communicate with others + * Collaborate and work with others + * Solve problems + * Understand and share the feelings of others + * Use time effectively or productively + + + +These skills are part of what makes us human, and everything in software is about humans. Humans are reviewing your code. Humans are installing or using the application you are writing. + +If these skills are so essential, why do we often dismiss them in favor of more "technical" skills and give them a bad rap? This isn't about focusing on one versus the other. Both are important and relevant. + +### Mindset and biases + +Our biases and mindset contribute to the importance we place on functional skills. Bias isn't a bad thing. There are [175 biases][2] that exist to help our brains combat four problems: + + * We have too much information to process. + * There's not enough meaning in the information we receive. + * There's not enough time to process information. + * We can't remember everything. Our memory is finite. + + + +One bias that sneaks in when it comes to assessing our skills is the Dunning-Kruger effect. We mistakenly assess our abilities as more exceptional than they are, which comes from an inability to recognize our own faults. You may think you know what you are doing when you don't because of the Dunning-Kruger effect. You think you are managing your time effectively, but in reality, you are working nights and weekends to get caught up. Yes, the work is getting completed, but at what cost? Working non-stop can lead to burnout or a decline in health. + +Another factor is your [mindset][3]. Do you have a growth mindset or a fixed mindset when it comes to learning a new skill? People with a fixed mindset believe that abilities are innate and can't be improved. Those with a growth mindset believe there is room for improvement, and you can improve any skill with practice. + +These statements reflect a fixed mindset: + + * "I'm just not a people person." + * "They're a natural-born leader." + + + +You're not born with the ability to speak or write. You learn these skills over time. The same goes for the core and functional skills important for developers. + +### Communication + +> "Over time I've learned the biggest source of failure is often due to people and teams. A lack of communication and coordination can cause serious problems." +> — Laurie Barth, [_How architecture improved my coding skills_][4] + +Communication includes verbal, non-verbal, and written communication. Failures along any of these can cause serious problems. Communication failures in tech look like: + + * Delays in resolving incidents + * Redesigning a feature + * Scope creep + * Lack of meaningful comments on pull requests (PRs)—these can be especially impactful to junior engineers + * Unnecessary conflicts and lack of alignment + * Delivering above or below expectations + + + +Cultural norms and personal preferences impact communication. Everybody has a preferred method of communicating, whether that is via email, face-to-face, Slack messages, phone, text, etc. Think about the cultural norms regarding communication in your workplace. Do they match your preferred method of communicating? If there is a mismatch, problems may arise. + +If you're a manager, do you know your direct reports' preferred communication style, or do you just utilize your preferred method? If a direct report prefers email so they can have some time to think before responding and you prefer face-to-face communication, a quick Slack message asking them to come to your office can cause unnecessary anxiety. + +### Empathy + +> "Empathy is much harder than we think… But to build empathy we need to slow down." +> —Andrew Tenzer and Ian Murray, [_The empathy delusion_][5] + +Empathy is one of the most important skills you can learn. Empathy is our ability to understand and share the feelings of others. We feel more connected to one another because of empathy. + +There are four attributes of empathy: + + * Seeing another person's perspective + * Being non-judgmental + * Recognizing emotions in other people + * Communicating your understanding of another person's feelings + + + +Communication and empathy are closely tied. To communicate effectively, you need to listen. To listen effectively, you need empathy. Instead of listening to what a colleague is saying, we usually think about how to best respond. As the adage goes, you have two ears and one mouth for a reason; you should be listening twice as often as you speak. + +When you show empathy towards another person, you are not minimizing their thoughts, feelings, or experiences. Instead of using comments like "it could be worse" or "at least…" use phrases like "that sounds horrible," "I can't imagine how you must feel," or "I'm here for you, how can I help?" + +### Get ready to level-up + +Improving on a skill takes time, but we often give up while we are learning once [impostor syndrome][6] kicks in. It takes years of practice to perfect something, and even with years of practice, you won't be perfect. You will make mistakes. When learning a new skill or improving on an existing skill, mastery—not perfection—should be the goal. Perfection implies there is no room for improvement; mastery indicates learning a skill is an ongoing journey, and there is room to improve. + +You don't want to be a perfect communicator. You want to be a master communicator. Even the most experienced public speakers make mistakes. If you aim for perfection, you will be disappointed. + +To improve a skill, you need to schedule time to practice. But not just any type of practice; to master a skill, use deliberate practice. Deliberate practice has five main components: + + 1. Create a specific goal. + 2. Break the goal down into small steps. + 3. Get feedback from a master. + 4. Step out of your comfort zone. + 5. Stay motivated. + + + +To illustrate this process, say you have a goal of presenting at a conference, but you aren't a confident public speaker. What are some small steps you can take to practice? + + * Identify and reduce the use of filler words like "um," "ah," or "you know." + * Make eye contact when speaking with others or let people know why you don't. + * Control mannerisms like fidgeting with your hands or nodding your head while talking. + * Incorporate appropriate pauses. + + + +Feedback is a necessary part of practicing. Seek out others to provide you with feedback. A great way to step out of your comfort zone and get feedback from master public speakers is to sign up for Toastmasters. This can also help you stay motivated as you work through the speeches towards becoming a Distinguished Toastmaster. + +You can apply this same process to any skill you are looking to master. + +### Where to learn more + +If you want to learn more about empathy and communication so you can level up your career, check out these resources: + + * [Communicating with empathy][7] course by Sharon Steed + * [_Deliberate practice: Your pathway to growth and mastery_][8] by Habits at Work + * [_Want to be more empathetic? Avoid these 7 responses_][9] by Laura Click + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/core-skills-tech-career + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI (Two hands holding a resume with computer, clock, and desk chair ) +[2]: https://medium.com/better-humans/cognitive-bias-cheat-sheet-55a472476b18 +[3]: https://www.penguinrandomhouse.com/books/44330/mindset-by-carol-s-dweck-phd/ +[4]: https://dev.to/laurieontech/how-architecture-improved-my-coding-skills-21e +[5]: https://www.reachsolutions.co.uk/sites/default/files/2019-07/Reach%20Solutions%20The%20Empathy%20Delusion%20V2.pdf +[6]: https://en.wikipedia.org/wiki/Impostor_syndrome +[7]: https://www.lynda.com/Business-Skills-tutorials/Communicating-Empathy/534584-2.html +[8]: https://habitsatwork.com/blog/deliberate-practice +[9]: https://medium.com/@lauraclick/want-to-be-more-empathetic-avoid-these-7-responses-21bb52d5d2ad From 2b4527bfead026ac27f2deb235ba9ad3a3fd5505 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 17 Jan 2020 01:00:03 +0800 Subject: [PATCH 592/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200116=20It?= =?UTF-8?q?=E2=80=99s=20the=20end=20for=20Windows=20Server=202008=20suppor?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200116 It-s the end for Windows Server 2008 support.md --- ...the end for Windows Server 2008 support.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/talk/20200116 It-s the end for Windows Server 2008 support.md diff --git a/sources/talk/20200116 It-s the end for Windows Server 2008 support.md b/sources/talk/20200116 It-s the end for Windows Server 2008 support.md new file mode 100644 index 0000000000..35e25fc844 --- /dev/null +++ b/sources/talk/20200116 It-s the end for Windows Server 2008 support.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (It’s the end for Windows Server 2008 support) +[#]: via: (https://www.networkworld.com/article/3513980/it-s-the-end-for-windows-server-2008-support.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +It’s the end for Windows Server 2008 support +====== +Microsoft recommends migrating Server 2008 workloads to Azure cloud services while enterprises modernize their apps for Windows Server 2016 or 2019 deployments. +PaulFleet / Getty Images / Microsoft + +This week's Patch Tuesday marked the end of the line for both Windows 7 and Windows Server 2008 (and 2008 R2). No more fixes will be issued for the two aged operating systems, unless you purchase a pricey extended service license. + +On the Windows 7 front, Microsoft has done a good job getting Windows 10 deployed through its aggressive (perhaps too aggressive) upgrade program. According to StatCounter, Windows 10 now accounts for 65% of the [worldwide desktop Windows market share][1], and Windows 7 is down to 27%. + +**RELATED:** [What to know before upgrading to Windows Server 2019][2] + +But while Windows 7 has gotten all the attention, Server 2008 actually has a larger share of holdouts, and in some ways, its end-of-life milestone is more significant. At last July’s Inspire show, a Microsoft executive said in an interview with cloud storage provider and Microsoft partner Carbonite that [60% of its current Windows Server][3] installed base was running Server 2008, accounting for 24 million instances.  + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +“There are a lot [of customers sticking with Server 2008],” says analyst Tim Crawford of research and advisory firm [AVOA][5]. “You could categorize them into those that either a) use functions specific to WS2008, and b) those that use a version of an application that is only compatible with WS2008. Upgrading is often easier said than done. Especially if the application is a custom app with lots of tentacles.” + +Server 2008 is based on the Windows Vista codebase, which should be reason alone to jettison it. But Windows Server 2016 and Windows Server 2019 are built on Windows 10, which means apps heavily dependent on the OS ecosystem might be hard to move since the internals are so different. + +“I do work with folks that are still running Windows Server 2008. They understand the ramifications of EOL for support. But most are in a predicament where they aren’t able to move the applications for a number of reasons, including application compatibility, location, etc.," Crawford says. + +For those apps that are challenging to move, he recommends isolating the system as much as possible to protect it, and putting in a plan to do what is needed to the applications to prepare them for movement as quickly as possible. + +Microsoft offers and recommends [Azure migration][6], so Server 2008 apps can [run in an Azure instance][7] while they are modernized for Server 2019 and then deployed on premises. + +Migration should be the paramount effort, because if you are running Server 2008 then you're using hardware that's at least eight years old and potentially 12 years old. That’s ancient in technology terms, and if nothing else, the hardware is going to fail. + +One of the headaches for admins is you cannot migrate Server 2008 directly to 2016 or 2019. You have to upgrade to Server 2012 as an intermediate step. So you are better off biting the bullet and migrating the apps to 2019 rather than spending time on two OS migrations. + +Microsoft has provided [resources][8] for Server 2008 users, including a migration guide and help moving to Azure. + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3513980/it-s-the-end-for-windows-server-2008-support.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://gs.statcounter.com/os-version-market-share/windows/desktop/worldwide#monthly-201807-201908 +[2]: https://www.networkworld.com/article/3512020/what-to-know-before-upgrading-from-windows-server-2016-to-server-2019.html +[3]: https://www.carbonite.com/blog/article/2019/07/schuster-azure-migration-and-office-365-top-partner-opportunities +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://avoa.com/ +[6]: https://cloudblogs.microsoft.com/windowsserver/2019/12/17/protect-workloads-still-running-on-windows-server-2008-and-2008-r2/ +[7]: https://www.networkworld.com/article/3300165/microsoft-lures-win-server-2008-users-toward-azure.html +[8]: https://www.microsoft.com/en-us/cloud-platform/windows-server-2008 +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world From b35d90fb14062f4e2edd1e14f7bdd701e57ca236 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 17 Jan 2020 08:46:04 +0800 Subject: [PATCH 593/676] translated --- ...eep your email in sync with OfflineIMAP.md | 79 ------------------- ...eep your email in sync with OfflineIMAP.md | 77 ++++++++++++++++++ 2 files changed, 77 insertions(+), 79 deletions(-) delete mode 100644 sources/tech/20200113 Keep your email in sync with OfflineIMAP.md create mode 100644 translated/tech/20200113 Keep your email in sync with OfflineIMAP.md diff --git a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md b/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md deleted file mode 100644 index e4e1f1ba94..0000000000 --- a/sources/tech/20200113 Keep your email in sync with OfflineIMAP.md +++ /dev/null @@ -1,79 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Keep your email in sync with OfflineIMAP) -[#]: via: (https://opensource.com/article/20/1/sync-email-offlineimap) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Keep your email in sync with OfflineIMAP -====== -Mirroring your email to a local folder is the first step in taming your -message pileup. Learn how in the third article in our series on 20 ways -to be more productive with open source in 2020. -![email or newsletters via inbox and browser][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Sync your email locally with OfflineIMAP - -I have a love/hate relationship with email. I love the way it allows me to communicate with people all over the world. But, like many of you, I get a lot of mail, much of it from lists as well as spammers, advertisers, and the like. And it builds up. - -![The OfflineIMAP "blinkenlights" UI][2] - -Almost all the tools I've tried (outside of the big mail providers) that work really well with large amounts of mail have one thing in common: they all rely on a local copy of your mail stored in [Maildir][3] format. And the most useful tool for that is [OfflineIMAP][4]. OfflineIMAP is a Python script that mirrors IMAP mailboxes to a local Maildir folder tree. I use it to create a local copy of my mail and keep it in sync. Most Linux distributions include it, and it is available via Python's pip package manager. - -The sample minimal configuration file is a good template to start with; begin by copying it to **~/.offlineimaprc**. Mine looks something like this: - - -``` -[general] -accounts = LocalSync -ui=Quiet -autorefresh=30 - -[Account LocalSync] -localrepository = LocalMail -remoterepository = MirrorIMAP - -[Repository MirrorIMAP] -type = IMAP -remotehost = my.mail.server -remoteuser = myusername -remotepass = mypassword -auth_mechanisms = LOGIN -createfolder = true -ssl = yes -sslcacertfile = OS-DEFAULT - -[Repository LocalMail] -type = Maildir -localfolders = ~/Maildir -sep = . -createfolder = true -``` - -What my configuration does is define two repositories: the remote IMAP server and the local Maildir folder. There is also the **Account** that tells OfflineIMAP what to sync when it runs. You can define multiple accounts linked to different repositories. This allows you to copy from one IMAP server to another as a backup, in addition to making a copy locally. - -The first run of OfflineIMAP will take a while if you have a lot of mail. But once it is done, future runs take a _lot_ less time. You can also run OfflineIMAP as a cron job (my preference) or as a daemon constantly syncing between repositories. The documentation covers all of this, as well as advanced configuration options for things like Gmail. - -Now that my mail is copied locally, there is a whole range of tools I can work with to speed up searching, filing, and managing mail. And I'll talk about that tomorrow. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/sync-email-offlineimap - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) -[2]: https://opensource.com/sites/default/files/uploads/productivity_3-1.png (The OfflineIMAP "blinkenlights" UI) -[3]: https://en.wikipedia.org/wiki/Maildir -[4]: http://www.offlineimap.org/ diff --git a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md b/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md new file mode 100644 index 0000000000..c5b20565ad --- /dev/null +++ b/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keep your email in sync with OfflineIMAP) +[#]: via: (https://opensource.com/article/20/1/sync-email-offlineimap) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 OfflineIMAP 同步邮件 +====== +将邮件镜像保存到本地是整理消息的第一步。在我们的 20 个使用开源提升生产力的系列的第三篇文章中了解该如何做。 +![email or newsletters via inbox and browser][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 OfflineIMAP 在本地同步你的邮件 + +我与邮件之间存在爱恨交织的关系。我喜欢它让我与世界各地的人交流的方式。但是,像你们中的许多人一样,我收到过很多邮件,许多是来自列表中的人,但也有很多垃圾邮件、广告等。这些积累了很多。 + +![The OfflineIMAP "blinkenlights" UI][2] + +我尝试过的大多数工具(除了大型提供商外)都可以很好地处理大量邮件,它们都有一个共同点:它们都依赖于以 [Maildir][3] 格式存储的本地邮件副本。这其中最有用的是 [OfflineIMAP][4]。OfflineIMAP 是将 IMAP 邮箱镜像到本地 Maildir 文件夹树的 Python 脚本。我用它来创建邮件的本地副本并使其保持同步。大多数 Linux 发行版都包含它,并且可以通过 Python 的 pip 包管理器获得。 + +示例的最小配置文件是一个很好的模板。首先将其复制到 **~/.offlineimaprc**。我的看起来像这样: + + +``` +[general] +accounts = LocalSync +ui=Quiet +autorefresh=30 + +[Account LocalSync] +localrepository = LocalMail +remoterepository = MirrorIMAP + +[Repository MirrorIMAP] +type = IMAP +remotehost = my.mail.server +remoteuser = myusername +remotepass = mypassword +auth_mechanisms = LOGIN +createfolder = true +ssl = yes +sslcacertfile = OS-DEFAULT + +[Repository LocalMail] +type = Maildir +localfolders = ~/Maildir +sep = . +createfolder = true +``` + +我的配置要做的是定义两个仓库:远程 IMAP 服务器和本地 Maildir 文件夹。还有一个**帐户**,告诉 OfflineIMAP 运行时要同步什么。你可以定义链接到不同仓库的多个帐户。除了本地复制外,这还允许你从一台 IMAP 服务器复制到另一台作为备份。 + +如果你有很多邮件,那么首次运行 OfflineIMAP 将花费一些时间。但是完成后,下次会花_少得多_的时间。你也可以将 CoffeeIMAP 作为 cron 任务(我的偏好)或作为守护程序在仓库之间不断进行同步。文档涵盖了所有这些内容以及 Gmail 等高级配置选项。 + +现在,我的邮件已在本地复制,并有多种工具用来加快搜索、归档和管理邮件的速度。我明天再说。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/sync-email-offlineimap + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) +[2]: https://opensource.com/sites/default/files/uploads/productivity_3-1.png (The OfflineIMAP "blinkenlights" UI) +[3]: https://en.wikipedia.org/wiki/Maildir +[4]: http://www.offlineimap.org/ From 9dfc0a080c560f1cd4bbf5d2173c69d6c356f8f8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 17 Jan 2020 09:28:45 +0800 Subject: [PATCH 594/676] translating --- ... Organize and sync your calendar with khal and vdirsyncer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md index b78ad493af..effad6fb4e 100644 --- a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md +++ b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f04ac3c25fd61823705aac4b076cd41ee56527a7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 17 Jan 2020 10:45:51 +0800 Subject: [PATCH 595/676] Rename sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md to sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md --- ... into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md (100%) diff --git a/sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md similarity index 100% rename from sources/tech/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md rename to sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md From c13b2636adb22867839ef49e7608fac6516f1915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 17 Jan 2020 21:24:37 +0800 Subject: [PATCH 596/676] Translated --- ...5 How to Add Border Around Text in GIMP.md | 139 ------------------ ...5 How to Add Border Around Text in GIMP.md | 139 ++++++++++++++++++ 2 files changed, 139 insertions(+), 139 deletions(-) delete mode 100644 sources/tech/20191215 How to Add Border Around Text in GIMP.md create mode 100644 translated/tech/20191215 How to Add Border Around Text in GIMP.md diff --git a/sources/tech/20191215 How to Add Border Around Text in GIMP.md b/sources/tech/20191215 How to Add Border Around Text in GIMP.md deleted file mode 100644 index 0b2e3858f2..0000000000 --- a/sources/tech/20191215 How to Add Border Around Text in GIMP.md +++ /dev/null @@ -1,139 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Add Border Around Text in GIMP) -[#]: via: (https://itsfoss.com/gimp-text-outline/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Add Border Around Text in GIMP -====== - -This simple tutorial explains the steps to outline text in [GIMP][1]. The text outline helps you highlight text against background of other color. - -![Outlined Text created in GIMP][2] - -Let’s see how can you add a border around your text. - -### Adding text outline in GIMP - -The entire procedure can be described in these easy steps: - - * Create your text and copy its outlined path - * Add a new transparent layer and add the outlined path to this layer - * Change the size of the outline, add a different color to it - - - -That’s all. Don’t worry, I am going to show each steps in detail with proper screenshots. By following this tutorial, you should be able to add outline to text even if you never used GIMP before. - -Just make sure that you have [GIMP installed on Linux][3] or whatever operating system you are using. - -This tutorial has been performed with GIMP 2.10 version. - -#### Step 1: Create your primary text and copy its outline - -Open GIMP and create a new file by going to the top menu->File->New. You can also use Ctrl+N keyboard shortcut. - -![Create New File][4] - -You can select the size of your canvas here. You may also choose if you want white background or a transparent background. It is under the Advanced Options->Color profile. - -I have chosen the default white background. It can be changed later. - -Now select the Text tool from the toolbox in the left sidebar. - -![Adding text in GIMP][5] - -Write the text you want. You can change the font, size and alignment of the text as per your choice. I have kept the default left alignment of the text for this article. - -I have deliberately chose a light color for the text so that it is difficult to read. I’ll add a darker outline to this light text in this tutorial. - -![Text added in GIMP][6] - -When you are done writing your text, right click the text box and select **Path from Text**. - -![Right click on the text box and select ‘Path from Text’][7] - -#### Step 2: Add a transparent layer with the text outline - -Now, go to the top menu, go to Layer and add a new layer. - -![Use Shift+Ctrl+N to add a new layer][8] - -Make sure to add the new layer as transparent. You can give it a suitable name like ‘outline for text’. Click OK to add this transparent layer. - -![Add a transparent layer][9] - -Go to the menu again and this time go to **Select** and click **From path**. You’ll see that your text has been highlighted. - -![Go to Select and choose From Path][10] - -Basically, you just created a transparent layer that has the same text (but transparent) as your original text. What you need to do now is to increase the size of the text on this layer. - -#### Step 3: Adding the text outline by increasing its size and changing its color - -To do that, go to Select in menu once again and this time choose Grow. This will allow you to grow the size of the text on the transparent layer. - -![Grow the selection on the additional layer][11] - -Grow it by 5 or 10 pixel or whatever you prefer. - -![Grow it by 5 or 10 pixel][12] - -What you need to do now is to fill this enlarged selection with a choice of your color. Since my original text is of light color, I am going to use back color for the outline here. - -**Select your main image layer** if it’s not already selected. The layers are visible at the right sidebar. Then go to the toolbox and select the bucket fill tool. Select the desired color you want for the outline. - -Now use the tool to fill black color to your selection. Mind that you fill the outer outline of the text, not the text itself. - -![Fill the outline of the text with a different color][13] - -You are pretty much done here. Use Ctrl+Shift+A to de-select your current selection. - -![Outline added to the text][14] - -So now you have successfully added outline to your text in GIMP. It is on white background and if you want a transparent background, just delete the background layer from the layer menu in the right sidebar. - -![Remove the white background layer if you want a transparent background][15] - -If you are happy with the result, save the file as PNG file (to keep transparent background) or whichever file format you prefer. - -**Did you make it work?** - -That’s it. That’s all you need to do to add a text outline in GIMP. - -I hope you find this GIMP tutorial helpful. You may want to check out another [simple tutorial about adding a watermark in GIMP][16]. - -If you have questions or suggestions, please feel free to leave a comment below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gimp-text-outline/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://www.gimp.org/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outlined_text_GIMP.png?ssl=1 -[3]: https://itsfoss.com/gimp-2-10-release/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/create_outline_text_gimp_1.jpeg?ssl=1 -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_2.jpg?ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp-3.jpg?ssl=1 -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_4.jpg?ssl=1 -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_5.jpg?ssl=1 -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_6.jpg?ssl=1 -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_7.jpg?ssl=1 -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_8.jpg?ssl=1 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_9.jpg?ssl=1 -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_10.jpg?ssl=1 -[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_11.jpg?ssl=1 -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_12.jpg?ssl=1 -[16]: https://itsfoss.com/add-watermark-gimp-linux/ diff --git a/translated/tech/20191215 How to Add Border Around Text in GIMP.md b/translated/tech/20191215 How to Add Border Around Text in GIMP.md new file mode 100644 index 0000000000..651a53fffb --- /dev/null +++ b/translated/tech/20191215 How to Add Border Around Text in GIMP.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Add Border Around Text in GIMP) +[#]: via: (https://itsfoss.com/gimp-text-outline/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 GIMP 中如何在文本周围添加边框 +====== + +这个简单的教程阐明了在 [GIMP][1] 中显示文本的轮廓的步骤。文本轮廓帮助你在其它颜色下高亮显示文本。 + +![Outlined Text created in GIMP][2] + +让我们看看如何在你的文本周围添加一个边框。 + +### 在 GIMP 中添加文本轮廓 + +整个过程可以用这些简单的步骤描述: + + * 创建文本,并复制它的轮廓路径 + * 添加一层新的透明层,并添加轮廓路径到透明层中 + * 更改轮廓的大小,给它添加一种不同的颜色 + + + +这就是全部的东西。不用担心,我将使用适当地截图详细的展示每个步骤。按照这个教程,你应该能够为文本添加轮廓,即使你在此之前从未使用过 GIMP 。 + +仅需要确保你已经 [在 Linux 上安装 GIMP][3] 或者你正在使用的任何操作。 + +这篇教程在 GIMP 2.10 版本下演示。 + +#### 步骤 1: 创建你的主要文本,并复制它的轮廓 + +打开 GIMP ,并通过转到 菜单 -> 文件 -> 新建 来创建一个新的文件。你应该可以使用 Ctrl+N 键盘快捷键。 + +![Create New File][4] + +你可以在这里选择画布的大小。你也可以选择要白色背景或一种透明背景。它在 高级选项 -> 颜色 配置文件下。 + +我选择默认的白色背景。它在以后能够更改。 + +现在从左边栏的工具箱中选择文本工具。 + +![Adding text in GIMP][5] + +写你想的文本。你可以根据你的选择以更改文本的字体,大小和对齐方式。我保持这篇文章的文本的默认左对齐。 + +我故意为文本选择一种浅色,以便难于阅读。在这篇教程中我将添加一个深色轮廓到这个浅色的文本。 + +![Text added in GIMP][6] + +当你写完文本后,右键文本框并选择 **文本的路径** 。 + +![Right click on the text box and select ‘Path from Text’][7] + +#### 步骤 2: 添加一个带有文本轮廓的透明层 + +现在,转到顶部菜单,转到 层 ,并添加一个新层。 + +![Use Shift+Ctrl+N to add a new layer][8] + +确保添加新层为透明的。你可以给它一个合适的名称,像 ‘文本大纲’。单击确定来添加这个透明层。 + +![Add a transparent layer][9] + +再次转到菜单,这次转到 **选择** ,并单击 **来自路径** 。你将看到你的文本应该被高亮显示。 + +![Go to Select and choose From Path][10] + +总的来说,你只创建一个透明层,它有像你的原文一样相同的文本(但是透明)。现在你需要做的是在这个层上增加文本的大小。 + +#### 步骤· 3: 通过增加它的大小和更改它的颜色来添加文本轮廓 + +为此,再次在菜单中转到 选择 ,这次选择 增加。这将允许增大透明层上的文本的大小。 + +![Grow the selection on the additional layer][11] + +以 5 或 10 像素增加,或者你喜欢的任意像素。 + +![Grow it by 5 or 10 pixel][12] + +你选择需要做是使用一种你选择的颜色来填充这个扩大的选择区。因为我的原文是浅色,在这里我将为轮廓使用背景色。 + +如果尚未选择的话,先 **选择你的主图像层** 。这些层在右侧栏中可视。然后转到工具箱并选择油漆桶工具。为你的轮廓选择想要的颜色。 + +选择使用该工具来填充黑色到你的选择区。记住。你填充文本外部的轮廓,而不是文本本身。 + +![Fill the outline of the text with a different color][13] + +在这里你完成了很多。使用 Ctrl+Shift+A 来取消你当前的选择区。 + +![Outline added to the text][14] + +如此,你现在已经在 GIMP 中成功地添加轮廓到你的文本。它是在白色背景中,如果你想要一个透明背景,只需要在右侧栏的图层菜单中删除背景层。 + +![Remove the white background layer if you want a transparent background][15] + +如果你对结果感到满意,保存文件未 PNG 文件(来保留透明背景),或你喜欢的任何文件格式。 + +**你使它工作了吗?** + +就这样。这就是你在 GIMP 中为添加一个文本轮廓而需要做的全部工作。 + +我希望你发现这个 GIMP 教程有帮助。你可能想查看另一个 [关于在 GIMP 中添加一个水印的简单教程][16]。 + +如果你有问题或建议,请在下面自由留言。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gimp-text-outline/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outlined_text_GIMP.png?ssl=1 +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/create_outline_text_gimp_1.jpeg?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_2.jpg?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp-3.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_4.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_5.jpg?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_6.jpg?ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_7.jpg?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_8.jpg?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_9.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_10.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_11.jpg?ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/outline_text_gimp_12.jpg?ssl=1 +[16]: https://itsfoss.com/add-watermark-gimp-linux/ From bb536cf07e09b0fc01e3d6b4b8f76df2aa7c06c8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:56:02 +0800 Subject: [PATCH 597/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200118=203=20Me?= =?UTF-8?q?thods=20to=20Install=20the=20Latest=20PHP=207=20Package=20on=20?= =?UTF-8?q?CentOS/RHEL=207=20and=20CentOS/RHEL=206?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md --- ...kage on CentOS-RHEL 7 and CentOS-RHEL 6.md | 227 ++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md diff --git a/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md b/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md new file mode 100644 index 0000000000..09b2f4ca73 --- /dev/null +++ b/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6) +[#]: via: (https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6 +====== + +PHP is the most popular open-source general-purpose scripting language and is widely used for web development. + +It’s part of the LAMP stack application suite and is used to create dynamic websites. + +Popular CMS applications WordPress, Joomla and Drupal are developed in PHP language. + +These applications require PHP 7 for their installation and configuration. + +PHP 7 loads your web application faster and consumes less server resources. + +By default the CentOS/RHEL 6 operating system provides PHP 5.3 in their official repository and CentOS/RHEL 7 provides PHP 5.4. + +In this article we will show you how to install the latest version of PHP on CentOS/RHEL 7 and CentOS/RHEL 6 systems. + +This can be done by adding the necessary **[additional third-party RPM repository][1]** to the system. + +### Method-1 : How to Install PHP 7 on CentOS 6/7 Using the Software Collections Repository (SCL) + +The SCL repository is now maintained by a CentOS SIG, which rebuilds the Red Hat Software Collections and also provides some additional packages of their own. + +It contains newer versions of various programs that can be installed alongside existing older packages and invoked by using the scl command. + +Run the following **[yum command][2]** to install Software Collections Repository (SCL) on CentOS + +``` +# yum install centos-release-scl +``` + +Run the following command to verify the PHP 7 version available in the scl repository. + +``` +# yum --disablerepo="*" --enablerepo="centos-sclo-rh" list *php + +Loaded plugins: fastestmirror, langpacks +Loading mirror speeds from cached hostfile +centos-sclo-rh: centos.mirrors.estointernet.in +Available Packages +php54-php.x86_64 5.4.40-4.el7 centos-sclo-rh +php55-php.x86_64 5.5.21-5.el7 centos-sclo-rh +rh-php70-php.x86_64 7.0.27-2.el7 centos-sclo-rh +rh-php71-php.x86_64 7.1.30-2.el7 centos-sclo-rh +rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh +``` + +Run the command below to install the PHP 7.2 on your system from scl. + +``` +# yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php +``` + +If you need to install additional modules for PHP 7.2, you can install them by running the command format below. For instance, you can install the **“gd”** and **“pdo”** packages by executing the command below. + +``` +# yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php-gd rh-php72-php-pdo +``` + +### Method-1a : How to Install PHP 7 on RHEL 7 Using the Software Collections Repository (SCL) + +For Red Hat 7, enable the following repositories to install the latest PHP 7 package. + +``` +# sudo subscription-manager repos --enable rhel-7-server-extras-rpms +# sudo subscription-manager repos --enable rhel-7-server-optional-rpms +# sudo subscription-manager repos --enable rhel-server-rhscl-7-rpms +``` + +Run the command below to search the available PHP 7 version from the RHSCL repository. + +``` +# yum search rh-php* +``` + +You can easily install PHP 7.3 on the RHEL 7 machine by running the command below from the RHSCL repository. + +``` +# yum install rh-php73 +``` + +### Method-2 : How to Install PHP 7 on CentOS 6/7 Using the Remi Repository + +The **[Remi repository][3]** stores and maintains the latest version of PHP packages with a large collection of libraries, extensions and tools. Some of them are back-ported from Fedora and EPEL. + +This is a CentOS community-recognized repository and doesn’t modify or affect any underlying packages. + +As a prerequisite, this installs the **[EPEL repository][4]** if it is not already installed on your system. + +You can easily find the available version of the PHP 7 package from the Remy repository because it adds a separate repo to each version. You can view them using the **[ls command][5]**. + +``` +# ls -lh /etc/yum.repos.d/remi-php* + +-rw-r--r--. 1 root root 456 Sep 6 01:31 /etc/yum.repos.d/remi-php54.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php70.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php71.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php72.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php73.repo +-rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php74.repo +``` + +You can easily install PHP 7.4 on the CentOS 6/7 systems by running the command below from the remi repository. + +``` +# yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo +``` + +### Method-2a : How to Install PHP 7 on RHEL 7 Using the Remi Reposiotry + +For Red Hat 7, install the following repositories to install the latest PHP 7 package. + +To install EPEL Repository on RHEL 7 + +``` +# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm +``` + +To install Remi Repository on RHEL 7 + +``` +# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm +``` + +To enable the optional RPMS repository. + +``` +# subscription-manager repos --enable=rhel-7-server-optional-rpms +``` + +You can easily install PHP 7.4 on the RHEL 7 systems by running the below command from the remi repository. + +``` +# yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo +``` + +To verify the PHP 7 installation, run the following command + +``` +# php -v + +PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS ) +Copyright (c) The PHP Group +Zend Engine v3.4.0, Copyright (c) Zend Technologies +``` + +### Method-3 : How to Install PHP 7 on CentOS 6/7 Using the IUS Community Repository + +IUS Community is a CentOS Community Approved third-party RPM repository which contains latest upstream versions of PHP, Python, MySQL, etc.., packages for Enterprise Linux (RHEL & CentOS) 5, 6 & 7. + +**[IUS Community Repository][6]** have dependency with EPEL Repository so we have to install EPEL repository prior to IUS repository installation. Follow the below steps to install & enable EPEL & IUS Community Repository to RPM systems and install the packages. + +EPEL package is included in the CentOS Extras repository and enabled by default so, we can install this by running below command. + +``` +# yum install epel-release +``` + +Download IUS Community Repository Shell script + +``` +# curl 'https://setup.ius.io/' -o setup-ius.sh + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed +100 1914 100 1914 0 0 6563 0 --:--:-- --:--:-- --:--:-- 133k +``` + +Install/Enable IUS Community Repository. + +``` +# sh setup-ius.sh +``` + +Run the following command to check available PHP 7 version in the IUS repository. + +``` +# yum --disablerepo="*" --enablerepo="ius" list *php7* + +Loaded plugins: fastestmirror, langpacks +Loading mirror speeds from cached hostfile +Available Packages +mod_php71u.x86_64 7.1.33-1.el7.ius ius +mod_php72u.x86_64 7.2.26-1.el7.ius ius +mod_php73.x86_64 7.3.13-1.el7.ius ius +php71u-bcmath.x86_64 7.1.33-1.el7.ius ius +php71u-cli.x86_64 7.1.33-1.el7.ius ius +php71u-common.x86_64 7.1.33-1.el7.ius ius +php71u-dba.x86_64 7.1.33-1.el7.ius ius +php71u-dbg.x86_64 7.1.33-1.el7.ius ius +php71u-devel.x86_64 7.1.33-1.el7.ius ius +php71u-embedded.x86_64 7.1.33-1.el7.ius ius +``` + +You can easily install PHP 7.3 on the CentOS 6/7 systems by running the command below from the IUS Community repository. + +``` +# yum --disablerepo="*" --enablerepo="ius" install php73-common php73-cli php73-gd php73-gd php73-mysqlnd php73-ldap php73-soap php73-mbstring +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/8-additional-thirdparty-yum-repositories-centos-rhel-fedora-linux/ +[2]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[3]: https://www.2daygeek.com/install-enable-remi-repository-on-centos-rhel-fedora-linux/ +[4]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-oracle-linux/ +[5]: https://www.2daygeek.com/linux-unix-ls-command-display-directory-contents/ +[6]: https://www.2daygeek.com/install-enable-ius-community-repository-on-rhel-centos/ From 86cf00ad6506bc9ae7f7d99dc8e0db768ac2a28d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:56:34 +0800 Subject: [PATCH 598/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Fedora?= =?UTF-8?q?=20CoreOS=20out=20of=20preview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Fedora CoreOS out of preview.md --- .../20200117 Fedora CoreOS out of preview.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20200117 Fedora CoreOS out of preview.md diff --git a/sources/tech/20200117 Fedora CoreOS out of preview.md b/sources/tech/20200117 Fedora CoreOS out of preview.md new file mode 100644 index 0000000000..d7a1393cde --- /dev/null +++ b/sources/tech/20200117 Fedora CoreOS out of preview.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora CoreOS out of preview) +[#]: via: (https://fedoramagazine.org/fedora-coreos-out-of-preview/) +[#]: author: (bgilbert https://fedoramagazine.org/author/bgilbert/) + +Fedora CoreOS out of preview +====== + +![The Fedora CoreOS logo on a gray background.][1] + +The Fedora CoreOS team is pleased to announce that Fedora CoreOS is now [available for general use][2]. + +Fedora CoreOS is a new Fedora Edition built specifically for running containerized workloads securely and at scale. It’s the successor to both [Fedora Atomic Host][3] and [CoreOS Container Linux][4] and is part of our effort to explore new ways of assembling and updating an OS. Fedora CoreOS combines the provisioning tools and automatic update model of Container Linux with the packaging technology, OCI support, and SELinux security of Atomic Host.  For more on the Fedora CoreOS philosophy, goals, and design, see the [announcement of the preview release][5]. + +Some highlights of the current Fedora CoreOS release: + + * [Automatic updates][6], with staged deployments and phased rollouts + * Built from Fedora 31, featuring: + * Linux 5.4 + * systemd 243 + * Ignition 2.1 + * OCI and Docker Container support via Podman 1.7 and Moby 18.09 + * cgroups v1 enabled by default for broader compatibility; cgroups v2 available via configuration + + + +Fedora CoreOS is available on a variety of platforms: + + * Bare metal, QEMU, OpenStack, and VMware + * Images available in all public AWS regions + * Downloadable cloud images for Alibaba, AWS, Azure, and GCP + * Can run live from RAM via ISO and PXE (netboot) images + + + +Fedora CoreOS is under active development.  Planned future enhancements include: + + * Addition of the _next_ release stream for extended testing of upcoming Fedora releases. + * Support for additional cloud and virtualization platforms, and processor architectures other than _x86_64_. + * Closer integration with Kubernetes distributions, including [OKD][7]. + * [Aggregate statistics collection][8]. + * Additional [documentation][9]. + + + +### Where do I get it? + +To try out the new release, head over to the [download page][10] to get OS images or cloud image IDs.  Then use the [quick start guide][11] to get a machine running quickly. + +### How do I get involved? + +It’s easy!  You can report bugs and missing features to the [issue tracker][12]. You can also discuss Fedora CoreOS in [Fedora Discourse][13], the [development mailing list][14], in _#fedora-coreos_ on Freenode, or at our [weekly IRC meetings][15]. + +### Are there stability guarantees? + +In general, the Fedora Project does not make any guarantees around stability.  While Fedora CoreOS strives for a high level of stability, this can be challenging to achieve in the rapidly evolving Linux and container ecosystems.  We’ve found that the incremental, exploratory, forward-looking development required for Fedora CoreOS — which is also a cornerstone of the Fedora Project as a whole — is difficult to reconcile with the iron-clad stability guarantee that ideally exists when automatically updating systems. + +We’ll continue to do our best not to break existing systems over time, and to give users the tools to manage the impact of any regressions.  Nevertheless, automatic updates may produce regressions or breaking changes for some use cases. You should make your own decisions about where and how to run Fedora CoreOS based on your risk tolerance, operational needs, and experience with the OS.  We will continue to announce any major planned or unplanned breakage to the [coreos-status mailing list][16], along with recommended mitigations. + +### How do I migrate from CoreOS Container Linux? + +Container Linux machines cannot be migrated in place to Fedora CoreOS.  We recommend [writing a new Fedora CoreOS Config][11] to provision Fedora CoreOS machines.  Fedora CoreOS Configs are similar to Container Linux Configs, and must be passed through the Fedora CoreOS Config Transpiler to produce an Ignition config for provisioning a Fedora CoreOS machine. + +Whether you’re currently provisioning your Container Linux machines using a Container Linux Config, handwritten Ignition config, or cloud-config, you’ll need to adjust your configs for differences between Container Linux and Fedora CoreOS.  For example, on Fedora CoreOS network configuration is performed with [NetworkManager key files][17] instead of _systemd-networkd_, and time synchronization is performed by _chrony_ rather than _systemd-timesyncd_.  Initial migration documentation will be [available soon][9] and a skeleton list of differences between the two OSes is available in [this issue][18]. + +CoreOS Container Linux will be maintained for a few more months, and then will be declared end-of-life.  We’ll announce the exact end-of-life date later this month. + +### How do I migrate from Fedora Atomic Host? + +Fedora Atomic Host has already reached end-of-life, and you should migrate to Fedora CoreOS as soon as possible.  We do not recommend in-place migration of Atomic Host machines to Fedora CoreOS. Instead, we recommend [writing a Fedora CoreOS Config][11] and using it to provision new Fedora CoreOS machines.  As with CoreOS Container Linux, you’ll need to adjust your existing cloud-configs for differences between Fedora Atomic Host and Fedora CoreOS. + +Welcome to Fedora CoreOS.  Deploy it, launch your apps, and let us know what you think! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-coreos-out-of-preview/ + +作者:[bgilbert][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/bgilbert/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/introducing-fedora-coreos-816x345.png +[2]: https://getfedora.org/coreos/ +[3]: https://www.projectatomic.io/ +[4]: https://coreos.com/os/docs/latest/ +[5]: https://fedoramagazine.org/introducing-fedora-coreos/ +[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/auto-updates/ +[7]: https://www.okd.io/ +[8]: https://github.com/coreos/fedora-coreos-pinger/ +[9]: https://docs.fedoraproject.org/en-US/fedora-coreos/ +[10]: https://getfedora.org/coreos/download/ +[11]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ +[12]: https://github.com/coreos/fedora-coreos-tracker/issues +[13]: https://discussion.fedoraproject.org/c/server/coreos +[14]: https://lists.fedoraproject.org/archives/list/coreos@lists.fedoraproject.org/ +[15]: https://github.com/coreos/fedora-coreos-tracker#meetings +[16]: https://lists.fedoraproject.org/archives/list/coreos-status@lists.fedoraproject.org/ +[17]: https://developer.gnome.org/NetworkManager/stable/nm-settings-keyfile.html +[18]: https://github.com/coreos/fedora-coreos-tracker/issues/159 From fd50af186aec8e3b1fe58a37b07c847cdad76626 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:57:15 +0800 Subject: [PATCH 599/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200118=20Zorin?= =?UTF-8?q?=20Grid=20Lets=20You=20Remotely=20Manage=20Multiple=20Zorin=20O?= =?UTF-8?q?S=20Computers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md --- ...tely Manage Multiple Zorin OS Computers.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md diff --git a/sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md b/sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md new file mode 100644 index 0000000000..184b68d84e --- /dev/null +++ b/sources/tech/20200118 Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers) +[#]: via: (https://itsfoss.com/zorin-grid/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Zorin Grid Lets You Remotely Manage Multiple Zorin OS Computers +====== + +One of the major hurdles institutes face is in managing and updating multiple Linux systems from a central point. + +Well, Zorin OS has come up with a new cloud-based tool that will help you manage multiple computers running Zorin OS from one single interface. You can update the systems, install apps and configuration all systems remotely using this tool called [Zorin Grid][1]. + +### Zorin Grid: Manage a fleet of Zorin OS computers remotely + +![][2] + +**Zorin Grid is a tool that makes it simple to set up, manage, and secure a fleet of Zorin OS-powered computers in businesses, schools, and organizations.** + +When it comes to managing Linux distributions (here, Zorin OS) on a multitude of systems for an organization – it is quite time-consuming. + +If it will be easier to manage Linux systems, more organizations will be interested to switch using Linux just like the [Italian city Vicenza replaced Windows by Zorin OS][3]. + +For the very same reason, the Zorin team decided to create ‘**Zorin Grid**‘ with the help of which every school, enterprises, organizations, and businesses will be able to easily manage their Zorin OS-powered machines. + +### Zorin Grid features + +![Zorin Grid Features][4] + +You might have guessed what it is capable of – but let me highlight the key features of Zorin Grid as per its official webpage: + + * Install and Remove Apps + * Set software update and security patch policies + * Monitor computer status + * Enforce security policies + * Keep track of software and hardware inventory + * Set desktop settings + * Organize computers into groups (for teams and departments) + * Role-based access control and audit logging + + + +In addition to these, you will be able to do a couple more things using the Zorin Grid service. But, it looks like most of the essential tasks will be covered by Zorin Grid. + +### How does Zorin Grid work? + +![][5] + +Zorin Grid is a cloud based software as a service. Zorin will be charging a monthly subscription fee for each computer managed by Zorin Grid in an organization. + +You’ll have to install the Zorin Grid client on all the systems that you want to manage. Since it is cloud-based, you can manage all the Zorin systems on your grid from a web browser by logging into you Zorin Grid account. + +You choose how to configure the computers once and the Zorin Grid applies the same configuration to all or specific computers in your organization. + +The price has not been finalized. [Artyom Zorin][6], **CEO of Zorin Group, told It’s FOSS** that schools and non-profit organizations will get Zorin Grid for a reduced pricing. + +While client-side software for Zorin Grid will be open source, the Zorin Grid server won’t be open source initially. Releasing it under an open source license is _tentatively_ on their roadmap. + +Artyom also told that they **plan to support other Linux distributions starting with Ubuntu and Ubuntu-based distros** after launching Zorin Grid for Zorin OS systems this summer. + +In case you decide to migrate from Windows to Zorin OS for your organization or business, you will find a [useful migration guide][7] by the Zorin OS team to help you switch to Linux. + +[Zorin Grid][1] + +**Wrapping Up** + +Let me summarize all the important points about Zorin Grid: + + * Zorin Grid is an upcoming cloud based service that lets you manage multiple Zorin OS systems. + * It’s a premium service that charges for each computer used. The pricing is not determined yet. + * Educational institutes and non-profit organizations can get Zorin Grid for a reduced pricing. + * Initially it can only handle Zorin OS. Other Ubuntu-based distributions are on the road-map but there is no definite timeline for that. + * The service should be available in the summer 2020. + * Zorin Grid server won’t be open source initially. + + + +Zorin Grid looks to be an impressive premium tool for organizations or businesses that want to use Linux while also being able to maintain their systems easily. + +Personally, I wouldn’t mind paying for the service if it makes deploying and using Linux easier, in general. + +Of course, it does not support every Linux distro as of yet – but it is indeed a promising service to keep an eye out for. + +What do you think about it? Do you know of a better alternative to Zorin Grid? Do share your views in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zorin-grid/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://zorinos.com/grid/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/zorin-grid-dashboard.png?ssl=1 +[3]: https://itsfoss.com/vicenza-windows-zorin/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/zorin_grid_features.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/zorin-os-computers.jpg?ssl=1 +[6]: https://itsfoss.com/zorin-os-interview/ +[7]: https://zorinos.com/help/switch-your-organization-to-zorin-os/ From b00a27d56a436d40fadb088a4a451e02043fb09b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:58:02 +0800 Subject: [PATCH 600/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Get=20?= =?UTF-8?q?started=20with=20this=20open=20source=20to-do=20list=20manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Get started with this open source to-do list manager.md --- ...ith this open source to-do list manager.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20200117 Get started with this open source to-do list manager.md diff --git a/sources/tech/20200117 Get started with this open source to-do list manager.md b/sources/tech/20200117 Get started with this open source to-do list manager.md new file mode 100644 index 0000000000..57c9061179 --- /dev/null +++ b/sources/tech/20200117 Get started with this open source to-do list manager.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with this open source to-do list manager) +[#]: via: (https://opensource.com/article/20/1/open-source-to-do-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Get started with this open source to-do list manager +====== +Todo is a powerful way to keep track of your task list. Learn how to use +it in the seventh in our series on 20 ways to be more productive with +open source in 2020. +![Team checklist][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Track your tasks with todo + +Tasks and to-do lists are very near and dear to my heart. I'm a big fan of productivity (so much so that I do a [podcast][2] about it) and try all sorts of different applications. I've even [given presentations][3] and [written articles][4] about them. So it only makes sense that, when I talk about being productive, task and to-do list tools are certain to come up. + +![Getting fancy with Todo.txt][5] + +In all honesty, for being simple, cross-platform, and easily synchronized, you cannot go wrong with [todo.txt][6]. It is one of the two to-do list and task management apps that I keep coming back to over and over again (the other is [Org mode][7]). And what keeps me coming back is that it is simple, portable, understandable, and has many great add-ons that don't break it if one machine has them and the others don't. And since it is a Bash shell script, I have never found a system that cannot support it. + +#### Set up todo.txt + +First things first, you need to install the base shell script and copy the default configuration file to the **~/.todo** directory: + + +``` +git clone +cd todo.txt-cli +make +sudo make install +mkdir ~/.todo +cp todo.cfg ~/.todo/config +``` + +Next, set up the configuration file. I like to uncomment the color settings at this point, but the only thing that must be set up right away is the **TODO_DIR** variable: + + +``` +`export TODO_DIR="$HOME/.todo"` +``` + +#### Add to-do's + +To add your first to-do item, simply type **todo.sh add <NewTodo>**, and it will be added. This will also create three files in **$HOME/.todo/**: todo.txt, done.txt, and reports.txt. + +After adding a few items, run **todo.sh ls** to see your to-do list. + +![Basic todo.txt list][8] + +#### Manage your tasks + +You can improve it a little by prioritizing the items. To add a priority to an item, run **todo.sh pri # A**. The number is the number of the task on the list, and the letter "A" is the priority. You can set the priority as anything from A to Z since that's how it will get sorted. + +To complete a task, run **todo.sh do #** to mark the item done and move the item to done.txt. Running **todo.sh report** will write a count of done and not done items to reports.txt. + +The file format used for all three files is well documented, so you can make changes with your text editor of choice. The basic format of todo.txt is: + + +``` +`(Priority) YYYY-MM-DD Task` +``` + +The date indicates the due date of a task, if one is set. When editing the file manually, just put an "x" in front of the task to mark it as done. Running **todo.sh archive** will move these items to done.txt, and you can work in that text file and archive the done items when you have time. + +#### Set up recurring tasks + +I have a lot of recurring tasks that I need to schedule every day/week/month. + +![Recurring tasks with the ice_recur add-on][9] + +This is where todo.txt's flexibility comes in. By using [add-ons][10] in **~/.todo.actions.d/**, you can add commands and extend the functionality of the base todo.sh. The add-ons are basically scripts that implement specific commands. For recurring tasks, the plugin [ice_recur][11] should fit the bill. By following the instructions on the page, you can set up tasks to recur in a very flexible manner. + +![Todour on MacOS][12] + +There are a lot of add-ons in the directory, including syncing to some cloud services. There are also links to desktop and mobile apps, so you can keep your to-do list with you on the go. + +I've only scratched the surface of todo's functionality, so take some time to dig in and see how powerful this tool is! It really helps me keep on task every day. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-to-do-list + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) +[2]: https://productivityalchemy.com/ +[3]: https://www.slideshare.net/AllThingsOpen/getting-to-done-on-the-command-line +[4]: https://opensource.com/article/18/2/getting-to-done-agile-linux-command-line +[5]: https://opensource.com/sites/default/files/uploads/productivity_7-1.png +[6]: http://todotxt.org/ +[7]: https://orgmode.org/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_7-2.png (Basic todo.txt list) +[9]: https://opensource.com/sites/default/files/uploads/productivity_7-3.png (Recurring tasks with the ice_recur add-on) +[10]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory +[11]: https://github.com/rlpowell/todo-text-stuff +[12]: https://opensource.com/sites/default/files/uploads/productivity_7-4.png (Todour on MacOS) From 5d1f78aba0ab8cab11efaba9dac85b2e6c47efc8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:58:42 +0800 Subject: [PATCH 601/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Use=20?= =?UTF-8?q?this=20Python=20script=20to=20find=20bugs=20in=20your=20Overclo?= =?UTF-8?q?ud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md --- ...n script to find bugs in your Overcloud.md | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md diff --git a/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md b/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md new file mode 100644 index 0000000000..ee167e6f78 --- /dev/null +++ b/sources/tech/20200117 Use this Python script to find bugs in your Overcloud.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this Python script to find bugs in your Overcloud) +[#]: via: (https://opensource.com/article/20/1/logtool-root-cause-identification) +[#]: author: (Arkady Shtempler https://opensource.com/users/ashtempl) + +Use this Python script to find bugs in your Overcloud +====== +LogTool is a set of Python scripts that helps you investigate root +causes for problems in Overcloud nodes. +![Searching for code][1] + +OpenStack stores and manages a bunch of log files on its Overcloud nodes and Undercloud host. Therefore, it's not easy to use OSP log files to investigate a problem you're having, especially when you don't even know what could have caused the problem. + +If that's your situation, [LogTool][2] makes your life much easier! It saves you the time and work it would otherwise take to investigate the root cause manually. Based on a fuzzy string matching algorithm, LogTool provides all the unique error and warning messages that have occurred in the past. You can export these messages for a particular time period, such as 10 minutes ago, an hour ago, a day ago, and so on, based on timestamp in the log. + +LogTool is a set of Python scripts, and its main module, **PyTool.py**, is executed on the Undercloud host. Some operation modes use additional scripts that are executed directly on Overcloud nodes, such as exporting  errors and warnings from Overcloud logs. + +LogTool supports Python 2 and 3, and you can change the working directory according to your needs: [LogTool_Python2][3] or [LogTool_Python3][4]. + +### Operation modes + +#### 1\. Export errors and warnings from Overcloud logs + +This mode is used to extract all unique **ERROR** and **WARNING** messages from Overcloud nodes that took place in the past. As the user, you're prompted to provide the "since time" and debug level to be used for extraction of errors or warnings. For example, if something went wrong in the last 10 minutes, you're be able to extract error and warning messages for just that time period. + +This operation mode generates a directory containing a result file for each Overcloud node. A result file is a simple text file that is compressed (***.gz**) to reduce the time needed to download it from the Overcloud node. To convert a compressed file to a regular text file, you can use [zcat][5] or a similar tool. Also, some versions of Vi and any recent version of Emacs both support reading compressed data. The result file is divided into sections and contains a table of contents at the bottom. + +There are two kinds of log files LogTool detects on the fly: _Standard_ and _Not Standard_. In _Standard_, each log line has a known and defined structure: timestamp, debug level, msg, and so on. In _Not Standard_, the log's structure is unknown; it could be a third party's logs, for example. In the table of contents, you find a "Section name --> Line number" per section, for example: + + * **Raw Data - extracted Errors/Warnings from standard OSP logs since:** This section contains all extracted Error/Warning messages as-is without any modifications or changes. These messages are the raw data LogTool uses for fuzzy matching analysis. + * **Statistics - Number of Errors/Warnings per standard OSP log since:** In this section, you find the amount of Errors and Warnings per Standard log file. This may help you understand potential components used to search for the root cause of your issue. + * **Statistics - Unique messages, per STANDARD OSP log file since:** This section addresses unique Error and Warning messages since a timestamp you provide. For more details about each unique Error or Warning, search for the same message in the Raw Data section. + * **Statistics - Unique messages per NON STANDARD log file, since any time:** This section contains the unique messages in nonstandard log files. Unfortunately, LogTool cannot handle these log files in the same manner as Standard Log files; therefore, the "since time" you provide on extraction will be ignored, and you'll see all of the unique Errors/Warnings messages ever created. So first, scroll down to the table of contents at the bottom of the result file and review its sections—use the line indexes in the table of contents to jump to the relevant sections, where numbers 3, 4, and 5 are most important. + + + +#### 2\. Download all logs from Overcloud nodes + +Logs from all Overcloud nodes are compressed and downloaded to a local directory on your Undercloud host. + +#### 3\. Grep for a string in all Overcloud logs + +This mode "greps" (searches) a string provided by the user on all Overcloud logs. For example, you might want to see all logged messages for a specific request ID, such as the request ID for a "Create VM" that has failed. + +#### 4\. Check current CPU,RAM and Disk on Overcloud + +This mode displays the current CPU, RAM, and disk info on each Overcloud node. + +#### 5\. Execute user's script + +This enables users to run their own scripts on Overcloud nodes. For instance, say an Overcloud deployment failed, so you need to execute the same procedure on each Controller node to fix that. You can implement a "work around" script and to run it on Controllers using this mode. + +#### 6\. Download relevant logs only, by given timestamp + +This mode downloads only the Overcloud logs with _"Last Modified" > "given by user timestamp."_ For example, if you got an error 10 minutes ago, old log files won't be relevant, so downloading them is unnecessary. In addition, you can't (or shouldn't)  attach large files in some bug reporting tools, so this mode might help with making bug reports. + +#### 7\. Export errors and warnings from Undercloud logs + +This is the same as mode #1 above, but for Undercloud logs. + +#### 8\. Check Unhealthy dockers on the Overcloud + +This mode is used to search for unhealthy Dockers on nodes. + +#### 9\. Download OSP logs and run LogTool locally + +This mode allows you to download OSP logs from Jenkins or Log Storage (for example, **cougar11.scl.lab.tlv.redhat.com**) and to analyze the downloaded logs locally. + +#### 10\. Analyze deployment log on the Undercloud + +This mode may help you understand what went wrong during Overcloud or Undercloud deployment. Deployment logs are generated when the **\--log** option is used, for example, inside the **overcloud_deploy.sh** script; the problem is that such logs are not "friendly," and it's hard to understand what went wrong, especially when verbosity is set to **vv** or more, as this makes the log unreadable with a bunch of data inside it. This mode provides some details about all failed tasks. + +#### 11\. Analyze Gerrit(Zuul) failed gate logs + +This mode is used to analyze Gerrit(Zuul) log files. It automatically downloads all files from a remote Gerrit gate (HTTP download) and analyzes all files locally. + +### Installation + +LogTool is available on GitHub. Clone it to your Undercloud host with: + + +``` +`git clone https://github.com/zahlabut/LogTool.git` +``` + +Some external Python modules are also used by the tool: + +#### Paramiko + +This SSH module is usually installed on Undercloud by default. Use the following command to verify whether it's installed: + + +``` +`ls -a /usr/lib/python2.7/site-packages | grep paramiko` +``` + +If you need to install the module, on your Undercloud, execute the following commands: + + +``` +sudo easy_install pip +sudo pip install paramiko==2.1.1 +``` + +#### BeautifulSoup + +This HTML parser module is used only in modes where log files are downloaded using HTTP. It's used to parse the Artifacts HTML page to get all of the links in it. To install BeautifulSoup, enter this command: + + +``` +`pip install beautifulsoup4` +``` + +You can also use the [requirements.txt][6] file to install all the required modules by executing: + + +``` +`pip install -r requirements.txt` +``` + +### Configuration + +All required parameters are set directly inside the **PyTool.py** script. The defaults are: + + +``` +overcloud_logs_dir = '/var/log/containers' +overcloud_ssh_user = 'heat-admin' +overcloud_ssh_key = '/home/stack/.ssh/id_rsa' +undercloud_logs_dir ='/var/log/containers' +source_rc_file_path='/home/stack/' +``` + +### Usage + +This tool is interactive, so to start it, just enter: + + +``` +cd LogTool +python PyTool.py +``` + +### Troubleshooting LogTool + +Two log files are created on runtime: Error.log and Runtime.log*.* Please add the contents of both in the description of the issue you'd like to open. + +### Limitations + +LogTool is hardcoded to handle files up to 500 MB. + +### LogTool_Python3 script + +Get it at [github.com/zahlabut/LogTool][2] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/logtool-root-cause-identification + +作者:[Arkady Shtempler][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ashtempl +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://github.com/zahlabut/LogTool +[3]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python2 +[4]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python3 +[5]: https://opensource.com/article/19/2/getting-started-cat-command +[6]: https://github.com/zahlabut/LogTool/blob/master/LogTool_Python3/requirements.txt From 8b97dedd6fa2bb676afe4c3cc6df2e4717afc7c6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 00:59:30 +0800 Subject: [PATCH 602/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20C=20vs?= =?UTF-8?q?.=20Rust:=20Which=20to=20choose=20for=20programming=20hardware?= =?UTF-8?q?=20abstractions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md --- ...e for programming hardware abstractions.md | 509 ++++++++++++++++++ 1 file changed, 509 insertions(+) create mode 100644 sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md diff --git a/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md new file mode 100644 index 0000000000..acb58aaf6d --- /dev/null +++ b/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -0,0 +1,509 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (C vs. Rust: Which to choose for programming hardware abstractions) +[#]: via: (https://opensource.com/article/20/1/c-vs-rust-abstractions) +[#]: author: (Dan Pittman https://opensource.com/users/dan-pittman) + +C vs. Rust: Which to choose for programming hardware abstractions +====== +Using type-level programming in Rust can make hardware abstractions +safer. +![Tools illustration][1] + +Rust is an increasingly popular programming language positioned to be the best choice for hardware interfaces. It's often compared to C for its level of abstraction. This article explains how Rust can handle bitwise operations in a number of ways and offers a solution that provides both safety and ease of use. + +Language | Origin | Official description | Overview +---|---|---|--- +C | 1972 | C is a general-purpose programming language which features economy of expression, modern control flow and data structures, and a rich set of operators. (Source: [CS Fundamentals][2]) | C is [an] imperative language and designed to compile in a relatively straightforward manner which provides low-level access to the memory. (Source: [W3schools.in][3]) +Rust | 2010 | A language empowering everyone to build reliable and efficient software (Source: [Rust website][4]) | Rust is a multi-paradigm system programming language focused on safety, especially safe concurrency. (Source: [Wikipedia][5]) + +### Bitwise operation over register values in C + +In the world of systems programming, where you may find yourself writing hardware drivers or interacting directly with memory-mapped devices, interaction is almost always done through memory-mapped registers provided by the hardware. You typically interact with these things through bitwise operations on some fixed-width numeric type. + +For instance, imagine an 8-bit register with three fields: + + +``` ++----------+------+-----------+---------+ +| (unused) | Kind | Interrupt | Enabled | ++----------+------+-----------+---------+ +   5-7       2-4        1          0 +``` + +The number below the field name prescribes the bits used by that field in the register. To enable this register, you would write the value **1**, represented in binary as **0000_0001**, to set the enabled field's bit. Often, though, you also have an existing configuration in the register that you don't want to disturb. Say you want to enable interrupts on the device but also want to be sure the device remains enabled. To do that, you must combine the Interrupt field's value with the Enabled field's value. You would do that with bitwise operations: + + +``` +`1 | (1 << 1)` +``` + +This gives you the binary value **0000_0011** by **or**-ing 1 with 2, which you get by shifting 1 left by 1. You can write this to your register, leaving it enabled but also enabling interrupts. + +This is a lot to keep in your head, especially when you're dealing with potentially hundreds of registers for a complete system. In practice, you do this with mnemonics which track a field's position in a register and how wide the field is—i.e., _what's its upper bound?_ + +Here's an example of one of these mnemonics. They are C macros that replace their occurrences with the code on the right-hand side. This is the shorthand for the register laid out above. The left-hand side of the **&** puts you in position for that field, and the right-hand side limits you to only that field's bits: + + +``` +#define REG_ENABLED_FIELD(x) (x << 0) & 1 +#define REG_INTERRUPT_FIELD(x) (x << 1) & 2 +#define REG_KIND_FIELD(x) (x << 2) & (7 << 2) +``` + +You'd then use these to abstract over the derivation of a register's value with something like: + + +``` +void set_reg_val(reg* u8, val u8); + +fn enable_reg_with_interrupt(reg* u8) { +    set_reg_val(reg, REG_ENABLED_FIELD(1) | REG_INTERRUPT_FIELD(1)); +} +``` + +This is the state of the art. In fact, this is how the bulk of drivers appear in the Linux kernel. + +Is there a better way? Consider the boon to safety and expressibility if the type system was borne out of research on modern programming languages. That is, what could you do with a richer, more expressive type system to make this process safer and more tenable? + +### Bitwise operation over register values in Rust + +Continuing with the register above as an example: + + +``` ++----------+------+-----------+---------+ +| (unused) | Kind | Interrupt | Enabled | ++----------+------+-----------+---------+ +   5-7       2-4        1          0 +``` + +How might you want to express such a thing in Rust types? + +You'll start in a similar way, by defining constants for each field's _offset_—that is, how far it is from the least significant bit—and its mask. A _mask_ is a value whose binary representation can be used to update or read the field from inside the register: + + +``` +const ENABLED_MASK: u8 = 1; +const ENABLED_OFFSET: u8 = 0; + +const INTERRUPT_MASK: u8 = 2; +const INTERRUPT_OFFSET: u8 = 1; + +const KIND_MASK: u8 = 7 << 2; +const KIND_OFFSET: u8 = 2; +``` + +Next, you'll declare a field type and do your operations to convert a given value into its position-relevant value for use inside the register: + + +``` +struct Field { +    value: u8, +} + +impl Field { +    fn new(mask: u8, offset: u8, val: u8) -> Self { +        Field { +            value: (val << offset) & mask, +        } +    } +} +``` + +Finally, you'll use a **Register** type, which wraps around a numeric type that matches the width of your register. **Register** has an **update** function that updates the register with the given field: + + +``` +struct Register(u8); + +impl Register { +    fn update(&mut self, val: Field) { +        self.0 = self.0 | field.value; +    } +} + +fn enable_register(&mut reg) { +    reg.update(Field::new(ENABLED_MASK, ENABLED_OFFSET, 1)); +} +``` + +With Rust, you can use data structures to represent fields, attach them to specific registers, and provide concise and sensible ergonomics while interacting with the hardware. This example uses the most basic facilities provided by Rust; regardless, the added structure alleviates some of the density from the C example above. Now a field is a named thing, not a number derived from shadowy bitwise operators, and registers are types with state—one extra layer of abstraction over the hardware. + +### A Rust implementation for ease of use + +The first rewrite in Rust is nice, but it's not ideal. You have to remember to bring the mask and offset, and you're calculating them ad hoc, by hand, which is error-prone. Humans aren't great at precise and repetitive tasks—we tend to get tired or lose focus, and this leads to mistakes. Transcribing the masks and offsets by hand, one register at a time, will almost certainly end badly. This is the kind of task best left to a machine. + +Second, thinking more structurally: What if there were a way to have the field's type carry the mask and offset information? What if you could catch mistakes in your implementation for how you access and interact with hardware registers at compile time instead of discovering them at runtime? Perhaps you can lean on one of the strategies commonly used to suss out issues at compile time, like types. + +You can modify the earlier example by using [**typenum**][6], a library that provides numbers and arithmetic at the type level. Here, you'll parameterize the **Field** type with its mask and offset, making it available for any instance of **Field** without having to include it at the call site: + + +``` +#[macro_use] +extern crate typenum; + +use core::marker::PhantomData; + +use typenum::*; + +// Now we'll add Mask and Offset to Field's type +struct Field<Mask: Unsigned, Offset: Unsigned> { +    value: u8, +    _mask: PhantomData<Mask>, +    _offset: PhantomData<Offset>, +} + +// We can use type aliases to give meaningful names to +// our fields (and not have to remember their offsets and masks). +type RegEnabled = Field<U1, U0>; +type RegInterrupt = Field<U2, U1>; +type RegKind = Field<op!(U7 << U2), U2>; +``` + +Now, when revisiting **Field**'s constructor, you can elide the mask and offset parameters because the type contains that information: + + +``` +impl<Mask: Unsigned, Offset: Unsigned> Field<Mask, Offset> { +    fn new(val: u8) -> Self { +        Field { +            value: (val << Offset::U8) & Mask::U8, +            _mask: PhantomData, +            _offset: PhantomData, +        } +    } +} + +// And to enable our register... +fn enable_register(&mut reg) { +    reg.update(RegEnabled::new(1)); +} +``` + +It looks pretty good, but… what happens when you make a mistake regarding whether a given value will _fit_ into a field? Consider a simple typo where you put **10** instead of **1**: + + +``` +fn enable_register(&mut reg) { +    reg.update(RegEnabled::new(10)); +} +``` + +In the code above, what is the expected outcome? Well, the code will set that enabled bit to 0 because **10 & 1 = 0**. That's unfortunate; it would be nice to know whether a value you're trying to write into a field will fit into the field before attempting a write. As a matter of fact, I'd consider lopping off the high bits of an errant field value _undefined behavior_ (gasps). + +### Using Rust with safety in mind + +How can you check that a field's value fits in its prescribed position in a general way? More type-level numbers! + +You can add a **Width** parameter to **Field** and use it to verify that a given value can fit into the field: + + +``` +struct Field<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> { +    value: u8, +    _mask: PhantomData<Mask>, +    _offset: PhantomData<Offset>, +    _width: PhantomData<Width>, +} + +type RegEnabled = Field<U1,U1, U0>; +type RegInterrupt = Field<U1, U2, U1>; +type RegKind = Field<U3, op!(U7 << U2), U2>; + +impl<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> Field<Width, Mask, Offset> { +    fn new(val: u8) -> Option<Self> { +        if val <= (1 << Width::U8) - 1 { +            Some(Field { +                value: (val << Offset::U8) & Mask::U8, +                _mask: PhantomData, +                _offset: PhantomData, +                _width: PhantomData, +            }) +        } else { +            None +        } +    } +} +``` + +Now you can construct a **Field** only if the given value fits! Otherwise, you have **None**, which signals that an error has occurred, rather than lopping off the high bits of the value and silently writing an unexpected value. + +Note, though, this will raise an error at runtime. However, we knew the value we wanted to write beforehand, remember? Given that, we can teach the compiler to reject entirely a program which has an invalid field value—we don’t have to wait until we run it! + +This time, you'll add a _trait bound_ (the **where** clause) to a new realization of new, called **new_checked**, that asks the incoming value to be less than or equal to the maximum possible value a field with the given **Width** can hold: + + +``` +struct Field<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> { +    value: u8, +    _mask: PhantomData<Mask>, +    _offset: PhantomData<Offset>, +    _width: PhantomData<Width>, +} + +type RegEnabled = Field<U1, U1, U0>; +type RegInterrupt = Field<U1, U2, U1>; +type RegKind = Field<U3, op!(U7 << U2), U2>; + +impl<Width: Unsigned, Mask: Unsigned, Offset: Unsigned> Field<Width, Mask, Offset> { +    const fn new_checked<V: Unsigned>() -> Self +    where +        V: IsLessOrEqual<op!((U1 << Width) - U1), Output = True>, +    { +        Field { +            value: (V::U8 << Offset::U8) & Mask::U8, +            _mask: PhantomData, +            _offset: PhantomData, +            _width: PhantomData, +        } +    } +} +``` + +Only numbers for which this property holds has an implementation of this trait, so if you use a number that does not fit, it will fail to compile. Take a look! + + +``` +fn enable_register(&mut reg) { +    reg.update(RegEnabled::new_checked::<U10>()); +} +12 |     reg.update(RegEnabled::new_checked::<U10>()); +   |                           ^^^^^^^^^^^^^^^^ expected struct `typenum::B0`, found struct `typenum::B1` +   | +   = note: expected type `typenum::B0` +           found type `typenum::B1` +``` + +**new_checked** will fail to produce a program that has an errant too-high value for a field. Your typo won't blow up at runtime because you could never have gotten an artifact to run. + +You're nearing Peak Rust in terms of how safe you can make memory-mapped hardware interactions. However, what you wrote back in the first example in C was far more succinct than the type parameter salad you ended up with. Is doing such a thing even tractable when you're talking about potentially hundreds or even thousands of registers? + +### Just right with Rust: both safe and accessible + +Earlier, I called out calculating masks by hand as being problematic, but I just did that same problematic thing—albeit at the type level. While using such an approach is nice, getting to the point when you can write any code requires quite a bit of boilerplate and manual transcription (I'm talking about the type synonyms here). + +Our team wanted something like the [TockOS mmio registers][7], but one that would generate typesafe implementations with the least amount of manual transcription possible. The result we came up with is a macro that generates the necessary boilerplate to get a Tock-like API plus type-based bounds checking. To use it, write down some information about a register, its fields, their width and offsets, and optional [enum][8]-like values (should you want to give "meaning" to the possible values a field can have): + + +``` +register! { +    // The register's name +    Status, +    // The type which represents the whole register. +    u8, +    // The register's mode, ReadOnly, ReadWrite, or WriteOnly. +    RW, +    // And the fields in this register. +    Fields [ +        On    WIDTH(U1) OFFSET(U0), +        Dead  WIDTH(U1) OFFSET(U1), +        Color WIDTH(U3) OFFSET(U2) [ +            Red    = U1, +            Blue   = U2, +            Green  = U3, +            Yellow = U4 +        ] +    ] +} +``` + +From this, you can generate register and field types like the previous example where the indices—the **Width**, **Mask**, and **Offset**—are derived from the values input in the **WIDTH** and **OFFSET** sections of a field's definition. Also, notice that all of these numbers are **typenums**; they're going to go directly into your **Field** definitions! + +The generated code provides namespaces for registers and their associated fields through the name given for the register and the fields. That's a mouthful; here's what it looks like: + + +``` +mod Status { +    struct Register(u8); +    mod On { +        struct Field; // There is of course more to this definition +    } +    mod Dead { +        struct Field; +    } +    mod Color { +        struct Field; +        pub const Red: Field = Field::<U1>new(); +        // &c. +    } +} +``` + +The generated API contains the nominally expected read and write primitives to get at the raw register value, but it also has ways to get a single field's value, do collective actions, and find out if any (or all) of a collection of bits is set. You can read the documentation on the [complete generated API][9]. + +### Kicking the tires + +What does it look like to use these definitions for a real device? Will the code be littered with type parameters, obscuring any real logic from view? + +No! By using type synonyms and type inference, you effectively never have to think about the type-level part of the program at all. You get to interact with the hardware in a straightforward way and get those bounds-related assurances automatically. + +Here's an example of a [UART][10] register block. I'll skip the declaration of the registers themselves, as that would be too much to include here. Instead, it starts with a register "block" then helps the compiler know how to look up the registers from a pointer to the head of the block. We do that by implementing **Deref** and **DerefMut**: + + +``` +#[repr(C)] +pub struct UartBlock { +    rx: UartRX::Register, +    _padding1: [u32; 15], +    tx: UartTX::Register, +    _padding2: [u32; 15], +    control1: UartControl1::Register, +} + +pub struct Regs { +    addr: usize, +} + +impl Deref for Regs { +    type Target = UartBlock; + +    fn deref(&self) -> &UartBlock { +        unsafe { &*(self.addr as *const UartBlock) } +    } +} + +impl DerefMut for Regs { +    fn deref_mut(&mut self) -> &mut UartBlock { +        unsafe { &mut *(self.addr as *mut UartBlock) } +    } +} +``` + +Once this is in place, using these registers is as simple as **read()** and **modify()**: + + +``` +fn main() { +    // A pretend register block. +    let mut x = [0_u32; 33]; + +    let mut regs = Regs { +        // Some shenanigans to get at `x` as though it were a +        // pointer. Normally you'd be given some address like +        // `0xDEADBEEF` over which you'd instantiate a `Regs`. +        addr: &mut x as *mut [u32; 33] as usize, +    }; + +    assert_eq!(regs.rx.read(), 0); + +    regs.control1 +        .modify(UartControl1::Enable::Set + UartControl1::RecvReadyInterrupt::Set); + +    // The first bit and the 10th bit should be set. +    assert_eq!(regs.control1.read(), 0b_10_0000_0001); +} +``` + +When we're working with runtime values we use **Option** like we saw earlier. Here I'm using **unwrap**, but in a real program with unknown inputs, you'd probably want to check that you got a **Some** back from that new call:[1][11],[2][12] + + +``` +fn main() { +    // A pretend register block. +    let mut x = [0_u32; 33]; + +    let mut regs = Regs { +        // Some shenanigans to get at `x` as though it were a +        // pointer. Normally you'd be given some address like +        // `0xDEADBEEF` over which you'd instantiate a `Regs`. +        addr: &mut x as *mut [u32; 33] as usize, +    }; + +    let input = regs.rx.get_field(UartRX::Data::Field::Read).unwrap(); +    regs.tx.modify(UartTX::Data::Field::new(input).unwrap()); +} +``` + +### Decoding failure conditions + +Depending on your personal pain threshold, you may have noticed that the errors are nearly unintelligible. Take a look at a not-so-subtle reminder of what I'm talking about: + + +``` +error[E0271]: type mismatch resolving `<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B1>, typenum::B0>, typenum::B0> as typenum::IsLessOrEqual<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B1>, typenum::B0>>>::Output == typenum::B1` +  --> src/main.rs:12:5 +   | +12 |     less_than_ten::<U20>(); +   |     ^^^^^^^^^^^^^^^^^^^^ expected struct `typenum::B0`, found struct `typenum::B1` +   | +   = note: expected type `typenum::B0` +       found type `typenum::B1` +``` + +The **expected typenum::B0 found typenum::B1** part kind of makes sense, but what on earth is the **typenum::UInt<typenum::UInt, typenum::UInt…** nonsense? Well, **typenum** represents numbers as binary [cons][13] cells! Errors like this make it hard, especially when you have several of these type-level numbers confined to tight quarters, to know which number it's talking about. Unless, of course, it's second nature for you to translate baroque binary representations to decimal ones. + +After the **U100**th time attempting to decipher any meaning from this mess, a teammate got Mad As Hell And Wasn't Going To Take It Anymore and made a little utility, **tnfilt**, to parse the meaning out from the misery that is namespaced binary cons cells. **tnfilt** takes the cons cell-style notation and replaces it with sensible decimal numbers. We imagine that others will face similar difficulties, so we shared [**tnfilt**][14]. You can use it like this: + + +``` +`$ cargo build 2>&1 | tnfilt` +``` + +It transforms the output above into something like this: + + +``` +`error[E0271]: type mismatch resolving `>::Output == typenum::B1`` +``` + +Now _that_ makes sense! + +### In conclusion + +Memory-mapped registers are used ubiquitously when interacting with hardware from software, and there are myriad ways to portray those interactions, each of which has a different place on the spectra of ease-of-use and safety. We found that the use of type-level programming to get compile-time checking on memory-mapped register interactions gave us the necessary information to make safer software. That code is available in the **[bounded-registers][15] crate** (Rust package). + +Our team started out right at the edge of the more-safe side of that safety spectrum and then tried to figure out how to move the ease-of-use slider closer to the easy end. From those ambitions, **bounded-registers** was born, and we use it anytime we encounter memory-mapped devices in our adventures at Auxon. + +* * * + + 1. Technically, a read from a register field, by definition, will only give a value within the prescribed bounds, but none of us lives in a pure world, and you never know what's going to happen when external systems come into play. You're at the behest of the Hardware Gods here, so instead of forcing you into a "might panic" situation, it gives you the **Option** to handle a "This Should Never Happen" case. + + 2. **get_field** looks a little weird. I'm looking at the **Field::Read** part, specifically. **Field** is a type, and you need an instance of that type to pass to **get_field**. A cleaner API might be something like: + + +``` +`regs.rx.get_field::();` +``` + +But remember that **Field** is a type synonym that has fixed indices for width, offset, etc. To be able to parameterize **get_field** like this, you'd need higher-kinded types. + + + + +* * * + +_This originally appeared on the [Auxon Engineering blog][16] and is edited and republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/c-vs-rust-abstractions + +作者:[Dan Pittman][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dan-pittman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl (Tools illustration) +[2]: https://cs-fundamentals.com/c-programming/history-of-c-programming-language.php +[3]: https://www.w3schools.in/c-tutorial/history-of-c/ +[4]: https://www.rust-lang.org/ +[5]: https://en.wikipedia.org/wiki/Rust_(programming_language) +[6]: https://docs.rs/crate/typenum +[7]: https://docs.rs/tock-registers/0.3.0/tock_registers/ +[8]: https://en.wikipedia.org/wiki/Enumerated_type +[9]: https://github.com/auxoncorp/bounded-registers#the-register-api +[10]: https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter +[11]: tmp.shpxgDsodx#1 +[12]: tmp.shpxgDsodx#2 +[13]: https://en.wikipedia.org/wiki/Cons +[14]: https://github.com/auxoncorp/tnfilt +[15]: https://crates.io/crates/bounded-registers +[16]: https://blog.auxon.io/2019/10/25/type-level-registers/ From 781008b82c9500bfc398c01cb4fa8c3a369a8570 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 18 Jan 2020 01:00:57 +0800 Subject: [PATCH 603/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200117=20Lockin?= =?UTF-8?q?g=20and=20unlocking=20accounts=20on=20Linux=20systems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200117 Locking and unlocking accounts on Linux systems.md --- ...and unlocking accounts on Linux systems.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 sources/tech/20200117 Locking and unlocking accounts on Linux systems.md diff --git a/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md b/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md new file mode 100644 index 0000000000..c1cb3a7be1 --- /dev/null +++ b/sources/tech/20200117 Locking and unlocking accounts on Linux systems.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Locking and unlocking accounts on Linux systems) +[#]: via: (https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Locking and unlocking accounts on Linux systems +====== +There are times when locking a Linux user account is necessary and times when you need to reverse that action. Here are commands for managing account access and what's behind them. +SQBack / Getty Images + +If you are administering a [Linux][1] system, there will likely be times that you need to lock an account. Maybe someone is changing positions and their continued need for the account is under question; maybe there’s reason to believe that access to the account has been compromised. In any event, knowing how to lock an account and how to unlock it should it be needed again is something you need to be able to do. + +One important thing to keep in mind is that there are multiple ways to lock an account, and they don't all have the same effect. If the account user is accessing an account using public/private keys instead of a password, some commands you might use to block access to an account will not be effective. + +### Locking an account using the passwd command + +One of the simplest ways to lock an account is with the **passwd -l** command. For example: + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +$ sudo passwd -l tadpole +``` + +The effect of this command is to insert an exclamation point as the first character in the encrypted password field in the /etc/shadow file. This is enough to keep the password from working. What previously looked like this (note the first character): + +``` +$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: +``` + +will look like this: + +``` +!$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPCnXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::: +``` + +On his next login attempt (should there be one), tadpole would probably try his password numerous times and not gain access. You, on the other hand, would be able to check the status of his account with a command like this (-S = status): + +``` +$ sudo passwd -S tadpole +tadpole L 10/15/2019 0 99999 7 -1 +``` + +The "L" in the second field tells you that the account is locked. Before the account was locked, it would have been a "P". An "NP" would mean that no password was set. + +**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][3] ]** + +The **usermod -L** command would have the same effect (inserting the exclamation character to disable use of the password). + +One of the benefits of locking an account in this way is that it's very easy to unlock the account when and if needed. Just reverse the change by removing the added exclamation point with a text editor or, better yet, by using the **passwd -u** command. + +``` +$ sudo passwd -u tadpole +passwd: password expiry information changed. +``` + +The problem with this approach is that, if the user is accessing his or her account with public/private keys, this change will not block their use. + +### Locking accounts with the chage command + +Another way to lock a user account is to the the **chage** command that helps manage account expiration dates. + +``` +$ sudu chage -E0 tadpole +$ sudo passwd -S tadpole +tadpole P 10/15/2019 0 99999 7 -1 +``` + +The **chage** command is going to make a subtle change to the /etc/shadow file. The eighth field in that colon-separated file (shown below) will be set to zero (previously empty) and this means the account is essentially expired. The **chage** command tracks the number of days between password changes, but also provides account expiration information when this option is used. A zero in the eiighth field would mean that the account expires a day after January 1, 1970, but also simply locks it when a command like that shown above is used. + +``` +$ sudo grep tadpole /etc/shadow | fold +tadpole:$6$IC6icrWlNhndMFj6$Jj14Regv3b2EdK.8iLjSeO893fFig75f32rpWpbKPNz7g/eqeaPC +nXl3iQ7RFIN0BGC0E91sghFdX2eWTe2ET0:18184:0:99999:7::0: + ^ + | + +--- days until expiration +``` + +To reverse this change, you can simply remove the 0 that was placed in the /etc/shadow entry for the user with a command like this: + +``` +% sudo chage -E-1 tadpole +``` + +Once an account is expired in this way, even passwordless [SSH][4] will not provide access. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3513982/locking-and-unlocking-accounts-on-linux-systems.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[4]: https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 2234eb35ff0c53a48acc2b65843d97fbe27b7493 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 12:35:15 +0800 Subject: [PATCH 604/676] PRF @geekpi --- ... across multiple devices with Syncthing.md | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md b/translated/tech/20200111 Sync files across multiple devices with Syncthing.md index e4bc076533..2243ad50cd 100644 --- a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md +++ b/translated/tech/20200111 Sync files across multiple devices with Syncthing.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Sync files across multiple devices with Syncthing) @@ -9,14 +9,16 @@ 使用 Syncthing 在多个设备间同步文件 ====== -2020 年,在我们的 20 个使用开源提升生产力的系列文章中,首先了解如何使用 Syncthing 同步文件。 -![Files in a folder][1] + +> 2020 年,在我们的 20 个使用开源提升生产力的系列文章中,首先了解如何使用 Syncthing 同步文件。 + +![](https://img.linux.net.cn/data/attachment/album/202001/18/123416rebvs7sjwm6c889y.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 Synthing 同步文件 -置新机器很麻烦。我们都有在机器之间复制的“标准设置”。多年来,我使用了很多方法来使它们在计算机之间同步。在过去(这会告诉你我年纪有多大了),曾经是软盘、然后是 Zip 磁盘、U 盘、SCP、Rsync、Dropbox、ownCloud,你想到的都试过。但这些似乎对我都不够好。 +设置新机器很麻烦。我们都有在机器之间复制的“标准设置”。多年来,我使用了很多方法来使它们在计算机之间同步。在过去(这会告诉你我年纪有多大了),曾经是软盘、然后是 Zip 磁盘、U 盘、SCP、Rsync、Dropbox、ownCloud,你想到的都试过。但这些似乎对我都不够好。 然后我偶然发现了 [Syncthing][2]。 @@ -28,19 +30,19 @@ Syncthing 可在 Linux、MacOS、Windows 和多种 BSD 中使用。还有一个 ![Installing Syncthing on Ubuntu][4] -首次启动 Syncthing 时,它将启动 Web 浏览器以配置守护程序。第一台计算机上没有太多要做,但是这是一个很好的机会来介绍一下用户界面 (UI)。最重要的是在右上方的 **Actions** 菜单下的 “System ID”。 +首次启动 Syncthing 时,它将启动 Web 浏览器以配置守护程序。第一台计算机上没有太多要做,但是这是一个很好的机会来介绍一下用户界面 (UI)。最重要的是在右上方的 “Actions” 菜单下的 “System ID”。 ![Machine ID][5] -设置第一台计算机后,请在第二台计算机上重复安装。在 UI 中,右下方将显示一个按钮,名为 **Add Remote Device**。单击按钮,你将会看到一个要求输入**设备 ID 和设备名**的框。从第一台计算机上复制并粘贴**设备 ID**,然后单击 **Save**。 +设置第一台计算机后,请在第二台计算机上重复安装。在 UI 中,右下方将显示一个按钮,名为 “Add Remote Device”。单击该按钮,你将会看到一个要求输入 “Device ID and a Name” 的框。从第一台计算机上复制并粘贴 “Device ID”,然后单击 “Save”。 -你应该会在第一台上看到一个请求添加第二台的弹出窗口。接受后,新机器将显示在第一台机器的右下角。与第二台计算机共享默认目录。单击 **Default Folder**,然后单击 **Edit** 按钮。弹出窗口的顶部有四个链接。单击 **Sharing**,然后选择第二台计算机。单击 **Save**,然后查看第二台计算机。你会看到一个接受共享目录的提示。接受后,它将开始在两台计算机之间同步文件。 +你应该会在第一台上看到一个请求添加第二台的弹出窗口。接受后,新机器将显示在第一台机器的右下角。与第二台计算机共享默认目录。单击 “Default Folder”,然后单击 “Edit” 按钮。弹出窗口的顶部有四个链接。单击 “Sharing”,然后选择第二台计算机。单击 “Save”,然后查看第二台计算机。你会看到一个接受共享目录的提示。接受后,它将开始在两台计算机之间同步文件。 ![Sharing a directory in Syncthing][6] -测试从一台计算机上复制文件到默认目录(**/your/home/Share**)。它应该很快会在另一台上出现。 +测试从一台计算机上复制文件到默认目录(“/你的家目录/Share”)。它应该很快会在另一台上出现。 -你可以根据需要添加任意数量的目录,这非常方便。如你在第一张图中所看到的,我有一个用于保存配置的 **myconfigs** 文件夹。当我买了一台新机器时,我只需安装 Syncthing,如果我在一台机器上调整了配置,我不必更新所有,它会自动更新。 +你可以根据需要添加任意数量的目录,这非常方便。如你在第一张图中所看到的,我有一个用于保存配置的 `myconfigs` 文件夹。当我买了一台新机器时,我只需安装 Syncthing,如果我在一台机器上调整了配置,我不必更新所有,它会自动更新。 -------------------------------------------------------------------------------- @@ -49,7 +51,7 @@ via: https://opensource.com/article/20/1/sync-files-syncthing 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ef8e0ebf7a2b749fd3e47ef75bc1b5d4bb5e1be5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 12:36:06 +0800 Subject: [PATCH 605/676] PUB @geekpi https://linux.cn/article-11793-1.html --- ...00111 Sync files across multiple devices with Syncthing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200111 Sync files across multiple devices with Syncthing.md (98%) diff --git a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md b/published/20200111 Sync files across multiple devices with Syncthing.md similarity index 98% rename from translated/tech/20200111 Sync files across multiple devices with Syncthing.md rename to published/20200111 Sync files across multiple devices with Syncthing.md index 2243ad50cd..65959e3d59 100644 --- a/translated/tech/20200111 Sync files across multiple devices with Syncthing.md +++ b/published/20200111 Sync files across multiple devices with Syncthing.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11793-1.html) [#]: subject: (Sync files across multiple devices with Syncthing) [#]: via: (https://opensource.com/article/20/1/sync-files-syncthing) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From 446be1c237a9e0e5ea44f880ad023d0e635c4fb9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 18 Jan 2020 12:36:58 +0800 Subject: [PATCH 606/676] Rename sources/tech/20200116 4 core skills to level-up your tech career in 2020.md to sources/talk/20200116 4 core skills to level-up your tech career in 2020.md --- ...20200116 4 core skills to level-up your tech career in 2020.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200116 4 core skills to level-up your tech career in 2020.md (100%) diff --git a/sources/tech/20200116 4 core skills to level-up your tech career in 2020.md b/sources/talk/20200116 4 core skills to level-up your tech career in 2020.md similarity index 100% rename from sources/tech/20200116 4 core skills to level-up your tech career in 2020.md rename to sources/talk/20200116 4 core skills to level-up your tech career in 2020.md From 3e3dad7524c140fa74a7f572b71412701cc35b9e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 18 Jan 2020 12:38:46 +0800 Subject: [PATCH 607/676] Rename sources/talk/20200116 It-s the end for Windows Server 2008 support.md to sources/news/20200116 It-s the end for Windows Server 2008 support.md --- .../20200116 It-s the end for Windows Server 2008 support.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => news}/20200116 It-s the end for Windows Server 2008 support.md (100%) diff --git a/sources/talk/20200116 It-s the end for Windows Server 2008 support.md b/sources/news/20200116 It-s the end for Windows Server 2008 support.md similarity index 100% rename from sources/talk/20200116 It-s the end for Windows Server 2008 support.md rename to sources/news/20200116 It-s the end for Windows Server 2008 support.md From 15d6a8a8ad27a9019abeccbb61c433435576f1c4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 18 Jan 2020 13:00:32 +0800 Subject: [PATCH 608/676] Rename sources/tech/20200117 Fedora CoreOS out of preview.md to sources/news/20200117 Fedora CoreOS out of preview.md --- sources/{tech => news}/20200117 Fedora CoreOS out of preview.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200117 Fedora CoreOS out of preview.md (100%) diff --git a/sources/tech/20200117 Fedora CoreOS out of preview.md b/sources/news/20200117 Fedora CoreOS out of preview.md similarity index 100% rename from sources/tech/20200117 Fedora CoreOS out of preview.md rename to sources/news/20200117 Fedora CoreOS out of preview.md From bd087a133ae0d631f277f5074940ce5fc4e0f2a5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 13:21:23 +0800 Subject: [PATCH 609/676] PRF @wxy --- .../tech/20190406 Run a server with Git.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/translated/tech/20190406 Run a server with Git.md b/translated/tech/20190406 Run a server with Git.md index c52295591e..6757473b58 100644 --- a/translated/tech/20190406 Run a server with Git.md +++ b/translated/tech/20190406 Run a server with Git.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Run a server with Git) @@ -10,37 +10,37 @@ 使用 Git 来管理 Git 服务器 ====== -> 借助 Gitolite,你可以使用 Git 来管理 Git 服务器。在我们的系列中了解这些鲜为人知的 Git 用途。 +> 借助 Gitolite,你可以使用 Git 来管理 Git 服务器。在我们的系列文章中了解这些鲜为人知的 Git 用途。 -![computer servers processing data][1] +![](https://img.linux.net.cn/data/attachment/album/202001/18/132045yrr1pb9n497tfbiy.png) -正如我在系列文章中演示的那样,[Git][2] 除了跟踪源代码外,还可以做很多事情。信不信由你,Git 甚至可以管理你的 Git 服务器,因此你可以或多或少地使用 Git 本身运行 Git 服务器。 +正如我在系列文章中演示的那样,[Git][2] 除了跟踪源代码外,还可以做很多事情。信不信由你,Git 甚至可以管理你的 Git 服务器,因此你可以或多或少地使用 Git 本身来运行 Git 服务器。 -当然,这涉及除日常使用 Git 之外的许多组件,其中最重要的是 [Gitolite][3],该后端应用程序可以管理你使用 Git 的每个细小的配置。Gitolite 的优点在于,由于它使用 Git 作为其前端接口,因此很容易将 Git 服务器管理集成到其他基于 Git 的工作流中。Gitolite 可以精确控制谁可以访问你服务器上的特定存储库以及他们具有哪些权限。你可以使用常规的 Linux 系统工具自行管理此类事务,但是如果在六个用户中只有一个或两个以上的仓库,则需要大量的工作。 +当然,这涉及除日常使用 Git 之外的许多组件,其中最重要的是 [Gitolite][3],该后端应用程序可以管理你使用 Git 的每个细微的配置。Gitolite 的优点在于,由于它使用 Git 作为其前端接口,因此很容易将 Git 服务器管理集成到其他基于 Git 的工作流中。Gitolite 可以精确控制谁可以访问你服务器上的特定存储库以及他们具有哪些权限。你可以使用常规的 Linux 系统工具自行管理此类事务,但是如果有好几个用户和不止一两个仓库,则需要大量的工作。 Gitolite 的开发人员做了艰苦的工作,使你可以轻松地为许多用户提供对你的 Git 服务器的访问权,而又不让他们访问你的整个环境 —— 而这一切,你可以使用 Git 来完成全部工作。 -Gitolite 并`不是` 图形化的管理员和用户面板。优秀的 [Gitea][4] 项目可提供这种经验,但是本文重点介绍 Gitolite 的简单优雅和令人舒适的熟悉感。 +Gitolite 并**不是**图形化的管理员和用户面板。优秀的 [Gitea][4] 项目可提供这种体验,但是本文重点介绍 Gitolite 的简单优雅和令人舒适的熟悉感。 ### 安装 Gitolite -假设你的 Git 服务器运行 Linux,则可以使用包管理器安装 Gitolite(在 CentOS 和 RHEL 上为 `yum`,在 Debian 和 Ubuntu 上为 `apt`,在 OpenSUSE 上为 `zypper` 等)。例如,在 RHEL 上: +假设你的 Git 服务器运行在 Linux 上,则可以使用包管理器安装 Gitolite(在 CentOS 和 RHEL 上为 `yum`,在 Debian 和 Ubuntu 上为 `apt`,在 OpenSUSE 上为 `zypper` 等)。例如,在 RHEL 上: ``` $ sudo yum install gitolite3 ``` -许多发行版的存储库仍提供的是旧版本的 Gitolite,但当前版本为版本 3。 +许多发行版的存储库提供的仍是旧版本的 Gitolite,但最新版本为版本 3。 你必须具有对服务器的无密码 SSH 访问权限。如果愿意,你可以使用密码登录服务器,但是 Gitolite 依赖于 SSH 密钥,因此必须配置使用密钥登录的选项。如果你不知道如何配置服务器以进行无密码 SSH 访问,请首先学习如何进行操作(Steve Ovens 的 Ansible 文章的[设置 SSH 密钥身份验证][5]部分对此进行了很好的说明)。这是加强服务器管理的安全以及运行 Gitolite 的重要组成部分。 ### 配置 Git 用户 -如果没有 Gitolite,则如果某人请求访问你在服务器上托管的 Git 存储库,则必须向该人提供用户帐户。Git 提供了一个特殊的外壳,即 `git-shell`,这是一个仅执行 Git 任务的特别特定的 shell。这可以让你有个只能通过非常受限的 Shell 环境的过滤器来访问服务器的用户。 +如果没有 Gitolite,则如果某人请求访问你在服务器上托管的 Git 存储库时,则必须向该人提供用户帐户。Git 提供了一个特殊的外壳,即 `git-shell`,这是一个仅执行 Git 任务的特别的特定 shell。这可以让你有个只能通过非常受限的 Shell 环境来过滤访问你的服务器的用户。 -该解决方案可行,但通常意味着用户可以访问服务器上的所有存储库,除非你具有用于组权限的良好模式,并在创建新存储库时严格保持这些权限。这种方式还需要在系统级别进行大量手动配置,这通常是为特定级别的系统管理员保留的区域,而不一定是通常负责 Git 存储库的人员。 +这个解决方案是一个办法,但通常意味着用户可以访问服务器上的所有存储库,除非你具有用于组权限的良好模式,并在创建新存储库时严格遵循这些权限。这种方式还需要在系统级别进行大量手动配置,这通常是只有特定级别的系统管理员才能做的工作,而不一定是通常负责 Git 存储库的人员。 -Gitolite 通过为需要访问任何存储库的每个人指定一个用户名来完全回避此问题。 默认情况下,用户名是 `git`,并且由于 Gitolite 的文档假定使用的是它,因此在学习该工具时保留它是一个很好的默认设置。对于曾经使用过 GitLab 或 GitHub 或任何其他 Git 托管服务的人来说,这也是一个众所周知的约定。 +Gitolite 通过为需要访问任何存储库的每个人指定一个用户名来完全回避此问题。默认情况下,该用户名是 `git`,并且由于 Gitolite 的文档中假定使用的是它,因此在学习该工具时保留它是一个很好的默认设置。对于曾经使用过 GitLab 或 GitHub 或任何其他 Git 托管服务的人来说,这也是一个众所周知的约定。 Gitolite 将此用户称为**托管用户**。在服务器上创建一个帐户以充当托管用户(我习惯使用 `git`,因为这是惯例): @@ -48,7 +48,7 @@ Gitolite 将此用户称为**托管用户**。在服务器上创建一个帐户 $ sudo adduser --create-home git ``` -为了控制该 `git` 用户帐户,该帐户必须具有属于你的有效 SSH 公钥。你应该已经进行了设置,因此复制你的公钥(**不是你的私钥**)添加到 `git` 用户的家目录中: +为了控制该 `git` 用户帐户,该帐户必须具有属于你的有效 SSH 公钥。你应该已经进行了设置,因此复制你的公钥(**而不是你的私钥**)添加到 `git` 用户的家目录中: ``` $ sudo cp ~/.ssh/id_ed25519.pub /home/git/ @@ -62,11 +62,11 @@ $ sudo su - git $ gitolite setup --pubkey id_ed25519.pub ``` -安装脚本运行后,`git` 的家用户目录将有一个 `repository` 目录,该目录(目前)包含文件 `git-admin.git` 和 `testing.git`。这就是该服务器所需的全部设置,现在请登出 `git` 用户。 +安装脚本运行后,`git` 的家用户目录将有一个 `repository` 目录,该目录(目前)包含存储库 `git-admin.git` 和 `testing.git`。这就是该服务器所需的全部设置,现在请登出 `git` 用户。 ### 使用 Gitolite -管理 Gitolite 就是编辑 Git 存储库中的文本文件,尤其是 `gitolite-admin.git`。你不会通过 SSH 进入服务器来进行 Git 管理,并且 Gitolite 也建议你不要这样尝试。你和你的用户存储在 Gitolite 服务器上的存储库是个**裸**存储库,因此最好不要使用它们。 +管理 Gitolite 就是编辑 Git 存储库中的文本文件,尤其是 `gitolite-admin.git` 中的。你不会通过 SSH 进入服务器来进行 Git 管理,并且 Gitolite 也建议你不要这样尝试。在 Gitolite 服务器上存储你和你的用户的存储库是个**裸**存储库,因此最好不要使用它们。 ``` $ git clone git@example.com:gitolite-admin.git gitolite-admin.git @@ -76,7 +76,7 @@ conf keydir ``` -该存储库中的 `conf` 目录包含一个名为 `gitolite.conf` 的文件。在文本编辑器中打开它,或使用`cat`查看其内容: +该存储库中的 `conf` 目录包含一个名为 `gitolite.conf` 的文件。在文本编辑器中打开它,或使用 `cat` 查看其内容: ``` repo gitolite-admin @@ -86,15 +86,15 @@ repo testing RW+ = @all ``` -你可能对该配置文件的功能有所了解:`gitolite-admin` 代表此存储库,并且 `id_ed25519` 密钥的所有者具有读取、写入和 Git 管理权限。换句话说,不是将用户映射到普通的本地 Unix 用户(因为所有用户都使用 `git` 用户托管用户身份),而是将用户映射到 `keydir` 目录中列出的 SSH 密钥。 +你可能对该配置文件的功能有所了解:`gitolite-admin` 代表此存储库,并且 `id_ed25519` 密钥的所有者具有读取、写入和管理 Git 的权限。换句话说,不是将用户映射到普通的本地 Unix 用户(因为所有用户都使用 `git` 用户托管用户身份),而是将用户映射到 `keydir` 目录中列出的 SSH 密钥。 `testing.git` 存储库使用特殊组符号为访问服务器的每个人提供了全部权限。 #### 添加用户 -如果要向 Git 服务器添加一个名为 `alice` 的用户,Alice 必须向你发送她的 SSH 公钥。Gitolite 使用 `.pub` 扩展名左边的任何内容作为该 Git 用户的标识符。不要使用默认的密钥名称值,而是给密钥指定一个指示密钥所有者的名称。如果用户有多个密钥(例如,一个用于笔记本电脑,一个用于台式机),则可以使用子目录来避免文件名冲突。例如,Alice 在笔记本电脑上使用的密钥可能是默认的 `id_rsa.pub`,因此将其重命名为`alice.pub` 或类似名称(或让用户根据其计算机上的本地用户帐户来命名密钥),然后将其放入 `gitolite-admin.git/keydir/work/laptop/` 目录中。如果她从她的桌面发送了另一个密钥,命名为 `alice.pub`(与上一个相同),然后将其添加到 `keydir/home/desktop/` 中。另一个密钥可能放到 `keydir/home/desktop/` 中,依此类推。Gitolite 递归地在 `keydir` 中搜索与存储库“用户”匹配的 `.pub` 文件,并将所有匹配项视为相同的身份。 +如果要向 Git 服务器添加一个名为 `alice` 的用户,Alice 必须向你发送她的 SSH 公钥。Gitolite 使用文件名的 `.pub` 扩展名左边的任何内容作为该 Git 用户的标识符。不要使用默认的密钥名称值,而是给密钥指定一个指示密钥所有者的名称。如果用户有多个密钥(例如,一个用于笔记本电脑,一个用于台式机),则可以使用子目录来避免文件名冲突。例如,Alice 在笔记本电脑上使用的密钥可能是默认的 `id_rsa.pub`,因此将其重命名为`alice.pub` 或类似名称(或让用户根据其计算机上的本地用户帐户来命名密钥),然后将其放入 `gitolite-admin.git/keydir/work/laptop/` 目录中。如果她从她的桌面计算机发送了另一个密钥,命名为 `alice.pub`(与上一个相同),然后将其添加到 `keydir/home/desktop/` 中。另一个密钥可能放到 `keydir/home/desktop/` 中,依此类推。Gitolite 递归地在 `keydir` 中搜索与存储库“用户”相匹配的 `.pub` 文件,并将所有匹配项视为相同的身份。 -当你将密钥添加到 `keydir` 目录时,必须将它们提交回服务器。这是一件很容易忘记的事情,这里有一个使用自动化的 Git 应用程序(例如 [Sparkleshare] [7])的真正的理由,因此任何更改都将立即提交给你的 Gitolite 管理员。第一次忘记提交和推送,在浪费了三个小时的时间以及用户的故障排除时间之后,你会发现 Gitolite 是使用 Sparkleshare 的完美理由。 +当你将密钥添加到 `keydir` 目录时,必须将它们提交回服务器。这是一件很容易忘记的事情,这里有一个使用自动化的 Git 应用程序(例如 [Sparkleshare][7])的真正的理由,因此任何更改都将立即提交给你的 Gitolite 管理员。第一次忘记提交和推送,在浪费了三个小时的你和你的用户的故障排除时间之后,你会发现 Gitolite 是使用 Sparkleshare 的完美理由。 ``` $ git add keydir @@ -106,10 +106,10 @@ $ git push origin HEAD #### 设置权限 -与用户一样,目录权限和组也是从你可能习惯的的常规 Unix 工具中抽象出来的(或可从在线信息查找)。在`gitolite-admin.git/conf` 目录中的 `gitolite.conf` 文件中授予对项目的权限。权限分为四个级别: +与用户一样,目录权限和组也是从你可能习惯的的常规 Unix 工具中抽象出来的(或可从在线信息查找)。在 `gitolite-admin.git/conf` 目录中的 `gitolite.conf` 文件中授予对项目的权限。权限分为四个级别: * `R` 允许只读。在存储库上具有 `R` 权限的用户可以克隆它,仅此而已。 -* `RW` 允许用户执行分支的快进推送、创建新分支和创建新标签。对于大多数用户来说,这个或多或少感觉就像一个“普通”的 Git 存储库。 +* `RW` 允许用户执行分支的快进推送、创建新分支和创建新标签。对于大多数用户来说,这个基本上就像是一个“普通”的 Git 存储库。 * `RW+` 允许可能具有破坏性的 Git 动作。用户可以执行常规的快进推送、回滚推送、变基以及删除分支和标签。你可能想要或不希望将其授予项目中的所有贡献者。 * `-` 明确拒绝访问存储库。这与未在存储库的配置中列出的用户相同。 @@ -126,7 +126,7 @@ repo widgets RW+ = alice ``` -现在,Alice(也仅 Alice 一个人)就可以克隆该存储库: +现在,Alice(也仅有 Alice 一个人)可以克隆该存储库: ``` [alice]$ git clone git@example.com:widgets.git @@ -188,7 +188,7 @@ repo foo/CREATOR/[a-z]..* R = READERS ``` -第一行定义了一组用户:该组称为 `@managers`,其中包含用户 `alice` 和 `bob`。下一行设置了通配符允许创建尚不存在的存储库,放在名为 `foo` 的目录下的创建存储库的用户名的子目录中。例如: +第一行定义了一组用户:该组称为 `@managers`,其中包含用户 `alice` 和 `bob`。下一行设置了通配符允许创建尚不存在的存储库,放在名为 `foo` 的目录下的创建该存储库的用户名的子目录中。例如: ``` [alice]$ git clone git@example.com:foo/alice/cool-app.git @@ -197,11 +197,11 @@ Initialized empty Git repository in /home/git/repositories/foo/alice/cool-app.gi warning: You appear to have cloned an empty repository. ``` -野生仓库的创建者可以使用一些机制来定义谁可以读取和写入其存储库,但是他们是被限定范围的。在大多数情况下,Gitolite 假定由一组特定的用户来管理项目权限。一种解决方案是使用 Git 挂钩授予所有用户对 `gitolite-admin` 的访问权限,以要求管理者批准将更改合并到 master 分支中。 +野生仓库的创建者可以使用一些机制来定义谁可以读取和写入其存储库,但是他们是有范围限定的。在大多数情况下,Gitolite 假定由一组特定的用户来管理项目权限。一种解决方案是使用 Git 挂钩来授予所有用户对 `gitolite-admin` 的访问权限,以要求管理者批准将更改合并到 master 分支中。 ### 了解更多 -Gitolite 具有比此介绍性文章涵盖的更多功能,因此请尝试一下。其[文档][8]非常出色,一旦你通读了它,就可以自定义 Gitolite 服务器,以向用户提供你喜欢的任何级别的控制。Gitolite 是一种维护成本低、简单的系统,你可以安装、设置它,然后基本上就可以将其忘却。 +Gitolite 具有比此介绍性文章所涵盖的更多功能,因此请尝试一下。其[文档][8]非常出色,一旦你通读了它,就可以自定义 Gitolite 服务器,以向用户提供你喜欢的任何级别的控制。Gitolite 是一种维护成本低、简单的系统,你可以安装、设置它,然后基本上就可以将其忘却。 -------------------------------------------------------------------------------- @@ -210,7 +210,7 @@ via: https://opensource.com/article/19/4/server-administration-git 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a6df20006ffebc44cc5259d41b245508297ec6e3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 13:22:03 +0800 Subject: [PATCH 610/676] PUB @wxy https://linux.cn/article-11795-1.html --- .../tech => published}/20190406 Run a server with Git.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190406 Run a server with Git.md (99%) diff --git a/translated/tech/20190406 Run a server with Git.md b/published/20190406 Run a server with Git.md similarity index 99% rename from translated/tech/20190406 Run a server with Git.md rename to published/20190406 Run a server with Git.md index 6757473b58..ee4497eb51 100644 --- a/translated/tech/20190406 Run a server with Git.md +++ b/published/20190406 Run a server with Git.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11795-1.html) [#]: subject: (Run a server with Git) [#]: via: (https://opensource.com/article/19/4/server-administration-git) [#]: author: (Seth Kenlon https://opensource.com/users/seth/users/seth) From e398777b8a662598fb7ebca0fbd17ea7f44704d4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 14:13:54 +0800 Subject: [PATCH 611/676] PRF @geekpi --- ...uration management of multiple machines.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md b/translated/tech/20200112 Use Stow for configuration management of multiple machines.md index 1a31d9728a..b5f2787038 100644 --- a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md +++ b/translated/tech/20200112 Use Stow for configuration management of multiple machines.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use Stow for configuration management of multiple machines) @@ -9,30 +9,31 @@ 使用 Stow 管理多台机器配置 ====== -2020 年,在我们的 20 个使用开源提升生产力的系列文章中,让我们了解如何使用 Stow 跨机器管理配置。 -![A person programming][1] +> 2020 年,在我们的 20 个使用开源提升生产力的系列文章中,让我们了解如何使用 Stow 跨机器管理配置。 + +![](https://img.linux.net.cn/data/attachment/album/202001/18/141330jdcjalqzjal84a03.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 Stow 管理符号链接 -昨天,我解释了如何使用 [Syncthing][2] 在多台计算机上保持文件同步。但是,这只是我用来保持配置一致性的工具之一。还有另一个简单的工具 [Stow][3]。 +昨天,我解释了如何使用 [Syncthing][2] 在多台计算机上保持文件同步。但是,这只是我用来保持配置一致性的工具之一。还有另一个表面上看起来更简单的工具:[Stow][3]。 ![Stow help screen][4] Stow 管理符号链接。默认情况下,它会链接目录到上一级目录。还有设置源和目标目录的选项,但我通常不使用它们。 -正如我在 Syncthing 的[文章][5] 中提到的,我使用 Syncthing 来保持 **myconfigs** 目录在我所有的计算机上一致。**myconfigs** 目录下面有多个子目录。每个子目录包含我经常使用的应用之一的配置文件。 +正如我在 Syncthing 的[文章][5] 中提到的,我使用 Syncthing 来保持 `myconfigs` 目录在我所有的计算机上一致。`myconfigs` 目录下面有多个子目录。每个子目录包含我经常使用的应用之一的配置文件。 ![myconfigs directory][6] -在每台计算机上,我进入 **myconfigs** 目录,并运行 **stow -S <目录名称>** 以将目录中的文件符号链接到我的家目录。例如,在**vim** 目录下,我有 **.vimrc** 和 **.vim** 目录。在每台机器上,我运行 **stow -S vim** 来创建符号链接 **~/.vimrc** 和 **~/.vim**。当我在一台计算机上更改 Vim 配置时,它会应用到我的所有机器上。 +在每台计算机上,我进入 `myconfigs` 目录,并运行 `stow -S <目录名称>` 以将目录中的文件符号链接到我的家目录。例如,在 `vim` 目录下,我有 `.vimrc` 和 `.vim` 目录。在每台机器上,我运行 `stow -S vim` 来创建符号链接 `~/.vimrc` 和 `~/.vim`。当我在一台计算机上更改 Vim 配置时,它会应用到我的所有机器上。 -然而,有时候,我需要一些特定于机器的配置,这就是为什么我有如 **msmtp-personal** 和 **msmtp-elastic**(我的雇主)这样的目录。由于我的 **msmtp** SMTP 客户端需要知道要中继的电子邮件服务器,并且每个服务器都有不同的设置和凭据,我会使用 **-D** 标志来取消链接,接着链接另外一个。 +然而,有时候,我需要一些特定于机器的配置,这就是为什么我有如 `msmtp-personal` 和 `msmtp-elastic`(我的雇主)这样的目录。由于我的 `msmtp` SMTP 客户端需要知道要中继电子邮件服务器,并且每个服务器都有不同的设置和凭据,我会使用 `-D` 标志来取消链接,接着链接另外一个。 ![Unstow one, stow the other][7] -有时我要给配置添加文件。为此,有一个 **-R** 选项来”重新链接“。例如,我喜欢在图形化 Vim 中使用一种与控制台不同的特定字体。除了标准 **.vimrc** 文件,**.gvimrc** 文件能让我设置特定于图形化版本的选项。当我第一次设置它时,我移动 **~/.gvimrc** 到 **~/myconfigs/vim** 中,然后运行 **stow -R vim**,它取消链接并重新链接该目录中的所有内容。 +有时我要给配置添加文件。为此,有一个 `-R` 选项来“重新链接”。例如,我喜欢在图形化 Vim 中使用一种与控制台不同的特定字体。除了标准 `.vimrc` 文件,`.gvimrc` 文件能让我设置特定于图形化版本的选项。当我第一次设置它时,我移动 `~/.gvimrc` 到 `~/myconfigs/vim` 中,然后运行 `stow -R vim`,它取消链接并重新链接该目录中的所有内容。 Stow 让我使用一个简单的命令行在多种配置之间切换,并且,结合 Syncthing,我可以确保无论我身在何处或在哪里进行更改,我都有我喜欢的工具的设置。 @@ -43,7 +44,7 @@ via: https://opensource.com/article/20/1/configuration-management-stow 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -53,6 +54,6 @@ via: https://opensource.com/article/20/1/configuration-management-stow [2]: https://syncthing.net/ [3]: https://www.gnu.org/software/stow/ [4]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png (Stow help screen) -[5]: https://opensource.com/article/20/1/20-productivity-tools-syncthing +[5]: https://linux.cn/article-11793-1.html [6]: https://opensource.com/sites/default/files/uploads/productivity_2-2.png (myconfigs directory) [7]: https://opensource.com/sites/default/files/uploads/productivity_2-3.png (Unstow one, stow the other) From cb49ce7ca75d28e0d1dd0b1b05d285bef9b2be41 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 14:15:01 +0800 Subject: [PATCH 612/676] PUB @geekpi https://linux.cn/article-11796-1.html --- ... Stow for configuration management of multiple machines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200112 Use Stow for configuration management of multiple machines.md (98%) diff --git a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md b/published/20200112 Use Stow for configuration management of multiple machines.md similarity index 98% rename from translated/tech/20200112 Use Stow for configuration management of multiple machines.md rename to published/20200112 Use Stow for configuration management of multiple machines.md index b5f2787038..cf673d3e6b 100644 --- a/translated/tech/20200112 Use Stow for configuration management of multiple machines.md +++ b/published/20200112 Use Stow for configuration management of multiple machines.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11796-1.html) [#]: subject: (Use Stow for configuration management of multiple machines) [#]: via: (https://opensource.com/article/20/1/configuration-management-stow) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From 4ef0a6f655251fe0cb483c119544ce53e8e21154 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 21:34:11 +0800 Subject: [PATCH 613/676] APL --- sources/tech/20200115 6 handy Bash scripts for Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200115 6 handy Bash scripts for Git.md b/sources/tech/20200115 6 handy Bash scripts for Git.md index 03464a840b..2e6754c875 100644 --- a/sources/tech/20200115 6 handy Bash scripts for Git.md +++ b/sources/tech/20200115 6 handy Bash scripts for Git.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8263ccb879a268addb36401e1be9fe6d4c52266c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 21:58:30 +0800 Subject: [PATCH 614/676] TSL --- .../20200115 6 handy Bash scripts for Git.md | 524 ------------------ .../20200115 6 handy Bash scripts for Git.md | 510 +++++++++++++++++ 2 files changed, 510 insertions(+), 524 deletions(-) delete mode 100644 sources/tech/20200115 6 handy Bash scripts for Git.md create mode 100644 translated/tech/20200115 6 handy Bash scripts for Git.md diff --git a/sources/tech/20200115 6 handy Bash scripts for Git.md b/sources/tech/20200115 6 handy Bash scripts for Git.md deleted file mode 100644 index 2e6754c875..0000000000 --- a/sources/tech/20200115 6 handy Bash scripts for Git.md +++ /dev/null @@ -1,524 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 handy Bash scripts for Git) -[#]: via: (https://opensource.com/article/20/1/bash-scripts-git) -[#]: author: (Bob Peterson https://opensource.com/users/bobpeterson) - -6 handy Bash scripts for Git -====== -These six Bash scripts will make your life easier when you're working -with Git repositories. -![Digital hand surrounding by objects, bike, light bulb, graphs][1] - -I wrote a bunch of Bash scripts that make my life easier when I'm working with Git repositories. Many of my colleagues say there's no need; that everything I need to do can be done with Git commands. While that may be true, I find the scripts infinitely more convenient than trying to figure out the appropriate Git command to do what I want. - -### 1\. gitlog - -**gitlog** prints an abbreviated list of current patches against the master version. It prints them from oldest to newest and shows the author and description, with **H** for **HEAD**, **^** for **HEAD^**, **2** for **HEAD~2,** and so forth. For example: - - -``` -$ gitlog -\-----------------------[ recovery25 ]----------------------- -(snip) -11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors -10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode - 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops - 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite - 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing - 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency - 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite - 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite - 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation - 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops - ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq - H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time -``` - -If I want to see what patches are on a different branch, I can specify an alternate branch: - - -``` -`$ gitlog recovery24` -``` - -### 2\. gitlog.id - -**gitlog.id** just prints the patch SHA1 IDs: - - -``` -$ gitlog.id -\-----------------------[ recovery25 ]----------------------- -56908eeb6940 2ca4a6b628a1 fc64ad5d99fe 02031a00a251 f6f38da7dd18 d8546e8f0023 fc3cc1f98f6b 12c3e0cb3523 76cce178b134 6fc1dce3ab9c 1b681ab074ca 26fed8de719b 802ff51a5670 49f67a512d8c f04f20193bbb 5f6afe809d23 2030521dc70e dada79b3be94 9b19a1e08161 78a035041d3e f03da011cae2 0d2b2e068fcd 2449976aa133 57dfb5e12ccd 53abedfdcf72 6fbdda3474b3 49544a547188 187032f7a63c 6f75dae23d93 95fc2a261b00 ebfb14ded191 f653ee9e414a 0e2911cb8111 73968b76e2e3 8a3e4cb5e92c a5f2da803b5b 7c9ef68388ed 71ca19d0cba8 340d27a33895 9b3c4e6efb10 d2e8c22be39b 9563e31f8bfd ebac7a38036c f703a3c27874 a3e86d2ef30e da3c604755b0 4525c2f5b46f a06a5b7dea02 8ba93c796d5c e8b5ff851bb9 -``` - -Again, it assumes the current branch, but I can specify a different branch if I want. - -### 3\. gitlog.id2 - -**gitlog.id2** is the same as **gitlog.id** but without the branch line at the top. This is handy for cherry-picking all patches from one branch to the current branch: - - -``` -$ # create a new branch -$ git branch --track origin/master -$ # check out the new branch I just created -$ git checkout recovery26 -$ # cherry-pick all patches from the old branch to the new one -$ for i in `gitlog.id2 recovery25` ; do git cherry-pick $i ;done -``` - -### 4\. gitlog.grep - -**gitlog.grep** greps for a string within that collection of patches. For example, if I find a bug and want to fix the patch that has a reference to function **inode_go_sync**, I simply do: - - -``` -$ gitlog.grep inode_go_sync -\-----------------------[ recovery25 - 50 patches ]----------------------- -(snip) -11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors -10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode - 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops -152:-static void inode_go_sync(struct gfs2_glock *gl) -153:+static int inode_go_sync(struct gfs2_glock *gl) -163:@@ -296,6 +302,7 @@ static void inode_go_sync(struct gfs2_glock *gl) - 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite - 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing - 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency - 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite - 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite - 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation - 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops - ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq - H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time -``` - -So, now I know that patch **HEAD~9** is the one that needs fixing. I use **git rebase -i HEAD~10** to edit patch 9, **git commit -a --amend**, then **git rebase --continue** to make the necessary adjustments. - -### 5\. gitbranchcmp3 - -**gitbranchcmp3** lets me compare my current branch to another branch, so I can compare older versions of patches to my newer versions and quickly see what's changed and what hasn't. It generates a compare script (that uses the KDE tool [Kompare][2], which works on GNOME3, as well) to compare the patches that aren't quite the same. If there are no differences other than line numbers, it prints **[SAME]**. If there are only comment differences, it prints **[same]** (in lower case). For example: - - -``` -$ gitbranchcmp3 recovery24 -Branch recovery24 has 47 patches -Branch recovery25 has 50 patches - -(snip) -38 87eb6901607a 340d27a33895 [same] gfs2: drain the ail2 list after io errors -39 90fefb577a26 9b3c4e6efb10 [same] gfs2: clean up iopen glock mess in gfs2_create_inode -40 ba3ae06b8b0e d2e8c22be39b [same] gfs2: Do proper error checking for go_sync family of glops -41 2ab662294329 9563e31f8bfd [SAME] gfs2: use page_offset in gfs2_page_mkwrite -42 0adc6d817b7a ebac7a38036c [SAME] gfs2: don't use buffer_heads in gfs2_allocate_page_backing -43 55ef1f8d0be8 f703a3c27874 [SAME] gfs2: Improve mmap write vs. punch_hole consistency -44 de57c2f72570 a3e86d2ef30e [SAME] gfs2: Multi-block allocations in gfs2_page_mkwrite -45 7c5305fbd68a da3c604755b0 [SAME] gfs2: Fix end-of-file handling in gfs2_page_mkwrite -46 162524005151 4525c2f5b46f [SAME] Rafael Aquini's slab instrumentation -47              a06a5b7dea02 [    ] GFS2: Add go_get_holdtime to gl_ops -48              8ba93c796d5c [    ] gfs2: introduce new function remaining_hold_time and use it in dq -49              e8b5ff851bb9 [    ] gfs2: Allow rgrps to have a minimum hold time - -Missing from recovery25: -The missing: -Compare script generated at: /tmp/compare_mismatches.sh -``` - -### 6\. gitlog.find - -Finally, I have **gitlog.find**, a script to help me identify where the upstream versions of my patches are and each patch's current status. It does this by matching the patch description. It also generates a compare script (again, using Kompare) to compare the current patch to the upstream counterpart: - - -``` -$ gitlog.find -\-----------------------[ recovery25 - 50 patches ]----------------------- -(snip) -11 340d27a33895 Bob Peterson     gfs2: drain the ail2 list after io errors -lo 5bcb9be74b2a Bob Peterson     gfs2: drain the ail2 list after io errors -10 9b3c4e6efb10 Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode -fn 2c47c1be51fb Bob Peterson     gfs2: clean up iopen glock mess in gfs2_create_inode - 9 d2e8c22be39b Bob Peterson     gfs2: Do proper error checking for go_sync family of glops -lo feb7ea639472 Bob Peterson     gfs2: Do proper error checking for go_sync family of glops - 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite -ms f3915f83e84c Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite - 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing -ms 35af80aef99b Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing - 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency -fn 39c3a948ecf6 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency - 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite -fn f53056c43063 Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite - 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite -fn 184b4e60853d Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite - 3 4525c2f5b46f Bob Peterson     Rafael Aquini's slab instrumentation -   Not found upstream - 2 a06a5b7dea02 Bob Peterson     GFS2: Add go_get_holdtime to gl_ops -   Not found upstream - ^ 8ba93c796d5c Bob Peterson     gfs2: introduce new function remaining_hold_time and use it in dq -   Not found upstream - H e8b5ff851bb9 Bob Peterson     gfs2: Allow rgrps to have a minimum hold time -   Not found upstream -Compare script generated: /tmp/compare_upstream.sh -``` - -The patches are shown on two lines, the first of which is your current patch, followed by the corresponding upstream patch, and a 2-character abbreviation to indicate its upstream status: - - * **lo** means the patch is in the local upstream Git repo only (i.e., not pushed upstream yet). - * **ms** means the patch is in Linus Torvald's master branch. - * **fn** means the patch is pushed to my "for-next" development branch, intended for the next upstream merge window. - - - -Some of my scripts make assumptions based on how I normally work with Git. For example, when searching for upstream patches, it uses my well-known Git tree's location. So, you will need to adjust or improve them to suit your conditions. The **gitlog.find** script is designed to locate [GFS2][3] and [DLM][4] patches only, so unless you're a GFS2 developer, you will want to customize it to the components that interest you. - -### Source code - -Here is the source for these scripts. - -#### 1\. gitlog - - -``` -#!/bin/bash -branch=$1 - -if test "x$branch" = x; then -    branch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi - -patches=0 -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` -for i in $LIST; do patches=$(echo $patches + 1 | bc);done - -if [[ $branch =~ .*for-next.* ]] -then -    start=HEAD -#    start=origin/for-next -else -    start=origin/master -fi - -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -/usr/bin/echo "-----------------------[" $branch "]-----------------------" -patches=$(echo $patches - 1 | bc); -for i in $LIST; do -    if [ $patches -eq 1 ]; then -        cnt=" ^" -    elif [ $patches -eq 0 ]; then -        cnt=" H" -    else -        if [ $patches -lt 10 ]; then -            cnt=" $patches" -        else -            cnt="$patches" -        fi -    fi -    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s %n" $i -    patches=$(echo $patches - 1 | bc) -done -#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" $tracking..$branch -#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" ^origin/master ^linux-gfs2/for-next $branch -``` - -#### 2\. gitlog.id - - -``` -#!/bin/bash -branch=$1 - -if test "x$branch" = x; then -    branch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi - -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -/usr/bin/echo "-----------------------[" $branch "]-----------------------" -git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' -``` - -#### 3\. gitlog.id2 - - -``` -#!/bin/bash -branch=$1 - -if test "x$branch" = x; then -    branch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi - -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` -git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' -``` - -#### 4\. gitlog.grep - - -``` -#!/bin/bash -param1=$1 -param2=$2 - -if test "x$param2" = x; then -    branch=`git branch -a | grep "*" | cut -d ' ' -f2` -    string=$param1 -else -    branch=$param1 -    string=$param2 -fi - -patches=0 -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` -for i in $LIST; do patches=$(echo $patches + 1 | bc);done -/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" -patches=$(echo $patches - 1 | bc); -for i in $LIST; do -    if [ $patches -eq 1 ]; then -        cnt=" ^" -    elif [ $patches -eq 0 ]; then -        cnt=" H" -    else -        if [ $patches -lt 10 ]; then -            cnt=" $patches" -        else -            cnt="$patches" -        fi -    fi -    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i -    /usr/bin/git show --pretty=email --patch-with-stat $i | grep -n "$string" -    patches=$(echo $patches - 1 | bc) -done -``` - -#### 5\. gitbranchcmp3 - - -``` -#!/bin/bash -# -# gitbranchcmp3 <old branch> [<new_branch>] -# -oldbranch=$1 -newbranch=$2 -script=/tmp/compare_mismatches.sh - -/usr/bin/rm -f $script -echo "#!/bin/bash" > $script -/usr/bin/chmod 755 $script -echo "# Generated by gitbranchcmp3.sh" >> $script -echo "# Run this script to compare the mismatched patches" >> $script -echo " " >> $script -echo "function compare_them()" >> $script -echo "{"  >> $script -echo "    git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script -echo "    git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script -echo "    kompare /tmp/gronk1 /tmp/gronk2" >> $script -echo "}" >> $script -echo " " >> $script - -if test "x$newbranch" = x; then -    newbranch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi - -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -declare -a oldsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$oldbranch | cut -d ' ' -f1 |paste -s -d ' '`) -declare -a newsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$newbranch | cut -d ' ' -f1 |paste -s -d ' '`) - -#echo "old: " $oldsha1s -oldcount=${#oldsha1s[@]} -echo "Branch $oldbranch has $oldcount patches" -oldcount=$(echo $oldcount - 1 | bc) -#for o in `seq 0 ${#oldsha1s[@]}`; do -#    echo -n ${oldsha1s[$o]} " " -#    desc=`git show $i | head -5 | tail -1|cut -b5-` -#done - -#echo "new: " $newsha1s -newcount=${#newsha1s[@]} -echo "Branch $newbranch has $newcount patches" -newcount=$(echo $newcount - 1 | bc) -#for o in `seq 0 ${#newsha1s[@]}`; do -#    echo -n ${newsha1s[$o]} " " -#    desc=`git show $i | head -5 | tail -1|cut -b5-` -#done -echo - -for new in `seq 0 $newcount`; do -    newsha=${newsha1s[$new]} -    newdesc=`git show $newsha | head -5 | tail -1|cut -b5-` -    oldsha="            " -    same="[    ]" -    for old in `seq 0 $oldcount`; do -        if test "${oldsha1s[$old]}" = "match"; then -            continue; -        fi -        olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` -        if test "$olddesc" = "$newdesc" ; then -            oldsha=${oldsha1s[$old]} -            #echo $oldsha -            git show $oldsha |tail -n +2 |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk1 -            git show $newsha |tail -n +2 |grep -v "index.*\\.\\." |grep -v "@@"  > /tmp/gronk2 -            diff /tmp/gronk1 /tmp/gronk2 &> /dev/null -            if [ $? -eq 0 ] ;then -# No differences -                same="[SAME]" -                oldsha1s[$old]="match" -                break -            fi -            git show $oldsha |sed -n '/diff/,$p' |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk1 -            git show $newsha |sed -n '/diff/,$p' |grep -v "index.*\\.\\." |grep -v "@@" > /tmp/gronk2 -            diff /tmp/gronk1 /tmp/gronk2 &> /dev/null -            if [ $? -eq 0 ] ;then -# Differences in comments only -                same="[same]" -                oldsha1s[$old]="match" -                break -            fi -            oldsha1s[$old]="match" -            echo "compare_them $oldsha $newsha" >> $script -        fi -    done -    echo "$new $oldsha $newsha $same $newdesc" -done - -echo -echo "Missing from $newbranch:" -the_missing="" -# Now run through the olds we haven't matched up -for old in `seq 0 $oldcount`; do -    if test ${oldsha1s[$old]} != "match"; then -        olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` -        echo "${oldsha1s[$old]} $olddesc" -        the_missing=`echo "$the_missing ${oldsha1s[$old]}"` -    fi -done - -echo "The missing: " $the_missing -echo "Compare script generated at: $script" -#git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' -``` - -#### 6\. gitlog.find - - -``` -#!/bin/bash -# -# Find the upstream equivalent patch -# -# gitlog.find -# -cwd=$PWD -param1=$1 -ubranch=$2 -patches=0 -script=/tmp/compare_upstream.sh -echo "#!/bin/bash" > $script -/usr/bin/chmod 755 $script -echo "# Generated by gitbranchcmp3.sh" >> $script -echo "# Run this script to compare the mismatched patches" >> $script -echo " " >> $script -echo "function compare_them()" >> $script -echo "{"  >> $script -echo "    cwd=$PWD" >> $script -echo "    git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script -echo "    cd ~/linux.git/fs/gfs2" >> $script -echo "    git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script -echo "    cd $cwd" >> $script -echo "    kompare /tmp/gronk1 /tmp/gronk2" >> $script -echo "}" >> $script -echo " " >> $script - -#echo "Gathering upstream patch info. Please wait." -branch=`git branch -a | grep "*" | cut -d ' ' -f2` -tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` - -cd ~/linux.git -if test "X${ubranch}" = "X"; then -    ubranch=`git branch -a | grep "*" | cut -d ' ' -f2` -fi -utracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` -# -# gather a list of gfs2 patches from master just in case we can't find it -# -#git log --abbrev-commit --pretty=format:"   %h %<|(32)%an %s" master |grep -i -e "gfs2" -e "dlm" > /tmp/gronk -git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/gfs2/ > /tmp/gronk.gfs2 -# ms = in Linus's master -git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/dlm/ > /tmp/gronk.dlm - -cd $cwd -LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` -for i in $LIST; do patches=$(echo $patches + 1 | bc);done -/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" -patches=$(echo $patches - 1 | bc); -for i in $LIST; do -    if [ $patches -eq 1 ]; then -        cnt=" ^" -    elif [ $patches -eq 0 ]; then -        cnt=" H" -    else -        if [ $patches -lt 10 ]; then -            cnt=" $patches" -        else -            cnt="$patches" -        fi -    fi -    /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i -    desc=`/usr/bin/git show --abbrev-commit -s --pretty=format:"%s" $i` -    cd ~/linux.git -    cmp=1 -    up_eq=`git log --reverse --abbrev-commit --pretty=format:"lo %h %<|(32)%an %s" $utracking..$ubranch | grep "$desc"` -# lo = in local for-next -    if test "X$up_eq" = "X"; then -        up_eq=`git log --reverse --abbrev-commit --pretty=format:"fn %h %<|(32)%an %s" master..$utracking | grep "$desc"` -# fn = in for-next for next merge window -        if test "X$up_eq" = "X"; then -            up_eq=`grep "$desc" /tmp/gronk.gfs2` -            if test "X$up_eq" = "X"; then -                up_eq=`grep "$desc" /tmp/gronk.dlm` -                if test "X$up_eq" = "X"; then -                    up_eq="   Not found upstream" -                    cmp=0 -                fi -            fi -        fi -    fi -    echo "$up_eq" -    if [ $cmp -eq 1 ] ; then -        UP_SHA1=`echo $up_eq|cut -d' ' -f2` -        echo "compare_them $UP_SHA1 $i" >> $script -    fi -    cd $cwd -    patches=$(echo $patches - 1 | bc) -done -echo "Compare script generated: $script" -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/bash-scripts-git - -作者:[Bob Peterson][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bobpeterson -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) -[2]: https://kde.org/applications/development/org.kde.kompare -[3]: https://en.wikipedia.org/wiki/GFS2 -[4]: https://en.wikipedia.org/wiki/Distributed_lock_manager diff --git a/translated/tech/20200115 6 handy Bash scripts for Git.md b/translated/tech/20200115 6 handy Bash scripts for Git.md new file mode 100644 index 0000000000..93a0d97796 --- /dev/null +++ b/translated/tech/20200115 6 handy Bash scripts for Git.md @@ -0,0 +1,510 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 handy Bash scripts for Git) +[#]: via: (https://opensource.com/article/20/1/bash-scripts-git) +[#]: author: (Bob Peterson https://opensource.com/users/bobpeterson) + +6 个方便的 Git 脚本 +====== + +> 当使用 Git 存储库时,这六个 Bash 脚本将使你的生活更轻松。 + +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +我编写了许多 Bash 脚本,这些脚本使我在使用 Git 存储库时工作更加轻松。我的许多同事说没有必要;我所做的一切都可以用 Git 命令完成。虽然这可能是正确的,但我发现脚本远比尝试找出适当的 Git 命令来执行我想要的操作更加方便。 + +### 1、gitlog + +`gitlog` 打印针对 master 分支的当前补丁的简短列表。它从最旧到最新打印它们,并显示作者和描述,其中 `H` 代表 `HEAD`,`^` 代表 `HEAD^`,`2` 代表 `HEAD~2`,依此类推。例如: + +``` +$ gitlog +-----------------------[ recovery25 ]----------------------- +(snip) +11 340d27a33895 Bob Peterson gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson gfs2: Do proper error checking for go_sync family of glops + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson Rafael Aquini's slab instrumentation + 2 a06a5b7dea02 Bob Peterson GFS2: Add go_get_holdtime to gl_ops + ^ 8ba93c796d5c Bob Peterson gfs2: introduce new function remaining_hold_time and use it in dq + H e8b5ff851bb9 Bob Peterson gfs2: Allow rgrps to have a minimum hold time +``` + +如果我想查看其他分支上有哪些补丁,可以指定一个替代分支: + +``` +$ gitlog recovery24 +``` + +### 2、gitlog.id + +`gitlog.id` 只是打印出补丁的 SHA1 ID: + +``` +$ gitlog.id +-----------------------[ recovery25 ]----------------------- +56908eeb6940 2ca4a6b628a1 fc64ad5d99fe 02031a00a251 f6f38da7dd18 d8546e8f0023 fc3cc1f98f6b 12c3e0cb3523 76cce178b134 6fc1dce3ab9c 1b681ab074ca 26fed8de719b 802ff51a5670 49f67a512d8c f04f20193bbb 5f6afe809d23 2030521dc70e dada79b3be94 9b19a1e08161 78a035041d3e f03da011cae2 0d2b2e068fcd 2449976aa133 57dfb5e12ccd 53abedfdcf72 6fbdda3474b3 49544a547188 187032f7a63c 6f75dae23d93 95fc2a261b00 ebfb14ded191 f653ee9e414a 0e2911cb8111 73968b76e2e3 8a3e4cb5e92c a5f2da803b5b 7c9ef68388ed 71ca19d0cba8 340d27a33895 9b3c4e6efb10 d2e8c22be39b 9563e31f8bfd ebac7a38036c f703a3c27874 a3e86d2ef30e da3c604755b0 4525c2f5b46f a06a5b7dea02 8ba93c796d5c e8b5ff851bb9 +``` + +同样,它假定是当前分支,但是如果需要,我可以指定其他分支。 + +### 3、gitlog.id2 + +`gitlog.id2` 与 `gitlog.id` 相同,但顶部没有显示分支的行。这对于从一个分支挑选所有补丁到当前分支很方便: + +``` +$ # 创建一个新分支 +$ git branch --track origin/master +$ # 检出刚刚创建的新分支 +$ git checkout recovery26 +$ # 从旧的分支挑选所有补丁到新分支 +$ for i in `gitlog.id2 recovery25` ; do git cherry-pick $i ;done +``` + +### 4、gitlog.grep + +`gitlog.grep` 会在该补丁集合中寻找一个字符串。例如,如果我发现一个错误并想修复引用了函数 `inode_go_sync` 的补丁,我可以简单地执行以下操作: + +``` +$ gitlog.grep inode_go_sync +-----------------------[ recovery25 - 50 patches ]----------------------- +(snip) +11 340d27a33895 Bob Peterson gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson gfs2: Do proper error checking for go_sync family of glops +152:-static void inode_go_sync(struct gfs2_glock *gl) +153:+static int inode_go_sync(struct gfs2_glock *gl) +163:@@ -296,6 +302,7 @@ static void inode_go_sync(struct gfs2_glock *gl) + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson Rafael Aquini's slab instrumentation + 2 a06a5b7dea02 Bob Peterson GFS2: Add go_get_holdtime to gl_ops + ^ 8ba93c796d5c Bob Peterson gfs2: introduce new function remaining_hold_time and use it in dq + H e8b5ff851bb9 Bob Peterson gfs2: Allow rgrps to have a minimum hold time +``` + +因此,现在我知道补丁 `HEAD~9` 是需要修复的补丁。我使用 `git rebase -i HEAD~10` 编辑补丁 9,`git commit -a --amend`,然后 `git rebase --continue` 以进行必要的调整。 + +### 5、gitbranchcmp3 + +`gitbranchcmp3` 使我可以将当前分支与另一个分支进行比较,因此我可以将较旧版本的补丁与我的较新版本进行比较,并快速查看已更改和未更改的内容。它生成一个比较脚本(使用了 KDE 工具 [Kompare][2],该工具也可在 GNOME3 上使用)以比较不太相同的补丁。如果除行号外没有其他差异,则打印 `[SAME]`。如果仅存在注释差异,则打印 `[same]`(小写)。例如: + +``` +$ gitbranchcmp3 recovery24 +Branch recovery24 has 47 patches +Branch recovery25 has 50 patches + +(snip) +38 87eb6901607a 340d27a33895 [same] gfs2: drain the ail2 list after io errors +39 90fefb577a26 9b3c4e6efb10 [same] gfs2: clean up iopen glock mess in gfs2_create_inode +40 ba3ae06b8b0e d2e8c22be39b [same] gfs2: Do proper error checking for go_sync family of glops +41 2ab662294329 9563e31f8bfd [SAME] gfs2: use page_offset in gfs2_page_mkwrite +42 0adc6d817b7a ebac7a38036c [SAME] gfs2: don't use buffer_heads in gfs2_allocate_page_backing +43 55ef1f8d0be8 f703a3c27874 [SAME] gfs2: Improve mmap write vs. punch_hole consistency +44 de57c2f72570 a3e86d2ef30e [SAME] gfs2: Multi-block allocations in gfs2_page_mkwrite +45 7c5305fbd68a da3c604755b0 [SAME] gfs2: Fix end-of-file handling in gfs2_page_mkwrite +46 162524005151 4525c2f5b46f [SAME] Rafael Aquini's slab instrumentation +47 a06a5b7dea02 [ ] GFS2: Add go_get_holdtime to gl_ops +48 8ba93c796d5c [ ] gfs2: introduce new function remaining_hold_time and use it in dq +49 e8b5ff851bb9 [ ] gfs2: Allow rgrps to have a minimum hold time + +Missing from recovery25: +The missing: +Compare script generated at: /tmp/compare_mismatches.sh +``` + +### 6、gitlog.find + +最后,我有一个 `gitlog.find` 脚本,可以帮助我识别补丁程序的上游版本在哪里以及每个补丁程序的当前状态。它通过匹配补丁说明来实现。它还会生成一个比较脚本(再次使用了 Kompare),以将当前补丁与上游对应补丁进行比较: + +``` +$ gitlog.find +-----------------------[ recovery25 - 50 patches ]----------------------- +(snip) +11 340d27a33895 Bob Peterson gfs2: drain the ail2 list after io errors +lo 5bcb9be74b2a Bob Peterson gfs2: drain the ail2 list after io errors +10 9b3c4e6efb10 Bob Peterson gfs2: clean up iopen glock mess in gfs2_create_inode +fn 2c47c1be51fb Bob Peterson gfs2: clean up iopen glock mess in gfs2_create_inode + 9 d2e8c22be39b Bob Peterson gfs2: Do proper error checking for go_sync family of glops +lo feb7ea639472 Bob Peterson gfs2: Do proper error checking for go_sync family of glops + 8 9563e31f8bfd Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite +ms f3915f83e84c Christoph Hellwig gfs2: use page_offset in gfs2_page_mkwrite + 7 ebac7a38036c Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing +ms 35af80aef99b Christoph Hellwig gfs2: don't use buffer_heads in gfs2_allocate_page_backing + 6 f703a3c27874 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency +fn 39c3a948ecf6 Andreas Gruenbacher gfs2: Improve mmap write vs. punch_hole consistency + 5 a3e86d2ef30e Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite +fn f53056c43063 Andreas Gruenbacher gfs2: Multi-block allocations in gfs2_page_mkwrite + 4 da3c604755b0 Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite +fn 184b4e60853d Andreas Gruenbacher gfs2: Fix end-of-file handling in gfs2_page_mkwrite + 3 4525c2f5b46f Bob Peterson Rafael Aquini's slab instrumentation + Not found upstream + 2 a06a5b7dea02 Bob Peterson GFS2: Add go_get_holdtime to gl_ops + Not found upstream + ^ 8ba93c796d5c Bob Peterson gfs2: introduce new function remaining_hold_time and use it in dq + Not found upstream + H e8b5ff851bb9 Bob Peterson gfs2: Allow rgrps to have a minimum hold time + Not found upstream +Compare script generated: /tmp/compare_upstream.sh +``` + +补丁显示为两行,第一行是你当前的修补程序,然后是相应的上游补丁,以及 2 个字符的缩写,以指示其上游状态: + +* `lo` 表示补丁仅在本地(`local`)上游 Git 存储库中(即尚未推送到上游)。 +* `ms` 表示补丁位于 Linus Torvald 的主(`master`)分支中。 +* `fn` 意味着补丁被推送到我的 “for-next” 开发分支,用于下一个上游合并窗口。 +   +我的一些脚本根据我通常使用 Git 的方式做出假设。例如,当搜索上游补丁时,它使用我众所周知的 Git 树的位置。因此,你需要调整或改进它们以适合你的条件。`gitlog.find` 脚本旨在仅定位 [GFS2][3] 和 [DLM][4] 补丁,因此,除非你是 GFS2 开发人员,否则你需要针对你感兴趣的组件对其进行自定义。 + +### 源代码 + +以下是这些脚本的源代码。 + +#### 1、gitlog + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then + branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +patches=0 +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done + +if [[ $branch =~ .*for-next.* ]] +then + start=HEAD +# start=origin/for-next +else + start=origin/master +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +/usr/bin/echo "-----------------------[" $branch "]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do + if [ $patches -eq 1 ]; then + cnt=" ^" + elif [ $patches -eq 0 ]; then + cnt=" H" + else + if [ $patches -lt 10 ]; then + cnt=" $patches" + else + cnt="$patches" + fi + fi + /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s %n" $i + patches=$(echo $patches - 1 | bc) +done +#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" $tracking..$branch +#git log --reverse --abbrev-commit --pretty=format:"%h %<|(32)%an %s" ^origin/master ^linux-gfs2/for-next $branch +``` + +#### 2、gitlog.id + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then + branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +/usr/bin/echo "-----------------------[" $branch "]-----------------------" +git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 3、gitlog.id2 + +``` +#!/bin/bash +branch=$1 + +if test "x$branch" = x; then + branch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` +git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 4、gitlog.grep + +``` +#!/bin/bash +param1=$1 +param2=$2 + +if test "x$param2" = x; then + branch=`git branch -a | grep "*" | cut -d ' ' -f2` + string=$param1 +else + branch=$param1 + string=$param2 +fi + +patches=0 +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done +/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do + if [ $patches -eq 1 ]; then + cnt=" ^" + elif [ $patches -eq 0 ]; then + cnt=" H" + else + if [ $patches -lt 10 ]; then + cnt=" $patches" + else + cnt="$patches" + fi + fi + /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i + /usr/bin/git show --pretty=email --patch-with-stat $i | grep -n "$string" + patches=$(echo $patches - 1 | bc) +done +``` + +#### 5、gitbranchcmp3 + +``` +#!/bin/bash +# +# gitbranchcmp3 [] +# +oldbranch=$1 +newbranch=$2 +script=/tmp/compare_mismatches.sh + +/usr/bin/rm -f $script +echo "#!/bin/bash" > $script +/usr/bin/chmod 755 $script +echo "# Generated by gitbranchcmp3.sh" >> $script +echo "# Run this script to compare the mismatched patches" >> $script +echo " " >> $script +echo "function compare_them()" >> $script +echo "{" >> $script +echo " git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script +echo " git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script +echo " kompare /tmp/gronk1 /tmp/gronk2" >> $script +echo "}" >> $script +echo " " >> $script + +if test "x$newbranch" = x; then + newbranch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi + +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +declare -a oldsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$oldbranch | cut -d ' ' -f1 |paste -s -d ' '`) +declare -a newsha1s=(`git log --reverse --abbrev-commit --pretty=oneline $tracking..$newbranch | cut -d ' ' -f1 |paste -s -d ' '`) + +#echo "old: " $oldsha1s +oldcount=${#oldsha1s[@]} +echo "Branch $oldbranch has $oldcount patches" +oldcount=$(echo $oldcount - 1 | bc) +#for o in `seq 0 ${#oldsha1s[@]}`; do +# echo -n ${oldsha1s[$o]} " " +# desc=`git show $i | head -5 | tail -1|cut -b5-` +#done + +#echo "new: " $newsha1s +newcount=${#newsha1s[@]} +echo "Branch $newbranch has $newcount patches" +newcount=$(echo $newcount - 1 | bc) +#for o in `seq 0 ${#newsha1s[@]}`; do +# echo -n ${newsha1s[$o]} " " +# desc=`git show $i | head -5 | tail -1|cut -b5-` +#done +echo + +for new in `seq 0 $newcount`; do + newsha=${newsha1s[$new]} + newdesc=`git show $newsha | head -5 | tail -1|cut -b5-` + oldsha=" " + same="[ ]" + for old in `seq 0 $oldcount`; do + if test "${oldsha1s[$old]}" = "match"; then + continue; + fi + olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` + if test "$olddesc" = "$newdesc" ; then + oldsha=${oldsha1s[$old]} + #echo $oldsha + git show $oldsha |tail -n +2 |grep -v "index.*\.\." |grep -v "@@" > /tmp/gronk1 + git show $newsha |tail -n +2 |grep -v "index.*\.\." |grep -v "@@" > /tmp/gronk2 + diff /tmp/gronk1 /tmp/gronk2 &> /dev/null + if [ $? -eq 0 ] ;then +# No differences + same="[SAME]" + oldsha1s[$old]="match" + break + fi + git show $oldsha |sed -n '/diff/,$p' |grep -v "index.*\.\." |grep -v "@@" > /tmp/gronk1 + git show $newsha |sed -n '/diff/,$p' |grep -v "index.*\.\." |grep -v "@@" > /tmp/gronk2 + diff /tmp/gronk1 /tmp/gronk2 &> /dev/null + if [ $? -eq 0 ] ;then +# Differences in comments only + same="[same]" + oldsha1s[$old]="match" + break + fi + oldsha1s[$old]="match" + echo "compare_them $oldsha $newsha" >> $script + fi + done + echo "$new $oldsha $newsha $same $newdesc" +done + +echo +echo "Missing from $newbranch:" +the_missing="" +# Now run through the olds we haven't matched up +for old in `seq 0 $oldcount`; do + if test ${oldsha1s[$old]} != "match"; then + olddesc=`git show ${oldsha1s[$old]} | head -5 | tail -1|cut -b5-` + echo "${oldsha1s[$old]} $olddesc" + the_missing=`echo "$the_missing ${oldsha1s[$old]}"` + fi +done + +echo "The missing: " $the_missing +echo "Compare script generated at: $script" +#git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' ' +``` + +#### 6、gitlog.find + +``` +#!/bin/bash +# +# Find the upstream equivalent patch +# +# gitlog.find +# +cwd=$PWD +param1=$1 +ubranch=$2 +patches=0 +script=/tmp/compare_upstream.sh +echo "#!/bin/bash" > $script +/usr/bin/chmod 755 $script +echo "# Generated by gitbranchcmp3.sh" >> $script +echo "# Run this script to compare the mismatched patches" >> $script +echo " " >> $script +echo "function compare_them()" >> $script +echo "{" >> $script +echo " cwd=$PWD" >> $script +echo " git show --pretty=email --patch-with-stat \$2 > /tmp/gronk2" >> $script +echo " cd ~/linux.git/fs/gfs2" >> $script +echo " git show --pretty=email --patch-with-stat \$1 > /tmp/gronk1" >> $script +echo " cd $cwd" >> $script +echo " kompare /tmp/gronk1 /tmp/gronk2" >> $script +echo "}" >> $script +echo " " >> $script + +#echo "Gathering upstream patch info. Please wait." +branch=`git branch -a | grep "*" | cut -d ' ' -f2` +tracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` + +cd ~/linux.git +if test "X${ubranch}" = "X"; then + ubranch=`git branch -a | grep "*" | cut -d ' ' -f2` +fi +utracking=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` +# +# gather a list of gfs2 patches from master just in case we can't find it +# +#git log --abbrev-commit --pretty=format:" %h %<|(32)%an %s" master |grep -i -e "gfs2" -e "dlm" > /tmp/gronk +git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/gfs2/ > /tmp/gronk.gfs2 +# ms = in Linus's master +git log --reverse --abbrev-commit --pretty=format:"ms %h %<|(32)%an %s" master fs/dlm/ > /tmp/gronk.dlm + +cd $cwd +LIST=`git log --reverse --abbrev-commit --pretty=oneline $tracking..$branch | cut -d ' ' -f1 |paste -s -d ' '` +for i in $LIST; do patches=$(echo $patches + 1 | bc);done +/usr/bin/echo "-----------------------[" $branch "-" $patches "patches ]-----------------------" +patches=$(echo $patches - 1 | bc); +for i in $LIST; do + if [ $patches -eq 1 ]; then + cnt=" ^" + elif [ $patches -eq 0 ]; then + cnt=" H" + else + if [ $patches -lt 10 ]; then + cnt=" $patches" + else + cnt="$patches" + fi + fi + /usr/bin/git show --abbrev-commit -s --pretty=format:"$cnt %h %<|(32)%an %s" $i + desc=`/usr/bin/git show --abbrev-commit -s --pretty=format:"%s" $i` + cd ~/linux.git + cmp=1 + up_eq=`git log --reverse --abbrev-commit --pretty=format:"lo %h %<|(32)%an %s" $utracking..$ubranch | grep "$desc"` +# lo = in local for-next + if test "X$up_eq" = "X"; then + up_eq=`git log --reverse --abbrev-commit --pretty=format:"fn %h %<|(32)%an %s" master..$utracking | grep "$desc"` +# fn = in for-next for next merge window + if test "X$up_eq" = "X"; then + up_eq=`grep "$desc" /tmp/gronk.gfs2` + if test "X$up_eq" = "X"; then + up_eq=`grep "$desc" /tmp/gronk.dlm` + if test "X$up_eq" = "X"; then + up_eq=" Not found upstream" + cmp=0 + fi + fi + fi + fi + echo "$up_eq" + if [ $cmp -eq 1 ] ; then + UP_SHA1=`echo $up_eq|cut -d' ' -f2` + echo "compare_them $UP_SHA1 $i" >> $script + fi + cd $cwd + patches=$(echo $patches - 1 | bc) +done +echo "Compare script generated: $script" +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/bash-scripts-git + +作者:[Bob Peterson][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bobpeterson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://kde.org/applications/development/org.kde.kompare +[3]: https://en.wikipedia.org/wiki/GFS2 +[4]: https://en.wikipedia.org/wiki/Distributed_lock_manager From f417dd688f7a2eae53239063f13f34e4e0aec9c0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 22:08:00 +0800 Subject: [PATCH 615/676] APL --- ...- A Bash function to maintain Python virtual environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md index 0a1192bccf..51fbc31785 100644 --- a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md +++ b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0d2a3db0f353c6d00d8ec85eb80fa75498552907 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 22:21:41 +0800 Subject: [PATCH 616/676] TSL --- ...to maintain Python virtual environments.md | 303 ------------------ ...to maintain Python virtual environments.md | 296 +++++++++++++++++ 2 files changed, 296 insertions(+), 303 deletions(-) delete mode 100644 sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md create mode 100644 translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md diff --git a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md deleted file mode 100644 index 51fbc31785..0000000000 --- a/sources/tech/20200113 setV- A Bash function to maintain Python virtual environments.md +++ /dev/null @@ -1,303 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (setV: A Bash function to maintain Python virtual environments) -[#]: via: (https://opensource.com/article/20/1/setv-bash-function) -[#]: author: (Sachin Patil https://opensource.com/users/psachin) - -setV: A Bash function to maintain Python virtual environments -====== -Get to know setV, a lightweight Python virtual environment manager and -alternative to virtualenvwrapper. -![Coding on a computer][1] - -For more than a year, [setV][2] has been hidden away within my [bash_scripts][3] project, but it's time for it to become public. setV is a Bash function I use as an alternative to [virtualenvwrapper][4]. It provides basic features that enable you to do things such as: - - * Use Python 3 by default - * Create a new virtual environment - * Create a new virtual environment using a custom Python path with **-p** (or **\--python**) - * Delete an existing virtual environment - * List all existing virtual environment - * Use Tab completion (in case you don't remember the virtual environment name) - - - -### Installation - -To install setV, download the script: - - -``` -`curl https://gitlab.com/psachin/setV/raw/master/install.sh` -``` - -Review the script, and then run it: - - -``` -`sh ./install.sh` -``` - -When you install setV, the installation script asks you to source **~/.bashrc** or **~/.bash_profile**. Be sure to do that. - -### Usage - -The basic command is **setv**. - -#### Create a virtual environment: - - -``` -setv --new rango  # setv -n rango - -# Or using a custom Python binary path -setv --new --python /opt/python/python3 rango  # setv -n -p /opt/python/python3 rango -``` - -#### Activate an existing environment: - - -``` -setv VIRTUAL_ENVIRONMENT_NAME - -# For example -setv rango -``` - -#### List all virtual environments: - - -``` -setv --list -# or -setv [TAB] [TAB] -``` - -#### Delete a virtual environment: - - -``` -`setv --delete rango` -``` - -#### Switch to another virtual environment: - - -``` -# Assuming you are in 'rango', switch to 'tango' using -setv tango -``` - -#### Tab Completion - -If you don't fully remember the virtual environment's name, Bash-like Tab completion works for virtual environment names. - -### Get involved - -setV is open source under the GNU [GPLv3][5], and contributions are welcome. To learn more, visit the Contribute section of setV's [README][6] in its GitLab repository. - -### The setV script - - -``` -#!/usr/bin/env bash -# setV - A Lightweight Python virtual environment manager. -# Author: Sachin (psachin) <[iclcoolster@gmail.com][7]> -# Author's URL: -# -# License: GNU GPL v3, See LICENSE file -# -# Configure(Optional): -# Set `SETV_VIRTUAL_DIR_PATH` value to your virtual environments -# directory-path. By default it is set to '~/virtualenvs/' -# -# Usage: -# Manual install: Added below line to your .bashrc or any local rc script(): -# --- -# source /path/to/virtual.sh -# --- -# -# Now you can 'activate' the virtual environment by typing -# $ setv <YOUR VIRTUAL ENVIRONMENT NAME> -# -# For example: -# $ setv rango -# -# or type: -# setv [TAB] [TAB]  (to list all virtual envs) -# -# To list all your virtual environments: -# $ setv --list -# -# To create new virtual environment: -# $ setv --new new_virtualenv_name -# -# To delete existing virtual environment: -# $ setv --delete existing_virtualenv_name -# -# To deactivate, type: -# $ deactivate - -# Path to virtual environment directory -SETV_VIRTUAL_DIR_PATH="$HOME/virtualenvs/" -# Default python version to use. This decides whether to use `virtualenv` or `python3 -m venv` -SETV_PYTHON_VERSION=3  # Defaults to Python3 -SETV_PY_PATH=$(which python${SETV_PYTHON_VERSION}) - -function _setvcomplete_() -{ -    # Bash-autocompletion. -    # This ensures Tab-auto-completions work for virtual environment names. -    local cmd="${1##*/}" # to handle command(s). -                         # Not necessary as such. 'setv' is the only command - -    local word=${COMP_WORDS[COMP_CWORD]} # Words thats being completed -    local xpat='${word}'                 # Filter pattern. Include -                                         # only words in variable '$names' -    local names=$(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') # Virtual environment names - -    COMPREPLY=($(compgen -W "$names" -X "$xpat" -- "$word")) # compgen generates the results -} - -function _setv_help_() { -    # Echo help/usage message -    echo "Usage: setv [OPTIONS] [NAME]" -    echo Positional argument: -    echo -e "NAME                       Activate virtual env." -    echo Optional arguments: -    echo -e "-l, --list                 List all Virtual Envs." -    echo -e "-n, --new NAME             Create a new Python Virtual Env." -    echo -e "-d, --delete NAME          Delete existing Python Virtual Env." -    echo -e "-p, --python PATH          Python binary path." -} - -function _setv_custom_python_path() -{ -    if [ -f "${1}" ]; -    then -        if [ "`expr $1 : '.*python\\([2,3]\\)'`" = "3" ]; -        then -            SETV_PYTHON_VERSION=3 -        else -            SETV_PYTHON_VERSION=2 -        fi -        SETV_PY_PATH=${1} -        _setv_create $2 -    else -        echo "Error: Path ${1} does not exist!" -    fi -} - -function _setv_create() -{ -    # Creates new virtual environment if ran with -n|--new flag -    if [ -z ${1} ]; -    then -        echo "You need to pass virtual environment name" -        _setv_help_ -    else -        echo "Creating new virtual environment with the name: $1" - -        if [ ${SETV_PYTHON_VERSION} -eq 3 ]; -        then -            ${SETV_PY_PATH} -m venv ${SETV_VIRTUAL_DIR_PATH}${1} -        else -            virtualenv -p ${SETV_PY_PATH} ${SETV_VIRTUAL_DIR_PATH}${1} -        fi - -        echo "You can now activate the Python virtual environment by typing: setv ${1}" -    fi -} - -function _setv_delete() -{ -    # Deletes virtual environment if ran with -d|--delete flag -    # TODO: Refactor -    if [ -z ${1} ]; -    then -        echo "You need to pass virtual environment name" -        _setv_help_ -    else -        if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; -        then -            read -p "Really delete this virtual environment(Y/N)? " yes_no -            case $yes_no in -                Y|y) rm -rvf ${SETV_VIRTUAL_DIR_PATH}${1};; -                N|n) echo "Leaving the virtual environment as it is.";; -                *) echo "You need to enter either Y/y or N/n" -            esac -        else -            echo "Error: No virtual environment found by the name: ${1}" -        fi -    fi -} - -function _setv_list() -{ -    # Lists all virtual environments if ran with -l|--list flag -    echo -e "List of virtual environments you have under ${SETV_VIRTUAL_DIR_PATH}:\n" -    for virt in $(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') -    do -        echo ${virt} -    done -} - -function setv() { -    # Main function -    if [ $# -eq 0 ]; -    then -        _setv_help_ -    elif [ $# -le 3 ]; -    then -        case "${1}" in -            -n|--new) _setv_create ${2};; -            -d|--delete) _setv_delete ${2};; -            -l|--list) _setv_list;; -            *) if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; -               then -                   # Activate the virtual environment -                   source ${SETV_VIRTUAL_DIR_PATH}${1}/bin/activate -               else -                   # Else throw an error message -                   echo "Sorry, you don't have any virtual environment with the name: ${1}" -                   _setv_help_ -               fi -               ;; -        esac -    elif [ $# -le 5 ]; -    then -        case "${2}" in -            -p|--python) _setv_custom_python_path ${3} ${4};; -            *) _setv_help_;; -        esac -    fi -} - -# Calls bash-complete. The compgen command accepts most of the same -# options that complete does but it generates results rather than just -# storing the rules for future use. -complete  -F _setvcomplete_ setv -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/setv-bash-function - -作者:[Sachin Patil][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/psachin -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) -[2]: https://gitlab.com/psachin/setV -[3]: https://github.com/psachin/bash_scripts -[4]: https://virtualenvwrapper.readthedocs.org/ -[5]: https://gitlab.com/psachin/setV/blob/master/LICENSE -[6]: https://gitlab.com/psachin/setV/blob/master/ReadMe.org -[7]: mailto:iclcoolster@gmail.com diff --git a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md new file mode 100644 index 0000000000..75dcec4367 --- /dev/null +++ b/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -0,0 +1,296 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (setV: A Bash function to maintain Python virtual environments) +[#]: via: (https://opensource.com/article/20/1/setv-bash-function) +[#]: author: (Sachin Patil https://opensource.com/users/psachin) + +setV:一个管理 Python 虚拟环境的 Bash 函数 +====== + +> 了解一下 setV,它是轻量级的 Python 虚拟环境管理器,是 virtualenvwrapper 的替代产品。 + +![Coding on a computer][1] + +这一年多来,[setV] [2] 悄悄隐藏在我的 [bash_scripts][3] 项目中,但现在是时候该公开了。setV 是一个 Bash 函数,我可以用它代替 [virtualenvwrapper][4]。它提供了使你能够执行以下操作的基本功能: + +* 默认使用 Python 3 +* 创建一个新的虚拟环境 +* 使用带有 `-p`(或 `--python`)的自定义 Python 路径来创建新的虚拟环境 +* 删除现有的虚拟环境 +* 列出所有现有的虚拟环境 +* 使用制表符补全(以防你忘记虚拟环境名称) + +### 安装 + +要安装 setV,请下载该脚本: + +``` +curl https://gitlab.com/psachin/setV/raw/master/install.sh +``` + +审核一下脚本,然后运行它: + +``` +sh ./install.sh +``` + +当安装 setV 时,安装脚本会询问你要嵌入到 `~/.bashrc` 还是 `~/.bash_profile`,根据你的喜好选择一个。 + +### 用法 + +基本的命令格式是 `setv`。 + +#### 创建虚拟环境 + +``` +setv --new rango  # setv -n rango + +# 或使用定制的 Python 路径 +setv --new --python /opt/python/python3 rango  # setv -n -p /opt/python/python3 rango +``` + +#### 激活已有的虚拟环境 + +``` +setv VIRTUAL_ENVIRONMENT_NAME +``` + +``` +# 示例 +setv rango +``` + +#### 列出所有的虚拟环境 + +``` +setv --list +# 或 +setv [TAB] [TAB] +``` + +#### 删除虚拟环境 + +``` +setv --delete rango +``` + +#### 切换到另外一个虚拟环境 + +``` +# 假设你现在在 'rango',切换到 'tango' +setv tango +``` + +#### 制表符补完 + +如果你不完全记得虚拟环境的名称,则 Bash 式的制表符补全也可以适用于虚拟环境名称。 + +### 参与其中 + +setV 在 GNU [GPLv3][5]下开源,欢迎贡献。要了解更多信息,请访问它的 GitLab 存储库中的 setV 的 [README][6] 的贡献部分。 + +### setV 脚本 + +``` +#!/usr/bin/env bash +# setV - A Lightweight Python virtual environment manager. +# Author: Sachin (psachin) +# Author's URL: https://psachin.gitlab.io/about +# +# License: GNU GPL v3, See LICENSE file +# +# Configure(Optional): +# Set `SETV_VIRTUAL_DIR_PATH` value to your virtual environments +# directory-path. By default it is set to '~/virtualenvs/' +# +# Usage: +# Manual install: Added below line to your .bashrc or any local rc script(): +# --- +# source /path/to/virtual.sh +# --- +# +# Now you can 'activate' the virtual environment by typing +# $ setv +# +# For example: +# $ setv rango +# +# or type: +# setv [TAB] [TAB] (to list all virtual envs) +# +# To list all your virtual environments: +# $ setv --list +# +# To create new virtual environment: +# $ setv --new new_virtualenv_name +# +# To delete existing virtual environment: +# $ setv --delete existing_virtualenv_name +# +# To deactivate, type: +# $ deactivate + +# Path to virtual environment directory +SETV_VIRTUAL_DIR_PATH="$HOME/virtualenvs/" +# Default python version to use. This decides whether to use `virtualenv` or `python3 -m venv` +SETV_PYTHON_VERSION=3 # Defaults to Python3 +SETV_PY_PATH=$(which python${SETV_PYTHON_VERSION}) + +function _setvcomplete_() +{ + # Bash-autocompletion. + # This ensures Tab-auto-completions work for virtual environment names. + local cmd="${1##*/}" # to handle command(s). + # Not necessary as such. 'setv' is the only command + + local word=${COMP_WORDS[COMP_CWORD]} # Words thats being completed + local xpat='${word}' # Filter pattern. Include + # only words in variable '$names' + local names=$(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') # Virtual environment names + + COMPREPLY=($(compgen -W "$names" -X "$xpat" -- "$word")) # compgen generates the results +} + +function _setv_help_() { + # Echo help/usage message + echo "Usage: setv [OPTIONS] [NAME]" + echo Positional argument: + echo -e "NAME Activate virtual env." + echo Optional arguments: + echo -e "-l, --list List all Virtual Envs." + echo -e "-n, --new NAME Create a new Python Virtual Env." + echo -e "-d, --delete NAME Delete existing Python Virtual Env." + echo -e "-p, --python PATH Python binary path." +} + +function _setv_custom_python_path() +{ + if [ -f "${1}" ]; + then + if [ "`expr $1 : '.*python\([2,3]\)'`" = "3" ]; + then + SETV_PYTHON_VERSION=3 + else + SETV_PYTHON_VERSION=2 + fi + SETV_PY_PATH=${1} + _setv_create $2 + else + echo "Error: Path ${1} does not exist!" + fi +} + +function _setv_create() +{ + # Creates new virtual environment if ran with -n|--new flag + if [ -z ${1} ]; + then + echo "You need to pass virtual environment name" + _setv_help_ + else + echo "Creating new virtual environment with the name: $1" + + if [ ${SETV_PYTHON_VERSION} -eq 3 ]; + then + ${SETV_PY_PATH} -m venv ${SETV_VIRTUAL_DIR_PATH}${1} + else + virtualenv -p ${SETV_PY_PATH} ${SETV_VIRTUAL_DIR_PATH}${1} + fi + + echo "You can now activate the Python virtual environment by typing: setv ${1}" + fi +} + +function _setv_delete() +{ + # Deletes virtual environment if ran with -d|--delete flag + # TODO: Refactor + if [ -z ${1} ]; + then + echo "You need to pass virtual environment name" + _setv_help_ + else + if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; + then + read -p "Really delete this virtual environment(Y/N)? " yes_no + case $yes_no in + Y|y) rm -rvf ${SETV_VIRTUAL_DIR_PATH}${1};; + N|n) echo "Leaving the virtual environment as it is.";; + *) echo "You need to enter either Y/y or N/n" + esac + else + echo "Error: No virtual environment found by the name: ${1}" + fi + fi +} + +function _setv_list() +{ + # Lists all virtual environments if ran with -l|--list flag + echo -e "List of virtual environments you have under ${SETV_VIRTUAL_DIR_PATH}:\n" + for virt in $(ls -l "${SETV_VIRTUAL_DIR_PATH}" | egrep '^d' | awk -F " " '{print $NF}') + do + echo ${virt} + done +} + +function setv() { + # Main function + if [ $# -eq 0 ]; + then + _setv_help_ + elif [ $# -le 3 ]; + then + case "${1}" in + -n|--new) _setv_create ${2};; + -d|--delete) _setv_delete ${2};; + -l|--list) _setv_list;; + *) if [ -d ${SETV_VIRTUAL_DIR_PATH}${1} ]; + then + # Activate the virtual environment + source ${SETV_VIRTUAL_DIR_PATH}${1}/bin/activate + else + # Else throw an error message + echo "Sorry, you don't have any virtual environment with the name: ${1}" + _setv_help_ + fi + ;; + esac + elif [ $# -le 5 ]; + then + case "${2}" in + -p|--python) _setv_custom_python_path ${3} ${4};; + *) _setv_help_;; + esac + fi +} + +# Calls bash-complete. The compgen command accepts most of the same +# options that complete does but it generates results rather than just +# storing the rules for future use. +complete -F _setvcomplete_ setv +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/setv-bash-function + +作者:[Sachin Patil][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/psachin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://gitlab.com/psachin/setV +[3]: https://github.com/psachin/bash_scripts +[4]: https://virtualenvwrapper.readthedocs.org/ +[5]: https://gitlab.com/psachin/setV/blob/master/LICENSE +[6]: https://gitlab.com/psachin/setV/blob/master/ReadMe.org +[7]: mailto:iclcoolster@gmail.com From 8e7f65331684bf2add20ba1b17715cf4cbd5f270 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 22:46:00 +0800 Subject: [PATCH 617/676] =?UTF-8?q?=E6=B8=85=E9=99=A4=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nimal vision, and more open source news.md | 93 ---------- ...u Cinnamon Distribution is Finally Here.md | 85 --------- ...l gets better, and more industry trends.md | 65 ------- ...n fellows from Africa, and more updates.md | 75 -------- ...bernetes etcd, and more industry trends.md | 63 ------- ...ed- Here-s What-s New and How to Get it.md | 165 ------------------ ... of microbes, and more open source news.md | 76 -------- ...the end for Windows Server 2008 support.md | 71 -------- 8 files changed, 693 deletions(-) delete mode 100644 sources/news/20191207 New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news.md delete mode 100644 sources/news/20191209 First Ever Release of Ubuntu Cinnamon Distribution is Finally Here.md delete mode 100644 sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md delete mode 100644 sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md delete mode 100644 sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md delete mode 100644 sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md delete mode 100644 sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md delete mode 100644 sources/news/20200116 It-s the end for Windows Server 2008 support.md diff --git a/sources/news/20191207 New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news.md b/sources/news/20191207 New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news.md deleted file mode 100644 index 93297c4cad..0000000000 --- a/sources/news/20191207 New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news.md +++ /dev/null @@ -1,93 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news) -[#]: via: (https://opensource.com/article/19/12/news-december-7) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -New machine learning from Alibaba and Netflix, mimicking animal vision, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we take a look an open source election auditing tool, new open source from Alibaba and Netflix, mimicking animal vision, and more! - -### Alibaba and Netflix share machine learning and data science software - -Two companies at the forefront of machine learning and data science have just released some of their tools under open source licenses. - -Chinese ecommerce giant Alibaba just [open sourced the algorithm libraries][2] for its Alink platform. The algorithms "are essential to support machine learning tasks such as online product recommendations and smart customer services." According to Jia Yangqing, president of Alibaba Cloud, Alink is a good fit for "developers seeking big data and machine-learning tools." You can find the source code for Alink (which is under an Apache 2.0 license) [on GitHub][3], with documentation in both Chinese and English. - -Not to be outdone, streaming service Netflix just released its [Metaflow Python library][4] under an Apache 2.0 license. Metaflow enables data scientists to "see early on whether a prototyped model would fail in production, allowing them to fix whatever the issue was". It also works with a number of Python data science libraries, like SciKit Learn, Pytorch, and Tensorflow. You can grab Metaflow's code from [its GitHub repository][5] or learn more about it at the [Metaflow website][6]. - -### Open source software to mimic animal vision - -Have you ever wondered how your dog or cat sees the world? Thanks to work by researchers at the University of Exeter in the UK and Australia's University of Queensland, you can find out. The team just released [software that allows humans to see the world as animals do][7]. - -Called micaToolbox, the software can interpret digital photos and process images of various environments by mimicking the limitations of animal vision. Anyone with a camera, a computer, or smartphone can use the software without knowing how to code. But micaToolbox isn't just a novelty. It's a serious scientific tool that can help "help biologists better understand a variety of animal behaviors, including mating systems, distance-dependent signalling and mimicry." And, according to researcher Jolyon Troscianko, the software can help identify "how an animal's camouflage works so that we can manage our land to protect certain species." - -You can [download micaBox][8] or [browse its source code][9] on GitHub. - -### New tool for post-election auditing - -More and more aspects of our lives and institutions are being automated. With that comes an increased danger of systems breaking down or malicious someones tampering with those systems. Open source gives us an opportunity to look at exactly how the automation works. - -Elections, in particular, are increasingly vulnerable. To combat election tampering, the US Cybersecurity and Infrastructure Security Agency (CISA) has joined forces with the non-profit organization VotingWorks to create a [web-based application for auditing ballots][10]. - -Called Arlo, the application is designed to ensure that "elections are secure, resilient, and transparent," said CISA's director Chris Krebs. Arlo works with a range of automated voting systems to help "officials compare audited votes to tabulated votes, and providing monitoring & reporting capabilities." Arlo was used to verify the results of recent state and local elections and is being further field-tested in the states of Georgia, Michigan, Missouri, Ohio, Pennsylvania, and Virginia. - -Arlo's source code, released under an AGPL-3.0 license, is [available on GitHub][11]. - -### Royal Navy debuts open source application development kit - -Consistency across user interfaces is key to a successful set of applications and services. The UK's Royal Navy understands the importance of this and has released the [open source NELSON standards toolkit][12] to help its developers and suppliers "save time and give users a consistent experience." - -Named after the legendary British admiral, NELSON is intended to "maintain high visual consistency and user-experience quality across the different applications developed or subcontracted by the Royal Navy." The toolkit consists of a set of components including visual styles, typographic elements, forms, elements like buttons and checkboxes, and notifications. - -NELSON has its own [GitHub repository][13], from which the Royal Navy encourages developers to make pull requests. - -#### In other news - - * [Council group plans for open source revenues and benefits platform][14] - * [Introducing Nebula, the open source global overlay network from Slack][15] - * [webOS Open Source Edition 2.0 keeps Palm's spirit alive in cars and IoT][16] - * [Duke University Introduces an Open Source Tool as an Alternative to a Monolithic LMS][17] - * [Open Source Technology Could Be a Boon to Farmers][18] - - - -_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/news-december-7 - -作者:[Scott Nesbitt][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/scottnesbitt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://www.zdnet.com/article/alibaba-cloud-publishes-machine-learning-algorithm-on-github/ -[3]: https://github.com/alibaba/alink -[4]: https://www.zdnet.com/article/netflix-our-metaflow-python-library-for-faster-data-science-is-now-open-source/ -[5]: https://github.com/Netflix/metaflow -[6]: https://metaflow.org/ -[7]: https://www.upi.com/Science_News/2019/12/03/Novel-software-helps-scientists-see-what-animals-see/5961575389734/ -[8]: http://www.empiricalimaging.com/download/micatoolbox/ -[9]: https://github.com/troscianko/micaToolbox -[10]: https://www.zdnet.com/article/cisa-and-votingworks-release-open-source-post-election-auditing-tool/ -[11]: https://github.com/votingworks/arlo -[12]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/open-source-royal-navy -[13]: https://github.com/Royal-Navy/standards-toolkit -[14]: https://www.ukauthority.com/articles/council-group-plans-for-open-source-revenues-and-benefits/ -[15]: https://slack.engineering/introducing-nebula-the-open-source-global-overlay-network-from-slack-884110a5579 -[16]: https://www.slashgear.com/webos-open-source-edition-2-0-keeps-palms-spirit-alive-in-cars-and-iot-25601309/ -[17]: https://iblnews.org/duke-university-introduces-an-open-source-tool-as-an-alternative-to-a-monolithic-lms/ -[18]: https://civileats.com/2019/12/02/open-source-technology-could-be-a-boon-to-farmers/ diff --git a/sources/news/20191209 First Ever Release of Ubuntu Cinnamon Distribution is Finally Here.md b/sources/news/20191209 First Ever Release of Ubuntu Cinnamon Distribution is Finally Here.md deleted file mode 100644 index 09af65568d..0000000000 --- a/sources/news/20191209 First Ever Release of Ubuntu Cinnamon Distribution is Finally Here.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (First Ever Release of Ubuntu Cinnamon Distribution is Finally Here!) -[#]: via: (https://itsfoss.com/ubuntu-cinnamon/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -First Ever Release of Ubuntu Cinnamon Distribution is Finally Here! -====== - -_**Brief: Ubuntu Cinnamon is a new distribution that utilizes Linux Mint’s Cinnamon desktop environment on top of Ubuntu code base. It’s first stable release is based on Ubuntu 19.10 Eoan Ermine.**_ - -[Cinnamon][1] is Linux Mint’s flagship desktop environment. Like [MATE desktop][2], Cinnamon is also a product of dissatisfaction with GNOME 3. With the GNOME Classic like user interface and relatively lower hardware requirements, Cinnamon soon gathered a dedicated userbase. - -Like any other desktop environment out there, you can [install Cinnamon on Ubuntu][3] and other distributions. - -Installing multiple [desktop environments][4] (DE) is not a difficult task but it often leads to conflicts (with other DE’s elements) and may not always provide the best experience. This is why major Linux distributions separate spins/flavors with various popular desktop environments. - -[Ubuntu also has various official flavors][5] featuring [KDE][6] (Kubuntu), [LXQt][7] (Lubuntu), Xfce (Xubuntu), Budgie ([Ubuntu Budgie][8]) etc. Cinnamon was not in this list but Ubuntu Cinnamon Remix project is trying to change that. - -### Ubuntu Cinnamon distribution - -![Ubuntu Cinnamon Desktop Screenshot][9] - -[Ubuntu Cinnamon][10] (website under construction) is a new Linux distribution that brings Cinnamon desktop to Ubuntu distribution. Joshua Peisach is the lead developer for the project and he is being helped by other volunteer contributors. The ex-developer of the now discontinued Ubuntu GNOME project and some members from Ubuntu team are also advising the team to help with the development. - -![Ubuntu Cinnamon Remix Screeenshot 1][11] - -Do note that Ubuntu Cinnamon is not an official flavor of Ubuntu. They are trying to get the flavorship but I think that will take a few more releases. - -The first stable release of Ubuntu Cinnamon is based on [Ubuntu 19.10 Eoan Ermine][12]. It uses Calamares installer from Lubuntu and features Cinnamon desktop version 4.0.10. Naturally, it uses Nemo file manager and LightDM. - -It supports EFI and UEFI and only comes with 64-bit support. - -You’ll get your regular goodies like LibreOffice, Firefox and some GNOME software and games. You can of course install more applications as per your need. - -### Download and install Ubuntu Cinnamon - -Do note that this is the first ever release of Ubuntu Cinnamon and the developers are not that experienced at this moment. - -If you don’t like troubleshooting, don’t use it on your main system. I expect this release to have a few bugs and issues which will be fixed eventually as more users test it out. - -You can download Ubuntu Cinnamon ISO from Sourceforge website: - -[Download Ubuntu Cinnamon][13] - -### What next from here? - -The dev team has a few improvements planned for the 20.04 release. The changes are mostly on the cosmetics though. There will be new GRUB and Plymouth theme, layout application and welcome screen. - -I downloaded it and tried it in a live session. Here’s what this distribution looks like: - -[Subscribe to our YouTube channel for more Linux videos][14] - -Meanwhile, if you manage to try it on your own, why not share your experience in the comments? If you use Linux Mint, will you switch to Ubuntu Cinnamon in near future? What are your overall opinion about this new project? Do share it in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ubuntu-cinnamon/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment) -[2]: https://mate-desktop.org/ -[3]: https://itsfoss.com/install-cinnamon-on-ubuntu/ -[4]: https://itsfoss.com/best-linux-desktop-environments/ -[5]: https://itsfoss.com/which-ubuntu-install/ -[6]: https://kde.org/ -[7]: https://lxqt.org/ -[8]: https://itsfoss.com/ubuntu-budgie-18-review/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/ubuntu_cinnamon_distribution_screenshot.jpg?ssl=1 -[10]: https://ubuntucinnamon.org/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/ubuntu_cinnamon_remix_screeenshot_1.jpg?ssl=1 -[12]: https://itsfoss.com/ubuntu-19-10-released/ -[13]: https://sourceforge.net/projects/ubuntu-cinnamon-remix/ -[14]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 diff --git a/sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md b/sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md deleted file mode 100644 index 81b00a0ec9..0000000000 --- a/sources/news/20191209 KubeCon gets bigger, the kernel gets better, and more industry trends.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (KubeCon gets bigger, the kernel gets better, and more industry trends) -[#]: via: (https://opensource.com/article/19/12/kubecon-bigger-kernel-better-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -KubeCon gets bigger, the kernel gets better, and more industry trends -====== -A weekly look at open source community, market, and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [KubeCon showed Kubernetes is big, but is it a Unicorn?][2] - -> It’s hard to remember now but there was a time when Kubernetes was a distant No. 3 in terms of container orchestrators being used in the market. It’s also eye opening to now realize that [the firms][3] that hatched the two platforms that [towered over][4] Kubernetes have had to completely re-jigger their business models under the Kubernetes onslaught. -> -> And full credit to the CNCF for attempting to diffuse some of that attention from Kubernetes by spending the vast majority of the KubeCon opening keynote address touting some of the nearly two dozen graduated, incubating, and sandbox projects it also hosts. But, it was really the Big K that stole the show. - -**The impact:** Open source is way more than the source code; governance is a big deal and can be the difference between longevity and irrelevance. Gathering, organizing, and maintaining humans is an entirely different skill set than doing the same for bits, but can have just as big an influence on the success of a project. - -## [Report: Kubernetes use on the rise][5] - -> At the same time, the Datadog report notes that container churn rates are approximately 10 times higher in orchestrated environments. Churn rates in container environments that lack an orchestration platform such as Kubernetes have increased in the last year as well. The average container lifespan at a typical company running infrastructure without orchestration is about two days, down from about six days in mid-2018. In 19% of those environments not running orchestration, the average container lifetime exceeded 30 days. That compares to only 3% of organizations running containers longer than 30 days in Kubernetes environments, according to the report’s findings. - -**The impact**: If your containers aren't churning, you're probably not getting the full benefit of the technology you've adopted. - -## [Upcoming Linux 5.5 kernel improves live patching, scheduling][6] - -> A new WFX Wi-Fi driver for the Silicon Labs WF200 ASIC transceiver is coming to Linux kernel 5.5. This particular wireless transceiver is geared toward low-power IoT devices and uses a 2.4 GHz 802.11b/g/n radio optimized for low power RF performance in crowded RF environments. This new driver can interface via both Serial Peripheral Interface (SPI) and Secure Digital Input Output (SDIO). - -**The impact**: The kernel's continued relevance is a direct result of the never-ending grind to keep being where people need it to be (i.e. basically everywhere). - -## [DigitalOcean Currents: December 2019][7] - -> In that spirit, this fall’s installment of our seasonal Currents report is dedicated to open source for the second year running. We surveyed more than 5800 developers around the world on the overall health and direction of the open source community. When we last checked in with the community in [2018][8], more than half of developers reported contributing to open source projects, and most felt the community was healthy and growing. - -**The impact**: While the good news outweighs the bad, there are a couple of things to keep an eye on: namely, making open source more inclusive and mitigating potential negative impact of big money. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/kubecon-bigger-kernel-better-more-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.sdxcentral.com/articles/opinion-editorial/kubecon-showed-kubernetes-is-big-but-is-it-a-unicorn/2019/11/ -[3]: https://www.sdxcentral.com/articles/news/docker-unloads-enterprise-biz-to-mirantis/2019/11/ -[4]: https://www.sdxcentral.com/articles/news/mesosphere-is-now-d2iq-and-kubernetes-is-its-game/2019/08/ -[5]: https://containerjournal.com/topics/container-ecosystems/report-kubernetes-use-on-the-rise/ -[6]: https://thenewstack.io/upcoming-linux-5-5-kernel-improves-live-patching-scheduling/ -[7]: https://blog.digitalocean.com/digitalocean-currents-december-2019/ -[8]: https://www.digitalocean.com/currents/october-2018/ diff --git a/sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md b/sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md deleted file mode 100644 index 85aef63325..0000000000 --- a/sources/news/20191214 Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates) -[#]: via: (https://opensource.com/article/19/12/python-news-december) -[#]: author: (Christian Heimes https://opensource.com/users/christian-heimes) - -Annual release cycle for Python, new Python Software Foundation fellows from Africa, and more updates -====== -Find out what's going on in the Python community in December. -![Python in a coffee cup.][1] - -The Python Software Foundation (PSF) is a nonprofit organization behind the Python programming language. I am fortunate to be a PSF Fellow (honorable member for life,) a Python core developer, and the liaison between my company, Red Hat, and the PSF. Part of that liaison work is providing updates on what’s happening in the Python community. Here’s a look at what we have going on in December. - -### Upcoming events - -A significant part of the Python community is its in-person events. These events are where users and contributors intermingle and learn together. Here are the big announcements of upcoming opportunities to connect. - -#### PyCon US 2020 - -[PyCon US][2] is by far the largest annual Python event. The next PyCon is April 15-23, 2020, in Pittsburgh. The call for proposals is open to all until December 20, 2019. I’m planning to attend PyCon for the conference and its [famous post-con sprints][3]. - -#### EuroPython - -EuroPython is the largest Python conference in Europe with about 1,000 attendees in the last years. [EP20][4] will be held in Dublin, Ireland, July 20-26, 2020. As a liaison for Red Hat, I’m proud to say that Red Hat sponsored EP18 in Edinburgh and donated the sponsoring tickets to Women Who Code Scotland. - -#### PyData - -[PyData][5] is a separate nonprofit related to the Python community through a focus on data science. They host many international events throughout the year, with upcoming events in [Austin, Texas][6], and [Warsaw, Poland][7] before the end of the year. - -### New PSF fellows from Africa - -The PSF promotes a few members to fellow every quarter. Yesterday, twelve new PSF fellows were [announced][8]. - -I’d like to highlight the four new fellows from Ghana, who are also the organizers of the first pan-African [PyCon Africa][9], which took place in August 2019 in Accra, Ghana. The Python community in Africa is growing at an amazing speed. PyCon Africa 2020 will be in Accra again, and I’m planning to spend my summer vacation there. - -### Annual release cycle for Python - -Python used to release a new major version about every 18 months. This timeline will change with the Python 3.9 release. With [PEP 602,][10] a new major version of Python will be released annually in October. The new cadence means fewer changes between releases and more predictable release dates. October was chosen to align with Linux distribution releases such as Fedora. Miro Hrončok from the Python maintenance team joined the discussion and has helped to find a convenient release date for us; for more details, please see . - -### Steering council election - -The Python Steering Council governs the development of Python. It was established after [Guido van Rossum stepped down][11] as benevolent dictator for life. Python core developers elect a new steering council for every major Python release. For the upcoming term, nine candidates were nominated for five seats on the council (with Guido being nominated, but [withdrawing][12]). See for all the details. Election results are expected to be announced mid-December. - -That covers what’s new in the Python community for December. Stay tuned for more updates in the future and mark your calendars for the conferences mentioned above. - -So you have a great business idea for a wonderful IT product or service, and you want to build your... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/python-news-december - -作者:[Christian Heimes][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/christian-heimes -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) -[2]: https://us.pycon.org/2020/ -[3]: https://opensource.com/article/19/5/pycon-developer-sprints -[4]: https://www.europython-society.org/post/188741002380/europython-2020-venue-and-location-selected -[5]: https://pydata.org/ -[6]: https://pydata.org/austin2019/ -[7]: https://pydata.org/warsaw2019/ -[8]: https://pyfound.blogspot.com/2019/11/python-software-foundation-fellow.html -[9]: https://africa.pycon.org/ -[10]: https://www.python.org/dev/peps/pep-0602/ -[11]: https://opensource.com/article/19/6/command-line-heroes-python -[12]: https://discuss.python.org/t/steering-council-nomination-guido-van-rossum-2020-term/2657/11 diff --git a/sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md b/sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md deleted file mode 100644 index 198d4f8292..0000000000 --- a/sources/news/20191219 2020 technology must haves, a guide to Kubernetes etcd, and more industry trends.md +++ /dev/null @@ -1,63 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (2020 technology must haves, a guide to Kubernetes etcd, and more industry trends) -[#]: via: (https://opensource.com/article/19/12/gartner-ectd-and-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -2020 technology must haves, a guide to Kubernetes etcd, and more industry trends -====== -A weekly look at open source community, market, and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Gartner's top 10 infrastructure and operations trends for 2020][2] - -> “The vast majority of organisations that do not adopt a shared self-service platform approach will find that their DevOps initiatives simply do not scale,” said Winser. "Adopting a shared platform approach enables product teams to draw from an I&O digital toolbox of possibilities, while benefiting from high standards of governance and efficiency needed for scale." - -**The impact**: The breakneck change of technology development and adoption will not slow down next year, as the things you've been reading about for the last two years become things you have to figure out to deal with every day. - -## [A guide to Kubernetes etcd: All you need to know to set up etcd clusters][3] - -> Etcd is a distributed reliable key-value store which is simple, fast and secure. It acts like a backend service discovery and database, runs on different servers in Kubernetes clusters at the same time to monitor changes in clusters and to store state/configuration data that should to be accessed by a Kubernetes master or clusters. Additionally, etcd allows Kubernetes master to support discovery service so that deployed application can declare their availability for inclusion in service. - -**The impact**: This is actually way more than I needed to know about setting up etcd clusters, but now I have a mental model of what that could look like, and you can too. - -## [How the open source model could fuel the future of digital marketing][4] - -> In other words, the broad adoption of open source culture has the power to completely invert the traditional marketing funnel. In the future, prospective customers could be first introduced to “late funnel” materials and then buy into the broader narrative — a complete reversal of how traditional marketing approaches decision-makers today. - -**The impact**: The SEO on this cuts two ways: It can introduce uninitiated marketing people to open source and uninitiated technical people to the ways that technology actually gets adopted. Neat! - -## [Kubernetes integrates interoperability, storage, waits on sidecars][5] - -> In a [recent interview][6], Lachlan Evenson, and was also a lead on the Kubernetes 1.16 release, said sidecar containers was one of the features that team was a “little disappointed” it could not include in their release. -> -> Guinevere Saenger, software engineer at GitHub and lead for the 1.17 release team, explained that sidecar containers gained increased focus “about a month ago,” and that its implementation “changes the pod spec, so this is a change that affects a lot of areas and needs to be handled with care.” She noted that it did move closer to completion and “will again be prioritized for 1.18.” - -**The impact**: You can read between the lines to understand a lot more about the Kubernetes sausage-making process. It's got governance, tradeoffs, themes, and timeframes; all the stuff that is often invisible to consumers of a project. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/gartner-ectd-and-more-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.information-age.com/gartner-top-10-infrastructure-and-operations-trends-2020-123486509/ -[3]: https://superuser.openstack.org/articles/a-guide-to-kubernetes-etcd-all-you-need-to-know-to-set-up-etcd-clusters/ -[4]: https://www.forbes.com/sites/forbescommunicationscouncil/2019/11/19/how-the-open-source-model-could-fuel-the-future-of-digital-marketing/#71b602fb20a5 -[5]: https://www.sdxcentral.com/articles/news/kubernetes-integrates-interoperability-storage-waits-on-sidecars/2019/12/ -[6]: https://kubernetes.io/blog/2019/12/06/when-youre-in-the-release-team-youre-family-the-kubernetes-1.16-release-interview/ diff --git a/sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md b/sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md deleted file mode 100644 index 507915626b..0000000000 --- a/sources/news/20191219 Linux Mint 19.3 -Tricia- Released- Here-s What-s New and How to Get it.md +++ /dev/null @@ -1,165 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Mint 19.3 “Tricia” Released: Here’s What’s New and How to Get it) -[#]: via: (https://itsfoss.com/linux-mint-19-3/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Linux Mint 19.3 “Tricia” Released: Here’s What’s New and How to Get it -====== - -_**Linux Mint 19.3 “Tricia” has been released. See what’s new in it and learn how to upgrade to Linux Mint 19.3.**_ - -The Linux Mint team finally announced the release of Linux Mint 19.3 codenamed ‘Tricia’ with useful feature additions along with a ton of improvements under-the-hood. - -This is a point release based on the latest **Ubuntu 18.04.3** and it comes packed with the **Linux kernel 5.0**. - -I downloaded and quickly tested the edition featuring the [Cinnamon 4.4][1] desktop environment. You may also try the Xfce or MATE edition of Linux Mint 19.3. - -### Linux Mint 19.3: What’s New? - -![Linux Mint 19 3 Desktop][2] - -While being an LTS release that will be supported until 2023 – it brings in a couple of useful features and improvements. Let me highlight some of them for you. - -#### System Reports - -![][3] - -Right after installing Linux Mint 19.3 (or upgrading it), you will notice a warning icon on the right side of the panel (taskbar). - -When you click on it, you should be displayed a list of potential issues that you can take care of to ensure the best out of Linux Mint experience. - -For starters, it will suggest that you should create a root password, install a language pack, or update software packages – in the form of a warning. This is particularly useful to make sure that you perform important actions even after following the first set of steps on the welcome screen. - -#### Improved Language Settings - -Along with the ability to install/set a language, you will also get the ability to change the time format. - -So, the language settings are now more useful than ever before. - -#### HiDPI Support - -As a result of [HiDPI][4] support, the system tray icons will look crisp and overall, you should get a pleasant user experience on a high-res display. - -#### New Applications - -![Linux Mint Drawing App][5] - -With the new release, you will n longer find “**GIMP**” pre-installed. - -Even though GIMP is a powerful utility, they decided to add a simpler “**Drawing**” app to let users to easily crop/resize images while being able to tweak it a little. - -Also, **Gnote** replaces **Tomboy** as the default note-taking application on Linux Mint 19.3 - -In addition to both these replacements, Celluloid video player has also been added instead of Xplayer. In case you did not know, Celluloid happens to be one of the [best open source video players][6] for Linux. - -#### Cinnamon 4.4 Desktop - -![Cinnamon 4 4 Desktop][7] - -In my case, the new Cinnamon 4.4 desktop experience introduces a couple of new abilities like adjusting/tweaking the panel zones individually as you can see in the screenshot above. - -#### Other Improvements - -There are several other improvements including more customizability options in the file manager and so on. - -You can read more about the detailed changes in the [official release notes][8]. - -[Subscribe to our YouTube channel for more Linux videos][9] - -### Linux Mint 19 vs 19.1 vs 19.2 vs 19.3: What’s the difference? - -You probably already know that Linux Mint releases are based on Ubuntu long term support releases. Linux Mint 19 series is based on Ubuntu 18.04 LTS. - -Ubuntu LTS releases get ‘point releases’ on the interval of a few months. Point release basically consists of bug fixes and security updates that have been pushed since the last release of the LTS version. This is similar to the Service Pack concept in Windows XP if you remember it. - -If you are going to download Ubuntu 18.04 which was released in April 2018 in 2019, you’ll get Ubuntu 18.04.2. The ISO image of 18.04.2 will consist of 18.04 and the bug fixes and security updates applied till 18.04.2. Imagine if there were no point releases, then right after [installing Ubuntu 18.04][10], you’ll have to install a few gigabytes of system updates. Not very convenient, right? - -But Linux Mint has it slightly different. Linux Mint has a major release based on Ubuntu LTS release and then it has three minor releases based on Ubuntu LTS point releases. - -Mint 19 was based on Ubuntu 18.04, 19.1 was based on 18.04.1 and Mint 19.2 is based on Ubuntu 18.04.2. Similarly, Mint 19.3 is based on Ubuntu 18.04.3. It is worth noting that all Mint 19.x releases are long term support releases and will get security updates till 2023. - -Now, if you are using Ubuntu 18.04 and keep your system updated, you’ll automatically get updated to 18.04.1, 18.04.2 etc. That’s not the case in Linux Mint. - -Linux Mint minor releases also consist of _feature changes_ along with bug fixes and security updates and this is the reason why updating Linux Mint 19 won’t automatically put you on 19.1. - -Linux Mint gives you the option if you want the new features or not. For example, Mint 19.3 has Cinnamon 4.4 and several other visual changes. If you are happy with the existing features, you can stay on Mint 19.2. You’ll still get the necessary security and maintenance updates on Mint 19.2 till 2023. - -Now that you understand the concept of minor releases and want the latest minor release, let’s see how to upgrade to Mint 19.3. - -### Linux Mint 19.3: How to Upgrade? - -No matter whether you have Linux Mint 19.1 or 19, you can follow these steps to [upgrade Linux Mint version][11]. - -**Note**: _You should consider making a system snapshot (just in case) for backup. In addition, the Linux Mint team advises you to disable the screensaver and upgrade Cinnamon spices (if installed) from the System settings._ - -![][12] - - 1. Launch the Update Manager. - 2. Now, refresh it to load up the latest available updates (or you can change the mirror if you want). - 3. Once done, simply click on the Edit button to find “**Upgrade to Linux Mint 19.3 Tricia**” button similar to the image above. - 4. Finally, just follow the on-screen instructions to easily update it. - - - -Based on your internet connection, it should take anything between a couple of minutes to 30 minutes. - -### Don’t see Mint 19.3 update yet? Here’s what you can do - -If you don’t see the option to upgrade to Linux Mint 19.3 Tricia, don’t lose hope. Here are a couple of things you can do. - -#### **Step 1: Make sure to use mint-upgrade-info version 1.1.3** - -Make sure that mint-upgrade-info is updated to version 1.1.3. You can try the install command that will update it to a newer version (if there is any). - -``` -sudo apt install mint-upgrade-info -``` - -#### **Step 2: Switch to default software sources** - -Chances are that you are using a mirror closer to you to get faster software downloads. But this could cause a problem as the mirrors might not have the new upgrade info yet. - -Go to Software Source and change the sources to default. Now run the update manager again and see if Mint 19.3 upgrade is available. - -### Download Linux Mint 19.3 ‘Tricia’ - -If you want to perform a fresh install, you can easily download the latest available version from the official download page (depending on what edition you want). - -You will also find multiple mirrors available to download the ISOs – feel free to try the nearest mirror for potentially faster download. - -[Linux Mint 19.3][13] - -**Wrapping Up** - -Have you tried Linux Mint 19.3 yet? Let me know your thoughts in the comments down below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/linux-mint-19-3/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://github.com/linuxmint/cinnamon/releases/tag/4.4.0 -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-19-3-desktop.jpg?ssl=1 -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-system-report.jpg?ssl=1 -[4]: https://wiki.archlinux.org/index.php/HiDPI -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-mint-drawing-app.jpg?ssl=1 -[6]: https://itsfoss.com/video-players-linux/ -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/cinnamon-4-4-desktop.jpg?ssl=1 -[8]: https://linuxmint.com/rel_tricia_cinnamon.php -[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[10]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ -[11]: https://itsfoss.com/upgrade-linux-mint-version/ -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/mintupgrade.png?ssl=1 -[13]: https://linuxmint.com/download.php diff --git a/sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md b/sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md deleted file mode 100644 index 3cf9d05097..0000000000 --- a/sources/news/20191221 Eliminating gender bias in open source software development, a database of microbes, and more open source news.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Eliminating gender bias in open source software development, a database of microbes, and more open source news) -[#]: via: (https://opensource.com/article/19/12/news-december-21) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Eliminating gender bias in open source software development, a database of microbes, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we take a look at eliminating gender bias in open source software development, an open source database of microbes, an open source index for cooperatives, and more! - -### Eliminating gender bias from open source development - -It's a sad fact that certain groups, among them women, are woefully underrepresented in open source projects. It's like a bug in the open source development process. Fortunately, there are initiatives to make that under representation a thing of the past. A study out of Oregon State University (OSU) intends to resolve the issue of the lack of women in open source development by "[finding these bugs and proposing redesigns around them][2], leading to more gender-inclusive tools used by software developers." - -The study will look at tools commonly used in open source development — including Eclipse, GitHub, and Hudson — to determine if they "significantly discourage newcomers, especially women, from joining OSS projects." According to Igor Steinmacher, one of the principal investigators of the study, the study will examine "how people use tools because the 'bugs' may be embedded in how the tool was designed, which may place people with different cognitive styles at a disadvantage." - -The developers of the tools being studied will walk through their software and answer questions based on specific personas. The researchers at OSU will suggest ways to redesign the software to eliminate gender bias and will "create a list of best practices for fixing gender-bias bugs in both products and processes." - -### Canadian university compiles open source microbial database - -What do you do when you have a vast amount of data but no way to effectively search and build upon it? You turn it into a database, of course. That's what researchers at Simon Fraser University in British Columbia, along with collaborators from around the globe, did with [information about chemical compounds created by bacteria and fungi][3]. Called the Natural Products Atlas, the database "holds information on nearly 25,000 natural compounds and serves as a knowledge base and repository for the global scientific community." - -Licensed under a Creative Commons Attribution 4.0 International License, the Natural Products Atlas "holds information on nearly 25,000 natural compounds and serves as a knowledge base and repository for the global scientific community." The [website for the Natural Products Atlas][4] hosts the database also includes a number of visualization tools and is fully searchable. - -Roger Linington, an associate professor at SFU who spearheaded the creation of the database, said that having "all the available data in one place and in a standardized format means we can now index natural compounds for anyone to freely access and learn more about." - -### Open source index for cooperatives - -Europe has long been a hotbed of both open source development and open source adoption. While European governments strongly advocate open source, non profits have been following suit. One of those is Cooperatives Europe, which is developing "[open source software to allow users to index co-op information and resources in a standardised way][5]." - -The idea behind the software, called Coop Starter, reinforces the [essential freedoms of free software][6]: it's intended to provide "education, training and information. The software may be used and repurposed by the public for their own needs and on their own infrastructure." Anyone can use it "to reference existing material on co-operative entrepreneurship" and can contribute "by sharing resources and information." - -The [code for Coop Starter][7], along with a related WordPress plugin, is available from Cooperative Europe's GitLab repository. - -#### In other news - - * [Nancy recognised as France’s top digital free and collaborative public service][8] - * [Open Source and AI: Ready for primetime in government?][9] - * [Open Software Means Kinder Science][10] - * [New Open-Source CoE to be launched by Wipro and Oman’s Ministry of Tech & Communication][11] - - - -_Thanks, as always, to Opensource.com staff members and [Correspondents][12] for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/news-december-21 - -作者:[Scott Nesbitt][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/scottnesbitt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://techxplore.com/news/2019-12-professors-gender-biased-bugs-open-source-software.html -[3]: https://www.sfu.ca/sfunews/stories/2019/12/sfu-global-collaboration-creates-world-s-first-open-source-datab.html -[4]: https://www.npatlas.org/joomla/ -[5]: https://www.thenews.coop/144412/sector/regional-organisations/cooperatives-europe-builds-open-source-index-for-the-co-op-movement/ -[6]: https://www.gnu.org/philosophy/free-sw.en.html -[7]: https://git.happy-dev.fr/startinblox/applications/coop-starter -[8]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/territoire-numerique-libre -[9]: https://federalnewsnetwork.com/commentary/2019/12/open-source-and-ai-ready-for-primetime-in-government/ -[10]: https://blogs.scientificamerican.com/observations/open-software-means-kinder-science/ -[11]: https://www.indianweb2.com/2019/12/11/new-open-source-coe-to-be-launched-by-wipro-and-omans-ministry-of-tech-communication/ -[12]: https://opensource.com/correspondent-program diff --git a/sources/news/20200116 It-s the end for Windows Server 2008 support.md b/sources/news/20200116 It-s the end for Windows Server 2008 support.md deleted file mode 100644 index 35e25fc844..0000000000 --- a/sources/news/20200116 It-s the end for Windows Server 2008 support.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (It’s the end for Windows Server 2008 support) -[#]: via: (https://www.networkworld.com/article/3513980/it-s-the-end-for-windows-server-2008-support.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -It’s the end for Windows Server 2008 support -====== -Microsoft recommends migrating Server 2008 workloads to Azure cloud services while enterprises modernize their apps for Windows Server 2016 or 2019 deployments. -PaulFleet / Getty Images / Microsoft - -This week's Patch Tuesday marked the end of the line for both Windows 7 and Windows Server 2008 (and 2008 R2). No more fixes will be issued for the two aged operating systems, unless you purchase a pricey extended service license. - -On the Windows 7 front, Microsoft has done a good job getting Windows 10 deployed through its aggressive (perhaps too aggressive) upgrade program. According to StatCounter, Windows 10 now accounts for 65% of the [worldwide desktop Windows market share][1], and Windows 7 is down to 27%. - -**RELATED:** [What to know before upgrading to Windows Server 2019][2] - -But while Windows 7 has gotten all the attention, Server 2008 actually has a larger share of holdouts, and in some ways, its end-of-life milestone is more significant. At last July’s Inspire show, a Microsoft executive said in an interview with cloud storage provider and Microsoft partner Carbonite that [60% of its current Windows Server][3] installed base was running Server 2008, accounting for 24 million instances.  - -[][4] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][4] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -“There are a lot [of customers sticking with Server 2008],” says analyst Tim Crawford of research and advisory firm [AVOA][5]. “You could categorize them into those that either a) use functions specific to WS2008, and b) those that use a version of an application that is only compatible with WS2008. Upgrading is often easier said than done. Especially if the application is a custom app with lots of tentacles.” - -Server 2008 is based on the Windows Vista codebase, which should be reason alone to jettison it. But Windows Server 2016 and Windows Server 2019 are built on Windows 10, which means apps heavily dependent on the OS ecosystem might be hard to move since the internals are so different. - -“I do work with folks that are still running Windows Server 2008. They understand the ramifications of EOL for support. But most are in a predicament where they aren’t able to move the applications for a number of reasons, including application compatibility, location, etc.," Crawford says. - -For those apps that are challenging to move, he recommends isolating the system as much as possible to protect it, and putting in a plan to do what is needed to the applications to prepare them for movement as quickly as possible. - -Microsoft offers and recommends [Azure migration][6], so Server 2008 apps can [run in an Azure instance][7] while they are modernized for Server 2019 and then deployed on premises. - -Migration should be the paramount effort, because if you are running Server 2008 then you're using hardware that's at least eight years old and potentially 12 years old. That’s ancient in technology terms, and if nothing else, the hardware is going to fail. - -One of the headaches for admins is you cannot migrate Server 2008 directly to 2016 or 2019. You have to upgrade to Server 2012 as an intermediate step. So you are better off biting the bullet and migrating the apps to 2019 rather than spending time on two OS migrations. - -Microsoft has provided [resources][8] for Server 2008 users, including a migration guide and help moving to Azure. - -Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3513980/it-s-the-end-for-windows-server-2008-support.html - -作者:[Andy Patrizio][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Andy-Patrizio/ -[b]: https://github.com/lujun9972 -[1]: https://gs.statcounter.com/os-version-market-share/windows/desktop/worldwide#monthly-201807-201908 -[2]: https://www.networkworld.com/article/3512020/what-to-know-before-upgrading-from-windows-server-2016-to-server-2019.html -[3]: https://www.carbonite.com/blog/article/2019/07/schuster-azure-migration-and-office-365-top-partner-opportunities -[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[5]: https://avoa.com/ -[6]: https://cloudblogs.microsoft.com/windowsserver/2019/12/17/protect-workloads-still-running-on-windows-server-2008-and-2008-r2/ -[7]: https://www.networkworld.com/article/3300165/microsoft-lures-win-server-2008-users-toward-azure.html -[8]: https://www.microsoft.com/en-us/cloud-platform/windows-server-2008 -[9]: https://www.facebook.com/NetworkWorld/ -[10]: https://www.linkedin.com/company/network-world From 3110b8c5f73f00656dafcc0f942a27ac70908a62 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 22:58:47 +0800 Subject: [PATCH 618/676] =?UTF-8?q?=E6=B8=85=E9=99=A4=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...y Banning Linux Gamers on Battlefield V.md | 86 ------------------- 1 file changed, 86 deletions(-) delete mode 100644 sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md diff --git a/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md b/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md deleted file mode 100644 index b0818e5fe8..0000000000 --- a/sources/news/20200104 Shocking- EA is Permanently Banning Linux Gamers on Battlefield V.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (fuzheng1998) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Shocking! EA is Permanently Banning Linux Gamers on Battlefield V) -[#]: via: (https://itsfoss.com/ea-banning-linux-gamers/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Shocking! EA is Permanently Banning Linux Gamers on Battlefield V -====== - -Only when I thought that [EA][1] as a game company might be getting better after [its decision to make its games available on Steam][2] – but it looks like that isn’t the case. - -In a [Reddit thread][3], a lot of Linux players seem to complain about getting banned by FairFight (which is the server-side anti-cheat engine used for BF V) just because they chose to play Battlefield V (BF V) on [Linux using Wine][4]. - -![][5] - -### Is this a widespread issue? - -Unfortunately, it seems to be the case with a number of Linux players using Wine to play Battlefield V on Linux. - -You can also find users on [Lutris Gaming forums][6] and [Battlefield forums][7] talking about it. - -Of course, the userbase on Linux playing Battlefield V isn’t huge – but it still matters, right? - -### What’s exactly the issue here? - -It looks like EA’s anti-cheat tech considers [DXVK][8] (Vulkan-based implementation of DirectX which tries to solve compatibility issues) as cheating. - -So, basically, the compatibility layer that is being utilized to make it possible to run Battlefield V is being detected as a modified file through which you’re “**potentially**” cheating. - -![Battlefield V on Lutris][9] - -Even though this could be an innocent problem for the anti-cheat engine but EA does not seem to acknowledge that at all. - -Here’s what they respond with when one of the players wrote an email to EA in order to lift the ban: - -> After thoroughly investigating your account and concern, we found that your account was actioned correctly and will not remove this sanction from your account. - -Also, with all this going on, [Lutris Gaming][10] seems to be quite furious on EA’s behavior with the permanent bans: - -> It has come to our attention that several Battlefield 5 players have recently been banned for playing on Linux, and that EA has chosen not to revert these wrongful punishments. Due to this, we advise to refrain from playing any multiplayer games published by [@EA][11] in the future. -> -> — Lutris Gaming (@LutrisGaming) [January 2, 2020][12] - -### Not just Battlefield V, it’s the same with Destiny 2 - -As pointed by a Redditor in the same thread, Bungie also happens to consider Wine as an emulator (which is against their policy) and has banned players on Linux a while back. - -### EA needs to address the issue - -_We have reached out to EA for a comment on the issue_. _And, we’re still waiting for a response._ - -I shall update the article if we have an official response from EA. However, considering Blizzard as an example, they should actually work on fixing the issue and [reverse the bans on players using Linux][13]. - -I know that BF V does not offer native Linux support – but supporting the compatibility layer and not considering it as cheating would allow Linux users to experience the game which they rightfully own (or considering to purchase). - -What are your thoughts on this? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ea-banning-linux-gamers/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.ea.com/ -[2]: https://thenextweb.com/gaming/2019/10/29/ea-games-are-coming-back-to-steam-but-you-still-need-origin/ -[3]: https://www.reddit.com/r/linux/comments/ej3q2p/ea_is_permanently_banning_linux_players_on/ -[4]: https://itsfoss.com/install-latest-wine/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/reddit-thread-ea.jpg?ssl=1 -[6]: https://forums.lutris.net/t/ea-banning-dxvk-on-battlefield-v/7810 -[7]: https://forums.battlefield.com/en-us/discussion/197938/ea-banning-dxvk-on-battlefield-v-play-linux -[8]: https://github.com/doitsujin/dxvk -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/battlefield-v-lutris-gaming.png?ssl=1 -[10]: https://lutris.net/ -[11]: https://twitter.com/EA?ref_src=twsrc%5Etfw -[12]: https://twitter.com/LutrisGaming/status/1212827248430059520?ref_src=twsrc%5Etfw -[13]: https://www.altchar.com/game-news/blizzard-unbans-overwatch-players-who-used-linux-os-agF9y0G2gWjn From ed7a5bf514fc73328748904a1462dea75044319a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 23:17:36 +0800 Subject: [PATCH 619/676] PRF --- .../tech/20200115 6 handy Bash scripts for Git.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/translated/tech/20200115 6 handy Bash scripts for Git.md b/translated/tech/20200115 6 handy Bash scripts for Git.md index 93a0d97796..c79d228fad 100644 --- a/translated/tech/20200115 6 handy Bash scripts for Git.md +++ b/translated/tech/20200115 6 handy Bash scripts for Git.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (6 handy Bash scripts for Git) @@ -12,9 +12,9 @@ > 当使用 Git 存储库时,这六个 Bash 脚本将使你的生活更轻松。 -![Digital hand surrounding by objects, bike, light bulb, graphs][1] +![](https://img.linux.net.cn/data/attachment/album/202001/18/231713jegbk8fyek798gxb.jpg) -我编写了许多 Bash 脚本,这些脚本使我在使用 Git 存储库时工作更加轻松。我的许多同事说没有必要;我所做的一切都可以用 Git 命令完成。虽然这可能是正确的,但我发现脚本远比尝试找出适当的 Git 命令来执行我想要的操作更加方便。 +我编写了许多 Bash 脚本,这些脚本使我在使用 Git 存储库时工作更加轻松。我的许多同事说没有必要:我所做的一切都可以用 Git 命令完成。虽然这可能是正确的,但我发现脚本远比尝试找出适当的 Git 命令来执行我想要的操作更加方便。 ### 1、gitlog @@ -126,7 +126,7 @@ Compare script generated at: /tmp/compare_mismatches.sh ### 6、gitlog.find -最后,我有一个 `gitlog.find` 脚本,可以帮助我识别补丁程序的上游版本在哪里以及每个补丁程序的当前状态。它通过匹配补丁说明来实现。它还会生成一个比较脚本(再次使用了 Kompare),以将当前补丁与上游对应补丁进行比较: +最后,我有一个 `gitlog.find` 脚本,可以帮助我识别补丁程序的上游版本在哪里以及每个补丁的当前状态。它通过匹配补丁说明来实现。它还会生成一个比较脚本(再次使用了 Kompare),以将当前补丁与上游对应补丁进行比较: ``` $ gitlog.find @@ -498,7 +498,7 @@ via: https://opensource.com/article/20/1/bash-scripts-git 作者:[Bob Peterson][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6f7dce0842a80c0bc4ecc5ad05d9cd88a1e9fec5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 Jan 2020 23:18:26 +0800 Subject: [PATCH 620/676] PUB @wxy https://linux.cn/article-11797-1.html --- .../20200115 6 handy Bash scripts for Git.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200115 6 handy Bash scripts for Git.md (99%) diff --git a/translated/tech/20200115 6 handy Bash scripts for Git.md b/published/20200115 6 handy Bash scripts for Git.md similarity index 99% rename from translated/tech/20200115 6 handy Bash scripts for Git.md rename to published/20200115 6 handy Bash scripts for Git.md index c79d228fad..8a43bb3220 100644 --- a/translated/tech/20200115 6 handy Bash scripts for Git.md +++ b/published/20200115 6 handy Bash scripts for Git.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11797-1.html) [#]: subject: (6 handy Bash scripts for Git) [#]: via: (https://opensource.com/article/20/1/bash-scripts-git) [#]: author: (Bob Peterson https://opensource.com/users/bobpeterson) From 0e3c0feb1c1378f28c860c26ad6cfcf949245c25 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 19 Jan 2020 00:57:46 +0800 Subject: [PATCH 621/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200119=20How=20?= =?UTF-8?q?to=20Set=20or=20Change=20Timezone=20in=20Ubuntu=20Linux=20[Begi?= =?UTF-8?q?nner=E2=80=99s=20Tip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md --- ...imezone in Ubuntu Linux -Beginner-s Tip.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md diff --git a/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md b/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md new file mode 100644 index 0000000000..869e8b1d79 --- /dev/null +++ b/sources/tech/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Set or Change Timezone in Ubuntu Linux [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/change-timezone-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Set or Change Timezone in Ubuntu Linux [Beginner’s Tip] +====== + +[When you install Ubuntu][1], it asks you to set timezone. If you chose a wrong timezone or if you have moved to some other part of the world, you can easily change it later. + +### How to change Timezone in Ubuntu and other Linux distributions + +There are two ways to change the timezone in Ubuntu. You can use the graphical settings or use the timedatectl command in the terminal. You may also change the /etc/timezone file directly but I won’t advise that. + +I’ll show you both graphical and terminal way in this beginner’s tutorial: + + * [Change timezone in Ubuntu via GUI][2] (suitable for desktop users) + * [Change timezone in Ubuntu via command line][3] (works for both desktop and servers) + + + +![][4] + +#### Method 1: Change Ubuntu timezone via terminal + +[Ubuntu][5] or any other distributions using systemd can use the timedatectl command to set timezone in Linux terminal. + +You can check the current date and timezone setting using timedatectl command without any option: + +``` +[email protected]:~$ timedatectl + Local time: Sat 2020-01-18 17:39:52 IST + Universal time: Sat 2020-01-18 12:09:52 UTC + RTC time: Sat 2020-01-18 12:09:52 + Time zone: Asia/Kolkata (IST, +0530) + System clock synchronized: yes +systemd-timesyncd.service active: yes + RTC in local TZ: no +``` + +As you can see in the output above, my system uses Asia/Kolkata. It also tells me that it is 5:30 hours ahead of GMT. + +To set a timezone in Linux, you need to know the exact timezone. You must use the correct format of the timezone (which is Continent/City). + +To get the timezone list, use the _list-timezones_ option of _timedatectl_ command: + +``` +timedatectl list-timezones +``` + +It will show you a huge list of the available time zones. + +![Timezones List][6] + +You can use the up and down arrow or PgUp and PgDown key to move between the pages. + +You may also grep the output and search for your timezone. For example, if you are looking for time zones in Europe, you may use: + +``` +timedatectl list-timezones | grep -i europe +``` + +Let’s say you want to set the timezone to Paris. The timezone value to be used here is Europe/Paris: + +``` +timedatectl set-timezone Europe/Paris +``` + +It won’t show any success message but the timezone is changed instantly. You don’t need to restart or log out. + +Keep in mind that though you don’t need to become root user and use sudo with the command but your account still need to have admin rights in order to change the timezone. + +You can verify the changed time and timezone by using the [date command][7]: + +``` +[email protected]:~$ date +Sat Jan 18 13:56:26 CET 2020 +``` + +#### Method 2: Change Ubuntu timezone via GUI + +Press the super key (Windows key) and search for Settings: + +![Applications Menu Settings][8] + +Scroll down a little and look for Details in the left sidebar: + +![Go to Settings -> Details][9] + +In Details, you’ll fine Date & Time in the left sidebar. Here, you should turn off Automatic Time Zone option (if it is enabled) and then click on the Time Zone: + +![In Details -> Date & Time, turn off the Automatic Time Zone][10] + +When you click the Time Zone, it will open an interactive map and you can click on the geographical location of your choice and close the window. + +![Select a timezone][11] + +You don’t have to do anything other than closing this map after selecting the new timezone. No need to logout or [shutdown Ubuntu][12]. + +I hope this quick tutorial helped you to change timezone in Ubuntu and other Linux distributions. If you have questions or suggestions, please let me know. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/change-timezone-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-ubuntu/ +[2]: tmp.bHvVztzy6d#change-timezone-gui +[3]: tmp.bHvVztzy6d#change-timezone-command-line +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/Ubuntu_Change-_Time_Zone.png?ssl=1 +[5]: https://ubuntu.com/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/timezones_in_ubuntu.jpg?ssl=1 +[7]: https://linuxhandbook.com/date-command/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/settings_detail_ubuntu.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu.jpg?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu_2.jpg?ssl=1 +[12]: https://itsfoss.com/schedule-shutdown-ubuntu/ From 94cca4d8c50ad967d844c8bab80319d6899aabca Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 19 Jan 2020 00:58:31 +0800 Subject: [PATCH 622/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200118=20Keep?= =?UTF-8?q?=20a=20journal=20of=20your=20activities=20with=20this=20Python?= =?UTF-8?q?=20program?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200118 Keep a journal of your activities with this Python program.md --- ...our activities with this Python program.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20200118 Keep a journal of your activities with this Python program.md diff --git a/sources/tech/20200118 Keep a journal of your activities with this Python program.md b/sources/tech/20200118 Keep a journal of your activities with this Python program.md new file mode 100644 index 0000000000..b5d3cf93a4 --- /dev/null +++ b/sources/tech/20200118 Keep a journal of your activities with this Python program.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keep a journal of your activities with this Python program) +[#]: via: (https://opensource.com/article/20/1/python-journal) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Keep a journal of your activities with this Python program +====== +Jrnl creates a searchable, timestamped, exportable, and (if you want) +encrypted log of your daily activities. Learn more in the eighth in our +series on 20 ways to be more productive with open source in 2020. +![Writing in a notebook][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Journaling with jrnl + +At my workplace, many of us post an "end of day" status to Slack before we leave for the day. With a lot of projects going on and a global team, it is a pretty good way to share what you got done, what isn't done, and what you need help with. But some days are so busy, so hectic that I can't remember what I did. And this is where journaling comes in. + +![jrnl][2] + +It's pretty easy to keep a text editor open and just add a line when you do something. But it can be challenging to go back and figure out when you make a particular note or pull out related lines quickly and easily. Fortunately, [jrnl][3] is here to help. + +Jrnl allows you to enter a quick entry from your command line, search past entries, and export to rich text formats like HTML and Markdown. You can have multiple journals, meaning you can keep your work entries separated from private ones. It stores entries as plain text, so even if jrnl stops working, you have your data. + +Since jrnl is a Python program, the easiest way to install it is with **pip3 install jrnl**; this will make sure you get the latest and greatest version. On its first run, it will ask some questions, and then you are good to go. + +![jrnl's first run][4] + +Now, whenever you need to make a note or log work, simply type **jrnl <some text>,** and it will be logged with a timestamp to the default file. You can search for entries on a specific date with **jrnl -on YYYY-MM-DD**, entries since a date with **jrnl -from YYYY-MM-DD**, and entries up to a specific date with **jrnl -to YYYY-MM-DD**. Search terms can be combined with the **-and** parameter, allowing for searches like **jrnl -from 2019-01-01 -and -to 2019-12-31**. + +You can also edit entries in the journal with the **\--edit** command-line flag. Before you do, set up your default editor for entries by editing the file **~/.config/jrnl/jrnl.yaml**. This is also where you can specify what files to use for journals, what special character to use for tags, and a few other options. Right now, the important thing is to set the editor. I use Vim, and jrnl's documentation has some [helpful hints][5] for using other editors like VSCode and Sublime Text. + +![Example jrnl config file][6] + +Jrnl can also encrypt journal files. By setting the global **encrypt** variable, you'll tell jrnl to encrypt all the journals you have defined. Encryption can also be set per file by adding **encrypt: true** to the definition in the configuration file. + + +``` +journals: +  default: ~/journals/journal.txt +  work: ~/journals/work.txt +  private: +    journal: ~/journals/private.txt +    encrypt: true +``` + +If a journal isn't already encrypted, you will be prompted for the password on any actions for that journal. The journal file will be stored encrypted on disk and safe from prying eyes. [The jrnl documentation][7] has a lot more information on how it works, what ciphers it uses, and so on. + +![Encrypted jrnl file][8] + +Journaling helps me remember what I did when and find it later when I need it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/python-journal + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook) +[2]: https://opensource.com/sites/default/files/uploads/productivity_8-1.png (jrnl) +[3]: https://jrnl.sh/ +[4]: https://opensource.com/sites/default/files/uploads/productivity_8-2.png (jrnl's first run) +[5]: https://jrnl.sh/recipes/#external-editors +[6]: https://opensource.com/sites/default/files/uploads/productivity_8-3.png (Example jrnl config file) +[7]: https://jrnl.sh/encryption/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_8-4.png (Encrypted jrnl file) From 26cbf9dc4e88111b8126a8c313d4319938d84988 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 19 Jan 2020 00:58:58 +0800 Subject: [PATCH 623/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200118=207=20th?= =?UTF-8?q?ings=20I=20learned=20from=20starting=20an=20open=20source=20pro?= =?UTF-8?q?ject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200118 7 things I learned from starting an open source project.md --- ...ed from starting an open source project.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20200118 7 things I learned from starting an open source project.md diff --git a/sources/tech/20200118 7 things I learned from starting an open source project.md b/sources/tech/20200118 7 things I learned from starting an open source project.md new file mode 100644 index 0000000000..4742064f15 --- /dev/null +++ b/sources/tech/20200118 7 things I learned from starting an open source project.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 things I learned from starting an open source project) +[#]: via: (https://opensource.com/article/20/1/open-source-project) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +7 things I learned from starting an open source project +====== +It's not really about project mechanics at all. +![Stickers from all different open source projects and communities][1] + +I'm currently involved—heavily involved—in [Enarx][2], an open source (of course!) project to support running sensitive workloads on untrusted hosts. I've had involvement in various open source projects over the years, but this is the first for which I'm one of the founders. We're at the stage now where we've got a fair amount of code, quite a lot of documentation, a logo, and (important!) stickers. The project will hopefully be included in a Linux Foundation group—the [Confidential Computing Consortium][3]—so things are going very well indeed. + +I thought it might be useful to reflect on some of the things we did to get things going. To be clear, Enarx is a particular type of project, one that we believe has commercial and enterprise applications. It's also not mature yet, and we'll have hurdles and challenges along the way. What's more, the route we've taken won't be right for all projects, but hopefully, there's enough here to give a few pointers to other projects or people considering starting one up. + +The first thing I'd say is that there's lots of help to be had out there. I'd start with Opensource.com, where you'll find [lots of guidance][4]. I'll follow up by saying that, however much of it you follow, you'll still get things wrong. That said, here's my list of things to consider when starting an open source project. + +### 1\. Aim for critical mass + +I'm very lucky to work at the amazing [Red Hat][5], where everything we do is open source and where we take open source and community very seriously. I've heard it called a "critical mass" company—in order to get something taken seriously, you need to get enough people interested in it that it's difficult to ignore. Enarx's two co-founders—Nathaniel McCallum and I—are both very enthusiastic about the project and have spent a lot of time gaining sponsors within the organisation (you know who you are, and we thank you—we also know we haven't done a good enough job with you on all occasions!) and "selling" it to engineers to get them interested enough that it was difficult to stop. + +Some projects just bobble along with one or two contributors, but if you want to attract people and attention, getting a good set of people together who can get momentum going is a must. + +### 2\. Create a demo + +If you want to get people involved, a demo is great. It doesn't necessarily need to be polished, but it does need to show that what you're doing is possible and that you know what you're doing. For early demos, you may be talking about command-line output; that's fine if what you're providing isn't a user interface (UI) product. Being able to talk about what you're doing and convey both your passion and the importance of the project is a great boon. People like to be able to _see_ or _experience_ something, and it's much easier to communicate your enthusiasm if they have something real that expresses that. + +### 3\. Choose a license + +Once you have code and it's open source, you want other people to be able to contribute. This may seem like an unimportant step, but selecting an appropriate open source licence[1][6] will allow other people to contribute on well-understood and defined terms, making it easier for them to be involved—and for the organisations for which they work to allow them to do so. + +### 4\. Get documentation + +You might think that developer documentation is the most important to get out there—otherwise, how will other people get involved in coding? I disagree, at least to start with. For a small project, you can probably scale to a few more people just by explaining what the code does, what it should do, and what's missing. However, if there's no documentation available to explain what it's for and how it's going to help people, then why would anyone bother even looking at it? + +This doesn't need to be polished marketing copy, and it doesn't need to be serious, but it does need to convey to people why they should care. It's also going to help you with the first point I mentioned, attaining critical mass, as being able to point to documentation, use cases, and the rest will help convince people that you've thought through the _point_ of your project. We've used a GitHub wiki as our main documentation hub, and we try to update it with new information as we generate it. This is an area, to be clear, where we could do better. But at least we know that. + +### 5\. Be visible + +People aren't going to find out about you unless you're visible. We were incredibly lucky in that the Confidential Computing Consortium was formed just as we were beginning to get to a level of critical mass, and we immediately had a platform to increase our exposure. We have a [Twitter account][7], I publish articles on [my blog][8], and at Opensource.com, we've been lucky enough to have the chance to publish on Red Hat's [now + Next][9] blog, I've done interviews with the press, and we speak at conferences wherever and whenever we can. + +We're very lucky to have these opportunities, and it's clear that not all these approaches are appropriate for all projects, but make use of what you can: the more that people know about you, the more people can contribute. + +### 6\. Be welcoming + +Let's assume that people have found out about you: what's next? Well, they're hopefully going to want to get involved. If they don't feel welcome, then any involvement they have will taper off quickly. Yes, you need documentation (and, after a while, technical documentation, no matter what I said above), but you also need ways for contributors to talk to you and for them to feel that they are valued. We have [Gitter channels][10], and our daily standups are open to anyone who wants to join. Recently, someone opened an issue on our [issues database][11], and during the conversation on that thread, it transpired that our daily standup time doesn't work for them (given their time zone), so we're going to ensure that at least once a week it _does_, and we've assured them that we'll accommodate them. + +### 7\. Work with people you like + +I really, really enjoy meeting and working with the members of the Enarx project team. We get on well, we joke, we laugh, and we share a common aim: to make Enarx successful. I'm a firm believer in doing things you enjoy, where possible. Particularly in the early stages of a project, you need people who are enthusiastic and enjoy working closely together—even if they're geographically separated by thousands of kilometres.[2][12] If they don't get on, there's a decent chance that your and their enthusiasm for the project will falter, that the momentum will be lost, and that the project will end up failing. You won't always get the chance to choose those with whom you work, but if you can, then choose people you like and get on with. + +### Conclusion: People + +I didn't realise it when I started writing this article, but it's not really about project mechanics at all: it's about people. If you read back, you'll find the importance of people visible in every tip, even the one about choosing a license. Open source projects aren't really about code: they're about people, how they share, how they work together, and how they interact. + +I'm certain that your experience of open source projects will vary, and I'd be very surprised if everyone agrees about the top seven things you should do for project success. Arguably, Enarx _isn't_ a success yet, and I shouldn't be giving advice at this stage of our maturity. But when I think back to all of the open source projects that I can think of that _are_ successful, people feature strongly, and I don't think that's a surprise at all. + +* * * + + 1. Or "license," if you're from the US. + 2. Or, in fact, miles. + + + +* * * + +_This article originally appeared on [Alice, Eve, and Bob – a security blog][13] and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-project + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/stickers-osdc-lead.png?itok=2RNn132b (Stickers from all different open source projects and communities) +[2]: https://enarx.io/ +[3]: https://confidentialcomputing.io/ +[4]: https://opensource.com/article/20/1/getting-started-open-source +[5]: https://redhat.com/ +[6]: tmp.3liT27tUaE#1 +[7]: https://twitter.com/enarxproject +[8]: https://aliceevebob.com/ +[9]: https://next.redhat.com/ +[10]: https://gitter.im/enarx/ +[11]: https://github.com/enarx/enarx/issues +[12]: tmp.3liT27tUaE#2 +[13]: https://aliceevebob.com/2019/12/17/7-tips-for-kicking-off-an-open-source-project/ From e27da301f1cb0afdfa8d1ca0c484cf9d83256811 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 19 Jan 2020 07:04:39 +0800 Subject: [PATCH 624/676] Rename sources/tech/20200118 7 things I learned from starting an open source project.md to sources/talk/20200118 7 things I learned from starting an open source project.md --- ...118 7 things I learned from starting an open source project.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200118 7 things I learned from starting an open source project.md (100%) diff --git a/sources/tech/20200118 7 things I learned from starting an open source project.md b/sources/talk/20200118 7 things I learned from starting an open source project.md similarity index 100% rename from sources/tech/20200118 7 things I learned from starting an open source project.md rename to sources/talk/20200118 7 things I learned from starting an open source project.md From c52b867edbce1029d543eab3b0bf1605a8afc09d Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 19 Jan 2020 08:54:22 +0800 Subject: [PATCH 625/676] translating --- ...200114 Organize your email with Notmuch.md | 111 ------------------ ...200114 Organize your email with Notmuch.md | 109 +++++++++++++++++ 2 files changed, 109 insertions(+), 111 deletions(-) delete mode 100644 sources/tech/20200114 Organize your email with Notmuch.md create mode 100644 translated/tech/20200114 Organize your email with Notmuch.md diff --git a/sources/tech/20200114 Organize your email with Notmuch.md b/sources/tech/20200114 Organize your email with Notmuch.md deleted file mode 100644 index c9d5cac441..0000000000 --- a/sources/tech/20200114 Organize your email with Notmuch.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Organize your email with Notmuch) -[#]: via: (https://opensource.com/article/20/1/organize-email-notmuch) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Organize your email with Notmuch -====== -Notmuch indexes, tags, and sorts your email. Learn how to use it in the -fourth article in our series on 20 ways to be more productive with open -source in 2020. -![Filing cabinet for organization][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Index your email with Notmuch - -Yesterday, I talked about how I use OfflineIMAP to [sync my mail][2] to my local machine. Today, I'll talk about how I preprocess all that mail before I read it. - -![Notmuch][3] - -[Maildir][4] is probably one of the most useful mail storage formats out there. And there are a LOT of tools to help with managing your mail. The one I keep coming back to is a little program called [Notmuch][5] that indexes, tags, and searches mail messages. And there are several programs that work with Notmuch to make it even easier to handle a large amount of mail. - -Most Linux distributions include Notmuch, and you can also get it for MacOS. Windows users can access it through Windows Subsystem for Linux ([WSL][6]), but it may require some additional tweaks. - -![Notmuch's first run][7] - -On Notmuch's very first run, it will ask you some questions and create a **.notmuch-config** file in your home directory. Next, index and tag all your mail by running **notmuch new**. You can verify it with **notmuch search tag:new**; this will find all messages with the "new" tag. That's probably a lot of mail since Notmuch uses the "new" tag to indicate messages that are new to it, so you'll want to clean that up. - -Run **notmuch search tag:unread** to find any unread messages; that should result in quite a lot less mail. To remove the "new" tag from messages you've already seen, run **notmuch tag -new not tag:unread**, which will search for all messages without the "unread" tag and remove the "new" tag from them. Now when you run **notmuch search tag:new**, it should show only the unread mail messages. - -Tagging messages in bulk is probably more useful, though, since manually updating tags at every run can be really tedious. The **\--batch** command-line option tells Notmuch to read multiple lines of commands and execute them. There is also the **\--input=filename** option, which reads commands from a file and applies them. I have a file called **tagmail.notmuch** that I use to add tags to mail that is "new"; it looks something like this: - - -``` -# Manage sent, spam, and trash folders --unread -new folder:Trash --unread -new folder:Spam --unread -new folder:Sent - -# Note mail sent specifically to me (excluding bug mail) -+to-me to:kevin at sonney.com and tag:new and not tag:to-me - -# And note all mail sent from me -+sent from:kevin at sonney.com and tag:new and not tag:sent - -# Remove the new tag from messages --new tag:new -``` - -I can then run **notmuch tag --input=tagmail.notmuch** to bulk-process my mail messages after running **notmuch new**, and then I can search on those tags as well. - -Notmuch also supports running pre- and post-new hooks. These scripts, stored in **Maildir/.notmuch/hooks**, define actions to run before (pre-new) and after (post-new) to index new mail with **notmuch new**. In yesterday's article, I talked about using [OfflineIMAP][8] to sync mail from my IMAP server. It's very easy to run it from the "pre-new" hook: - - -``` -#!/bin/bash -# Remove the new tag from messages that are still tagged as new -notmuch tag -new tag:new - -# Sync mail messages -offlineimap -a LocalSync -u quiet -``` - -You can also use the Python application [afew][9], which interfaces with the Notmuch database, to tag things like _Mailing List_ and _Spam_ for you. You can run afew from the post-new hook in a similar way: - - -``` -#!/bin/bash -# tag with my custom tags -notmuch tag --input=~/tagmail.notmuch - -# Run afew to tag new mail -afew -t -n -``` - -I recommend that when using afew to tag messages, you do NOT use the **[ListMailsFilter]** since some mail handlers add obscure or downright junk List-ID headers to mail messages (I'm looking at you, Google). - -![alot email client][10] - -At this point, any mail reader that supports Notmuch or Maildir can work with my email. I'll sometimes use [alot][11], a Notmuch-specific client, to read mail at the console, but it's not as fancy as some other mail readers. - -In the coming days, I'll show you some other mail clients that will likely integrate with tools you already use. In the meantime, check out some of the other tools that work with Maildir mailboxes—you might find a hidden gem I've not tried yet. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/organize-email-notmuch - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) -[2]: https://opensource.com/article/20/1/sync-email-offlineimap -[3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch) -[4]: https://en.wikipedia.org/wiki/Maildir -[5]: https://notmuchmail.org/ -[6]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 -[7]: https://opensource.com/sites/default/files/uploads/productivity_4-2.png (Notmuch's first run) -[8]: http://www.offlineimap.org/ -[9]: https://afew.readthedocs.io/en/latest/index.html -[10]: https://opensource.com/sites/default/files/uploads/productivity_4-3.png (alot email client) -[11]: https://github.com/pazz/alot diff --git a/translated/tech/20200114 Organize your email with Notmuch.md b/translated/tech/20200114 Organize your email with Notmuch.md new file mode 100644 index 0000000000..1d81905ea3 --- /dev/null +++ b/translated/tech/20200114 Organize your email with Notmuch.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organize your email with Notmuch) +[#]: via: (https://opensource.com/article/20/1/organize-email-notmuch) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Notmuch 组织你的邮件 +====== +Notmuch 索引、标记和排序电子邮件。在我们的 20 个使用开源提升生产力的系列的第四篇文章中了解该如何使用。 +![Filing cabinet for organization][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 用 Notmuch 为你的邮件建立索引 + +昨天,我谈到了如何使用 OfflineIMAP [将我的邮件同步][2]到本地计算机。今天,我将讨论如何在阅读之前预处理所有邮件。 + +![Notmuch][3] + +[Maildir][4] 可能是最有用的邮件存储格式之一。有很多工具可以帮助你管理邮件。我经常使用一个名为 [Notmuch][5] 的小程序,它能索引、标记和搜索邮件。Notmuch 配合其他几个程序一起使用可以使处理大量邮件更加容易。 + +大多数 Linux 发行版都包含 Notmuch,你也可以在 MacOS 上获得它。Windows 用户可以通过 Linux 的 Windows 子系统([WSL][6])访问它,但可能需要进行一些其他调整。 + +![Notmuch's first run][7] + +Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 **.notmuch-config** 文件。接下来,运行 **notmuch new** 来索引并标记所有邮件。你可以使用 **notmuch search tag:new** 进行验证,它会找到所有带有 “new” 标签的消息。这可能会有很多邮件,因为 Notmuch 使用 “new” 标签来指示新邮件,因此你需要对其进行清理。 + +运行 **notmuch search tag:unread** 来查找未读消息,这会减少很多邮件。要从你已阅读的消息中删除 “new” 标签,请运行 **notmuch tag -new not tag:unread**,它将搜索所有没有 “unread” 标签的消息,并从其中删除 “new” 标签。现在,当你运行 **notmuch search tag:new**时,它将仅显示未读邮件。 + +但是,批量标记消息可能更有用,因为在每次运行时手动更新标记可能非常繁琐。**\--batch** 命令行选项告诉 Notmuch 读取多行命令并执行它们。还有一个 **\--input=filename** 选项,该选项从文件中读取命令并应用它们。我有一个名为 **tagmail.notmuch** 的文件,用于给”新“邮件添加标签;它看起来像这样: + + +``` +# Manage sent, spam, and trash folders +-unread -new folder:Trash +-unread -new folder:Spam +-unread -new folder:Sent + +# Note mail sent specifically to me (excluding bug mail) ++to-me to:kevin at sonney.com and tag:new and not tag:to-me + +# And note all mail sent from me ++sent from:kevin at sonney.com and tag:new and not tag:sent + +# Remove the new tag from messages +-new tag:new +``` + +我可以在运行 **notmuch new** 后运行 **notmuch tag --input=tagmail.notmuch** 批量处理我的邮件,之后我也可以搜索这些标签。 + +Notmuch 还支持 pre-new 和 post-new 钩子。这些脚本存放在 **Maildir/.notmuch/hooks** 中,它们定义了在使用 **notmuch new** 索引新邮件之前(pre-new)和之后(post-new)要做的操作。在昨天的文章中,我谈到了使用 [OfflineIMAP][8] 同步来自 IMAP 服务器的邮件。从 “pre-new” 钩子运行它非常容易: + + +``` +#!/bin/bash +# Remove the new tag from messages that are still tagged as new +notmuch tag -new tag:new + +# Sync mail messages +offlineimap -a LocalSync -u quiet +``` + +你还可以使用可以操作 Notmuch 数据库的 Python 应用 [afew][9],来为你标记_邮件列表_和_垃圾邮件_。你可以用类似的方法在 post-new 钩子中使用 afew: + + +``` +#!/bin/bash +# tag with my custom tags +notmuch tag --input=~/tagmail.notmuch + +# Run afew to tag new mail +afew -t -n +``` + +我建议你在使用 afew 标记邮件时,不要使用 **[ListMailsFilter]**,因为某些邮件处理程序会在邮件中添加模糊或者完全的垃圾列表中的标头(我说的是你 Google)。 + +![alot email client][10] + +此时,任何支持 Notmuch 或 Maildir 的邮件阅读器都可以读取我的邮件。有时,我会使用 [alot][11](一个 Notmuch 特定的客户端)在控制台中阅读邮件,但是它不像其他邮件阅读器那么美观。 + +在接下来的几天,我将向你展示其他一些邮件客户端,它们可能会与你在使用的工具集成在一起。同时,请查看可与 Maildir 邮箱一起使用的其他工具。你可能会发现我没发现的好东西。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/organize-email-notmuch + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) +[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch) +[4]: https://en.wikipedia.org/wiki/Maildir +[5]: https://notmuchmail.org/ +[6]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[7]: https://opensource.com/sites/default/files/uploads/productivity_4-2.png (Notmuch's first run) +[8]: http://www.offlineimap.org/ +[9]: https://afew.readthedocs.io/en/latest/index.html +[10]: https://opensource.com/sites/default/files/uploads/productivity_4-3.png (alot email client) +[11]: https://github.com/pazz/alot From 9b2aa6fc5869e0d256883e7cf42a82d6d62e5674 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 19 Jan 2020 08:59:27 +0800 Subject: [PATCH 626/676] translating --- ...0117 Get started with this open source to-do list manager.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200117 Get started with this open source to-do list manager.md b/sources/tech/20200117 Get started with this open source to-do list manager.md index 57c9061179..210c8508c1 100644 --- a/sources/tech/20200117 Get started with this open source to-do list manager.md +++ b/sources/tech/20200117 Get started with this open source to-do list manager.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ac5b0e57ab0f259edc65b86d9e9c1da2795d1a5c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 15:51:25 +0800 Subject: [PATCH 627/676] APL --- ...st- Which to choose for programming hardware abstractions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md b/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md index acb58aaf6d..b8a72997df 100644 --- a/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md +++ b/sources/tech/20200117 C vs. Rust- Which to choose for programming hardware abstractions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1f56218e8532407316f6d3658916f9fd0947e80a Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sun, 19 Jan 2020 23:05:01 +0800 Subject: [PATCH 628/676] Translated. --- ...4 ways to volunteer this holiday season.md | 67 ----------------- ... ways to volunteder this holiday season.md | 71 +++++++++++++++++++ 2 files changed, 71 insertions(+), 67 deletions(-) delete mode 100644 sources/tech/20191220 4 ways to volunteer this holiday season.md create mode 100644 translated/tech/20191220 4 ways to volunteder this holiday season.md diff --git a/sources/tech/20191220 4 ways to volunteer this holiday season.md b/sources/tech/20191220 4 ways to volunteer this holiday season.md deleted file mode 100644 index e90a48cebc..0000000000 --- a/sources/tech/20191220 4 ways to volunteer this holiday season.md +++ /dev/null @@ -1,67 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 ways to volunteer this holiday season) -[#]: via: (https://opensource.com/article/19/12/ways-volunteer) -[#]: author: (John Jones https://opensource.com/users/johnjones4) - -4 ways to volunteer this holiday season -====== -Looking to spread some holiday cheer? Donate your talents to open source -organizations that help communities in need. -![Gift box opens with colors coming out][1] - -Social impact happens when leaders deploy individuals and resources to make positive change, but many social efforts are lacking technology resources that are up to the task of serving these change-makers. However, there are organizations helping to accelerate tech for good by connecting developers who want to make a change with communities and nonprofits who desperately need better technology. These organizations often serve specific audiences and recruit specific kinds of technologists, but they all share a common thread: open source. - -As developers, we all seek to participate in the open source community for a variety of reasons. Some participate for professional development, some participate so that they may collaborate with a vast, impressive network of technologists, and others participate because they know their contributions are necessary for the success of a project. Why not also volunteer your talents as a developer to an effort that needs them, and contribute to open source all at the same time? The organizations below are prime examples of how you can do that. - -### Code for America - -Code for America is an example of how government can still be by the people and for the people in the digital age. Through its Brigade Network, the organization has cultivated a national alliance of volunteer programmers, data scientists, concerned citizens, and designers organized in cities all over the United States. These local affiliates host regular meet-ups which are open to the community to both pitch new projects to the group and collaborate on ongoing efforts. To match volunteers with projects, the brigades’ websites often list the specific skills needed for a project such as data analysis, content creation, and JavaScript. While the brigades focus on local issues, shared experiences like natural disasters can foster collaboration. For example, a multi-brigade effort from the New Orleans, Houston, and Tampa Bay teams developed a hurricane response website that can be quickly adapted to different cities when disaster strikes. - -To get involved, visit Code for America’s [website][2] for a list of its over 70 brigades, and a path for individuals to start their own if there is not one already in their community. - -### Code for Change - -Code for Change shows that social impact can start even in high school. A group of high school coders in Indianapolis started their own club to give back to local organizations by creating open source software solutions to issues in their community. Code for Change encourages local organizations to reach out with a project idea, and the student group steps in to develop a completely free and open source solution. The group has developed projects such as "Sapphire," which optimized volunteer management systems for a local refugee organization, and a Civil Rights Commission complaint form that makes it easier for citizens to voice their concerns online. - -For more information on how to create a Code for Change chapter in your own community, [visit their website][3]. - -### Python for Good/Ruby for Good - -Python for Good and Ruby for Good are twin annual events in Portland, Oregon and Fairfax, Virginia, that bring people together to develop and program solutions for those respective communities. Over a weekend, individuals get together to hear pitches from local nonprofits and tackle their issues by building open source solutions. In 2017, Ruby For Good participants created "Justice for Juniors," which mentors and tutors current and formerly incarcerated youths to integrate them back into the community. Participants have also created "Diaperbase," an inventory management system that has been used by diaper banks all over the United States. One of the main objectives of these events is to bring organizations and people from seemingly different industries and mindsets to come together for a common good. Companies can sponsor the events, nonprofits can submit project ideas, and people of all skill levels can register to attend the event and contribute. Through their bicoastal efforts, Ruby for Good and Python for Good are living up to their motto of "making the world gooder." - -[Ruby for Good][4] is held in the summer and hosted on George Mason’s campus in Fairfax, Virginia. - -### Social Coder - -UK-based Ed Guiness created Social Coder to bring together volunteers and charities to create and use open source projects for nonprofits across six continents. Social Coder actively recruits a network of skilled IT volunteers from all over the world and matches them to charities and nonprofits registered through Social Coder. Projects can range from simple website updates to entire mobile app development. - -For example, PHASE Worldwide, a small non-governmental association supporting efforts in Nepal, got access to key support and expertise leveraging open source technology because of Social Coder. - -While a bulk of the charities already partnered with Social Coder are based in the UK, organizations in other countries are welcome. Through their website, individuals can register to work on social software projects and connect with organizations and charities seeking their help. - -Individuals interested in volunteering with Social Coder can sign up [here][5]. - -The four-day-long siege of a Nairobi mall ended Tuesday with a death toll of more than 60 people –... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/ways-volunteer - -作者:[John Jones][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/johnjones4 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) -[2]: https://brigade.codeforamerica.org/ -[3]: http://codeforchange.herokuapp.com/ -[4]: https://rubyforgood.org/ -[5]: https://socialcoder.org/Home/Programmer diff --git a/translated/tech/20191220 4 ways to volunteder this holiday season.md b/translated/tech/20191220 4 ways to volunteder this holiday season.md new file mode 100644 index 0000000000..47ba22d002 --- /dev/null +++ b/translated/tech/20191220 4 ways to volunteder this holiday season.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways to volunteer this holiday season) +[#]: via: (https://opensource.com/article/19/12/ways-volunteer) +[#]: author: (John Jones https://opensource.com/users/johnjones4) + +假期志愿服务的4种方式 +====== +想要洒播些节日的快乐吗?为开源组织做贡献,帮助有需要的社区。 +![Gift box opens with colors coming out][1] + + +当领导者们配置人员和资源以做出积极改变时,就会产生社会影响。但是,许多社会努力都缺乏能够为这些改变者提供服务的技术资源。然而,有些组织通过将想要做出改变的开发人员与迫切需要更好技术的社区和非营利组织联系起来,来促进技术进步。这些组织通常为特定的受众提供服务,并招募特定种类的技术人员,它们有一个共同点:开源。 + +作为开发人员,我们出于各种原因试图加入开源社区。有些是为了专业发展,有些是为了能够与广阔的网络上令人印象深刻的技术人员合作,还有其他人则是因为他们清楚自己的贡献对于项目的成功的必要性。为什么不将你作为开发人员的才华投入到需要它的地方,而同时又为开源组织做贡献呢?以下组织是实现此目标的一些主要事例。 + + + +### Code for America + +Code for America 是在数字时代,政府如何依靠人民为人民服务的一个例子。通过其Brigade Network,该组织在美国各个城市中组织了一个由志愿程序员,数据科学家,相关公民和设计师组成的全国联盟。这些本地分支机构定期举行聚会,向社区开放。这样既可以向小组推出新项目,又可以协调正在进行的工作。为了使志愿者与项目相匹配,各网站经常列出项目所需的特定技能,例如数据分析,内容创建和JavaScript。同时,Brigade网站也会关注当地问题,分享自然灾害等共同经验,这些都可以促进成员之间的合作。例如,新奥尔良,休斯敦和坦帕湾团队合作开发了一个飓风响应网站,当灾难发生时,该网站可以快速响应不同的城市灾难情况。 + +想要加入该组织,请访问 [网站][2] 获取70 多个 Brigade 的清单,以及个人加入组织的指南。 + +### Code for Change + +Code for Change 显示了即使在高中时期,也可以为社会做贡献。印第安纳波利斯的一群高中编码员成立了自己的俱乐部,他们通过创建针对社区问题的开源软件解决方案来回馈当地组织。 Code for Change 鼓励当地组织提出项目构想,学生团体加入并开发完全免费和开源的解决方案。该小组已经开发了诸如“蓝宝石”之类的项目,该项目优化了当地难民组织的志愿者管理系统,并建立了民权委员会的投诉表格,方便公民就他们所关心的问题在网上发表意见。 + +有关如何在你自己的社区中创建 Code for Change,[访问他们的网站][3]. + +### Python for Good/Ruby for Good + +Python for Good and Ruby for Good 是在俄勒冈州波特兰市和弗吉尼亚州费尔法克斯市举办的双年展活动,该活动将人们聚集在一起,为各自的社区开发和制定解决方案。 + +在周末,人们聚在一起聆听当地非营利组织的建议,并通过构建开源解决方案来解决他们的问题。 2017年,Ruby For Good参与者创建了“ Justice for Juniors”,该计划指导当前和以前被监禁的年轻人,并将他们重新融入社区。参与者还创建了“ Diaperbase”,这是一种库存管理系统,已被美国各地的尿布银行使用。这些活动的主要目标之一是将看似不同的行业和思维方式的组织和个人聚集在一起,以谋求共同利益。公司可以赞助活动,非营利组织可以提交项目构想,各种技能的人都可以注册参加活动并做出贡献。通过两岸(美国大西洋和太平洋东西海岸)的努力,Ruby for Good 和Python for Good 一直恪守“使世界变得更好”的座右铭。 + +[Ruby for Good][4] 在夏天举行,举办地点在弗吉尼亚州费尔法克斯的乔治•梅森(George Mason)大学。 + +### Social Coder + +英国的Ed Guiness创建了Social Coder,将志愿者和慈善机构召集在一起,为六大洲的非营利组织创建和使用开源项目。 Social Coder积极招募来自世界各地的熟练IT志愿者,并将其与通过Social Coder注册的慈善机构和非营利组织进行匹配。项目范围从简单的网站更新到整个移动应用程序的开发。 + +例如,PHASE Worldwide 是一个在尼泊尔支持工作的小型非政府组织,因为Social Coder,它获得了利用开源技术的关键支持和专业知识。 + +有许多慈善机构已经与英国的Social Coder进行了合作,也欢迎其它国家的组织加入。通过他们的网站,个人可以注册为社会软件项目工作,找到寻求帮助的组织和慈善机构。 + + +对 Social Coder 的志愿服务感兴趣的个人可以 [在此][5]注册. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/ways-volunteer + +作者:[John Jones][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/johnjones4 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://brigade.codeforamerica.org/ +[3]: http://codeforchange.herokuapp.com/ +[4]: https://rubyforgood.org/ +[5]: https://socialcoder.org/Home/Programmer From 9b3ab30118e7bfb61003533ac15df19a7b29e2e6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 23:05:38 +0800 Subject: [PATCH 629/676] PRF @robsean --- ...5 How to Add Border Around Text in GIMP.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/tech/20191215 How to Add Border Around Text in GIMP.md b/translated/tech/20191215 How to Add Border Around Text in GIMP.md index 651a53fffb..6a4e57b0c5 100644 --- a/translated/tech/20191215 How to Add Border Around Text in GIMP.md +++ b/translated/tech/20191215 How to Add Border Around Text in GIMP.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Add Border Around Text in GIMP) @@ -10,7 +10,9 @@ 在 GIMP 中如何在文本周围添加边框 ====== -这个简单的教程阐明了在 [GIMP][1] 中显示文本的轮廓的步骤。文本轮廓帮助你在其它颜色下高亮显示文本。 +![](https://img.linux.net.cn/data/attachment/album/202001/19/230506fzkyktqglfcyzkuh.jpg) + +这个简单的教程介绍了在 [GIMP][1] 中显示文本的轮廓的步骤。文本轮廓可以帮助你在其它颜色下高亮显示该文本。 ![Outlined Text created in GIMP][2] @@ -20,25 +22,23 @@ 整个过程可以用这些简单的步骤描述: - * 创建文本,并复制它的轮廓路径 - * 添加一层新的透明层,并添加轮廓路径到透明层中 - * 更改轮廓的大小,给它添加一种不同的颜色 - - +* 创建文本,并复制它的轮廓路径 +* 添加一层新的透明层,并添加轮廓路径到透明层中 +* 更改轮廓的大小,给它添加一种不同的颜色 这就是全部的东西。不用担心,我将使用适当地截图详细的展示每个步骤。按照这个教程,你应该能够为文本添加轮廓,即使你在此之前从未使用过 GIMP 。 -仅需要确保你已经 [在 Linux 上安装 GIMP][3] 或者你正在使用的任何操作。 +仅需要确保你已经 [在 Linux 上安装 GIMP][3],或者也可以使用的其它任何操作系统。 这篇教程在 GIMP 2.10 版本下演示。 #### 步骤 1: 创建你的主要文本,并复制它的轮廓 -打开 GIMP ,并通过转到 菜单 -> 文件 -> 新建 来创建一个新的文件。你应该可以使用 Ctrl+N 键盘快捷键。 +打开 GIMP ,并通过转到 “菜单 -> 文件 -> 新建” 来创建一个新的文件。你应该可以使用 `Ctrl+N` 键盘快捷键。 ![Create New File][4] -你可以在这里选择画布的大小。你也可以选择要白色背景或一种透明背景。它在 高级选项 -> 颜色 配置文件下。 +你可以在这里选择画布的大小。你也可以选择要白色背景或一种透明背景。它在 “高级选项 -> 颜色” 配置文件下。 我选择默认的白色背景。它在以后能够更改。 @@ -46,35 +46,35 @@ ![Adding text in GIMP][5] -写你想的文本。你可以根据你的选择以更改文本的字体,大小和对齐方式。我保持这篇文章的文本的默认左对齐。 +写你想要的文本。你可以根据你的选择以更改文本的字体、大小和对齐方式。我保持这篇文章的文本的默认左对齐。 我故意为文本选择一种浅色,以便难于阅读。在这篇教程中我将添加一个深色轮廓到这个浅色的文本。 ![Text added in GIMP][6] -当你写完文本后,右键文本框并选择 **文本的路径** 。 +当你写完文本后,右键文本框并选择 “文本的路径” 。 ![Right click on the text box and select ‘Path from Text’][7] #### 步骤 2: 添加一个带有文本轮廓的透明层 -现在,转到顶部菜单,转到 层 ,并添加一个新层。 +现在,转到顶部菜单,转到“层”,并添加一个新层。 ![Use Shift+Ctrl+N to add a new layer][8] -确保添加新层为透明的。你可以给它一个合适的名称,像 ‘文本大纲’。单击确定来添加这个透明层。 +确保添加新层为透明的。你可以给它一个合适的名称,像“文本大纲”。单击确定来添加这个透明层。 ![Add a transparent layer][9] -再次转到菜单,这次转到 **选择** ,并单击 **来自路径** 。你将看到你的文本应该被高亮显示。 +再次转到菜单,这次转到 “选择” ,并单击 “来自路径” 。你将看到你的文本应该被高亮显示。 ![Go to Select and choose From Path][10] -总的来说,你只创建一个透明层,它有像你的原文一样相同的文本(但是透明)。现在你需要做的是在这个层上增加文本的大小。 +总的来说,你只创建了一个透明层,它有像你的原文一样相同的文本(但是透明)。现在你需要做的是在这个层上增加文本的大小。 -#### 步骤· 3: 通过增加它的大小和更改它的颜色来添加文本轮廓 +#### 步骤 3: 通过增加它的大小和更改它的颜色来添加文本轮廓 -为此,再次在菜单中转到 选择 ,这次选择 增加。这将允许增大透明层上的文本的大小。 +为此,再次在菜单中转到 “选择” ,这次选择 “增加”。这将允许增大透明层上的文本的大小。 ![Grow the selection on the additional layer][11] @@ -84,13 +84,13 @@ 你选择需要做是使用一种你选择的颜色来填充这个扩大的选择区。因为我的原文是浅色,在这里我将为轮廓使用背景色。 -如果尚未选择的话,先 **选择你的主图像层** 。这些层在右侧栏中可视。然后转到工具箱并选择油漆桶工具。为你的轮廓选择想要的颜色。 +如果尚未选择的话,先选择你的主图像层。这些层在右侧栏中可视。然后转到工具箱并选择油漆桶工具。为你的轮廓选择想要的颜色。 选择使用该工具来填充黑色到你的选择区。记住。你填充文本外部的轮廓,而不是文本本身。 ![Fill the outline of the text with a different color][13] -在这里你完成了很多。使用 Ctrl+Shift+A 来取消你当前的选择区。 +在这里你完成了很多。使用 `Ctrl+Shift+A` 来取消你当前的选择区。 ![Outline added to the text][14] @@ -100,7 +100,7 @@ 如果你对结果感到满意,保存文件未 PNG 文件(来保留透明背景),或你喜欢的任何文件格式。 -**你使它工作了吗?** +### 你使它工作了吗? 就这样。这就是你在 GIMP 中为添加一个文本轮廓而需要做的全部工作。 @@ -115,7 +115,7 @@ via: https://itsfoss.com/gimp-text-outline/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0565e2556c4f4ad7b64ccee9d334fae8911bcc82 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 23:06:27 +0800 Subject: [PATCH 630/676] PUB @robsean https://linux.cn/article-11799-1.html --- .../20191215 How to Add Border Around Text in GIMP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191215 How to Add Border Around Text in GIMP.md (98%) diff --git a/translated/tech/20191215 How to Add Border Around Text in GIMP.md b/published/20191215 How to Add Border Around Text in GIMP.md similarity index 98% rename from translated/tech/20191215 How to Add Border Around Text in GIMP.md rename to published/20191215 How to Add Border Around Text in GIMP.md index 6a4e57b0c5..6a59c6ac66 100644 --- a/translated/tech/20191215 How to Add Border Around Text in GIMP.md +++ b/published/20191215 How to Add Border Around Text in GIMP.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11799-1.html) [#]: subject: (How to Add Border Around Text in GIMP) [#]: via: (https://itsfoss.com/gimp-text-outline/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From b0427c217698982c4c67ec281dcfc9256e0b8097 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 19 Jan 2020 23:13:19 +0800 Subject: [PATCH 631/676] Rename 20191220 4 ways to volunteder this holiday season.md to 20191220 4 ways to volunteer this holiday season.md --- ...son.md => 20191220 4 ways to volunteer this holiday season.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/tech/{20191220 4 ways to volunteder this holiday season.md => 20191220 4 ways to volunteer this holiday season.md} (100%) diff --git a/translated/tech/20191220 4 ways to volunteder this holiday season.md b/translated/tech/20191220 4 ways to volunteer this holiday season.md similarity index 100% rename from translated/tech/20191220 4 ways to volunteder this holiday season.md rename to translated/tech/20191220 4 ways to volunteer this holiday season.md From ed5fa9bcbaa64923c7b5a073d4d4d791ddd69ef2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 23:43:30 +0800 Subject: [PATCH 632/676] PRF @wxy --- ...nction to maintain Python virtual environments.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md index 75dcec4367..38d003cfa2 100644 --- a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md +++ b/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (setV: A Bash function to maintain Python virtual environments) @@ -10,11 +10,11 @@ setV:一个管理 Python 虚拟环境的 Bash 函数 ====== -> 了解一下 setV,它是轻量级的 Python 虚拟环境管理器,是 virtualenvwrapper 的替代产品。 +> 了解一下 setV,它是一个轻量级的 Python 虚拟环境管理器,是 virtualenvwrapper 的替代产品。 -![Coding on a computer][1] +![](https://img.linux.net.cn/data/attachment/album/202001/19/234306tvvg5ffwakrzr5vv.jpg) -这一年多来,[setV] [2] 悄悄隐藏在我的 [bash_scripts][3] 项目中,但现在是时候该公开了。setV 是一个 Bash 函数,我可以用它代替 [virtualenvwrapper][4]。它提供了使你能够执行以下操作的基本功能: +这一年多来,我的 [bash_scripts][3] 项目中悄悄隐藏这 [setV][2],但现在是时候该公开了。setV 是一个 Bash 函数,我可以用它代替 [virtualenvwrapper][4]。它提供了使你能够执行以下操作的基本功能: * 默认使用 Python 3 * 创建一个新的虚拟环境 @@ -37,7 +37,7 @@ curl https://gitlab.com/psachin/setV/raw/master/install.sh sh ./install.sh ``` -当安装 setV 时,安装脚本会询问你要嵌入到 `~/.bashrc` 还是 `~/.bash_profile`,根据你的喜好选择一个。 +当安装 setV 时,安装脚本会要求你引入(`source`)一下 `~/.bashrc` 或 `~/.bash_profile` 的配置,根据你的喜好选择一个。 ### 用法 @@ -281,7 +281,7 @@ via: https://opensource.com/article/20/1/setv-bash-function 作者:[Sachin Patil][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0bacb6b8c11c1fdba116c892524924fa7ee7fc15 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 19 Jan 2020 23:43:56 +0800 Subject: [PATCH 633/676] PUB @wxy https://linux.cn/article-11800-1.html --- ...A Bash function to maintain Python virtual environments.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200113 setV- A Bash function to maintain Python virtual environments.md (99%) diff --git a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md b/published/20200113 setV- A Bash function to maintain Python virtual environments.md similarity index 99% rename from translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md rename to published/20200113 setV- A Bash function to maintain Python virtual environments.md index 38d003cfa2..45e4beaf52 100644 --- a/translated/tech/20200113 setV- A Bash function to maintain Python virtual environments.md +++ b/published/20200113 setV- A Bash function to maintain Python virtual environments.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11800-1.html) [#]: subject: (setV: A Bash function to maintain Python virtual environments) [#]: via: (https://opensource.com/article/20/1/setv-bash-function) [#]: author: (Sachin Patil https://opensource.com/users/psachin) From e4b485d5b8bc22d41f664be5567e8b4a67ce71ac Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 20 Jan 2020 00:52:18 +0800 Subject: [PATCH 634/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200119=20Open?= =?UTF-8?q?=20source=20fights=20cancer,=20Tesla=20adopts=20Coreboot,=20Ube?= =?UTF-8?q?r=20and=20Lyft=20release=20open=20source=20machine=20learning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md --- ...ft release open source machine learning.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md diff --git a/sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md b/sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md new file mode 100644 index 0000000000..90b5c18537 --- /dev/null +++ b/sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning) +[#]: via: (https://opensource.com/article/20/1/news-january-19) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning +====== +Catch up on the biggest open source headlines from the past two weeks. +![Weekly news roundup with TV][1] + +In this edition of our open source news roundup, we take a look machine learning tools from Uber and Lyft, open source software to fight cancer, saving students money with open textbooks, and more! + +### Uber and Lyft release machine learning tools + +It's hard to a growing company these days that doesn't take advantage of machine learning to streamline its business and make sense of the data it amasses. Ridesharing companies, which gather massive amounts of data, have enthusiastically embraced the promise of machine learning. Two of the biggest players in the ridesharing sector have made some of their machine learning code open source. + +Uber recently [released the source code][2] for its Manifold tool for debugging machine learning models. According to Uber software engineer Lezhi Li, Manifold will "benefit the machine learning (ML) community by providing interpretability and debuggability for ML workflows." If you're interested, you can browse Manifold's source code [on GitHub][3]. + +Lyft has also upped its open source stakes by releasing Flyte. Flyte, whose source code is [available on GitHub][4], manages machine learning pipelines and "is an essential backbone to (Lyft's) operations." Lyft has been using it to train AI models and process data "across pricing, logistics, mapping, and autonomous projects." + +### Software to detect cancer cells + +In a study recently published in _Nature Biotechnology_, a team of medical researchers from around the world announced [new open source software][5] that "could make it easier to create personalised cancer treatment plans." + +The software assesses "the proportion of cancerous cells in a tumour sample" and can help clinicians "judge the accuracy of computer predictions and establish benchmarks" across tumor samples. Maxime Tarabichi, one of the lead authors of [the study][6], said that the software "provides a foundation which will hopefully become a much-needed, unbiased, gold-standard benchmarking tool for assessing models that aim to characterise a tumour’s genetic diversity." + +### University of Regina saves students over $1 million with open textbooks + +If rising tuition costs weren't enough to send university student spiralling into debt, the high prices of textbooks can deepen the crater in their bank accounts. To help ease that financial pain, many universities turn to open textbooks. One of those schools is the University of Regina. By offering open text books, the university [expects to save a huge amount for students][7] over the next five years. + +The expected savings are in the region of $1.5 million (CAD), or around $1.1 million USD (at the time of writing). The textbooks, according to a report by radio station CKOM, are "provided free for (students) and they can be printed off or used as e-books." Students aren't getting inferior-quality textbooks, though. Nilgun Onder of the University of Regina said that the "textbooks and other open education resources the university published are all peer-reviewed resources. In other words, they are reliable and credible." + +### Tesla adopts Coreboot + +Much of the software driving (no pun intended) the electric vehicles made by Tesla Motors is open source. So it's not surprising to learn that the company has [adopted Coreboot][8] "as part of their electric vehicle computer systems." + +Coreboot was developed as a replacement for proprietary BIOS and is used to boot hardware and the Linux kernel. The code, which is in [Tesla's GitHub repository][9], "is from Tesla Motors and Samsung," according to Phoronix. Samsung, in case you're wondering, makes the chip on which Tesla's self-driving software runs. + +#### In other news + + * [Arduino launches new modular platform for IoT development][10] + * [SUSE and Karunya Institute of Technology and Sciences collaborate to enhance cloud and open source learning][11] + * [How open-source code could help us survive natural disasters][12] + * [The hottest thing in robotics is an open source project you've never heard of][13] + + + +_Thanks, as always, to Opensource.com staff members and moderators for their help this week. Make sure to check out [our event calendar][14], to see what's happening next week in open source._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/news-january-19 + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://venturebeat.com/2020/01/07/uber-open-sources-manifold-a-visual-tool-for-debugging-ai-models/ +[3]: https://github.com/uber/manifold +[4]: https://github.com/lyft/flyte +[5]: https://www.cbronline.com/industry/healthcare/open-source-cancer-cells/ +[6]: https://www.nature.com/articles/s41587-019-0364-z +[7]: https://www.ckom.com/2020/01/07/open-source-program-to-save-u-of-r-students-1-5m/ +[8]: https://www.phoronix.com/scan.php?page=news_item&px=Tesla-Uses-Coreboot +[9]: https://github.com/teslamotors/coreboot +[10]: https://techcrunch.com/2020/01/07/arduino-launches-a-new-modular-platform-for-iot-development/ +[11]: https://www.crn.in/news/suse-and-karunya-institute-of-technology-and-sciences-collaborate-to-enhance-cloud-and-open-source-learning/ +[12]: https://qz.com/1784867/open-source-data-could-help-save-lives-during-natural-disasters/ +[13]: https://www.techrepublic.com/article/the-hottest-thing-in-robotics-is-an-open-source-project-youve-never-heard-of/ +[14]: https://opensource.com/resources/conferences-and-events-monthly From 88fee6a70e2880ae72b19f57f360b5189bf7fda8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 20 Jan 2020 00:52:50 +0800 Subject: [PATCH 635/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200119=20One=20?= =?UTF-8?q?open=20source=20chat=20tool=20to=20rule=20them=20all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200119 One open source chat tool to rule them all.md --- ... open source chat tool to rule them all.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20200119 One open source chat tool to rule them all.md diff --git a/sources/tech/20200119 One open source chat tool to rule them all.md b/sources/tech/20200119 One open source chat tool to rule them all.md new file mode 100644 index 0000000000..963b7246d0 --- /dev/null +++ b/sources/tech/20200119 One open source chat tool to rule them all.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (One open source chat tool to rule them all) +[#]: via: (https://opensource.com/article/20/1/open-source-chat-tool) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +One open source chat tool to rule them all +====== +BitlBee brings multiple chat applications into a single interface. Find +out how to set up and use BitlBee in the ninth in our series on 20 ways +to be more productive with open source in 2020. +![Person using a laptop][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Bring all your chats into one interface with BitlBee + +Instant messaging and chat have become a staple of the online world. And if you are like me, you probably have about five or six different apps running to talk to your friends, co-workers, and others. It really is a pain to keep up with it all. Thankfully, you can use one app (OK, two apps) to consolidate a lot of those chats into a single point. + +![BitlBee on XChat][2] + +[BitlBee][3] is an application that you run as a service that can bridge a standard IRC client with a whole bunch of messaging services. And since it is essentially an IRC server, you have a wealth of clients to choose from. + +BitlBee is included with almost all Linux distributions. Installing on Ubuntu (my Linux desktop of choice) goes something like this: + + +``` +`sudo apt install bitlbee-libpurple` +``` + +On  other distributions, the name of the package may be slightly different, but a search for _bitlbee_ should reveal your options. + +You'll notice I use the libpurple version of BitlBee. This version allows me to use all the protocols available in the [libpurple][4] instant messaging library, which was originally developed for [Pidgin][5]. + +Once the package is installed, the service should start automatically. Now, using an IRC client ([XChat][6] in these pictures), I can connect to the service on port 6667 (the standard IRC port). + +![Initial BitlBee connection][7] + +You will be automatically connected to the control channel **&bitlbee**. This channel is unique to you—every person gets their own on multi-user systems. This is where you can configure the services. + +The full documentation is available at any time by typing **help** in the control channel. Explore here, then register an account on the server with the **register** command. + + +``` +`register ` +``` + +Now, any configuration changes you make on the server—IM accounts, settings, etc.—will be saved when you type **save**. Whenever you connect, use **identify <mypassword>** to connect to your account and load all those settings. + +![purple settings][8] + +The command **help purple** will show you all the available protocols that libpurple provides. For example, I've installed the [**telegram-purple**][9] package, which adds the ability to connect to Telegram. I can add an account by using my phone number with the **account add** command. + + +``` +`account add telegram +15555555` +``` + +BitlBee will show that it has added the account. You can list your accounts with **account list**. Since I only have one account, I can log into it with **account 0 on**, and it will go through the Telegram login process, list all my friends and chats, and I am good to go. + +But what about Slack, one of the most common chat systems out there? Well, you can install the [**slack-libpurple**][10] plugin, and do the same for Slack. If you aren't comfortable compiling and installing things, this may not be for you. + +Follow the instructions on the plugin page, and after you have installed it, restart the BitlBee service. Now when you run **help purple**, Slack should be listed. Adding a Slack account happens the same as with all the other protocols. + + +``` +account add slack [ksonney@myslack.slack.com][11] +account 1 set password my_legcay_API_token +account 1 on +``` + +And what do you know? You're connected to Slack, and you can add the Slack channels you're interested in with the **chat add** command. For example: + + +``` +`chat add 1 happyparty` +``` + +adds the Slack channel happyparty as the local channel #happyparty. You can use the standard IRC **/join** command to access the channel now. Pretty cool. + +BitlBee and an IRC client help me keep (most of) my chats and instant messages in a single place and reduces my distractions because I no longer have to find and switch to whichever app just pinged me. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-chat-tool + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/sites/default/files/uploads/productivity_9-1.png (BitlBee on XChat) +[3]: https://www.bitlbee.org/ +[4]: https://developer.pidgin.im/wiki/WhatIsLibpurple +[5]: http://pidgin.im/ +[6]: http://xchat.org/ +[7]: https://opensource.com/sites/default/files/uploads/productivity_9-2.png (Initial BitlBee connection) +[8]: https://opensource.com/sites/default/files/uploads/productivity_9-3.png (purple settings) +[9]: https://github.com/majn/telegram-purple +[10]: https://github.com/dylex/slack-libpurple +[11]: mailto:ksonney@myslack.slack.com From 0646f033893b79df7806385a8d2e28a03b7495c7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 20 Jan 2020 00:53:17 +0800 Subject: [PATCH 636/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200119=20What's?= =?UTF-8?q?=20your=20favorite=20Linux=20terminal=20trick=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200119 What-s your favorite Linux terminal trick.md --- ...at-s your favorite Linux terminal trick.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20200119 What-s your favorite Linux terminal trick.md diff --git a/sources/tech/20200119 What-s your favorite Linux terminal trick.md b/sources/tech/20200119 What-s your favorite Linux terminal trick.md new file mode 100644 index 0000000000..d830c65072 --- /dev/null +++ b/sources/tech/20200119 What-s your favorite Linux terminal trick.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's your favorite Linux terminal trick?) +[#]: via: (https://opensource.com/article/20/1/linux-terminal-trick) +[#]: author: (Opensource.com https://opensource.com/users/admin) + +What's your favorite Linux terminal trick? +====== +Take our poll or tell us about your favorite terminal trick. Is it a +nifty productivity shortcut or a fun Easter egg? +![Terminal command prompt on orange background][1] + +The beginning of a new year is always a great time to evaluate new ways to become more efficient. Many people try out new productivity tools or figure out how to optimize their most mundane processes. One area to assess is the terminal. Especially in the world of open source, there are tons of ways to make life at the terminal more efficient (and fun!) with shortcuts and commands.  + +  + +We asked our writers about their favorite terminal trick. They shared their time-saving tips and even a fun terminal Easter egg. Will you adopt one of these keyboard shortcuts or command line hacks? Do you have a favorite you'd like to share? Tell us about it by taking our poll or leaving a comment.  + +  + +"I couldn't choose a favorite; I use all three of these daily:  + + * **Ctrl + L** to clear screen (instead of typing "clear"). + * **sudo !!** to run previous command with sudo privileges.  + * **grep -Ev '^#|^$' <file>** will display file content without comments or empty lines." + + + +—Mars Toktonaliev + +  + +"For me, if I'm in a terminal text editor and I want to make it go away so I can quickly do something else, I background it with **Ctrl + Z**, do whatever I need to do, and then bring it back with **fg**. I will also sometimes do the same thing with **top** or **htop.** I can background it, and bring it back anytime I want to check current performance. I don't see backgrounding and foregrounding done in the wild very often, and it can really enhance multitasking on the terminal." + +—Jay LaCroix + +  + +"Because I tend to do much of the same things at the terminal on a given day, two things are constants in my day: + + * **Ctrl + R** to reverse search my Bash history for a command that I have already run and wish to do so again + * Caret substitution is the best as I often do things like **sudo dnf** **search <package name>** then if I find a suitable package that way I then do **^search^install** to rerun the command replacing the search with install. + + + +Sure these things are basic but so time-saving for me." + +—Steve Morris + +  + +"My cool terminal trick isn't something I do in the terminal, but _which terminal_ I use. Sometimes I just want the feeling of using an Apple II, or an old amber-on-black terminal. That's when I fire up Cool Retro Term. Screenshots are on the [website][2]." + +—Jim Hall + +  + +"Probably **ssh -X** to run graphical programs on other machines. Copy/pasting (on some terminal emulators, like gnome-terminal) C-S c and C-S v. I'm not sure if this counts (as it goes graphical in the interesting part, but starts with **ssh**). Most recently I had a need to log in to another machine but have my kids be able to follow along on the bigger screen from my laptop. This [link][3] showed me something I'd never before seen: mirroring the active session from another computer screen on my laptop over the local network (x11vnc -desktop) and being able to control it from both machines at the same time." + +—Kyle R. Conway + +  + +"You can install **Install 'sl' $ sudo apt install sl** or **$ sudo dnf install sl**, and when the command **sl** is entered at the Bash prompt a text-based steam locomotive moves across the display." + +—Don Watkins + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/linux-terminal-trick + +作者:[Opensource.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/admin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) +[2]: https://github.com/Swordfish90/cool-retro-term +[3]: https://elinux.org/Screen_Casting_on_a_Raspberry_Pi From cc2a5ebb16adcdc39f0fa544ab57d30037c51f11 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 20 Jan 2020 11:10:33 +0800 Subject: [PATCH 637/676] translated --- ... your calendar with khal and vdirsyncer.md | 108 ------------------ ... your calendar with khal and vdirsyncer.md | 105 +++++++++++++++++ 2 files changed, 105 insertions(+), 108 deletions(-) delete mode 100644 sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md create mode 100644 translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md diff --git a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md deleted file mode 100644 index effad6fb4e..0000000000 --- a/sources/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md +++ /dev/null @@ -1,108 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Organize and sync your calendar with khal and vdirsyncer) -[#]: via: (https://opensource.com/article/20/1/open-source-calendar) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Organize and sync your calendar with khal and vdirsyncer -====== -Keeping and sharing a calendar can be a pain. Learn how to make it -easier in the fifth article in our series on 20 ways to be more -productive with open source in 2020. -![Calendar close up snapshot][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Keep track of your schedule with khal and vdirsyncer - -Calendars are a _pain_ to deal with, and finding good tooling is always hard. But I've made some progress since last year when I listed calendaring as [one of my "fails."][2] - -The most difficult thing about calendars today is that now they almost always need to be shared online in some way. The two most popular online calendars are Google Calendar and Microsoft Outlook/Exchange. Both are used heavily in corporate environments, which means my calendar has to support one or both options. - -![khal calendar][3] - -[Khal][4] is a console-based calendar that reads and writes VCalendar files. It's fairly easy to configure, but it does not support syncing with other applications. - -Fortunately, khal works with [vdirsyncer][5], a nifty command-line program that can synchronize online calendars (and contacts, which I'll talk about in a separate article) to your local drive. And yes, this includes uploading new events, too. - -![vdirsyncer][6] - -Vdirsyncer is a Python 3 program, and it can be installed via your package manager or pip. It can synchronize CalDAV, VCalendar/iCalendar, Google Calendar, and local files in a directory. Since I use Google Calendar, I'll use that as an example, although it is not the easiest thing to set up. - -Setting vdirsyncer up for Google is [well-documented][7], so I won't go into the nuts and bolts here. The important thing is to make sure your sync pairs are set up in a way that sets Google Calendar as the "winner" for conflict resolution. That is, if there are two updates to the same event, it needs to know which one takes precedence. Do so with something like this: - - -``` -[general] -status_path = "~/.calendars/status" - -[pair personal_sync] -a = "personal" -b = "personallocal" -collections = ["from a", "from b"] -conflict_resolution = "a wins" -metadata = ["color"] - -[storage personal] -type = "google_calendar" -token_file = "~/.vdirsyncer/google_calendar_token" -client_id = "google_client_id" -client_secret = "google_client_secret" - -[storage personallocal] -type = "filesystem" -path = "~/.calendars/Personal" -fileext = ".ics" -``` - -After the first sync of vdirsyncer, you will end up with a series of directories in the storage path. Each will contain several files, one for each entry in the calendar. The next step is to get them into khal. Start by running **khal configure** to do the initial setup. - -![Configuring khal][8] - -Now, running **khal interactive** will bring up the display shown at the beginning of this article. Typing **n** will bring up the New Event dialog. One small thing to note here: the calendars are named to match the directories that vdirsyncer creates, but you can change the khal config file to give them clearer names. Adding colors to entries based on which calendar they're on will also help you identify which is which on the list: - - -``` -[calendars] -[[personal]] -path = ~/.calendars/Personal/kevin@sonney.com/ -color = light magenta -[[holidays]] -path = ~/.calendars/Personal/cln2stbjc4hmgrrcd5i62ua0ctp6utbg5pr2sor1dhimsp31e8n6errfctm6abj3dtmg@virtual/ -color = light blue -[[birthdays]] -path = ~/.calendars/Personal/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual/ -color = brown -``` - -Now when you run **khal interactive**, each calendar will be colored to distinguish it from the others, and when you add a new entry, it will have a more descriptive name. - -![Adding a new calendar entry][9] - -The setup is a little tricky, but once it's done, khal with vdirsyncer gives you an easy way to manage calendar events and keep them in sync with your online services. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/open-source-calendar - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) -[2]: https://opensource.com/article/19/1/productivity-tool-wish-list -[3]: https://opensource.com/sites/default/files/uploads/productivity_5-1.png (khal calendar) -[4]: https://khal.readthedocs.io/en/v0.9.2/index.html -[5]: https://github.com/pimutils/vdirsyncer -[6]: https://opensource.com/sites/default/files/uploads/productivity_5-2.png (vdirsyncer) -[7]: https://vdirsyncer.pimutils.org/en/stable/config.html#google -[8]: https://opensource.com/sites/default/files/uploads/productivity_5-3.png (Configuring khal) -[9]: https://opensource.com/sites/default/files/uploads/productivity_5-4.png (Adding a new calendar entry) diff --git a/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md b/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md new file mode 100644 index 0000000000..a84fc3c917 --- /dev/null +++ b/translated/tech/20200115 Organize and sync your calendar with khal and vdirsyncer.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organize and sync your calendar with khal and vdirsyncer) +[#]: via: (https://opensource.com/article/20/1/open-source-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 khal 和 vdirsyncer 组织和同步你的日历 +====== +保存和共享日历可能会有点麻烦。在我们的 20 个使用开源提升生产力的系列的第五篇文章中了解如何让它更简单。 +![Calendar close up snapshot][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 khal 和 vdirsyncer 跟踪你的日程 + +处理日历很_麻烦_,要找到好的工具总是很困难的。但是自从我去年将日历列为[我的“失败“之一][2]以来,我已经取得了一些进步。 + +目前使用日历最困难的是一直需要以某种方式在线共享。两种最受欢迎的在线日历是 Google Calendar 和 Microsoft Outlook/Exchange。两者都在公司环境中大量使用,这意味着我的日历必须支持其中之一或者两个。 + +![khal calendar][3] + +[Khal][4] 是基于控制台的日历,可以读取和写入 VCalendar 文件。它配置相当容易,但是不支持与其他应用同步。 + +幸运的是,khal 能与 [vdirsyncer][5] 一起使用,它是一个漂亮的命令行程序,可以将在线日历(和联系人,我将在另一篇文章中讨论)同步到本地磁盘。是的,它还可以上传新事件。 + +![vdirsyncer][6] + +Vdirsyncer 是个 Python 3 程序,可以通过软件包管理器或 pip 安装。它可以同步 CalDAV、VCalendar/iCalendar、Google Calendar 和目录中的本地文件。由于我使用 Google Calendar,尽管这不是最简单的设置,我也将以它为例。 + +在 vdirsyncer 中设置 Google Calendar 是[有文档参考的][7],所以这里我不再赘述。重要的是确保同步对设置将 Google Calendar 设置为冲突解决的”赢家“。也就是说,如果同一事件有两个更新,那么需要知道哪个更新优先。类似这样做: + + +``` +[general] +status_path = "~/.calendars/status" + +[pair personal_sync] +a = "personal" +b = "personallocal" +collections = ["from a", "from b"] +conflict_resolution = "a wins" +metadata = ["color"] + +[storage personal] +type = "google_calendar" +token_file = "~/.vdirsyncer/google_calendar_token" +client_id = "google_client_id" +client_secret = "google_client_secret" + +[storage personallocal] +type = "filesystem" +path = "~/.calendars/Personal" +fileext = ".ics" +``` + +在第一次 vdirsyncer 同步之后,你将在存储路径中看到一系列目录。每个文件夹都将包含多个文件,日历中的每个事件都是一个文件。下一步是导入 khal。首先运行 **khal configure** 进行初始设置。 + +![Configuring khal][8] + +现在,运行 **khal interactive** 将显示本文开头的界面。输入 **n** 将打开“新事件”对话框。这里要注意的一件事:日历的名称与 vdirsyncer 创建的目录匹配,但是你可以更改 khal 配置文件来指定更清晰的名称。根据条目所在的日历向条目添加颜色还可以帮助你确定日历内容: + + +``` +[calendars] +[[personal]] +path = ~/.calendars/Personal/kevin@sonney.com/ +color = light magenta +[[holidays]] +path = ~/.calendars/Personal/cln2stbjc4hmgrrcd5i62ua0ctp6utbg5pr2sor1dhimsp31e8n6errfctm6abj3dtmg@virtual/ +color = light blue +[[birthdays]] +path = ~/.calendars/Personal/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual/ +color = brown +``` + +现在,当你运行 **khal interactive** 时,每个日历将被着色以区别于其他日历,并且当你添加新条目时,它将有更具描述性的名称。 + +![Adding a new calendar entry][9] + +设置有些麻烦,但是完成后,khal 和 vdirsyncer 可以一起为你提供一种简便的方法来管理日历事件并使它们与你的在线服务保持同步。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-calendar + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://opensource.com/article/19/1/productivity-tool-wish-list +[3]: https://opensource.com/sites/default/files/uploads/productivity_5-1.png (khal calendar) +[4]: https://khal.readthedocs.io/en/v0.9.2/index.html +[5]: https://github.com/pimutils/vdirsyncer +[6]: https://opensource.com/sites/default/files/uploads/productivity_5-2.png (vdirsyncer) +[7]: https://vdirsyncer.pimutils.org/en/stable/config.html#google +[8]: https://opensource.com/sites/default/files/uploads/productivity_5-3.png (Configuring khal) From 56eae89c17262f6f04ec722f5a1bf65d4e03f6c7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 20 Jan 2020 11:13:53 +0800 Subject: [PATCH 638/676] translating --- ...eep a journal of your activities with this Python program.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200118 Keep a journal of your activities with this Python program.md b/sources/tech/20200118 Keep a journal of your activities with this Python program.md index b5d3cf93a4..bfa79a8893 100644 --- a/sources/tech/20200118 Keep a journal of your activities with this Python program.md +++ b/sources/tech/20200118 Keep a journal of your activities with this Python program.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 83bbc1f6c15055c19201079e2815ddf305a7b9f6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 20 Jan 2020 21:29:12 +0800 Subject: [PATCH 639/676] Rename sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md to sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md --- ...oreboot, Uber and Lyft release open source machine learning.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md (100%) diff --git a/sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md b/sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md similarity index 100% rename from sources/tech/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md rename to sources/news/20200119 Open source fights cancer, Tesla adopts Coreboot, Uber and Lyft release open source machine learning.md From 4ed6ab3f94245e674639c886748661d821f9cef1 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 20 Jan 2020 21:52:17 +0800 Subject: [PATCH 640/676] translating --- ...nto Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md index 68ede9acfa..a2bca0089f 100644 --- a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md +++ b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5845e14467093912b9f002183b4ad6198ce899fe Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 20 Jan 2020 21:56:18 +0800 Subject: [PATCH 641/676] translating --- .../20191227 Top CI-CD resources to set you up for success.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191227 Top CI-CD resources to set you up for success.md b/sources/tech/20191227 Top CI-CD resources to set you up for success.md index 77d2391a5d..d3da7c4d09 100644 --- a/sources/tech/20191227 Top CI-CD resources to set you up for success.md +++ b/sources/tech/20191227 Top CI-CD resources to set you up for success.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From da2a26b7ada53ddc46d4ac0aed1245559b0104df Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 20 Jan 2020 22:38:07 +0800 Subject: [PATCH 642/676] PRF @Morisun029 --- ...4 ways to volunteer this holiday season.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/translated/tech/20191220 4 ways to volunteer this holiday season.md b/translated/tech/20191220 4 ways to volunteer this holiday season.md index 47ba22d002..7da97feaf3 100644 --- a/translated/tech/20191220 4 ways to volunteer this holiday season.md +++ b/translated/tech/20191220 4 ways to volunteer this holiday season.md @@ -1,54 +1,52 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 ways to volunteer this holiday season) [#]: via: (https://opensource.com/article/19/12/ways-volunteer) [#]: author: (John Jones https://opensource.com/users/johnjones4) -假期志愿服务的4种方式 +假期志愿服务的 4 种方式 ====== -想要洒播些节日的快乐吗?为开源组织做贡献,帮助有需要的社区。 -![Gift box opens with colors coming out][1] +> 想要洒播些节日的快乐吗?为开源组织做贡献,帮助有需要的社区。 + +![](https://img.linux.net.cn/data/attachment/album/202001/20/223730f7983z8atxp1tf4l.jpg) 当领导者们配置人员和资源以做出积极改变时,就会产生社会影响。但是,许多社会努力都缺乏能够为这些改变者提供服务的技术资源。然而,有些组织通过将想要做出改变的开发人员与迫切需要更好技术的社区和非营利组织联系起来,来促进技术进步。这些组织通常为特定的受众提供服务,并招募特定种类的技术人员,它们有一个共同点:开源。 作为开发人员,我们出于各种原因试图加入开源社区。有些是为了专业发展,有些是为了能够与广阔的网络上令人印象深刻的技术人员合作,还有其他人则是因为他们清楚自己的贡献对于项目的成功的必要性。为什么不将你作为开发人员的才华投入到需要它的地方,而同时又为开源组织做贡献呢?以下组织是实现此目标的一些主要事例。 - - ### Code for America -Code for America 是在数字时代,政府如何依靠人民为人民服务的一个例子。通过其Brigade Network,该组织在美国各个城市中组织了一个由志愿程序员,数据科学家,相关公民和设计师组成的全国联盟。这些本地分支机构定期举行聚会,向社区开放。这样既可以向小组推出新项目,又可以协调正在进行的工作。为了使志愿者与项目相匹配,各网站经常列出项目所需的特定技能,例如数据分析,内容创建和JavaScript。同时,Brigade网站也会关注当地问题,分享自然灾害等共同经验,这些都可以促进成员之间的合作。例如,新奥尔良,休斯敦和坦帕湾团队合作开发了一个飓风响应网站,当灾难发生时,该网站可以快速响应不同的城市灾难情况。 +“Code for America” 是在数字时代,政府如何依靠人民为人民服务的一个例子。通过其 Brigade Network,该组织在美国各个城市中组织了一个由志愿程序员、数据科学家、相关公民和设计师组成的全国联盟。这些本地分支机构定期举行聚会,向社区开放。这样既可以向小组推出新项目,又可以协调正在进行的工作。为了使志愿者与项目相匹配,该网站经常列出项目所需的特定技能,例如数据分析、内容创建和JavaScript。同时,Brigade 网站也会关注当地问题,分享自然灾害等共同经验,这些都可以促进成员之间的合作。例如,新奥尔良、休斯敦和坦帕湾团队合作开发了一个飓风响应网站,当灾难发生时,该网站可以快速响应不同的城市灾难情况。 -想要加入该组织,请访问 [网站][2] 获取70 多个 Brigade 的清单,以及个人加入组织的指南。 +想要加入该组织,请访问 [该网站][2] 获取 70 多个 Brigade 的清单,以及个人加入组织的指南。 ### Code for Change -Code for Change 显示了即使在高中时期,也可以为社会做贡献。印第安纳波利斯的一群高中编码员成立了自己的俱乐部,他们通过创建针对社区问题的开源软件解决方案来回馈当地组织。 Code for Change 鼓励当地组织提出项目构想,学生团体加入并开发完全免费和开源的解决方案。该小组已经开发了诸如“蓝宝石”之类的项目,该项目优化了当地难民组织的志愿者管理系统,并建立了民权委员会的投诉表格,方便公民就他们所关心的问题在网上发表意见。 +“Code for Change” 显示了即使在高中时期,也可以为社会做贡献。印第安纳波利斯的一群高中开发爱好者成立了自己的俱乐部,他们通过创建针对社区问题的开源软件解决方案来回馈当地组织。“Code for Change” 鼓励当地组织提出项目构想,学生团体加入并开发完全自由和开源的解决方案。该小组已经开发了诸如“蓝宝石”之类的项目,该项目优化了当地难民组织的志愿者管理系统,并建立了民权委员会的投诉表格,方便公民就他们所关心的问题在网上发表意见。 -有关如何在你自己的社区中创建 Code for Change,[访问他们的网站][3]. +有关如何在你自己的社区中创建 “Code for Change”,[访问他们的网站][3]。 ### Python for Good/Ruby for Good -Python for Good and Ruby for Good 是在俄勒冈州波特兰市和弗吉尼亚州费尔法克斯市举办的双年展活动,该活动将人们聚集在一起,为各自的社区开发和制定解决方案。 +“Python for Good” 和 “Ruby for Good” 是在俄勒冈州波特兰市和弗吉尼亚州费尔法克斯市举办的双年展活动,该活动将人们聚集在一起,为各自的社区开发和制定解决方案。 -在周末,人们聚在一起聆听当地非营利组织的建议,并通过构建开源解决方案来解决他们的问题。 2017年,Ruby For Good参与者创建了“ Justice for Juniors”,该计划指导当前和以前被监禁的年轻人,并将他们重新融入社区。参与者还创建了“ Diaperbase”,这是一种库存管理系统,已被美国各地的尿布银行使用。这些活动的主要目标之一是将看似不同的行业和思维方式的组织和个人聚集在一起,以谋求共同利益。公司可以赞助活动,非营利组织可以提交项目构想,各种技能的人都可以注册参加活动并做出贡献。通过两岸(美国大西洋和太平洋东西海岸)的努力,Ruby for Good 和Python for Good 一直恪守“使世界变得更好”的座右铭。 +在周末,人们聚在一起聆听当地非营利组织的建议,并通过构建开源解决方案来解决他们的问题。 2017 年,“Ruby For Good” 参与者创建了 “Justice for Juniors”,该计划指导当前和以前被监禁的年轻人,并将他们重新融入社区。参与者还创建了 “Diaperbase”,这是一种库存管理系统,为美国各地的尿布库diaper bank所使用。这些活动的主要目标之一是将看似不同的行业和思维方式的组织和个人聚集在一起,以谋求共同利益。公司可以赞助活动,非营利组织可以提交项目构想,各种技能的人都可以注册参加活动并做出贡献。通过两岸(美国大西洋和太平洋东西海岸)的努力,“Ruby for Good” 和 “Python for Good” 一直恪守“使世界变得更好”的座右铭。 -[Ruby for Good][4] 在夏天举行,举办地点在弗吉尼亚州费尔法克斯的乔治•梅森(George Mason)大学。 +“[Ruby for Good][4]” 在夏天举行,举办地点在弗吉尼亚州费尔法克斯的乔治•梅森大学。 ### Social Coder -英国的Ed Guiness创建了Social Coder,将志愿者和慈善机构召集在一起,为六大洲的非营利组织创建和使用开源项目。 Social Coder积极招募来自世界各地的熟练IT志愿者,并将其与通过Social Coder注册的慈善机构和非营利组织进行匹配。项目范围从简单的网站更新到整个移动应用程序的开发。 +英国的 Ed Guiness 创建了 “Social Coder”,将志愿者和慈善机构召集在一起,为六大洲的非营利组织创建和使用开源项目。“Social Coder” 积极招募来自世界各地的熟练 IT 志愿者,并将其与通过 Social Coder 注册的慈善机构和非营利组织进行匹配。项目范围从简单的网站更新到整个移动应用程序的开发。 -例如,PHASE Worldwide 是一个在尼泊尔支持工作的小型非政府组织,因为Social Coder,它获得了利用开源技术的关键支持和专业知识。 +例如,PHASE Worldwide 是一个在尼泊尔支持工作的小型非政府组织,因为 “Social Coder”,它获得了利用开源技术的关键支持和专业知识。 -有许多慈善机构已经与英国的Social Coder进行了合作,也欢迎其它国家的组织加入。通过他们的网站,个人可以注册为社会软件项目工作,找到寻求帮助的组织和慈善机构。 +有许多慈善机构已经与英国的 “Social Coder”进行了合作,也欢迎其它国家的组织加入。通过他们的网站,个人可以注册为社会软件项目工作,找到寻求帮助的组织和慈善机构。 - -对 Social Coder 的志愿服务感兴趣的个人可以 [在此][5]注册. +对 “Social Coder” 的志愿服务感兴趣的个人可以 [在此][5]注册. -------------------------------------------------------------------------------- @@ -57,8 +55,8 @@ via: https://opensource.com/article/19/12/ways-volunteer 作者:[John Jones][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6e35d595b911954bc6b28d164dee3e9832a37551 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 20 Jan 2020 22:39:44 +0800 Subject: [PATCH 643/676] PUB @Morisun029 https://linux.cn/article-11803-1.html --- .../20191220 4 ways to volunteer this holiday season.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191220 4 ways to volunteer this holiday season.md (98%) diff --git a/translated/tech/20191220 4 ways to volunteer this holiday season.md b/published/20191220 4 ways to volunteer this holiday season.md similarity index 98% rename from translated/tech/20191220 4 ways to volunteer this holiday season.md rename to published/20191220 4 ways to volunteer this holiday season.md index 7da97feaf3..ca2c8fb8e0 100644 --- a/translated/tech/20191220 4 ways to volunteer this holiday season.md +++ b/published/20191220 4 ways to volunteer this holiday season.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11803-1.html) [#]: subject: (4 ways to volunteer this holiday season) [#]: via: (https://opensource.com/article/19/12/ways-volunteer) [#]: author: (John Jones https://opensource.com/users/johnjones4) From fbc71c83a8e9c15a9b84a42c269bdadc43fb1181 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 20 Jan 2020 23:53:43 +0800 Subject: [PATCH 644/676] PRF @geekpi --- ...eep your email in sync with OfflineIMAP.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md b/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md index c5b20565ad..bca35ab20d 100644 --- a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md +++ b/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Keep your email in sync with OfflineIMAP) @@ -9,21 +9,22 @@ 使用 OfflineIMAP 同步邮件 ====== -将邮件镜像保存到本地是整理消息的第一步。在我们的 20 个使用开源提升生产力的系列的第三篇文章中了解该如何做。 -![email or newsletters via inbox and browser][1] + +> 将邮件镜像保存到本地是整理消息的第一步。在我们的 20 个使用开源提升生产力的系列的第三篇文章中了解该如何做。 + +![](https://img.linux.net.cn/data/attachment/album/202001/20/235324nbgfyuwl98syowta.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 OfflineIMAP 在本地同步你的邮件 -我与邮件之间存在爱恨交织的关系。我喜欢它让我与世界各地的人交流的方式。但是,像你们中的许多人一样,我收到过很多邮件,许多是来自列表中的人,但也有很多垃圾邮件、广告等。这些积累了很多。 +我与邮件之间存在爱恨交织的关系。我喜欢它让我与世界各地的人交流的方式。但是,像你们中的许多人一样,我收到过很多邮件,许多是来自邮件列表的,但也有很多垃圾邮件、广告等。这些积累了很多。 ![The OfflineIMAP "blinkenlights" UI][2] -我尝试过的大多数工具(除了大型提供商外)都可以很好地处理大量邮件,它们都有一个共同点:它们都依赖于以 [Maildir][3] 格式存储的本地邮件副本。这其中最有用的是 [OfflineIMAP][4]。OfflineIMAP 是将 IMAP 邮箱镜像到本地 Maildir 文件夹树的 Python 脚本。我用它来创建邮件的本地副本并使其保持同步。大多数 Linux 发行版都包含它,并且可以通过 Python 的 pip 包管理器获得。 - -示例的最小配置文件是一个很好的模板。首先将其复制到 **~/.offlineimaprc**。我的看起来像这样: +我尝试过的大多数工具(除了大型邮件服务商外)都可以很好地处理大量邮件,它们都有一个共同点:它们都依赖于以 [Maildir][3] 格式存储的本地邮件副本。这其中最有用的是 [OfflineIMAP][4]。OfflineIMAP 是将 IMAP 邮箱镜像到本地 Maildir 文件夹树的 Python 脚本。我用它来创建邮件的本地副本并使其保持同步。大多数 Linux 发行版都包含它,并且可以通过 Python 的 pip 包管理器获得。 +示例的最小配置文件是一个很好的模板。首先将其复制到 `~/.offlineimaprc`。我的看起来像这样: ``` [general] @@ -54,9 +55,9 @@ createfolder = true 我的配置要做的是定义两个仓库:远程 IMAP 服务器和本地 Maildir 文件夹。还有一个**帐户**,告诉 OfflineIMAP 运行时要同步什么。你可以定义链接到不同仓库的多个帐户。除了本地复制外,这还允许你从一台 IMAP 服务器复制到另一台作为备份。 -如果你有很多邮件,那么首次运行 OfflineIMAP 将花费一些时间。但是完成后,下次会花_少得多_的时间。你也可以将 CoffeeIMAP 作为 cron 任务(我的偏好)或作为守护程序在仓库之间不断进行同步。文档涵盖了所有这些内容以及 Gmail 等高级配置选项。 +如果你有很多邮件,那么首次运行 OfflineIMAP 将花费一些时间。但是完成后,下次会花*少得多*的时间。你也可以将 OfflineIMAP 作为 cron 任务(我的偏好)或作为守护程序在仓库之间不断进行同步。其文档涵盖了所有这些内容以及 Gmail 等高级配置选项。 -现在,我的邮件已在本地复制,并有多种工具用来加快搜索、归档和管理邮件的速度。我明天再说。 +现在,我的邮件已在本地复制,并有多种工具用来加快搜索、归档和管理邮件的速度。这些我明天再说。 -------------------------------------------------------------------------------- @@ -65,7 +66,7 @@ via: https://opensource.com/article/20/1/sync-email-offlineimap 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ddacd9f1c25e19e14a96c66f3ffc083d136aebc1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 20 Jan 2020 23:54:54 +0800 Subject: [PATCH 645/676] PUB @geekpi https://linux.cn/article-11804-1.html --- .../20200113 Keep your email in sync with OfflineIMAP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200113 Keep your email in sync with OfflineIMAP.md (98%) diff --git a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md b/published/20200113 Keep your email in sync with OfflineIMAP.md similarity index 98% rename from translated/tech/20200113 Keep your email in sync with OfflineIMAP.md rename to published/20200113 Keep your email in sync with OfflineIMAP.md index bca35ab20d..64ecd19ab6 100644 --- a/translated/tech/20200113 Keep your email in sync with OfflineIMAP.md +++ b/published/20200113 Keep your email in sync with OfflineIMAP.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11804-1.html) [#]: subject: (Keep your email in sync with OfflineIMAP) [#]: via: (https://opensource.com/article/20/1/sync-email-offlineimap) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From b5f17f7093b413d62e7c4919d076d70c5e2e0c54 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:53:02 +0800 Subject: [PATCH 646/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Ansibl?= =?UTF-8?q?e=20Automation=20Tool=20Installation,=20Configuration=20and=20Q?= =?UTF-8?q?uick=20Start=20Guide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md --- ...on, Configuration and Quick Start Guide.md | 360 ++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md diff --git a/sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md b/sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md new file mode 100644 index 0000000000..76cf181ff2 --- /dev/null +++ b/sources/tech/20200121 Ansible Automation Tool Installation, Configuration and Quick Start Guide.md @@ -0,0 +1,360 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ansible Automation Tool Installation, Configuration and Quick Start Guide) +[#]: via: (https://www.2daygeek.com/install-configure-ansible-automation-tool-linux-quick-start-guide/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Ansible Automation Tool Installation, Configuration and Quick Start Guide +====== + +There are many automation tools on the market. + +I can name a few of them, and they are widely used by many organizations, such as Puppet, Chef, CFEngine, Foreman, Katello, Saltstock, Space Walk. + +### What Automation Tool Does? + +Automation tools make the life of a Linux administrator much easier by automating routine tasks without human intervention. + +These tools allow users to perform configuration management, application deployment and provisioning. + +### Why do you like Ansible? + +Ansible is an agent-less automation tool that uses SSH to perform all tasks, but others require agents on client nodes. + +### What is Ansible? + +Ansible is an open source, easy-to-use, powerful IT automation tool that performs tasks on client nodes over SSH. + +It is built in Python and is one of the most popular and robust programming languages in the world today’s. + +The Python package is required on both ends to perform all the modules. + +It can configure systems, deploy software, and schedule advanced IT tasks such as continuous deployment or zero downtime rolling updates. + +You can easily perform any kind of automation tasks with simple and complex tasks through Ansible. + +Before you get started, you need to understand some of the Ansible terminology that helps you to make a task easier. + +### How Ansible Works? + +Ansible works by pushing small programs known as ansible modules on the client nodes, and these modules are temporarily stored in the client nodes, which are used to communicate with the Ansible server via a JSON protocol. + +Ansible runs these modules via SSH and remove them when finished. + +Modules are nothing but scripts written in Python, Perl, etc,. + +![][1] + +The control node, which controls the entire functionality of the playbook, including client nodes (hosts). + + * **Control node:** The host you use Ansible to execute tasks on managed nodes. You can have multiple control nodes, but you cannot use a Windows machine as a control node. + * **Managed nodes:** List of hosts configured by the control node + * **Inventory:** A list of hosts managed by the control nodes, these nodes are configured in the **“/etc/ansible/hosts”** file. It contains information about each node, such as an IP address or its hostname, and these nodes can be grouped as needed. + * **Modules:** Each module is used to perform a specific task, which currently supports 3387 modules. + * **ad-hoc:** It allows you to run one task at a time (it uses the **/usr/bin/ansible** binary). + * **Tasks:** There is a list of tasks in each play. Tasks are executed in order, one at a time in the managed nodes. + * **Playbooks:** You can perform multiple tasks simultaneously using playbooks, whereas you can only perform one task using an ad-hoc command. Playbooks are written in YAML and are easy to read (which uses the **/usr/bin/ansible-playbook** binary). In the future we will create an article about playbooks that you can use to perform complex tasks. + + + +### Testing Environment: + +This environment contains one control node (**server.2g.lab**) and three managed nodes (**node1.2g.lab, node2.2g.lab, node3.2g.lab**), all running in the virtual environment with the following operating systems. + +``` ++----------------------+---------------+-------------+---------------+ +| System Purpose | Hostname | IP Address | OS | ++----------------------+---------------+-------------+---------------+ +|Ansible Control Node | server.2g.lab | 192.168.1.7 | Manjaro 18 | +|Managed Node1 | node1.2g.lab | 192.168.1.6 | CentOS7 | +|Managed Node2 | node2.2g.lab | 192.168.1.5 | CentOS8 | +|Managed Node3 | node3.2g.lab | 192.168.1.9 | Ubuntu 18.04 | +|User: daygeek | ++--------------------------------------------------------------------+ +``` + +### Prerequisites: + + * Enable password-less authentication between Ansible control node and managed nodes. + * The control node must be Python 2 (version 2.7) or Python 3 (versions 3.5 and higher). + * The managed node must be Python 2 (version 2.6 or later) or Python 3 (version 3.5 or later). + * If you have SELinux enabled on remote nodes, you will also want to install **libselinux-python** on them before using any copy/file/template related functions in Ansible. + + + +### How to Install the Ansible on Control Node + +The Ansible package is available in the distribution official repository, so you can easily install it. + +For **“Fedora/RHEL 8/CentOS 8”** system, use the **[DNF Command][2]** to install ansible. + +Make a note: You need to enable the **[EPEL repository][3]** on RHEL/CentOS systems because the Ansible package is not available in the distribution official repository. + +``` +$ sudo dnf install ansible +``` + +For **“Debian/Ubuntu”** systems, use **[APT-GET Command][4]** or **[APT Command][5]** to install ansible. + +Configure the blow PPA to install the latest stable version of ansible on Ubuntu. + +``` +$ sudo apt update +$ sudo apt install software-properties-common +$ sudo apt-add-repository --yes --update ppa:ansible/ansible +$ sudo apt install ansible +``` + +For Debian system, configure the blow source list: + +``` +$ echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/ansible.list +$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 +$ sudo apt update +$ sudo apt install ansible +``` + +For **“Arch Linux”** based systems, use **[Pacman Command][6]** to install ansible. + +``` +$ sudo pacman -S ansible +``` + +For **“RHEL/CentOS”** systems, use **[YUM Command][7]** to install ansible. + +``` +$ sudo yum install ansible +``` + +For **“openSUSE”** system, use **[Zypper Command][8]** to install ansible. + +``` +$ sudo zypper install ansible +``` + +Alternatively, you can install it using the **[PIP Python package manager][9]** + +``` +$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py +$ sudo python get-pip.py +$ sudo pip install ansible +``` + +Check the version of Ansible installed on the control node as follows: + +``` +$ ansible --version + +ansible 2.9.2 + config file = /etc/ansible/ansible.cfg + configured module search path = ['/home/daygeek/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] + ansible python module location = /usr/lib/python3.8/site-packages/ansible + executable location = /usr/bin/ansible + python version = 3.8.1 (default, Jan 8 2020, 23:09:20) [GCC 9.2.0] +``` + +### How to Install Python Package on Managed Nodes + +Use the following command to install the python package on managed nodes. + +``` +$ sudo yum install -y python +$ sudo dnf install -y python +$ sudo zypper install -y python +$ sudo pacman -S python +$ sudo apt install -y python +``` + +### How to Setup SSH key authentication (Password-less Authentication) on Linux + +Use the following command to create an ssh key, and then copy them to remote machines. + +``` +$ ssh-keygen +$ ssh-copy-id [email protected] +$ ssh-copy-id [email protected] +$ ssh-copy-id [email protected] +``` + +Refer the following article to **[setup SSH key authentication (Password-less Authentication) on Linux][10]** + +### How to Create Ansible Inventory + +Add the list of nodes you want to manage in the **“/etc/ansible/hosts”** file. If you do not find an existing one you can create a new file. This is a sample inventory file for my test environment. + +``` +$ sudo vi /etc/ansible/hosts + +[web] +node1.2g.lab +node2.2g.lab + +[app] +node3.2g.lab +``` + +Let’s see if we can find all hosts using the following command. + +``` +$ ansible all --list-hosts + + hosts (3): + node1.2g.lab + node2.2g.lab + node3.2g.lab +``` + +Run the below command for individual groups. + +``` +$ ansible web --list-hosts + + hosts (2): + node1.2g.lab + node2.2g.lab +``` + +### How to Perform a Task Using the ad-hoc Command + +Once the host inventory validation check is done, you are ready to drive a car. Here you go..! + +**Syntax:** + +``` +ansible [pattern] -m [module] -a "[module options]" + +Details: +======== +ansible: A command +pattern: Enter the entire inventory or a specific group +-m [module]: Run the given module name +-a [module options]: Specify the module arguments +``` + +Use the Ping module to ping all nodes in your inventory: + +``` +$ ansible all -m ping + +node3.2g.lab | SUCCESS => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/bin/python" + }, + "changed": false, + "ping": "pong" +} +node1.2g.lab | SUCCESS => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/bin/python" + }, + "changed": false, + "ping": "pong" +} +node2.2g.lab | SUCCESS => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/libexec/platform-python" + }, + "changed": false, + "ping": "pong" +} +``` + +All systems have given a successful result, nothing has changed, and return `pong’ on success. + +You can get a list of available modules using the following command. + +``` +$ ansible-doc -l +``` + +Currently supports 3387 built-in modules, which will grow with each Ansible release: + +``` +$ ansible-doc -l | wc -l +3387 +``` + +Use the command module to execute commands against all nodes in your inventory: + +``` +$ ansible all -m command -a "uptime" + +node3.2g.lab | CHANGED | rc=0 >> + 18:05:07 up 1:21, 3 users, load average: 0.12, 0.06, 0.01 +node1.2g.lab | CHANGED | rc=0 >> + 06:35:06 up 1:21, 4 users, load average: 0.01, 0.03, 0.05 +node2.2g.lab | CHANGED | rc=0 >> + 18:05:07 up 1:25, 3 users, load average: 0.01, 0.01, 0.00 +``` + +Execute the command module for a specific group. + +To check the memory usage for the **“app”** group. + +``` +$ ansible app -m command -a "free -m" + +node3.2g.lab | CHANGED | rc=0 >> + total used free shared buff/cache available +Mem: 1993 1065 91 6 836 748 +Swap: 1425 0 1424 +``` + +To run the hostnamectl command against the **“web”** group, use the following format. + +``` +$ ansible web -m command -a "hostnamectl" + +node1.2g.lab | CHANGED | rc=0 >> + Static hostname: CentOS7.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 002f47b82af248f5be1d67b67e03514c + Boot ID: dc38f9b8089d4b2d9304e526e00c6a8f + Virtualization: kvm + Operating System: CentOS Linux 7 (Core) + CPE OS Name: cpe:/o:centos:centos:7 + Kernel: Linux 3.10.0-957.el7.x86_64 + Architecture: x86-64 +node2.2g.lab | CHANGED | rc=0 >> + Static hostname: node2.2g.lab + Icon name: computer-vm + Chassis: vm + Machine ID: e39e3a27005d44d8bcbfcab201480b45 + Boot ID: 27b46a09dde546da95ace03420fe12cb + Virtualization: oracle + Operating System: CentOS Linux 8 (Core) + CPE OS Name: cpe:/o:centos:centos:8 + Kernel: Linux 4.18.0-80.el8.x86_64 + Architecture: x86-64 +``` + +**Reference:** [Ansible Docs][11] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/install-configure-ansible-automation-tool-linux-quick-start-guide/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[3]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-oracle-linux/ +[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[6]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[7]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[8]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[9]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[10]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ +[11]: https://docs.ansible.com/ansible/latest/user_guide/index.html From dca9fef3e2cdc24a6c88bc731c9f3dc22bded075 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:53:39 +0800 Subject: [PATCH 647/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200120=20Learni?= =?UTF-8?q?ng=20about=20Partitions=20and=20How=20to=20Create=20Them=20for?= =?UTF-8?q?=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md --- ...tions and How to Create Them for Fedora.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md diff --git a/sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md b/sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md new file mode 100644 index 0000000000..93fa25b3ef --- /dev/null +++ b/sources/tech/20200120 Learning about Partitions and How to Create Them for Fedora.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learning about Partitions and How to Create Them for Fedora) +[#]: via: (https://fedoramagazine.org/learning-about-partitions-and-how-to-create-them-for-fedora/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +Learning about Partitions and How to Create Them for Fedora +====== + +![][1] + +Operating system distributions try to craft a one size fits all partition layout for their file systems. Distributions cannot know the details about how your hardware is configured or how you use your system though. Do you have more than one storage drive? If so, you might be able to get a performance benefit by putting the write-heavy partitions (_var_ and _swap_ for example) on a separate drive from the others that tend to be more read-intensive since most drives cannot read and write at the same time. Or maybe you are running a database and have a small solid-state drive that would improve the database’s performance if its files are stored on the SSD. + +The following sections attempt to describe in brief some of the historical reasons for separating some parts of the file system out into separate partitions so that you can make a more informed decision when you install your Linux operating system. + +If you know more (or contradictory) historical details about the partitioning decisions that shaped the Linux operating systems used today, contribute what you know below in the comments section! + +### Common partitions and why or why not to create them + +#### The boot partition + +One of the reasons for putting the ***/*_boot_ directory on a separate partition was to ensure that the boot loader and kernel were located within [the first 1024 cylinders of the disk][2]. Most modern computers do not have the 1024 cylinder restriction. So for most people, this concern is no longer relevant. However, modern UEFI-based computers have [a different restriction][3] that makes it necessary to have a separate partition for the boot loader. UEFI-based computers require that the boot loader ([which can be the Linux kernel directly][4]) be on a FAT-formatted file system. The Linux operating system, however, requires a POSIX-compliant file system that can designate access permissions to individual files. Since [FAT file systems do not support access permissions][5], the boot loader must be on a separate file system than the rest of the operating system on modern UEFI-based computers. A single partition cannot be [formatted][6] with more than one type of file system. + +#### The var partition + +One of the historical reasons for [putting the /var directory on a separate partition][7] was to prevent files that were frequently written to (_/var/log/*_ for example) from filling up the entire drive. Since modern drives tend to be much larger and since other means like [log rotation][8] and [disk quotas][9] are available to manage storage utilization, putting _/var_ on a separate partition may not be necessary. It is much easier to change a disk quota than it is to re-partition a drive. + +Another reason for isolating _/var_ was that file system corruption was much more common in the original version of the Linux [Extended File System (EXT)][10]. The file systems that had more write activity were much more likely to be irreversibly corrupted by a power outage than those that did not. By partitioning the disk into separate file systems, one could limit the scope of the damage in the event of file system corruption. This concern is no longer as significant because modern file systems support [journaling][11]. + +#### The home partition + +Having ***/*_home_ on a separate partition makes it possible to re-format the other partitions without overwriting your home directories. However, because modern Linux distributions are much better at doing in-place operating system upgrades, re-formatting shouldn’t be needed as frequently as it might have been in the past. + +It can still be useful to have _/home_ on a separate partition if you have a dual-boot setup and want both operating systems to share the same home directories. Or if your operating system is installed on a file system that supports snapshots and rollbacks and you want to be able to rollback your operating system to an older snapshot without reverting the content in your user profiles. Even then, some file systems allow their descendant file systems to be rolled back independently, so it still may not be necessary to have a separate partition for _/home_. On ZFS, for example, one pool/partition can have multiple descendant file systems. + +#### The swap partition + +The _swap_ partition reserves space for the contents of RAM to be written to permanent storage. There are pros and cons to having a swap partition. A pro of having swap memory is that it theoretically gives you time to gracefully shutdown unneeded applications before [the OOM killer][12] takes matters into its own hands. This might be important if the system is running mission-critical software that you don’t want abruptly terminated. A con might be that your system runs so slow when it starts swapping memory to disk that you’d rather the OOM killer take care of the problem for you. + +Another use for swap memory is [hibernation mode][13]. This might be where the rule that the swap partition should be twice the size of your computer’s RAM originated. Ideally, you should be able to put a system into hibernation even if nearly all of its RAM is in use. Beware that Linux’s support for hibernation is not perfect. It is not uncommon that after a Linux system is resumed from hibernation some hardware devices are left in an inoperable state (for example, no video from the video card or no internet from the WiFi card). + +In any case, having a swap partition is more a matter of taste. It is not required. + +#### The root partition + +The _root_ partition (/) is the catch-all for all directories that have not been assigned to a separate partition. There is always at least one root partition. BIOS-based systems that are new enough to not have the 1024 cylinder limit can be configured with only a root partition and no others so that there is never a need to resize a partition or file system if space requirements change. + +#### The EFI system partition + +The [EFI System Partition (ESP)][14] serves the same purpose on UEFI-based computers as the _boot_ partition did on the older BIOS-based computers. It contains the boot loader and kernel. Because the files on the ESP need to be accessible by the computer’s firmware, the ESP has a few restrictions that the older boot partition did not have. The restrictions are: + + 1. The ESP must be formatted with a FAT file system (_vfat_ in Anaconda) + 2. The ESP must have a special [type-code][15] (_EF00_ when using [gdisk][16]) + + + +Because the older boot partition did not have file system or type-code restrictions, it is permissible to apply the above properties to the _boot_ partition and use it as your ESP. Note, however, that the GRUB boot loader does not support combining the boot and ESP partitions. If you use GRUB, you will have to create a separate partition and mount it beneath the _/boot_ directory. + +The [Boot Loader Specification (BLS)][17] lists several reasons why it is ideal to use the legacy boot partition as your ESP. The reasons include: + + 1. The UEFI firmware should be able to load the kernel directly. Having a separate, non-ESP compliant boot partition for the kernel prevents the UEFI firmware from being able to directly load the kernel. + 2. Nesting the ESP mount point three mount levels deep increases the likelihood that an intermediate mount could fail or otherwise be unavailable when needed. That is, requiring _root_ (/), then _boot_ (/boot), then _efi_ (/efi) to be consecutively mounted is unnecessarily complex and prone to error. + 3. Requiring the boot loader to be able to read other partitions/disks which may be formatted with arbitrary file systems is non-trivial. Even when the boot loader does contain such code, the code that works at installation time can become outdated and fail to access the kernel/initrd after a file system update. This is currently true of GRUB’s _ZFS_ file system driver, for example. You must be careful not to update your _ZFS_ file system if you use the GRUB boot loader or else your system may not come back up the next time you reboot. + + + +Besides the concerns listed above, it is a good idea to have your startup environment — up to and including your [initramfs][18] — on a single self-contained file system for recovery purposes. Suppose, for example, that you need to rollback your root file system because it has become corrupted or it has become infected with malware. If your _kernel_ and _initramfs_ are on the _root_ file system, you may be unable to perform the recovery. By having the _boot loader_, _kernel_, and _initramfs_ all on a single file system that is rarely accessed or updated, you can increase your chances of being able to recover the rest of your system. + +In summary, there are many ways that you can layout your partitions and the type of hardware (BIOS or UEFI) and the brand of boot loader (GRUB, Syslinux or [systemd-boot][19]) are among the factors that will influence which layouts will work. + +### Other considerations + +#### MBR vs. GPT + +[GUID Partition Table (GPT)][20] is the newer partition format that supports larger disks. GPT was designed to work with the newer UEFI firmware. It is backward-compatible with the older [Master Boot Record (MBR)][21] partition format but not all boot loaders support the [MBR boot method][21]. _GRUB_ and _Syslinux_ support both MBR and UEFI, but _systemd-boot_ only supports the newer [UEFI boot method][22]. + +By using GPT now, you can increase the likelihood that your storage device, or an image of it, can be transferred over to a newer computer in the future should you wish to do so. If you have an older computer that natively supports only MBR-partitioned drives, you may need to add the _inst.gpt_ parameter to **Anaconda** when starting the installer to get it to use the newer format. How to add the _inst.gpt_ parameter is shown in the below video titled **“Partitioning a BIOS Computer”**. + +If you use the _GPT_ partition format on a BIOS-based computer, and you use the _GRUB_ boot loader, you must additionally create a one megabyte _biosboot_ partition at the start of your storage device. The _biosboot_ partition is not needed by any other brand of boot loader. How to create the _biosboot_ partition is demonstrated in the below video titled **“Partitioning a BIOS Computer”**. + +#### LVM + +One last thing to consider when manually partitioning your Linux system is whether to use standard partitions or logical volumes. Logical volumes are managed by the [Logical Volume Manager (LVM)][23]. You can setup LVM volumes directly on your disk without first creating standard partitions to hold them. However, most computers still require that the boot partition be a standard partition and not an LVM volume. Consequently, having LVM volumes only increases the complexity of the system because the LVM volumes must be created within standard partitions. + +The main features of LVM — online storage resizing and clustering — are not really applicable to the typical end user. Most laptops do not have hot-swappable drive bays for adding or reconfiguring storage while the system is running. And not many laptop or desktop users have [clvmd][24] configured so they can access a centralized storage device concurrently from multiple client computers. + +LVM is great for servers and clusters. But it adds extra complexity for the typical end user. Go with standard partitions unless you are a server admin who needs the more advanced features. + +### Video demonstrations + +Now that you know which partitions you need, you can watch the sort video demonstrations below to see how to manually partition a Fedora Linux computer from the Anaconda installer. + +These videos demonstrate creating only the minimally required partitions. You can add more if you choose. + +Because the _GRUB_ boot loader requires a more complex partition layout on UEFI systems, the below video titled **“Partitioning a UEFI Computer”** additionally demonstrates how to install the _systemd-boot_ boot loader. By using the _systemd-boot_ boot loader, you can reduce the number of needed partitions to just two — _boot_ and _root_. How to use a boot loader other than the default (GRUB) with Fedora’s Anaconda installer is officially documented [here][25]. + +**Partitioning a UEFI Computer** + +**Partitioning a BIOS Computer** + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/learning-about-partitions-and-how-to-create-them-for-fedora/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/partitions-fedora-816x346.png +[2]: https://en.wikipedia.org/wiki/Cylinder_1024 +[3]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#EFI_system_partition +[4]: https://www.kernel.org/doc/Documentation/efi-stub.txt +[5]: https://en.wikipedia.org/wiki/File_system_permissions#Operating_system_variations +[6]: https://en.wikipedia.org/wiki/Disk_formatting#Formatting +[7]: https://access.redhat.com/discussions/641923 +[8]: https://linuxconfig.org/setting-up-logrotate-on-redhat-linux +[9]: https://docs.oracle.com/cd/E19253-01/819-5461/gazud/index.html +[10]: https://en.wikipedia.org/wiki/Extended_file_system +[11]: https://en.wikipedia.org/wiki/Journaling_file_system +[12]: https://lwn.net/Articles/317814/ +[13]: https://www.fosslinux.com/184/what-is-difference-between-suspend-and-hibernate-in-linux.htm +[14]: https://en.wikipedia.org/wiki/EFI_system_partition +[15]: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs +[16]: https://fedoramagazine.org/managing-partitions-with-sgdisk/ +[17]: https://systemd.io/BOOT_LOADER_SPECIFICATION/ +[18]: https://fedoramagazine.org/initramfs-dracut-and-the-dracut-emergency-shell/ +[19]: https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/ +[20]: https://en.wikipedia.org/wiki/GUID_Partition_Table +[21]: https://en.wikipedia.org/wiki/Master_boot_record +[22]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#UEFIBOOT +[23]: https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux) +[24]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/logical_volume_manager_administration/lvm_cluster_overview +[25]: https://docs.fedoraproject.org/en-US/fedora/rawhide/install-guide/install/Installing_Using_Anaconda/#sect-installation-gui-storage-partitioning-bootloader From 9fcfc5c97f5378852c2a62ea7f6551c97dcc73c7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:54:09 +0800 Subject: [PATCH 648/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Syncth?= =?UTF-8?q?ing:=20Open=20Source=20P2P=20File=20Syncing=20Tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md --- ...hing- Open Source P2P File Syncing Tool.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md diff --git a/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md new file mode 100644 index 0000000000..aa87c0f873 --- /dev/null +++ b/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Syncthing: Open Source P2P File Syncing Tool) +[#]: via: (https://itsfoss.com/syncthing/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Syncthing: Open Source P2P File Syncing Tool +====== + +_**Brief: Syncthing is an open-source peer-to-peer file synchronization tool that you can use for syncing files between multiple devices (including an Android phone).**_ + +Usually, we have a cloud sync solution like [MEGA][1] or Dropbox to have a backup of our files on the cloud while making it easier to share it. + +But, what do you do if you want to sync your files across multiple devices without storing them on the cloud? + +That is where [Syncthing][2] comes to the rescue. + +### Syncthing: An open source tool to synchronize files across devices + +![][3] + +Syncthing lets you sync your files across multiple devices (including the support for Android smartphones). It primarily works through a web UI on Linux but also offers a GUI (to separately install). + +However, Syncthing does not utilize the cloud at all – it is a [peer-to-peer][4] file synchronization tool. Your data doesn’t go to a central server. Instead, the data is synced with all the devices between them. So, it does not really replace the [typical cloud storage services on Linux][5]. + +To add remote devices, you just need the device ID (or simply scan the QR code), no IP addresses involved. + +If you want a remote backup of your files – you should probably rely on the cloud. + +![Syncthing GUI][6] + +All things considered, Syncthing can come in handy for a lot of things. Technically, you can have your important files accessible on multiple systems securely and privately without worrying about anyone spying on your data. + +For instance, you may not want to store some of the sensitive files on the cloud – so you can add other trusted devices to sync and keep a copy of those files. + +Even though I described it briefly, there’s more to it and than meets the eye. I’d also recommend reading the [official FAQ][7] to clear some confusion on how it works – if you’re interested. + +### Features of Syncthing + +You probably do not want a lot of options in a synchronization tool – it should be dead simple to work reliably to sync your files. + +Syncthing is indeed quite simple and easy to understand – even though it is recommended that you should go through the [documentation][8] if you want to use every bit of its functionality. + +Here, I’ll highlight a few useful features of Syncthing: + +#### Cross-Platform Support + +![Syncthing on Android][9] + +Being an open-source solution, it does support Windows, Linux, and macOS. + +In addition to that, it also supports Android smartphones. You’ll be disappointed if you have an iOS device – so far, no plans for iOS support. + +#### File Versioning + +![Syncthing File Versioning][10] + +Syncthing utilizes a variety of [File Versioning methods][11] to archive the old files if they are replaced or deleted. + +By default, you won’t find it enabled. But, when you create a folder to sync, that’s when you will find the option to toggle the file versioning to your preferred method. + +#### Easy To Use + +While being a peer-to-peer file synchronization tool, it just works out of the box with no advanced tweaks. + +However, it does let you configure advanced settings when needed. + +#### Security & Privacy + +Even though you do not share your data with any cloud service providers, there are still some connections made that might gain the attention of an eavesdropper. So, Syncthing makes sure the communication is secured using TLS. + +In addition to that, there are solid authentication methods to ensure that only the devices/connections you allow explicitly will be granted access to sync/read data. + +For Android smartphones, you can also force the traffic through Tor if you’re using the [Orbot app][12]. You’ll find several other options for Android as well. + +#### Other Functionalities + +![][13] + +When exploring the tool yourself, you will notice that there are no limits to how many folders you can sync and the number of devices that you can sync. + +So, being a free and open-source solution with lots of useful features makes it an impressive choice for Linux users looking to have a peer-to-peer sync client. + +### Installing Syncthing on Linux + +You may not observe a .deb file or an .AppImage file for it on its official download webpage. But, you do get a snap package on the [Snap store][14] – if you’re curious you can read about [using snap apps][15] on Linux to get started. + +You may not find it in the software center (if you do – it may not be the latest version). + +**Note:** _There’s also a [Syncthing-GTK][16] available if you want a GUI to manage that – instead of a browser._ + +[Syncthing][2] + +You can also utilize the terminal to get it installed if you have a Debian-based distro – the instructions are on the [official download page][17]. + +### My experience with Syncthing + +Personally, I got it installed on Pop!_OS 19.10 and used it for a while before writing this up. + +I tried syncing folders, removing them, adding duplicate files to see how the file versioning works, and so on. It worked just fine. + +However, when I tried syncing it to a phone (Android) – the sync started a bit late, it wasn’t very quick. So, if we could have an option to explicitly force sync, that could help. Or, did I miss the option? Let me know in the comments if I did. + +Technically, it uses the resources of your system to work – so if you have a number of devices connected to sync, it should potentially improve the sync speed (upload/download). + +Overall, it works quite well – but I must say that you shouldn’t rely on it as the only backup solution to your data. + +**Wrapping Up** + +Have you tried Syncthing yet? If yes, how was your experience with it? Feel free to share it in the comments below. + +Also, if you know about some awesome alternatives to this – let me know about it as well. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/syncthing/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-mega-cloud-storage-linux/ +[2]: https://syncthing.net/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/Peer-to-peer +[5]: https://itsfoss.com/cloud-services-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-gtk.png?ssl=1 +[7]: https://docs.syncthing.net/users/faq.html +[8]: https://docs.syncthing.net/users/index.html +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-android.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-file-versioning.jpg?ssl=1 +[11]: https://docs.syncthing.net/users/versioning.html +[12]: https://play.google.com/store/apps/details?id=org.torproject.android&hl=en_IN +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot1.jpg?ssl=1 +[14]: https://snapcraft.io/syncthing +[15]: https://itsfoss.com/install-snap-linux/ +[16]: https://github.com/syncthing/syncthing-gtk/releases/latest +[17]: https://syncthing.net/downloads/ From 0fa02709dc4dca1af132a44ca5277700e2a42e2b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:55:05 +0800 Subject: [PATCH 649/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200120=20Use=20?= =?UTF-8?q?this=20Twitter=20client=20for=20Linux=20to=20tweet=20from=20the?= =?UTF-8?q?=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md --- ...nt for Linux to tweet from the terminal.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md diff --git a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md new file mode 100644 index 0000000000..c49b45ace4 --- /dev/null +++ b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this Twitter client for Linux to tweet from the terminal) +[#]: via: (https://opensource.com/article/20/1/tweet-terminal-rainbow-stream) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Use this Twitter client for Linux to tweet from the terminal +====== +Keep up with your Twitter feed without leaving the terminal by using +Rainbow Stream in the tenth in our series on 20 ways to be more +productive with open source in 2020. +![Chat bubbles][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Keep up with Twitter with Rainbow Stream + +I love social networking and microblogging. It's quick, it's easy, and I can share my thoughts with the world really quickly. The drawback is, of course, that almost all the desktop options for non-Windows users are wrappers around the website. [Twitter][2] has a lot of clients, but what I really want is something lightweight, easy to use, and most importantly, attractive. + +![Rainbow Stream for Twitter][3] + +[Rainbow Stream][4] is one of the prettier Twitter clients. It is easy to use and installs quickly with a simple **pip3 install rainbowstream**. On the first run, it will open a browser window and have you authorize with Twitter. Once that is done, you land at a prompt, and your Twitter timeline will start scrolling by. + +![Rainbow Stream first run][5] + +The most important commands to know are **p** to pause the stream, **r** to resume the stream, **h** to get help, and **t** to post a new tweet. For example, **h tweets** will give you all the options for sending and replying to tweets. Another useful help screen is **h messages**, which gives the commands for working with direct messages, which is something my wife and I use a lot. There are a lot of other commands, and I refer back to help a lot. + +As your timeline scrolls by, you can see that it has full UTF-8 support and, with the right font, will show indicators for how many times something was retweeted and liked, as well as icons and emojis. + +![Kill this love][6] + +One of the _best_ things about Rainbow Stream is that you don't have to give up on photos and images. This feature is off by default, but you can try it out with the **config** command. + + +``` +`config IMAGE_ON_TERM = true` +``` + +This command renders any images as ASCII art. If you have a photo-heavy stream, this may be a bit much, but I like it. It has a very retro-1990s BBS feel, and I did love the BBS scene in the 1990s. + +You can also use Rainbow Stream to manage lists, mute people, block people, follow, unfollow, and everything else that is available with the Twitter API. There is also theme support, so you can customize the stream to your favorite color scheme. + +When I'm working and don't want to have yet-another-tab open on my browser, Rainbow Stream lets me keep up in a terminal off to the side. + +Without open source, Twitter wouldn't exist. Every Tweet you send and receive touches open source... + +Sergey Bronnikov shares why the OpenVZ team created Twisource, an open source social media tool. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) +[2]: https://twitter.com/home +[3]: https://opensource.com/sites/default/files/uploads/productivity_10-1.png (Rainbow Stream for Twitter) +[4]: https://rainbowstream.readthedocs.io/en/latest/ +[5]: https://opensource.com/sites/default/files/uploads/productivity_10-2.png (Rainbow Stream first run) +[6]: https://opensource.com/sites/default/files/uploads/day10-image3_1.png (Kill this love) From b74628396a159e5cdbc6f6cbf1bc47b43e1cd241 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 21 Jan 2020 00:55:38 +0800 Subject: [PATCH 650/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200120=20Use=20?= =?UTF-8?q?Wireshark=20at=20the=20Linux=20command=20line=20with=20TShark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md --- ...k at the Linux command line with TShark.md | 768 ++++++++++++++++++ 1 file changed, 768 insertions(+) create mode 100644 sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md diff --git a/sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md b/sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md new file mode 100644 index 0000000000..d582ca77f0 --- /dev/null +++ b/sources/tech/20200120 Use Wireshark at the Linux command line with TShark.md @@ -0,0 +1,768 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Wireshark at the Linux command line with TShark) +[#]: via: (https://opensource.com/article/20/1/wireshark-linux-tshark) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Use Wireshark at the Linux command line with TShark +====== +Learning to analyze network packets is a powerful skill. +![Multi-colored and directional network computer cables][1] + +Most of the time when we connect to the internet, we don't think about the network protocols at work underneath that make it all possible. Right now, while you are reading this article, numerous packets are being exchanged by your computer and traveling across the internet. + +To understand these protocols, you need a tool that can capture and help you analyze these packets. [Wireshark][2] is a popular open source graphical user interface (GUI) tool for analyzing packets. However, it also provides a powerful command-line utility called [TShark][3] for people who prefer to work on the Linux command line. + +To try the examples in this article, you need to be connected to the internet. For any changes to TShark's command-line options or flags, please refer to the appropriate man pages and online [documentation][4]. Also, I am using Fedora for these examples. + + +``` +[gaurav@testbox ~]$ cat /etc/fedora-release +Fedora release 30 (Thirty) +[gaurav@testbox ~]$ +``` + +### Check your installation + +First, ensure the required packages are installed: + + +``` +[gaurav@testbox ~]$ rpm -qa | grep -i wireshark +wireshark-cli-3.0.1-1.fc30.x86_64 +[gaurav@testbox ~]$ +``` + +If the Wireshark package is installed, check whether the TShark utility is installed and, if so, which version: + + +``` +[gaurav@testbox ~]$ tshark -v +TShark (Wireshark) 3.0.1 (23f278e2) + +Built using gcc 9.0.1 20190312 (Red Hat 9.0.1-0.10). +[gaurav@testbox ~]$ +``` + +If you are logged in as a regular, non-root user, you need sudo rights to use the TShark utility. Root users can skip sudo and directly run the **tshark** command. + +### Find network devices available to TShark + +Before TShark can analyze packets, it needs to capture those packets. Network packets are processed via a network interface card (NIC) on servers, workstations, or desktops or a WiFi card on laptops. Begin by identifying the NIC or WiFi card used to connect to the internet. + +To identify what network devices are available to TShark, run the following command. My laptop (which I am using for these examples) shows: + + +``` +[gaurav@testbox ~]$ sudo tshark -D +Running as user "root" and group "root". This could be dangerous. +1\. wlp61s0 +2\. lo (Loopback) +3\. any +4\. virbr0 +5\. enp0s31f6 +6\. bluetooth-monitor +7\. nflog +8\. nfqueue +[gaurav@testbox ~]$ +``` + +I am using my WiFi card to connect to my home router for accessing the internet. You can use the **ifconfig -a** command to view all network interfaces on a system. If the **ifconfig** command is not installed, you can use the newer **ip addr show** command instead. One of the interfaces should have an IP address assigned to it. For a specific interface, you can use **ifconfig <interface-name>**, for example: + + +``` +`ifconfig wlp61s0` +``` + +### Capture some packets + +Now that you know which interface is being used to connect to the internet, you can start capturing some packets using it. The **-i** option can be used to capture packets on this specific interface. You'll see a bunch of output that shows the network packets being transmitted via the interface, but you can stop it with the **Ctrl+C** command: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xa02b AAAA fedoraproject.org +    2 0.000128115  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xcc47 A fedoraproject.org +    3 0.000316195  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xe29d A fedoraproject.org +    4 0.000616019  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xac7c AAAA fedoraproject.org +    5 0.007963200  192.168.1.1 → 192.168.1.9  DNS 93 Standard query response 0xcc47 A fedoraproject.org A 185.141.165.254 +    6 0.009171815  192.168.1.1 → 192.168.1.9  DNS 93 Standard query response 0xe29d A fedoraproject.org A 185.141.165.254 +    7 0.011075350  192.168.1.1 → 192.168.1.9  DNS 322 Standard query response 0xa02b AAAA fedoraproject.org AAAA 2610:28:3090:3001:dead:beef:cafe:fed3 AAAA 2605:bc80:3010:600:dead:beef:cafe:fed9 AAAA 2604:1580:fe00:0:dead:beef:cafe:fed1 NS ns04.fedoraproject.org NS ns05.fedoraproject.org NS ns02.fedoraproject.org A 152.19.134.139 AAAA 2610:28:3090:3001:dead:beef:cafe:fed5 A 209.132.181.17 A 85.236.55.10 AAAA 2001:4178:2:1269:dead:beef:cafe:fed5 +    8 0.012458151  192.168.1.1 → 192.168.1.9  DNS 322 Standard query response 0xac7c AAAA fedoraproject.org AAAA 2605:bc80:3010:600:dead:beef:cafe:fed9 AAAA 2610:28:3090:3001:dead:beef:cafe:fed3 AAAA 2604:1580:fe00:0:dead:beef:cafe:fed1 NS ns05.fedoraproject.org NS ns02.fedoraproject.org NS ns04.fedoraproject.org A 152.19.134.139 AAAA 2610:28:3090:3001:dead:beef:cafe:fed5 A 209.132.181.17 A 85.236.55.10 AAAA 2001:4178:2:1269:dead:beef:cafe:fed5 +^C8 packets captured +[gaurav@testbox ~]$ +``` + +Look at the first two packets above; they are denoted by numbers at the beginning of the line: + + +``` +1 0.000000000  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xa02b AAAA fedoraproject.org +2 0.000128115  192.168.1.9 → 192.168.1.1  DNS 77 Standard query 0xcc47 A fedoraproject.org +``` + +These lines include two IP addresses on either side of an arrow—these are the hosts that are exchanging the packet. The arrow's direction indicates which direction the packet is going. Therefore, **192.168.1.9 → 192.168.1.1** means the packet originated at host **192.168.1.9**, which is my laptop, and is headed for destination **192.168.1.1**, which is my home router. After the destination IP address, you see **DNS**, which is just the Domain Name System protocol, followed by a DNS query. More about that later. + +You can limit the number of packets captured and displayed on the screen using the **-c** (count) option. The following example shows 10 packets being captured. Notice the protocols—you saw DNS above, and here there are other protocols like NTP and TCP: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 10 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 10.5.26.10   NTP 90 NTP Version 4, client +    2 0.803303963  192.168.1.9 → 10.5.27.10   NTP 90 NTP Version 4, client +    3 3.524867645  192.168.1.9 → 192.168.1.1  DNS 69 Standard query 0x3837 A testbox +    4 6.227373094  192.168.1.9 → 192.168.1.1  DNS 89 Standard query 0x0814 A location.services.mozilla.com +    5 6.227395145  192.168.1.9 → 192.168.1.1  DNS 89 Standard query 0x5e1c AAAA location.services.mozilla.com +    6 6.234878912  192.168.1.1 → 192.168.1.9  DNS 105 Standard query response 0x0814 A location.services.mozilla.com A 34.253.23.107 +    7 6.238110416  192.168.1.1 → 192.168.1.9  DNS 223 Standard query response 0x5e1c AAAA location.services.mozilla.com CNAME locprod1-elb-eu-west-1.prod.mozaws.net SOA ns-1260.awsdns-29.org +    8 6.238446999  192.168.1.9 → 34.253.23.107 TCP 74 35326 → 443 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=2832002333 TSecr=0 WS=128 +    9 6.438833991 34.253.23.107 → 192.168.1.9  TCP 74 443 → 35326 [SYN, ACK] Seq=0 Ack=1 Win=26847 Len=0 MSS=1440 SACK_PERM=1 TSval=2056252981 TSecr=2832002333 WS=256 +   10 6.438947001  192.168.1.9 → 34.253.23.107 TCP 66 35326 → 443 [ACK] Seq=1 Ack=1 Win=64256 Len=0 TSval=2832002533 TSecr=2056252981 +10 packets captured +[gaurav@testbox ~]$ +``` + +The DNS protocol converts the hostname to an IP address and the IP address to a hostname. There are dedicated DNS (or name) servers, which you can query with either a hostname or an IP address. The example below uses the **nslookup** command to query the name servers to resolve a hostname to an IP address. Before you proceed, ensure the **bind-utils** package is installed: + + +``` +[gaurav@testbox ~]$ rpm -qa | grep -i bind-utils +bind-utils-9.11.5-13.P4.fc30.x86_64 +[gaurav@testbox ~]$ +``` + +In order to query your name server, you need to find out which one your machine is talking to. You can find that information in the **/etc/resolv.conf** file. In my case, the name server is pointed to **1.1.1.1**, which is a public DNS service provided by Cloudflare: + + +``` +[gaurav@testbox ~]$ cat /etc/resolv.conf +# Generated by NetworkManager +nameserver 1.1.1.1 +[gaurav@testbox ~]$ +``` + +Hostnames like Opensource.com are easy for humans to understand, but machines use IP addresses to connect to other machines over a network or the internet. For your computer to connect to opensource.com, it needs to find the site's IP address; you can find it with the command: + + +``` +`nslookup opensource.com` +``` + +If **nslookup** is not available on your machine, you can use the **dig** command instead: + + +``` +`dig opensource.com` +``` + +But—_before you hit Enter_—open another terminal and type the following command to tell TShark to capture any traffic that goes to your name server (e.g., 1.1.1.1): + + +``` +`sudo tshark -i wlp61s0 host 1.1.1.1` +``` + +Keep that terminal running and return to the other one, then run **nslookup** (or **dig**). When the command completes, it gives Opensource.com's IP address, which is 54.204.39.132. Here is **nslookup**'s output: + + +``` +[gaurav@testbox ~]$ nslookup opensource.com +Server:         1.1.1.1 +Address:        1.1.1.1#53 + +Non-authoritative answer: +Name:   opensource.com +Address: 54.204.39.132 + +[gaurav@testbox ~]$ +``` + +And **dig**'s output: + + +``` +[gaurav@testbox ~]$ dig opensource.com + +; <<>> DiG 9.11.5-P4-RedHat-9.11.5-13.P4.fc30 <<>> opensource.com +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<\- opcode: QUERY, status: NOERROR, id: 33030 +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 1452 +;; QUESTION SECTION: +;opensource.com.                        IN      A + +;; ANSWER SECTION: +opensource.com.         206     IN      A       54.204.39.132 + +;; Query time: 30 msec +;; SERVER: 1.1.1.1#53(1.1.1.1) +;; WHEN: Sat Nov 02 21:05:54 IST 2019 +;; MSG SIZE  rcvd: 59 + +[gaurav@testbox ~]$ +``` + +So far, so good, but what is happening at the packet level? Move to the terminal where you entered the **tshark** command. It captured a few packets: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 host 1.1.1.1 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    2 1.798275687  192.168.1.9 → 1.1.1.1      DNS 74 Standard query 0xcda0 A opensource.com +    3 1.827143443      1.1.1.1 → 192.168.1.9  DNS 90 Standard query response 0xcda0 A opensource.com A 54.204.39.132 +    ^C packets captured +[gaurav@testbox ~]$ +``` + +The packet below originated from my laptop **192.168.1.9** and is headed for destination **1.1.1.1**. The packet is for the DNS protocol, and it's querying (Standard query) the name server for Opensource.com: + + +``` +`2 1.798275687 192.168.1.9 → 1.1.1.1 DNS 74 Standard query 0xcda0 A opensource.com` +``` + +The packet below is a reply coming from my name server **1.1.1.1** to my machine **192.168.1.9**. Again, it's DNS, but now it's a response for the query (Standard query response) for Opensource.com's IP address: + + +``` +`3 1.827143443      1.1.1.1 → 192.168.1.9  DNS 90 Standard query response 0xcda0 A opensource.com A 54.204.39.132` +``` + +If you know beforehand what protocol you are looking for, you can add it to the **tshark** command. The following example is looking only for UDP packets, but it captured DNS packets. This is because DNS packets use the UDP protocol underneath: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 udp +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 1.1.1.1      DNS 89 Standard query 0xcc6d A location.services.mozilla.com +    2 0.000068640  192.168.1.9 → 1.1.1.1      DNS 89 Standard query 0x6484 AAAA location.services.mozilla.com +    3 0.032616053      1.1.1.1 → 192.168.1.9  DNS 189 Standard query response 0xcc6d A location.services.mozilla.com CNAME locprod1-elb-eu-west-1.prod.mozaws.net A 52.215.71.87 A 54.72.168.141 A 34.253.23.107 +    4 0.108203529      1.1.1.1 → 192.168.1.9  DNS 241 Standard query response 0x6484 AAAA location.services.mozilla.com CNAME locprod1-elb-eu-west-1.prod.mozaws.net SOA ns-1260.awsdns-29.org +    5 1.268489014  192.168.1.9 → 1.1.1.1      DNS 69 Standard query 0x74be A testbox +    6 1.302652455      1.1.1.1 → 192.168.1.9  DNS 144 Standard query response 0x74be No such name A testbox SOA a.root-servers.net +    7 6.268558254  192.168.1.9 → 1.1.1.1      DNS 79 Standard query 0xc47a A cups.pnq.redhat.com +    8 6.268618039  192.168.1.9 → 1.1.1.1      DNS 79 Standard query 0xb08b AAAA cups.pnq.redhat.com +    9 6.664992312      1.1.1.1 → 192.168.1.9  DNS 143 Standard query response 0xb08b AAAA cups.pnq.redhat.com SOA a1-68.akam.net +   10 6.665088305      1.1.1.1 → 192.168.1.9  DNS 143 Standard query response 0xc47a A cups.pnq.redhat.com SOA a1-68.akam.net +^C10 packets captured +[gaurav@testbox ~]$ +``` + +The **ping** command is often used to check if a machine is up or accessible over a network. You can run the **ping** command against Opensource.com's IP address to see if the server is up and running. + +Before you do that, start a packet capture so you can analyze the packet later. Open a terminal and run the following command, which will keep running and looking for packets that are originating in or destined for IP address 54.204.39.132: + + +``` +`sudo tshark -i wlp61s0 host 54.204.39.132` +``` + +In another terminal, run the following **ping** command. The **-c** is for count, so **-c 2** means it should send only two packets to the given host: + + +``` +`ping -c 2 54.204.39.132` +``` + +From the terminal where you ran the **ping** command, you can see two packets were sent and two were received. It also says that there was 0% packet loss, which suggests that the destination 54.204.39.132 responded to the **ping** requests: + + +``` +[gaurav@testbox ~]$ ping -c 2 54.204.39.132 +PING 54.204.39.132 (54.204.39.132) 56(84) bytes of data. +64 bytes from 54.204.39.132: icmp_seq=1 ttl=43 time=357 ms +64 bytes from 54.204.39.132: icmp_seq=2 ttl=43 time=278 ms + +\--- 54.204.39.132 ping statistics --- +2 packets transmitted, 2 received, 0% packet loss, time 1ms +rtt min/avg/max/mdev = 278.045/317.410/356.776/39.369 ms +[gaurav@testbox ~]$ +``` + +Move back to the terminal where TShark is running. It shows four packets: the requests in the **ping** command (**-c 2**) and two replies, hence a total of four packets: + + +``` +Packet 1 - request (1st request) +Packet 2 - reply (to Packet 1) +Packet 3 - request (2nd request) +Packet 4 - reply (to Packet 3) +``` + +The output shows that it is using the [ICMP][5] protocol. **Ping** works over ICMP to complete its tasks: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1749, seq=1/256, ttl=64 +    2 0.356750411 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1749, seq=1/256, ttl=43 (request in 1) +    3 1.000295229  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1749, seq=2/512, ttl=64 +    4 1.278267790 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1749, seq=2/512, ttl=43 (request in 3) +^C4 packets captured +[gaurav@testbox ~]$ +``` + +Network packets are sent in binary format, so if you want to see how they look on the network, you can dump the packet's hexadecimal format by simply adding an **-x** to the **tshark** command, and you will see the hexadecimal output. The following output shows a **ping** request sent by running the command **ping -c 1 54.204.39.132**: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -x -c 2 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +0000  28 c6 8e 3e 39 3a 48 89 e7 a0 33 db 08 00 45 00   (..>9:H...3...E. +0010  00 54 e6 29 40 00 40 01 34 7e c0 a8 01 09 36 cc   .T.)@.@.4~....6. +0020  27 84 08 00 25 5f 27 d1 00 01 7e aa bd 5d 00 00   '...%_'...~..].. +0030  00 00 a2 f3 0d 00 00 00 00 00 10 11 12 13 14 15   ................ +0040  16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25   .......... !"#$% +0050  26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35   &'()*+,-./012345 +0060  36 37                                             67 + +0000  48 89 e7 a0 33 db 28 c6 8e 3e 39 3a 08 00 45 00   H...3.(..>9:..E. +0010  00 54 31 06 00 00 2b 01 3e a2 36 cc 27 84 c0 a8   .T1...+.>.6.'... +0020  01 09 00 00 2d 5f 27 d1 00 01 7e aa bd 5d 00 00   ....-_'...~..].. +0030  00 00 a2 f3 0d 00 00 00 00 00 10 11 12 13 14 15   ................ +0040  16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25   .......... !"#$% +0050  26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35   &'()*+,-./012345 +0060  36 37                                             67 + +2 packets captured +[gaurav@testbox ~]$ +``` + +### Save your output + +Seeing output on the screen is OK, but often you need to save data to a file to use it later. Use the **ping** command but add **-w** to tell TShark to dump the output to a file. For example, the following saves the output to file named **nlog.pcap** within the **/tmp** directory: + + +``` +`sudo tshark -w /tmp/nlog.pcap -i wlp61s0 host 54.204.39.132` +``` + +Now run the **ping** command again from another terminal, but this time with a count of five packets: + + +``` +`ping -c 5 54.204.39.132` +``` + +The TShark terminal shows that 10 packets were captured. Why 10? Because you asked **ping** to send five requests, and you got five replies, hence 10 packets. Use **Ctrl+C** to stop the packet capture: + + +``` +[gaurav@testbox ~]$ sudo tshark -w /tmp/nlog.pcap -i wlp61s0 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +10 ^C +[gaurav@testbox ~]$ +``` + +TShark saved the output to the file **/tmp/nlog.pcap**: + + +``` +[gaurav@testbox ~]$ ls -l /tmp/nlog.pcap +-rw-------. 1 root root 1692 Nov  2 21:10 /tmp/nlog.pcap +[gaurav@testbox ~]$ +``` + +The **file** command shows the file type is a **pcapng** capture file, so you can't just open the file using an editor like Vim and start reading; all you'll see is a bunch of garbage characters: + + +``` +[gaurav@testbox ~]$ sudo file /tmp/nlog.pcap +/tmp/nlog.pcap: pcapng capture file - version 1.0 +[gaurav@testbox ~]$ +``` + +Since TShark wrote the data to the file, it can read it back from the file as well using the **-r** option followed by the filename. The following shows all 10 packets (five requests and five replies): + + +``` +[gaurav@testbox ~]$ sudo tshark -r /tmp/nlog.pcap +Running as user "root" and group "root". This could be dangerous. +    1 0.000000000  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=1/256, ttl=64 +    2 0.270098703 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=1/256, ttl=43 (request in 1) +    3 1.000485186  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=2/512, ttl=64 +    4 1.323571769 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=2/512, ttl=43 (request in 3) +    5 2.000955585  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=3/768, ttl=64 +    6 2.347737132 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=3/768, ttl=43 (request in 5) +    7 3.000912998  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=4/1024, ttl=64 +    8 3.269412434 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=4/1024, ttl=43 (request in 7) +    9 4.001573635  192.168.1.9 → 54.204.39.132 ICMP 98 Echo (ping) request  id=0x1875, seq=5/1280, ttl=64 +   10 4.293431592 54.204.39.132 → 192.168.1.9  ICMP 98 Echo (ping) reply    id=0x1875, seq=5/1280, ttl=43 (request in 9) +[gaurav@testbox ~]$ + +#TCP handshake +``` + +A [TCP handshake][6] is done before establishing a connection over a network. The examples above just queried a name server or tried to determine whether a machine is reachable via a **ping** command, neither of which requires establishing a connection with the host. Try to fetch [www.opensource.com][7] via the **wget** command. + +Before you run **wget**, run the following command in another terminal to capture packets. I have deliberately kept the count to three since the handshake involves initial packets: + + +``` +`sudo tshark -i wlp61s0 -c 3 host 54.204.39.132` +``` + +Next, run the **wget** command to download the index file: + + +``` +[gaurav@testbox ~]$ wget +\--2019-11-02 21:13:54--   +Resolving [www.opensource.com][7] ([www.opensource.com][7])... 54.204.39.132 +Connecting to [www.opensource.com][7] ([www.opensource.com)|54.204.39.132|:443][8]... connected. +HTTP request sent, awaiting response... 301 Moved Permanently +Location: [following] +\--2019-11-02 21:13:56--   +Resolving opensource.com (opensource.com)... 54.204.39.132 +Connecting to opensource.com (opensource.com)|54.204.39.132|:80... connected. +HTTP request sent, awaiting response... 302 Found +Location: [following] +\--2019-11-02 21:13:57--   +Connecting to opensource.com (opensource.com)|54.204.39.132|:443... connected. +HTTP request sent, awaiting response... 200 OK +Length: 71561 (70K) [text/html] +Saving to: ‘index.html’ + +index.html                        100%[=============================================================>]  69.88K   105KB/s    in 0.7s     + +2019-11-02 21:13:59 (105 KB/s) - ‘index.html’ saved [71561/71561] + +[gaurav@testbox ~]$ ^C +``` + +You can view the three packets below. The first packet sends a **SYN** request from my laptop to the Opensource.com server. The second packet is the Opensource.com server replying with a **SYN, ACK** flag set. Finally, the third packet is my laptop sending an **ACK** request to acknowledge receiving the second packet. This is called a TCP handshake. After this handshake, both nodes (i.e., my laptop and the Opensource.com server) can exchange data. + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 3 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 54.204.39.132 TCP 74 58784 → 443 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=790376430 TSecr=0 WS=128 +    2 0.306538226 54.204.39.132 → 192.168.1.9  TCP 74 443 → 58784 [SYN, ACK] Seq=0 Ack=1 Win=26847 Len=0 MSS=1440 SACK_PERM=1 TSval=1306268046 TSecr=790376430 WS=512 +    3 0.306671608  192.168.1.9 → 54.204.39.132 TCP 66 58784 → 443 [ACK] Seq=1 Ack=1 Win=64256 Len=0 TSval=790376737 TSecr=1306268046 +3 packets captured +[gaurav@testbox ~]$ +``` + +If you exclude **-c 3**, it will capture all packets, and you will see a similar ritual to close a connection. Only this time, my laptop sent a **FIN, ACK** packet to Opensource.com (in packet 1 below), followed by a **FIN, ACK** from Opensource.com to my laptop (in packet 2 below), and finally an **ACK** packet sent by my laptop to the Opensource.com server. This concludes the network connection that was established earlier, and any future connections will have to set up a TCP handshake again. + + +``` +   73 4.505715716  192.168.1.9 → 54.204.39.132 TCP 66 59574 → 443 [FIN, ACK] Seq=814 Ack=76239 Win=69888 Len=0 TSval=792384514 TSecr=1306769989 +   74 4.737227282 54.204.39.132 → 192.168.1.9  TCP 66 443 → 59574 [FIN, ACK] Seq=76239 Ack=815 Win=29184 Len=0 TSval=1306770066 TSecr=792384514 +   75 4.737389399  192.168.1.9 → 54.204.39.132 TCP 66 59574 → 443 [ACK] Seq=815 Ack=76240 Win=69888 Len=0 TSval=792384745 TSecr=1306770066 +``` + +### Encrypt handshake data + +These days, most websites are accessed over HTTPS instead of HTTP. This ensures the data passed between the two nodes is encrypted on the wire as it passes through the internet. To ensure data is encrypted, a [TLS handshake][9] method, which is similar to the TCP handshake, happens. + +Fire another **wget** command, but this time it captures 11 packets from the beginning: + + +``` +[gaurav@testbox ~]$ wget +\--2019-11-02 21:15:21--   +Resolving [www.opensource.com][7] ([www.opensource.com][7])... 54.204.39.132 +Connecting to [www.opensource.com][7] ([www.opensource.com)|54.204.39.132|:443][8]... connected. +HTTP request sent, awaiting response... 301 Moved Permanently +Location: [following] +\--2019-11-02 21:15:23--   +Resolving opensource.com (opensource.com)... 54.204.39.132 +Connecting to opensource.com (opensource.com)|54.204.39.132|:80... connected. +HTTP request sent, awaiting response... 302 Found +Location: [following] +\--2019-11-02 21:15:28--   +Connecting to opensource.com (opensource.com)|54.204.39.132|:443... connected. +HTTP request sent, awaiting response... 200 OK +Length: 71561 (70K) [text/html] +Saving to: ‘index.html’ + +index.html                        100%[=============================================================>]  69.88K   114KB/s    in 0.6s     + +2019-11-02 21:15:31 (114 KB/s) - ‘index.html’ saved [71561/71561] + +[gaurav@testbox ~]$ +``` + +The TCP handshake concludes in the first three packets, and the fourth to the ninth have various packets that have TLS strings, which follow a similar handshake ritual to set up a secure, encrypted connection between the two hosts: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 11 host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 0.000000000  192.168.1.9 → 54.204.39.132 TCP 74 58800 → 443 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=790462858 TSecr=0 WS=128 +    2 0.305006506 54.204.39.132 → 192.168.1.9  TCP 74 443 → 58800 [SYN, ACK] Seq=0 Ack=1 Win=26847 Len=0 MSS=1440 SACK_PERM=1 TSval=1306289652 TSecr=790462858 WS=512 +    3 0.305135180  192.168.1.9 → 54.204.39.132 TCP 66 58800 → 443 [ACK] Seq=1 Ack=1 Win=64256 Len=0 TSval=790463163 TSecr=1306289652 +    4 0.308282152  192.168.1.9 → 54.204.39.132 TLSv1 583 Client Hello +    5 0.613210220 54.204.39.132 → 192.168.1.9  TCP 66 443 → 58800 [ACK] Seq=1 Ack=518 Win=28160 Len=0 TSval=1306289729 TSecr=790463166 +    6 0.613298883 54.204.39.132 → 192.168.1.9  TLSv1.2 3139 Server Hello, Certificate, Server Key Exchange, Server Hello Done +    7 0.613356054  192.168.1.9 → 54.204.39.132 TCP 66 58800 → 443 [ACK] Seq=518 Ack=3074 Win=61184 Len=0 TSval=790463472 TSecr=1306289729 +    8 0.617318607  192.168.1.9 → 54.204.39.132 TLSv1.2 192 Client Key Exchange, Change Cipher Spec, Encrypted Handshake Message +    9 0.919718195 54.204.39.132 → 192.168.1.9  TLSv1.2 324 New Session Ticket, Change Cipher Spec, Encrypted Handshake Message +   10 0.940858609  192.168.1.9 → 54.204.39.132 TLSv1.2 240 Application Data +   11 1.228530079 54.204.39.132 → 192.168.1.9  TLSv1.2 754 Application Data +11 packets captured +[gaurav@testbox ~]$ +``` + +Because HTTPS works on port 443 by default, you can use it as a filter in TShark to capture traffic going to that specific port: + + +``` +`sudo tshark -i wlp61s0 host 54.204.39.132 and port 443` +``` + +Timestamps are essential when you need to analyze packets offline to reconstruct events from the past, e.g., for debugging. Adding a **-t ad** flag to TShark will add timestamps to the beginning of each packet capture: + + +``` +[gaurav@testbox ~]$ sudo tshark -n -i wlp61s0 -t ad +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +    1 2019-11-02 21:43:58.344158174 25:c9:8e:3f:38:3a → 48:89:e7:a0:33:db ARP 42 Who has 192.168.1.9? Tell 192.168.1.1 +    2 2019-11-02 21:43:58.344194844 48:89:e7:a0:33:db → 25:c9:8e:3f:38:3a ARP 42 192.168.1.9 is at 48:89:e7:a0:33:db +    3 2019-11-02 21:44:00.223393961  192.168.1.9 → 1.1.1.1      DNS 79 Standard query 0x00fb A cups.pnq.redhat.com +    4 2019-11-02 21:44:00.223460961  192.168.1.9 → 1.1.1.1      DNS 79 Standard query 0x1814 AAAA cups.pnq.redhat.com +    5 2019-11-02 21:44:00.266325914      1.1.1.1 → 192.168.1.9  DNS 143 Standard query response 0x00fb A cups.pnq.redhat.com SOA a1-68.akam.net +    6 2019-11-02 21:44:00.269102767      1.1.1.1 → 192.168.1.9  DNS 143 Standard query response 0x1814 AAAA cups.pnq.redhat.com SOA a1-68.akam.net +^C6 packets captured +[gaurav@testbox ~]$ +``` + +### View an entire packet + +So far, you have seen several examples of packets and ways to interpret them but not an entire packet. Here's how to use **ping** and the **nslookup** utility to dump an entire packet: + + +``` +[gaurav@testbox ~]$ ping -c 1 54.204.39.132 +PING 54.204.39.132 (54.204.39.132) 56(84) bytes of data. +64 bytes from 54.204.39.132: icmp_seq=1 ttl=43 time=357 ms + +\--- 54.204.39.132 ping statistics --- +1 packets transmitted, 1 received, 0% packet loss, time 0ms +rtt min/avg/max/mdev = 356.961/356.961/356.961/0.000 ms +[gaurav@testbox ~]$ +``` + +In another window, run the following command and then the **ping** command above. Notice the additional **-V** flag—it is used to dump the entire packet information on the screen. The output is divided into various sections, starting with Frames, then moving to Ethernet, then to Internet Protocol, and so on. + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 1 -V host 54.204.39.132 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +Frame 1: 98 bytes on wire (784 bits), 98 bytes captured (784 bits) on interface 0 +    Interface id: 0 (wlp61s0) +        Interface name: wlp61s0 +    Encapsulation type: Ethernet (1) +    Arrival Time: Nov  2, 2019 21:17:55.556150846 IST +    [Time shift for this packet: 0.000000000 seconds] +    Epoch Time: 1572709675.556150846 seconds +    [Time delta from previous captured frame: 0.000000000 seconds] +    [Time delta from previous displayed frame: 0.000000000 seconds] +    [Time since reference or first frame: 0.000000000 seconds] +    Frame Number: 1 +    Frame Length: 98 bytes (784 bits) +    Capture Length: 98 bytes (784 bits) +    [Frame is marked: False] +    [Frame is ignored: False] +    [Protocols in frame: eth:ethertype:ip:icmp:data] +Ethernet II, Src: IntelCor_a0:33:db (48:89:e7:a0:33:db), Dst: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +    Destination: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +        Address: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) +        .... ...0 .... .... .... .... = IG bit: Individual address (unicast) +    Source: IntelCor_a0:33:db (48:89:e7:a0:33:db) +        Address: IntelCor_a0:33:db (48:89:e7:a0:33:db) +        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) +        .... ...0 .... .... .... .... = IG bit: Individual address (unicast) +    Type: IPv4 (0x0800) +Internet Protocol Version 4, Src: 192.168.1.9, Dst: 54.204.39.132 +    0100 .... = Version: 4 +    .... 0101 = Header Length: 20 bytes (5) +    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) +        0000 00.. = Differentiated Services Codepoint: Default (0) +        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) +    Total Length: 84 +    Identification: 0x8f68 (36712) +    Flags: 0x4000, Don't fragment +        0... .... .... .... = Reserved bit: Not set +        .1.. .... .... .... = Don't fragment: Set +        ..0. .... .... .... = More fragments: Not set +        ...0 0000 0000 0000 = Fragment offset: 0 +    Time to live: 64 +    Protocol: ICMP (1) +    Header checksum: 0x8b3f [validation disabled] +    [Header checksum status: Unverified] +    Source: 192.168.1.9 +    Destination: 54.204.39.132 +Internet Control Message Protocol +    Type: 8 (Echo (ping) request) +    Code: 0 +    Checksum: 0xcfc5 [correct] +    [Checksum Status: Good] +    Identifier (BE): 7399 (0x1ce7) +    Identifier (LE): 59164 (0xe71c) +    Sequence number (BE): 1 (0x0001) +    Sequence number (LE): 256 (0x0100) +    Timestamp from icmp data: Nov  2, 2019 21:17:55.000000000 IST +    [Timestamp from icmp data (relative): 0.556150846 seconds] +    Data (48 bytes) + +0000  5b 7c 08 00 00 00 00 00 10 11 12 13 14 15 16 17   [|.............. +0010  18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27   ........ !"#$%&' +0020  28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37   ()*+,-./01234567 +        Data: 5b7c080000000000101112131415161718191a1b1c1d1e1f… +        [Length: 48] + +1 packet captured +[gaurav@testbox ~] +``` + +Similarly, run the following **nslookup** command and, on the side, dump the entire packet via TShark: + + +``` +[gaurav@testbox ~]$ nslookup opensource.com +Server:         1.1.1.1 +Address:        1.1.1.1#53 + +Non-authoritative answer: +Name:   opensource.com +Address: 54.204.39.132 + +[gaurav@testbox ~]$ +``` + +Here is how the packet looks when you do a DNS lookup—notice the UDP protocol is being used: + + +``` +[gaurav@testbox ~]$ sudo tshark -i wlp61s0 -c 1 -V host 1.1.1.1 +Running as user "root" and group "root". This could be dangerous. +Capturing on 'wlp61s0' +Frame 1: 88 bytes on wire (704 bits), 88 bytes captured (704 bits) on interface 0 +    Interface id: 0 (wlp61s0) +        Interface name: wlp61s0 +    Encapsulation type: Ethernet (1) +    Arrival Time: Nov  2, 2019 21:19:32.161216715 IST +    [Time shift for this packet: 0.000000000 seconds] +    Epoch Time: 1572709772.161216715 seconds +    [Time delta from previous captured frame: 0.000000000 seconds] +    [Time delta from previous displayed frame: 0.000000000 seconds] +    [Time since reference or first frame: 0.000000000 seconds] +    Frame Number: 1 +    Frame Length: 88 bytes (704 bits) +    Capture Length: 88 bytes (704 bits) +    [Frame is marked: False] +    [Frame is ignored: False] +    [Protocols in frame: eth:ethertype:ip:udp:dns] +Ethernet II, Src: IntelCor_a0:33:db (48:89:e7:a0:33:db), Dst: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +    Destination: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +        Address: Netgear_3f:38:3a (25:c9:8e:3f:38:3a) +        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) +        .... ...0 .... .... .... .... = IG bit: Individual address (unicast) +    Source: IntelCor_a0:33:db (48:89:e7:a0:33:db) +        Address: IntelCor_a0:33:db (48:89:e7:a0:33:db) +        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) +        .... ...0 .... .... .... .... = IG bit: Individual address (unicast) +    Type: IPv4 (0x0800) +Internet Protocol Version 4, Src: 192.168.1.9, Dst: 1.1.1.1 +    0100 .... = Version: 4 +    .... 0101 = Header Length: 20 bytes (5) +    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) +        0000 00.. = Differentiated Services Codepoint: Default (0) +        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) +    Total Length: 74 +    Identification: 0x907d (36989) +    Flags: 0x4000, Don't fragment +        0... .... .... .... = Reserved bit: Not set +        .1.. .... .... .... = Don't fragment: Set +        ..0. .... .... .... = More fragments: Not set +        ...0 0000 0000 0000 = Fragment offset: 0 +    Time to live: 64 +    Protocol: UDP (17) +    Header checksum: 0xe672 [validation disabled] +    [Header checksum status: Unverified] +    Source: 192.168.1.9 +    Destination: 1.1.1.1 +User Datagram Protocol, Src Port: 60656, Dst Port: 53 +    Source Port: 60656 +    Destination Port: 53 +    Length: 54 +    Checksum: 0x2fd2 [unverified] +    [Checksum Status: Unverified] +    [Stream index: 0] +    [Timestamps] +        [Time since first frame: 0.000000000 seconds] +        [Time since previous frame: 0.000000000 seconds] +Domain Name System (query) +    Transaction ID: 0x303c +    Flags: 0x0100 Standard query +        0... .... .... .... = Response: Message is a query +        .000 0... .... .... = Opcode: Standard query (0) +        .... ..0. .... .... = Truncated: Message is not truncated +        .... ...1 .... .... = Recursion desired: Do query recursively +        .... .... .0.. .... = Z: reserved (0) +        .... .... ...0 .... = Non-authenticated data: Unacceptable +    Questions: 1 +    Answer RRs: 0 +    Authority RRs: 0 +    Additional RRs: 0 +    Queries +        clock01.util.phx2.redhat.com: type A, class IN +            Name: clock01.util.phx2.redhat.com +            [Name Length: 28] +            [Label Count: 5] +            Type: A (Host Address) (1) +            Class: IN (0x0001) + +1 packet captured +[gaurav@testbox ~]$ +``` + +### Next steps + +Once you are comfortable with these basics of packet capturing and analysis, you can utilize TShark's various capture and display filters when working on more advanced use cases. Refer to the online documentation for more information on these filters. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/wireshark-linux-tshark + +作者:[Gaurav Kamathe][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: https://www.wireshark.org/ +[3]: https://www.wireshark.org/docs/wsug_html_chunked/AppToolstshark.html +[4]: https://www.wireshark.org/docs/man-pages/tshark.html +[5]: https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol +[6]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Connection_establishment +[7]: http://www.opensource.com +[8]: http://www.opensource.com)|54.204.39.132|:443 +[9]: https://en.wikipedia.org/wiki/Transport_Layer_Security#TLS_handshake From cb78502d5a011ac5ab00cc833d9b57451d03fa5d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 08:25:30 +0800 Subject: [PATCH 651/676] APL --- sources/talk/20191015 How GNOME uses Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191015 How GNOME uses Git.md b/sources/talk/20191015 How GNOME uses Git.md index f64057287e..5cf183f2e8 100644 --- a/sources/talk/20191015 How GNOME uses Git.md +++ b/sources/talk/20191015 How GNOME uses Git.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c98195bdd0cee9646945f652b133caed6d013847 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 09:15:36 +0800 Subject: [PATCH 652/676] TSL --- sources/talk/20191015 How GNOME uses Git.md | 60 ------------------ .../talk/20191015 How GNOME uses Git.md | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 60 deletions(-) delete mode 100644 sources/talk/20191015 How GNOME uses Git.md create mode 100644 translated/talk/20191015 How GNOME uses Git.md diff --git a/sources/talk/20191015 How GNOME uses Git.md b/sources/talk/20191015 How GNOME uses Git.md deleted file mode 100644 index 5cf183f2e8..0000000000 --- a/sources/talk/20191015 How GNOME uses Git.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How GNOME uses Git) -[#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) -[#]: author: (Molly de Blanc https://opensource.com/users/mollydb) - -How GNOME uses Git -====== -The GNOME project's decision to centralize on GitLab is creating -benefits across the community—even beyond the developers. -![red panda][1] - -“What’s your GitLab?” is one of the first questions I was asked on my first day working for the [GNOME Foundation][2]—the nonprofit that supports GNOME projects, including the [desktop environment][3], [GTK][4], and [GStreamer][5]. The person was referring to my username on [GNOME’s GitLab instance][6]. In my time with GNOME, I’ve been asked for my GitLab a lot. - -We use GitLab for basically everything. In a typical day, I get several issues and reference bug reports, and I occasionally need to modify a file. I don’t do this in the capacity of being a developer or a sysadmin. I’m involved with the Engagement and Inclusion & Diversity (I&D) teams. I write newsletters for Friends of GNOME and interview contributors to the project. I work on sponsorships for GNOME events. I don’t write code, and I use GitLab every day. - -The GNOME project has been managed a lot of ways over the past two decades. Different parts of the project used different systems to track changes to code, collaborate, and share information both as a project and as a social space. However, the project made the decision that it needed to become more integrated and it took about a year from conception to completion. - -There were a number of reasons GNOME wanted to switch to a single tool for use across the community. External projects touch GNOME, and providing them an easier way to interact with resources was important for the project, both to support the community and to grow the ecosystem. We also wanted to better track metrics for GNOME—the number of contributors, the type and number of contributions, and the developmental progress of different parts of the project. - -When it came time to pick a collaboration tool, we considered what we needed. One of the most important requirements was that it must be hosted by the GNOME community; being hosted by a third party didn’t feel like an option, so that discounted services like GitHub and Atlassian. And, of course, it had to be free software. It quickly became obvious that the only real contender was GitLab. We wanted to make sure contribution would be easy. GitLab has features like single sign-on, which allows people to use GitHub, Google, GitLab.com, and GNOME accounts. - -We agreed that GitLab was the way to go, and we began to migrate from many tools to a single tool. GNOME board member [Carlos Soriano][7] led the charge. With lots of support from GitLab and the GNOME community, we completed the process in May 2018. - -There was a lot of hope that moving to GitLab would help grow the community and make contributing easier. Because GNOME previously used so many different tools, including Bugzilla and CGit, it’s hard to quantitatively measure how the switch has impacted the number of contributions. We can more clearly track some statistics though, such as the nearly 10,000 issues closed and 7,085 merge requests merged between June and November 2018. People feel that the community has grown and become more welcoming and that contribution is, in fact, easier. - -People come to free software from all sorts of different starting points, and it’s important to try to even out the playing field by providing better resources and extra support for people who need them. Git, as a tool, is widely used, and more people are coming to participate in free software with those skills ready to go. Self-hosting GitLab provides the perfect opportunity to combine the familiarity of Git with the feature-rich, user-friendly environment provided by GitLab. - -It’s been a little over a year, and the change is really noticeable. Continuous integration (CI) has been a huge benefit for development, and it has been completely integrated into nearly every part of GNOME. Teams that aren’t doing code development have also switched to using the GitLab ecosystem for their work. Whether it’s using issue tracking to manage assigned tasks or version control to share and manage assets, even teams like Engagement and I&D have taken up using GitLab. - -It can be hard for a community, even one developing free software, to adapt to a new technology or tool. It is especially hard in a case like GNOME, a project that [recently turned 22][8]. After more than two decades of building a project like GNOME, with so many parts used by so many people and organizations, the migration was an endeavor that was only possible thanks to the hard work of the GNOME community and generous assistance from GitLab. - -I find a lot of convenience in working for a project that uses Git for version control. It’s a system that feels comfortable and is familiar—it’s a tool that is consistent across workplaces and hobby projects. As a new member of the GNOME community, it was great to be able to jump in and just use GitLab. As a community builder, it’s inspiring to see the results: more associated projects coming on board and entering the ecosystem; new contributors and community members making their first contributions to the project; and increased ability to measure the work we’re doing to know it’s effective and successful. - -It’s great that so many teams doing completely different things (such as what they’re working on and what skills they’re using) agree to centralize on any tool—especially one that is considered a standard across open source. As a contributor to GNOME, I really appreciate that we’re using GitLab. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/how-gnome-uses-git - -作者:[Molly de Blanc][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mollydb -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/redpanda_firefox_pet_animal.jpg?itok=aSpKsyna (red panda) -[2]: https://www.gnome.org/foundation/ -[3]: https://gnome.org/ -[4]: https://www.gtk.org/ -[5]: https://gstreamer.freedesktop.org/ -[6]: https://gitlab.gnome.org/ -[7]: https://twitter.com/csoriano1618?lang=en -[8]: https://opensource.com/article/19/8/poll-favorite-gnome-version diff --git a/translated/talk/20191015 How GNOME uses Git.md b/translated/talk/20191015 How GNOME uses Git.md new file mode 100644 index 0000000000..e9b82aa7d1 --- /dev/null +++ b/translated/talk/20191015 How GNOME uses Git.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How GNOME uses Git) +[#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) +[#]: author: (Molly de Blanc https://opensource.com/users/mollydb) + +GNOME 项目是如何使用 Git 的? +====== + +将 GNOME 项目集中在 GitLab 上的决定为整个社区(不只是开发人员)带来了好处。 + +![red panda][1] + +“您的 GitLab 是什么?”这是我在 [GNOME 基金会][2]工作的第一天被问到的第一个问题之一,该基金会是支持 GNOME 项目的非盈利组织,包括[桌面环境][3]、[GTK][4] 和 [GStreamer][5]。此人指的是我在 [GNOME 的 GitLab 实例][6上的用户名。我在 GNOME 期间,经常有人要求我提供我的 GitLab。 + +我们使用 GitLab 进行几乎所有操作。通常情况下,我会收到一些提案和参考错误报告,有时还需要修改文件。我不是以开发人员或系统管理员的身份进行此操作的。我参与了“参与度、包容性和多样性(I&D)”团队。我为 GNOME 朋友们撰写新闻通讯,并采访该项目的贡献者。我为 GNOME 活动提供赞助。我不写代码,但我每天都使用 GitLab。 + +在过去的二十年中,GNOME 项目的管理采用了各种方式。该项目的不同部分使用不同的系统来跟踪代码更改、协作以及作为项目和社交空间共享信息。但是,该项目决定,它需要更加一体化,这从构思到完成大约花费了一年的时间。 + +GNOME 希望切换到单个工具供整个社区使用的原因很多。外部项目与 GNOME 息息相关,并为它们提供与资源交互的更简单的方式对于项目至关重要,无论是支持社区还是发展生态系统。我们还希望更好地跟踪 GNOME 的指标,即贡献者的数量、贡献的类型和数量以及项目不同部分的开发进度。 + +当需要选择一种协作工具时,我们考虑了我们需要的东西。最重要的要求之一是它必须由 GNOME 社区托管。由第三方托管并不是一种选择,因此像 GitHub 和 Atlassian 这样的服务就不在考虑之中。而且,当然了,它必须是自由软件。很快,唯一真正的竞争者就是 GitLab。我们希望确保进行贡献很容易。GitLab 具有诸如单点登录的功能,该功能允许人们使用 GitHub、Google、GitLab.com 和 GNOME 帐户登录。 + +我们认为 GitLab 是一条出路,我们开始从许多工具迁移到单个工具。GNOME 董事会成员 [Carlos Soriano][7] 领导这项改变。在 GitLab 和 GNOME 社区的大力支持下,我们于 2018 年 5 月完成了该过程。 + +人们非常希望迁移到 GitLab 有助于社区的发展,并使贡献更容易。由于 GNOME 以前使用了许多不同的工具,包括 Bugzilla 和 CGit,因此很难定量地评估这次切换对贡献量的影响。但是,我们可以更清楚地跟踪一些统计数据,例如在 2018 年 6 月至 2018 年 11 月之间关闭了近 10,000 个提案,合并了 7,085 个合并请求。人们感到社区在发展壮大,越来越受欢迎,而且贡献实际上也更容易。 + +人们因不同的原因而开始使用自由软件,重要的是,可以通过为需要软件的人提供更好的资源和更多的支持来公平竞争。Git 作为一种工具已被广泛使用,并且越来越多的人使用这些技能来参与到自由软件当中。自托管的 GitLab 提供了将 Git 的熟悉度与 GitLab 提供的功能丰富、用户友好的环境相结合的绝佳机会。 + +已经一年多了,变化确实很明显。持续集成(CI)为开发带来了巨大的好处,并且已经完全集成到 GNOME 的几乎每个部分当中。不进行代码开发的团队也转而使用 GitLab 生态系统进行工作。无论是使用问题跟踪来管理分配的任务,还是使用版本控制来共享和管理资产,就连“参与度、包容性和多样性(I&D)”这样的团队都已经使用了 GitLab。 + +一个社区,即使是一个正在开发的自由软件,也很难适应新技术或新工具。在类似 GNOME 的情况下,这尤其困难,该项目[最近已经 22 岁了] [8]。像 GNOME 这样经过了 20 多年建设的项目,太多的人和组织使用了太多的部件,但迁移工作之所以能实现,这要归功于 GNOME 社区的辛勤工作和 GitLab 的慷慨帮助。 + +在为使用 Git 进行版本控制的项目工作时,我发现很方便。这是一个令人感觉舒适和熟悉的系统,是一个在工作场所和爱好项目之间保持一致的工具。作为 GNOME 社区的新成员,能够参与并使用 GitLab 真是太好了。作为社区建设者,看到这样结果是令人鼓舞的:越来越多的相关项目加入并进入生态系统;新的贡献者和社区成员对该项目做出了首次贡献;以及增强了衡量我们正在做的工作以了解其成功和成功的能力。 + +如此多的做着完全不同的事情(例如他们正在从事的不同工作以及所使用的不同技能)的团队同意集中在一个工具上(尤其是被认为是跨开源的标准工具),这一点很棒。 作为 GNOME 的贡献者,我真的非常感谢我们使用了 GitLab。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-gnome-uses-git + +作者:[Molly de Blanc][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mollydb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/redpanda_firefox_pet_animal.jpg?itok=aSpKsyna (red panda) +[2]: https://www.gnome.org/foundation/ +[3]: https://gnome.org/ +[4]: https://www.gtk.org/ +[5]: https://gstreamer.freedesktop.org/ +[6]: https://gitlab.gnome.org/ +[7]: https://twitter.com/csoriano1618?lang=en +[8]: https://opensource.com/article/19/8/poll-favorite-gnome-version From 292bd2260937aebe9c2688948b10cd490b22fb9d Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 21 Jan 2020 09:23:22 +0800 Subject: [PATCH 653/676] translated --- ...ith this open source to-do list manager.md | 109 ------------------ ...ith this open source to-do list manager.md | 107 +++++++++++++++++ 2 files changed, 107 insertions(+), 109 deletions(-) delete mode 100644 sources/tech/20200117 Get started with this open source to-do list manager.md create mode 100644 translated/tech/20200117 Get started with this open source to-do list manager.md diff --git a/sources/tech/20200117 Get started with this open source to-do list manager.md b/sources/tech/20200117 Get started with this open source to-do list manager.md deleted file mode 100644 index 210c8508c1..0000000000 --- a/sources/tech/20200117 Get started with this open source to-do list manager.md +++ /dev/null @@ -1,109 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with this open source to-do list manager) -[#]: via: (https://opensource.com/article/20/1/open-source-to-do-list) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Get started with this open source to-do list manager -====== -Todo is a powerful way to keep track of your task list. Learn how to use -it in the seventh in our series on 20 ways to be more productive with -open source in 2020. -![Team checklist][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Track your tasks with todo - -Tasks and to-do lists are very near and dear to my heart. I'm a big fan of productivity (so much so that I do a [podcast][2] about it) and try all sorts of different applications. I've even [given presentations][3] and [written articles][4] about them. So it only makes sense that, when I talk about being productive, task and to-do list tools are certain to come up. - -![Getting fancy with Todo.txt][5] - -In all honesty, for being simple, cross-platform, and easily synchronized, you cannot go wrong with [todo.txt][6]. It is one of the two to-do list and task management apps that I keep coming back to over and over again (the other is [Org mode][7]). And what keeps me coming back is that it is simple, portable, understandable, and has many great add-ons that don't break it if one machine has them and the others don't. And since it is a Bash shell script, I have never found a system that cannot support it. - -#### Set up todo.txt - -First things first, you need to install the base shell script and copy the default configuration file to the **~/.todo** directory: - - -``` -git clone -cd todo.txt-cli -make -sudo make install -mkdir ~/.todo -cp todo.cfg ~/.todo/config -``` - -Next, set up the configuration file. I like to uncomment the color settings at this point, but the only thing that must be set up right away is the **TODO_DIR** variable: - - -``` -`export TODO_DIR="$HOME/.todo"` -``` - -#### Add to-do's - -To add your first to-do item, simply type **todo.sh add <NewTodo>**, and it will be added. This will also create three files in **$HOME/.todo/**: todo.txt, done.txt, and reports.txt. - -After adding a few items, run **todo.sh ls** to see your to-do list. - -![Basic todo.txt list][8] - -#### Manage your tasks - -You can improve it a little by prioritizing the items. To add a priority to an item, run **todo.sh pri # A**. The number is the number of the task on the list, and the letter "A" is the priority. You can set the priority as anything from A to Z since that's how it will get sorted. - -To complete a task, run **todo.sh do #** to mark the item done and move the item to done.txt. Running **todo.sh report** will write a count of done and not done items to reports.txt. - -The file format used for all three files is well documented, so you can make changes with your text editor of choice. The basic format of todo.txt is: - - -``` -`(Priority) YYYY-MM-DD Task` -``` - -The date indicates the due date of a task, if one is set. When editing the file manually, just put an "x" in front of the task to mark it as done. Running **todo.sh archive** will move these items to done.txt, and you can work in that text file and archive the done items when you have time. - -#### Set up recurring tasks - -I have a lot of recurring tasks that I need to schedule every day/week/month. - -![Recurring tasks with the ice_recur add-on][9] - -This is where todo.txt's flexibility comes in. By using [add-ons][10] in **~/.todo.actions.d/**, you can add commands and extend the functionality of the base todo.sh. The add-ons are basically scripts that implement specific commands. For recurring tasks, the plugin [ice_recur][11] should fit the bill. By following the instructions on the page, you can set up tasks to recur in a very flexible manner. - -![Todour on MacOS][12] - -There are a lot of add-ons in the directory, including syncing to some cloud services. There are also links to desktop and mobile apps, so you can keep your to-do list with you on the go. - -I've only scratched the surface of todo's functionality, so take some time to dig in and see how powerful this tool is! It really helps me keep on task every day. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/open-source-to-do-list - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) -[2]: https://productivityalchemy.com/ -[3]: https://www.slideshare.net/AllThingsOpen/getting-to-done-on-the-command-line -[4]: https://opensource.com/article/18/2/getting-to-done-agile-linux-command-line -[5]: https://opensource.com/sites/default/files/uploads/productivity_7-1.png -[6]: http://todotxt.org/ -[7]: https://orgmode.org/ -[8]: https://opensource.com/sites/default/files/uploads/productivity_7-2.png (Basic todo.txt list) -[9]: https://opensource.com/sites/default/files/uploads/productivity_7-3.png (Recurring tasks with the ice_recur add-on) -[10]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory -[11]: https://github.com/rlpowell/todo-text-stuff -[12]: https://opensource.com/sites/default/files/uploads/productivity_7-4.png (Todour on MacOS) diff --git a/translated/tech/20200117 Get started with this open source to-do list manager.md b/translated/tech/20200117 Get started with this open source to-do list manager.md new file mode 100644 index 0000000000..5845325fde --- /dev/null +++ b/translated/tech/20200117 Get started with this open source to-do list manager.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with this open source to-do list manager) +[#]: via: (https://opensource.com/article/20/1/open-source-to-do-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +开始使用开源待办清单管理器 +====== +Todo 是跟踪任务列表的强大方法。在我们的 20 个使用开源提升生产力的系列的第七篇文章中了解如何使用它。 +![Team checklist][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 todo 跟踪任务 + +任务和待办事项列表离我很近。我是生产力的狂热粉丝(以至于我为此做了一个[播客][2]),我尝试了各种不同的应用。我甚至为此[做了演讲][3]并[写了些文章][4]。因此,当我谈到提高工作效率时,肯定会出现任务和待办事项清单工具。 + +![Getting fancy with Todo.txt][5] + +说实话,由于简单、跨平台且易于同步,你用 [todo.txt][6] 不会错。它是两个我经常使用的待办列表以及任务管理应用之一(另一个是 [Org mode][7])。让我继续使用它的原因它简单、便携、易于理解,并且有许多很好的附加组件,并且当一台机器有附加组件,而另一台没有,也不会破坏程序。由于它是一个 Bash shell 脚本,我还没发现一个无法支持它的系统。 + +#### 设置 todo.txt + +首先,你需要安装基本 shell 脚本并将默认配置文件复制到 **~/.todo** 目录: + + +``` +git clone +cd todo.txt-cli +make +sudo make install +mkdir ~/.todo +cp todo.cfg ~/.todo/config +``` + +接下来,设置配置文件。此时,我想取消注释颜色设置,但必须马上设置的是 **TODO_DIR** 变量: + + +``` +`export TODO_DIR="$HOME/.todo"` +``` + +#### 添加待办事件 + +要添加第一个待办事件,只需输入 **todo.sh add <NewTodo>** 就能添加。这还将在 **$HOME/.todo/** 中创建三个文件:todo.txt、todo.txt 和 reports.txt。 + +添加几个项目后,运行 **todo.sh ls** 查看你的待办事项。 + +![Basic todo.txt list][8] + +#### 管理任务 + +你可以通过给项目设置优先级来稍微改善它。要向项目添加优先级,运行 **todo.sh pri # A**。数字是列表中任务的数量,而字母 ”A“ 是优先级。你可以将优先级设置为从 A 到 Z,因为这是它的排序方式。 + +要完成任务,运行**todo.sh do #** 来标记项目已完成,并将项目移动到 done.txt。运行 **todo.sh report** 会向 report.txt 写入已完成和未完成项的数量。 + +所有三个文件的格式都有详细记录,因此你可以选择自己的文本编辑器修改。todo.txt 的基本格式是: + + +``` +`(Priority) YYYY-MM-DD Task` +``` + +如果设置了任务,那么日期表示任务的到期日期。手动编辑文件时,只需在任务前面加一个 ”x“ 来标记为已完成。运行 **todo.sh archive** 会将这些项目移动到 done.txt,你可以在该文本文件编辑,并在有时间时将已完成的项目归档。 + +#### 设置重复任务 + +我有很多重复任务,我需要以每天/周/月来计划。 + +![Recurring tasks with the ice_recur add-on][9] + +这就是 todo.txt 的灵活性所在。通过在 **~/.todo.actions.d/** 中使用[附加组件][10],你可以添加命令并扩展基本 todo.sh 的功能。附加组件基本上是实现特定命令的脚本。对于重复执行的任务,插件 [ice_recur][11] 可以满足。按照页面上的说明操作,你可以以非常灵活的方式设置要重复处理的任务。 + +![Todour on MacOS][12] + +目录中有很多附加组件,包括同步到某些云服务。也有链接到桌面或移动端应用的组件,这样你可以随时看到待办列表。 + +我只介绍了这个 todo 功能的表面,所以请花点时间深入了解这个工具的强大!它真的帮助我跟上每天的任务。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-to-do-list + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) +[2]: https://productivityalchemy.com/ +[3]: https://www.slideshare.net/AllThingsOpen/getting-to-done-on-the-command-line +[4]: https://opensource.com/article/18/2/getting-to-done-agile-linux-command-line +[5]: https://opensource.com/sites/default/files/uploads/productivity_7-1.png +[6]: http://todotxt.org/ +[7]: https://orgmode.org/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_7-2.png (Basic todo.txt list) +[9]: https://opensource.com/sites/default/files/uploads/productivity_7-3.png (Recurring tasks with the ice_recur add-on) +[10]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory +[11]: https://github.com/rlpowell/todo-text-stuff +[12]: https://opensource.com/sites/default/files/uploads/productivity_7-4.png (Todour on MacOS) \ No newline at end of file From 38356fac22520e687090afcc34661e06de2a07a3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 21 Jan 2020 09:26:25 +0800 Subject: [PATCH 654/676] translating --- ... this Twitter client for Linux to tweet from the terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md index c49b45ace4..1e9eda911f 100644 --- a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md +++ b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ebb37f710d3fd3262a22784f5a893c08b16ce25b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 09:27:45 +0800 Subject: [PATCH 655/676] PRF --- .../talk/20191015 How GNOME uses Git.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/talk/20191015 How GNOME uses Git.md b/translated/talk/20191015 How GNOME uses Git.md index e9b82aa7d1..adca6f09e9 100644 --- a/translated/talk/20191015 How GNOME uses Git.md +++ b/translated/talk/20191015 How GNOME uses Git.md @@ -1,42 +1,42 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How GNOME uses Git) [#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) [#]: author: (Molly de Blanc https://opensource.com/users/mollydb) -GNOME 项目是如何使用 Git 的? +一个非技术人员对 GNOME 项目使用 GitLab 的感受 ====== -将 GNOME 项目集中在 GitLab 上的决定为整个社区(不只是开发人员)带来了好处。 +> 将 GNOME 项目集中在 GitLab 上的决定为整个社区(不只是开发人员)带来了好处。 ![red panda][1] -“您的 GitLab 是什么?”这是我在 [GNOME 基金会][2]工作的第一天被问到的第一个问题之一,该基金会是支持 GNOME 项目的非盈利组织,包括[桌面环境][3]、[GTK][4] 和 [GStreamer][5]。此人指的是我在 [GNOME 的 GitLab 实例][6上的用户名。我在 GNOME 期间,经常有人要求我提供我的 GitLab。 +“您的 GitLab 是什么?”这是我在 [GNOME 基金会][2]工作的第一天被问到的第一个问题之一,该基金会是支持 GNOME 项目(包括[桌面环境][3]、[GTK][4] 和 [GStreamer][5])的非盈利组织。此人问的是我在 [GNOME 的 GitLab 实例][6]上的用户名。我在 GNOME 期间,经常有人要求我提供我的 GitLab。 -我们使用 GitLab 进行几乎所有操作。通常情况下,我会收到一些提案和参考错误报告,有时还需要修改文件。我不是以开发人员或系统管理员的身份进行此操作的。我参与了“参与度、包容性和多样性(I&D)”团队。我为 GNOME 朋友们撰写新闻通讯,并采访该项目的贡献者。我为 GNOME 活动提供赞助。我不写代码,但我每天都使用 GitLab。 +我们使用 GitLab 进行几乎所有操作。通常情况下,我会收到一些提案issue和参考错误报告,有时还需要修改文件。我不是以开发人员或系统管理员的身份进行此操作的。我参与了“参与度、包容性和多样性(I&D)”团队。我为 GNOME 朋友们撰写新闻通讯,并采访该项目的贡献者。我为 GNOME 活动提供赞助。我不写代码,但我每天都使用 GitLab。 -在过去的二十年中,GNOME 项目的管理采用了各种方式。该项目的不同部分使用不同的系统来跟踪代码更改、协作以及作为项目和社交空间共享信息。但是,该项目决定,它需要更加一体化,这从构思到完成大约花费了一年的时间。 +在过去的二十年中,GNOME 项目的管理采用了各种方式。该项目的不同部分使用不同的系统来跟踪代码更改、协作以及作为项目和社交空间共享信息。但是,该项目决定,它需要更加地一体化,这从构思到完成大约花费了一年的时间。 -GNOME 希望切换到单个工具供整个社区使用的原因很多。外部项目与 GNOME 息息相关,并为它们提供与资源交互的更简单的方式对于项目至关重要,无论是支持社区还是发展生态系统。我们还希望更好地跟踪 GNOME 的指标,即贡献者的数量、贡献的类型和数量以及项目不同部分的开发进度。 +GNOME 希望切换到单个工具供整个社区使用的原因很多。外部项目与 GNOME 息息相关,并为它们提供更简单的与资源交互的方式对于项目至关重要,无论是支持社区还是发展生态系统。我们还希望更好地跟踪 GNOME 的指标,即贡献者的数量、贡献的类型和数量以及项目不同部分的开发进度。 -当需要选择一种协作工具时,我们考虑了我们需要的东西。最重要的要求之一是它必须由 GNOME 社区托管。由第三方托管并不是一种选择,因此像 GitHub 和 Atlassian 这样的服务就不在考虑之中。而且,当然了,它必须是自由软件。很快,唯一真正的竞争者就是 GitLab。我们希望确保进行贡献很容易。GitLab 具有诸如单点登录的功能,该功能允许人们使用 GitHub、Google、GitLab.com 和 GNOME 帐户登录。 +当需要选择一种协作工具时,我们考虑了我们需要的东西。最重要的要求之一是它必须由 GNOME 社区托管。由第三方托管并不是一种选择,因此像 GitHub 和 Atlassian 这样的服务就不在考虑之中。而且,当然了,它必须是自由软件。很快,唯一真正的竞争者出现了,它就是 GitLab。我们希望确保进行贡献很容易。GitLab 具有诸如单点登录的功能,该功能允许人们使用 GitHub、Google、GitLab.com 和 GNOME 帐户登录。 我们认为 GitLab 是一条出路,我们开始从许多工具迁移到单个工具。GNOME 董事会成员 [Carlos Soriano][7] 领导这项改变。在 GitLab 和 GNOME 社区的大力支持下,我们于 2018 年 5 月完成了该过程。 -人们非常希望迁移到 GitLab 有助于社区的发展,并使贡献更容易。由于 GNOME 以前使用了许多不同的工具,包括 Bugzilla 和 CGit,因此很难定量地评估这次切换对贡献量的影响。但是,我们可以更清楚地跟踪一些统计数据,例如在 2018 年 6 月至 2018 年 11 月之间关闭了近 10,000 个提案,合并了 7,085 个合并请求。人们感到社区在发展壮大,越来越受欢迎,而且贡献实际上也更容易。 +人们非常希望迁移到 GitLab 有助于社区的发展,并使贡献更加容易。由于 GNOME 以前使用了许多不同的工具,包括 Bugzilla 和 CGit,因此很难定量地评估这次切换对贡献量的影响。但是,我们可以更清楚地跟踪一些统计数据,例如在 2018 年 6 月至 2018 年 11 月之间关闭了近 10,000 个提案,合并了 7,085 个合并请求。人们感到社区在发展壮大,越来越受欢迎,而且贡献实际上也更加容易。 人们因不同的原因而开始使用自由软件,重要的是,可以通过为需要软件的人提供更好的资源和更多的支持来公平竞争。Git 作为一种工具已被广泛使用,并且越来越多的人使用这些技能来参与到自由软件当中。自托管的 GitLab 提供了将 Git 的熟悉度与 GitLab 提供的功能丰富、用户友好的环境相结合的绝佳机会。 -已经一年多了,变化确实很明显。持续集成(CI)为开发带来了巨大的好处,并且已经完全集成到 GNOME 的几乎每个部分当中。不进行代码开发的团队也转而使用 GitLab 生态系统进行工作。无论是使用问题跟踪来管理分配的任务,还是使用版本控制来共享和管理资产,就连“参与度、包容性和多样性(I&D)”这样的团队都已经使用了 GitLab。 +切换到 GitLab 已经一年多了,变化确实很明显。持续集成(CI)为开发带来了巨大的好处,并且已经完全集成到 GNOME 的几乎每个部分当中。不进行代码开发的团队也转而使用 GitLab 生态系统进行工作。无论是使用问题跟踪来管理分配的任务,还是使用版本控制来共享和管理资产,就连“参与度、包容性和多样性(I&D)”这样的团队都已经使用了 GitLab。 一个社区,即使是一个正在开发的自由软件,也很难适应新技术或新工具。在类似 GNOME 的情况下,这尤其困难,该项目[最近已经 22 岁了] [8]。像 GNOME 这样经过了 20 多年建设的项目,太多的人和组织使用了太多的部件,但迁移工作之所以能实现,这要归功于 GNOME 社区的辛勤工作和 GitLab 的慷慨帮助。 在为使用 Git 进行版本控制的项目工作时,我发现很方便。这是一个令人感觉舒适和熟悉的系统,是一个在工作场所和爱好项目之间保持一致的工具。作为 GNOME 社区的新成员,能够参与并使用 GitLab 真是太好了。作为社区建设者,看到这样结果是令人鼓舞的:越来越多的相关项目加入并进入生态系统;新的贡献者和社区成员对该项目做出了首次贡献;以及增强了衡量我们正在做的工作以了解其成功和成功的能力。 -如此多的做着完全不同的事情(例如他们正在从事的不同工作以及所使用的不同技能)的团队同意集中在一个工具上(尤其是被认为是跨开源的标准工具),这一点很棒。 作为 GNOME 的贡献者,我真的非常感谢我们使用了 GitLab。 +如此多的做着完全不同的事情(例如他们正在从事的不同工作以及所使用的不同技能)的团队同意汇集在一个工具上(尤其是被认为是跨开源的标准工具),这一点很棒。作为 GNOME 的贡献者,我真的非常感谢我们使用了 GitLab。 -------------------------------------------------------------------------------- @@ -45,7 +45,7 @@ via: https://opensource.com/article/19/10/how-gnome-uses-git 作者:[Molly de Blanc][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8312cbc74e97a06e300817bbd6fb99e1f12a1940 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 21 Jan 2020 09:28:35 +0800 Subject: [PATCH 656/676] PUB @wxy https://linux.cn/article-11806-1.html --- {translated/talk => published}/20191015 How GNOME uses Git.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20191015 How GNOME uses Git.md (98%) diff --git a/translated/talk/20191015 How GNOME uses Git.md b/published/20191015 How GNOME uses Git.md similarity index 98% rename from translated/talk/20191015 How GNOME uses Git.md rename to published/20191015 How GNOME uses Git.md index adca6f09e9..d39600f1ef 100644 --- a/translated/talk/20191015 How GNOME uses Git.md +++ b/published/20191015 How GNOME uses Git.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11806-1.html) [#]: subject: (How GNOME uses Git) [#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) [#]: author: (Molly de Blanc https://opensource.com/users/mollydb) From 54af0d82109dd2bec8c2d8a94b50f05e295404bc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:55:43 +0800 Subject: [PATCH 657/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Read?= =?UTF-8?q?=20Reddit=20from=20the=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 Read Reddit from the Linux terminal.md --- ...121 Read Reddit from the Linux terminal.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20200121 Read Reddit from the Linux terminal.md diff --git a/sources/tech/20200121 Read Reddit from the Linux terminal.md b/sources/tech/20200121 Read Reddit from the Linux terminal.md new file mode 100644 index 0000000000..81c7e9d35e --- /dev/null +++ b/sources/tech/20200121 Read Reddit from the Linux terminal.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Read Reddit from the Linux terminal) +[#]: via: (https://opensource.com/article/20/1/open-source-reddit-client) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Read Reddit from the Linux terminal +====== +Take brief mental breaks from your work with Reddit client Tuir in the +eleventh in our series on 20 ways to be more productive with open source +in 2020. +![Digital creative of a browser on the internet][1] + +Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. + +### Read Reddit with Tuir + +Taking short breaks is essential in staying productive. One of the places I like to go when taking a break is [Reddit][2], which can be a great resource if you want it to be. I find all kinds of articles there about DevOps, productivity, Emacs, chickens, and some ChromeOS projects I play with. These discussions can be valuable. I also follow a couple of subreddits that are just pictures of animals because I like pictures of animals (and not just chickens), and sometimes after a long work session, what I really need are kitten pictures. + +![/r/emacs in Tuir][3] + +When I'm reading Reddit (and not just looking at pictures of baby animals), I use [Tuir][4], which stands for Terminal UI for Reddit. Tuir is a feature-complete Reddit client and can be run on any system that runs Python. Installation is done through the pip Python installer and is exceptionally painless. + +On its first run, Tuir will take you to the default article list on Reddit. The top and bottom of the screen have bars that list different commands. The top bar shows your location on Reddit, and the second line shows the commands filtered by the Reddit "Hot/New/Controversial/etc." categories. Filtering is invoked by pressing the number next to the filter you want to use. + +![Filtering by Reddit's "top" category][5] + +You can navigate through the list with the arrow keys, or with the **j**, **k**, **h**, and **l** keys, the same ones you use for Vi/Vim. The bottom bar has commands for navigating the app. If you want to jump to another subreddit, simply hit the **/** key to open a prompt and type the name of the subreddit you want to interact with. + +![Logging in][6] + +Some things aren't accessible unless you are logged in. Tuir will prompt you if you try to do something that requires logging in, like posting a new article (**c**) or up/down voting (**a** and **z**, respectively). To log in, press the **u** key. This will launch a browser to log in via OAuth2, and Tuir will save the token. Afterward, your username should appear in the top-right of the screen. + +Tuir can also launch your browser to view images, load links, and so on. With a little tuning, it can even show images on the terminal (although I didn't manage to get that to work properly). + +Overall, I'm pretty happy with Tuir for quickly catching up on Reddit when I need a break. + +Tuir is one of two forks of the now-defunct [RTV][7]. The other is [TTRV][8], which isn't available via pip (yet) but has the same features. I'm looking forward to seeing how they differentiate themselves over time. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-reddit-client + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://www.reddit.com/ +[3]: https://opensource.com/sites/default/files/uploads/productivity_11-1.png (/r/emacs in Tuir) +[4]: https://gitlab.com/ajak/tuir +[5]: https://opensource.com/sites/default/files/uploads/productivity_11-2.png (Filtering by Reddit's "top" category) +[6]: https://opensource.com/sites/default/files/uploads/productivity_11-3.png (Logging in) +[7]: https://github.com/michael-lazar/rtv +[8]: https://github.com/tildeclub/ttrv From 0d4c1fc5d3a4596d9eaadf4194bec5dc05bb0ef6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:56:31 +0800 Subject: [PATCH 658/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=2013=20o?= =?UTF-8?q?f=20the=20best=20React=20JavaScript=20frameworks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 13 of the best React JavaScript frameworks.md --- ...of the best React JavaScript frameworks.md | 496 ++++++++++++++++++ 1 file changed, 496 insertions(+) create mode 100644 sources/tech/20200121 13 of the best React JavaScript frameworks.md diff --git a/sources/tech/20200121 13 of the best React JavaScript frameworks.md b/sources/tech/20200121 13 of the best React JavaScript frameworks.md new file mode 100644 index 0000000000..e82ef14a8a --- /dev/null +++ b/sources/tech/20200121 13 of the best React JavaScript frameworks.md @@ -0,0 +1,496 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (13 of the best React JavaScript frameworks) +[#]: via: (https://opensource.com/article/20/1/react-javascript-frameworks) +[#]: author: (Amit Dua https://opensource.com/users/amitdua) + +13 of the best React JavaScript frameworks +====== +If you're using React.js or React Native to create user interfaces, try +these frameworks. +![Javascript code close-up with neon graphic overlay][1] + +React.js and React Native are popular open source platforms for developing user interfaces (UIs); both rank well for desirability and use in StackOverflow's 2019 Developer Survey. React.js was developed by Facebook in 2011 as a JavaScript library to address the need for cross-platform, dynamic, and high-performing UIs, while React Native, which Facebook released in 2015, is used for building native applications using JavaScript. + +The following are 13 of the best React JavaScript frameworks; all are open source—the first 11 (like React) are licensed under the MIT license and the latter two are licensed under Apache 2.0. + +### 1\. Create React App + +This command-line interface from Facebook developers is a must-have for every React Native project. The reason is that the [Create React App][2] is easy to use and prevents you from having to manually set up and configure your app, thereby saving you a lot of time and effort. With just a simple command, everything will be ready for you to create a React native project easily. You can use it to build a catalog and files, and the framework also includes tools to build, test, and launch your application. + + +``` +# Install package +$ npm install -g create-react-native-web-app +  +# Run create-react-native-web-app <project-directory> +$ create-react-native-web-app myApp +  +# cd into your <project-directory> +$ cd myApp +  +# Run Web/Ios/Android development +# Web +$ npm run web +  +# IOS (simulator) +$ npm run ios +  +# Android (connected device) +$ npm run android +``` + +#### Why opt for Create React App + + 1. Top-notch tool developed with a configure bundle, transpiler, and test runner + 2. No configuration and no extra files at the app structure + 3. Fixed Development stack + 4. Effective Fast developing tool + + + +### 2\. Material Kit React + +Inspired by Google's Material Design system, [Material Kit React][3] can be an excellent choice for building React UI components. The best thing about this library is that it offers a lot of components that are built to fit together and look incredible. There are over 1,000 fully coded components, and each one comes with separate layers organized in folders. This means you have thousands of options to choose from. There are several example pages as well, in case you want to get inspiration or share an idea or concept with someone. + +#### Installing the Material Kit + + +``` +`  $ npm install @material-ui/core` +``` + +#### Implementation + + +``` +import React from 'react'; +import Button from '@material-ui/core/Button'; + +const App = () => ( +  <Button variant="contained" color="primary"> +    Hello World +  </Button> +); +``` + +The Material-UI component work without any additional setup, and do not pollute the global scope. + +#### Advantage + +The React component supports easier and faster web development. With it, you can build your own design system, or start with Material Design. + +### 3\. Shards React + +This modern React UI kit has been built from scratch to achieve fast performance. It has a modern design system that lets you customize things the way you want. You can even download the source files to customize things at the code level. Also, the SCSS syntax used for styling enhances the development experience. + +[Shards React][4] is based on Shards and uses React Datepicker, React Popper (a positioning engine), and noUISlider. It also supports incredible Material Design icons. There are some pre-made versions to help you gain some inspiration and get started. + +#### Installation Shards with Yarn or NPM + + +``` +# Yarn +yarn add shards-react + +# NPM +npm i shards-react +``` + +#### Advantages + + 1. Shards is lightweight having a small footprint and weighting ~13kb minified and gzipped + 2. Shards is responsive by default being able to adapt and reflow its layout to any screen size + 3. Shards is well documented so you can start building beautiful interfaces as soon as possible + + + +### 4\. Styled Components + +This efficient CSS tool helps build small, reusable components that are responsible for an app's visual interface. With traditional CSS, you can accidentally overwrite the selectors used in other places on the website, but [Styled Components][5] can help you completely avoid this problem by using a CSS syntax directly inside your components. + +#### Installation + + +``` +`npm install --save styled-components` +``` + +#### Implementation + + +``` +const Button = styled.button` +  background: background_type; +  border-radius: radius_value; +  border: abc; +  color: name_of_color; +  Margin: margin_value; +  padding: value; +``` + +#### Advantage + + 1. Make components more readable + 2. Components rely on JavaScript for their style + 3. Build custom components with CSS + 4. Inline styling + 5. Convert component even the custom component to a styled component by simply invoking styled() + + + +### 5\. Redux + +[Redux][6] is a state-management solution for JavaScript applications. While it is mostly used for React.js, you can also use it for other React-like frameworks. + +#### Installation + + +``` +sudo npm install redux +sudo npm install react-redux +``` + +#### Implementation + + +``` +import { createStore } from "redux"; +import rotateReducer from "reducers/rotateReducer"; + +function configureStore(state = { rotating: value}) { +  return createStore(rotateReducer,state); +} + +export default configureStore; +``` + +#### Advantage + + 1. Predictable state update helps in defining the data flow of the application + 2. Logic easier to test and time-travel debugging with reducer functions + 3. Centralizing the state + + + +### 6\. React Virtualized + +This React Native JavaScript framework helps in large-list and tabular-data rendering. Using [React Virtualized][7], you can restrict the number of requests and Document Object Model (DOM) elements, thus enhancing the performance of React apps. + +#### Installation + + +``` +`npm install react-virtualized` +``` + +#### Implementation + + +``` +import 'react-virtualized/styles.css' +import { Column, Table } from 'react-virtualized' +import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer' +import List from 'react-virtualized/dist/commonjs/List' +{ +  alias: { +    'react-virtualized/List': 'react-virtualized/dist/es/List', +  }, +  ...rest +} +``` + +#### Advantages + + 1. Display a large amount of data efficiently + 2. Rendering a huge data set + 3. Implements virtual rendering with a set of components + + + +### 7\. React DnD + +[ReactDnD][8] is responsible for the creation of complex drag-and-drop interfaces. There are dozens of drag-and-drop libraries, but React DnD stands out because it is built on top of modern HTML5's drag-and-drop API, making the process of creating interfaces easy. + +#### Installation + + +``` +`npm install react-dnd-preview` +``` + +#### Implementation + + +``` + import Preview from 'react-dnd-preview'; +  +  const generatePreview = ({itemType, item, style}) => { +    return <div class="item-list" style={style}>{itemType}</div>; +  }; +  +  class App extends React.Component { +    ... +  +    render() { +      return ( +        <DndProvider backend={MyBackend}> +          <ItemList /> +          <Preview generator={generatePreview} /> +          // or +          <Preview>{generatePreview}</Preview> +        </DndProvider> +      ); +    } +  } +``` + +#### Advantages + + 1. Beautiful and natural movement of items bouquet + 2. Powerful keyboard and screen reader support wheelchair + 3. Extremely performant + 4. Clean and powerful api + 5. Plays extremely well with standard browser interactions + 6. Unopinionated styling + 7. No creation of additional wrapper dom nodes + + + +### 8\. React Bootstrap + +This UI Kit library replaces Bootstrap's JavaScript with React, giving you more control over the functions of each component. Because each component is built to be easily accessible, [React Bootstrap][9] can be beneficial for frontend framework building. There are thousands of bootstrap themes to choose from. + +#### Installation + + +``` +`npm install react-bootstrap bootstrap` +``` + +#### Implementation + + +``` +import 'bootstrap/dist/css/bootstrap.min.css'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import './index.css'; +import App from './App'; +import registerServiceWorker from './registerServiceWorker'; + +ReactDOM.render(<App />, document.getElementById('root')); +registerServiceWorker(); +``` + +#### Advantages + + 1. Can easily import required code/component + 2. Saves typing and bugs by compressing the Bootstrap + 3. Reduces typing efforts and conflicts by compressing the Bootstrap + 4. It is easy to use + 5. It encapsulates in elements + + + +### 9\. React Suite + +[React Suite][10] is another efficient React.js framework that contains a wide range of component libraries for enterprise system products. It supports all major browsers and platforms, making it suitable for just about any system. It also supports server-side rendering. + +#### Installation + + +``` +`npm i rsuite --save` +``` + +#### Implementation + + +``` +import { Button } from 'rsuite'; +import 'rsuite/styles/less/index.less'; +ReactDOM.render(<Button>Button</Button>, mountNode); +``` + +#### Advantages + + 1. Easily manage the application easily by the help of global accessing features + 2. Redux library centralizes the state management + 3. Redux is flexible with all the UI layers and has a large ecosystem + 4. Redux reduces this complexity and provides global accessibility + + + +### 10\. PrimeReact + +The best thing about [PrimeReact][11] is that it provides components that cover almost all of a UI's basic requirements, such as input options, menus, data presentations, messages, etc. The framework also pays close attention to the mobile experience, thus helping you design touch-optimized elements. + +#### Installation + + +``` +npm install primereact --save +npm install primeicons --save +``` + +#### Implementation + + +``` +import {Dialog} from 'primereact/dialog'; +import {Accordion,AccordionTab} from 'primereact/accordion'; +dependencies: { +    "react": "^16.0.0", +    "react-dom": "^16.0.0", +    "react-transition-group": "^2.2.1", +    "classnames": "^2.2.5", +    "primeicons": "^2.0.0" +} +``` + +#### Advantages + + 1. Simplicity and Performance + 2. Ease of Use + 3. Spring Applications + 4. Create rich user interfaces + 5. Usability and simplicity + + + +### 11\. React Router + +[React Router][12] is quite popular in the React Native developer community because it is very easy to start working with. All you need is Git and the npm package manager installed on your PC, a basic knowledge of React, and a willingness to learn. There is nothing too complicated. + +#### Installation + + +``` +`$ npm install --save react-router` +``` + +#### Implementation + + +``` +import { Router, Route, Switch } from "react-router"; +  +// using CommonJS modules +var Router = require("react-router").Router; +var Route = require("react-router").Route; +var Switch = require("react-router").Switch; +``` + +#### Advantages + + 1. Dynamic route matching + 2. CSS transitions on views when navigating + 3. Standardized app structure and behavior + + + +### 12\. Grommet + +[Grommet][13] is used for creating responsive and accessible mobile-first web apps. The best thing about this Apache 2.0-licensed JavaScript framework is that it offers accessibility, modularity, responsiveness, and theming in one small package. Perhaps this is one of the major reasons it is widely used by companies like Netflix, GE, Uber, and Boeing. + +#### Installation for yarn and npm + + +``` +` $ npm install grommet styled-components --save` +``` + +#### Implementation + + +``` +"grommet-controls/chartjs": { +          "transform": "grommet-controls/es6/chartjs/${member}", +          "preventFullImport": true, +          "skipDefaultConversion": true +``` + +#### Advantages + + 1. Create one toolkit as a packaged deal + 2. Take the open-door policy to the extreme + 3. Restructuring can help influence an established org + + + +### 13\. Onsen UI + +[Onsen UI][14] is another mobile app development framework that uses HTML5 and JavaScript and offers integration with Angular, Vue, and React. It is licensed under Apache 2.0. + +Onsen offers tabs, a side menu, stack navigation, and other components. The best thing about the framework is that all of its components have iOS and Android Material Design support along with automatic styling, which changes the app's appearance depending on the platform. + +#### Installation + + +``` +`npm install onsenui` +``` + +#### Implementation + + +``` +(function() { +    'use strict'; +    var module = angular.module('app', ['onsen']); + +    module.controller('AppController', function($scope) { +      // more to come here +    }); + +})(); +``` + +#### Advantages + + 1. Onsen UI is built on free and open-source code + 2. Doesn't force any type of DRM on apps developed with it + 3. Compiles JavaScript and HTML5 code + 4. Offers end users the native experience + + + +* * * + +What are your favorite React JavaScript frameworks? Please share them in the comments. + +Learn more about React Native, a framework for building native apps using React and JavaScript. + +Whether you are new to JavaScript or an experienced JavaScript developer, using libraries and... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/react-javascript-frameworks + +作者:[Amit Dua][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/amitdua +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_javascript.jpg?itok=60evKmGl (Javascript code close-up with neon graphic overlay) +[2]: https://github.com/facebook/create-react-app +[3]: https://github.com/creativetimofficial/material-kit-react +[4]: https://github.com/DesignRevision/shards-react +[5]: https://github.com/styled-components/styled-components +[6]: https://github.com/reduxjs/redux +[7]: https://github.com/bvaughn/react-virtualized +[8]: https://github.com/react-dnd/react-dnd/ +[9]: https://github.com/react-bootstrap/react-bootstrap +[10]: https://github.com/rsuite/rsuite +[11]: https://github.com/primefaces/primereact +[12]: https://github.com/ReactTraining/react-router +[13]: https://github.com/grommet/grommet +[14]: https://github.com/OnsenUI/OnsenUI From 98aa3020a33c981fc754a0324537b088cba4053e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:57:00 +0800 Subject: [PATCH 659/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20What?= =?UTF-8?q?=20you=20need=20to=20know=20about=20System76's=20open=20source?= =?UTF-8?q?=20firmware=20project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 What you need to know about System76-s open source firmware project.md --- ...System76-s open source firmware project.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20200121 What you need to know about System76-s open source firmware project.md diff --git a/sources/tech/20200121 What you need to know about System76-s open source firmware project.md b/sources/tech/20200121 What you need to know about System76-s open source firmware project.md new file mode 100644 index 0000000000..5e391d05c2 --- /dev/null +++ b/sources/tech/20200121 What you need to know about System76-s open source firmware project.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What you need to know about System76's open source firmware project) +[#]: via: (https://opensource.com/article/20/1/system76-open-source-firmware) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +What you need to know about System76's open source firmware project +====== +This Q&A with System76 principal engineer Jeremy Soller discusses the +company's project for an open source embedded controller. +![Person using a laptop][1] + +When you power on your computer, there’s a lot more going on than you might think. One of the most important elements involved is the embedded controller (EC). This is what is responsible for providing abstractions for the battery, charging system, keyboard, touchpad, suspend/resume, and thermal control, among others. These controllers are typically proprietary and usually run proprietary firmware. + +System76 is about to change that paradigm. Recently, the company adopted [coreboot][2] for their Galago Pro and Darter Pro laptop models. Now they intend to extend the open source approach to the EC. There is a project associated with Chrome OS devices called [Chromium EC][3] that is open source; however, it is only available for Chromebooks and specific EC chips. System76 wanted to supply their customers with an open source embedded controller firmware, too. + +They had to start from scratch with a project that can compile for the EC architecture they have in their laptops, the [Intel 8051][4]. Their project for an [open source EC][5], the System76 EC, is a GPLv3-licensed embedded controller firmware for System76 laptops. It is designed to be portable to boards using several 8-bit microcontrollers. This project has grown to the point where it is now possible to boot a System76 Galago Pro and have the battery, keyboard, touchpad, suspend/resume, and thermal control mentioned earlier. + +Eager to learn more, I emailed [Jeremy Soller][6], who is Principal Engineer at System76, for a deeper dive. Below are some highlights from our conversation. + +### Q: What is the importance of the Intel 8051? Do all laptops use that chipset? + +A: The embedded controller in our laptops, the ITE IT8587E, uses the Intel 8051 instruction set. Not all laptops use this instruction set, but many do. This is important because we need a toolchain that can compile firmware for the 8051 instruction set, as well as firmware that is written for that toolchain. + +### Q: What is involved in writing open code to utilize the Intel 8051? + +A: Mostly we have to define the registers for utilizing hardware on the embedded controller. There are protocols like SMBus and PECI that are implemented in hardware and need drivers for them. These drivers often have to be written for each embedded controller to abstract its hardware, so there is a common interface. Our EC firmware has abstractions for some Arduinos as well as the EC in our laptops, so we can write firmware that is portable. + +### Q: Google developed an open EC. Why not fork that project? + +A: Our initial concept was to utilize Chromium EC for our open EC firmware, but this was not possible. After discussions with members of the team at Google working on it, it became clear that the firmware was not capable of being ported to 8-bit microcontrollers like the 8051 used in our EC, or the AVR used in many Arduinos. It was mostly targeted to ARM microcontrollers. We mutually concluded that it was better to start a new project targeting 8-bit microcontrollers, which is a new codebase that is GPLv3, as opposed to the BSD license used by Chromium EC. + +### Q: How significant is it that System76 is open sourcing the code? + +A: The only other x86_64 laptops with open source EC firmware are certain Chromebooks using Chromium EC. However, these laptops have poor support for full desktop Linux distributions such as Ubuntu. We are providing users of our laptops with significant capabilities to view and modify the behavior of the laptop to their needs, all while running a full desktop operating system. When it is paired with our open system firmware, there is very little that a user cannot do with one of these laptops. + +### Q: What implications does open code have for firmware and other developers? + +A: I strongly believe that open EC firmware will be just as important for hardware customization as open system firmware. The user can adjust keyboard mappings, change fan curves, modify battery charging settings, and more. The most exciting thing about this is that I cannot predict all that is possible with this change. Many of the components in the system are tied to the EC firmware. Having the ability to change the EC and system firmware means these components could potentially be modified in a large number of different, unpredictable ways. + +### Q: What is really important about developing software for this EC, and what sets it apart? + +A: Something particularly important is that the EC we are using is the IT8587E, and its instruction set architecture is Intel 8051. Chromium EC cannot be compiled for the 8051, due to being targeted toward 32-bit microcontrollers. Our project aims to support the ubiquitous 8-bit microcontrollers from many vendors, as well as Arduino’s for easy prototyping. In addition, this unifies the work we were doing on [Thelio Io][7] with the work we have done on laptop firmware. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/system76-open-source-firmware + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/article/19/11/coreboot-system76-laptops +[3]: https://chromium.googlesource.com/chromiumos/platform/ec/+/master/README.md +[4]: https://en.wikipedia.org/wiki/Intel_MCS-51 +[5]: https://github.com/system76/ec +[6]: https://www.linkedin.com/in/jeremy-soller-0475a117/ +[7]: https://opensource.com/article/18/11/system76-thelio-desktop-computer From 4f16cc0aa33d7bf3b337f8e4e1d0af79cfecd2ec Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:57:20 +0800 Subject: [PATCH 660/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Never?= =?UTF-8?q?=20enough:=20Working=20openly=20with=20anxiety?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200121 Never enough- Working openly with anxiety.md --- ...ver enough- Working openly with anxiety.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20200121 Never enough- Working openly with anxiety.md diff --git a/sources/tech/20200121 Never enough- Working openly with anxiety.md b/sources/tech/20200121 Never enough- Working openly with anxiety.md new file mode 100644 index 0000000000..5fb89e3bc1 --- /dev/null +++ b/sources/tech/20200121 Never enough- Working openly with anxiety.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Never enough: Working openly with anxiety) +[#]: via: (https://opensource.com/open-organization/20/1/leading-openly-anxiety) +[#]: author: (Sam Knuth https://opensource.com/users/samfw) + +Never enough: Working openly with anxiety +====== +Open organizations reward initiative. For leaders with anxiety, that may +fuel some exhausting patterns. +![A graph of a wave.][1] + +_Editor's note: This article is part of a series on working with mental health conditions. It details the author's personal experiences and is not meant to convey professional medical advice or guidance._ + +Something in [a recent podcast interview][2] with food writer Melissa Clark caught my ear. Asked if she was a "productive person,'' Clark replied by saying: "I am an anxious person. I have a lot of anxiety, and my way of coping with it is to be very, very busy […]. That's how I deal with the world. I [pause] _do_." + +Clark's point resonated with me, because I live with multiple mental health conditions that have a fundamental impact on how I approach my work. And I believe they've played a role in the career success I've experienced. + +I have [generalized anxiety disorder][3] and [obsessive-compulsive disorder][4] (OCD). Both of these conditions have had serious impacts on my life. Some of those impacts have been disruptive. At the same time, some have contributed positively to my success and my development as a leader in a growing organization. + +I've spent most of my career in an organization built on openness and transparency, and yet I have rarely spoken about my mental health and how it might impact my work. In sharing these stories now, I hope to help reduce the [stigma of mental health at work][5] and connect with others who may be experiencing similar or related situations. Given the prevalence of [mental illness globally][6], chances are good that if you don't experience a mental health condition first hand, then you're likely working on a daily basis with someone who does. + +Learning about how mental illness manifests at work may help you navigate relationships with others as well as your own challenges. As a leader in an open organization, I feel compelled to share my experiences in the hope that they are useful to others. Working openly has specific implications for me—and, I suspect, for others with similar mental health conditions—which I'll detail in this series. + +### How it started + +My anxiety and OCD started shortly after I graduated from college and was living in New York City (though I could probably trace their histories further, this was the moment when they became apparent). The wave of confidence I rode during the dot com boom was crushed in the bubble-bursting crash in March of 2001. The memory of coming into work, being called into an all hands meeting (the first we'd ever had at my small company), and being told that as of today there was no money to make payroll, is etched into my mind. + +My girlfriend and I had just moved into a $2100-per-month apartment. Fear of not being able to pay the rent, or being otherwise swallowed up by the city, resulted in a general sense of unease and nervousness in my gut, combined with very real symptoms of OCD. + +For example, while walking to work at a temp job I took after my company folded, I would wonder if I had remembered to lock the apartment door. I would retrace the steps of my morning routine in my mind, trying to find that moment when I turned the key. If I couldn't specifically remember, the sense of unease and worry in my gut would build to the point that I couldn't think about anything else. Frequently, I would turn around, rush back home, and double check that the door was locked. When I did so, I would have to do something memorable, like repeat a phrase out loud, so that I could mark the moment in my memory. Then, back on the way to work, I would again wonder if I had locked the door, and I could say "Yes, and when you did it, you said out loud 'It's Tuesday morning and I'm locking the door!'" + +I've spent most of my career in an organization built on openness and transparency, and yet I have rarely spoken about my mental health and how it might impact my work. + +### So, how does this translate to an advantage at work? + +One of the primary factors contributing to success at my company is an ability to take initiative. Much work needs to be done, and we're in an environment of continual growth and change—which means it's not always clear _what_ needs to be done or _who_ should be doing it. That creates the opportunity for people to observe a need then step up to fill it. This is true in many open organizations, where everyone, regardless of job title or level, is encouraged to step forward. + +Living with anxiety, I continually feel like I need to be doing something, or worry that I'm not doing enough. This motivates me to seek opportunities for contributing. In other words, the anxiety makes me proactive. Being "proactive" or a "self starter" is something you'll find in the "qualifications" section of many job postings! + +I'm very fortunate to have built my career at a successful company, where continual growth creates financial incentives. One of my largest anxieties is about money—the fear of not having enough of it. Being in a leadership role at a quickly growing, profitable company exponentially multiplies what I call the anxiety performance loop (see Figure 1). A high quarterly bonus or other financial reward for a job well done is an invitation to do more, to raise the bar higher, to double down on the behaviors that seem to provide positive outcomes at work. Quarter after quarter after quarter. + +![][7] + +You can observe in all this a virtuous cycle: Opportunities I find at work satisfy my mental needs, and as a result I experience success and rewards. And this, on the face of it, is true. + +So, what's the problem? + +The anxiety-driven performance loop presents two challenges: it never ends, and it is based on a negative emotional state (fear and worry). + +Perhaps the best phrase to illustrate this would be "What have you done for me lately?" In my mental landscape, this is what everyone is thinking about me all the time. No matter what I achieve, no matter what reward or recognition I receive, I imagine that within minutes the person acknowledging my achievement is thinking, "Now, why are you still sitting there? Get out and go do some more!" + +People are not, of course, really thinking this. But my mind can locate enough truth in it to justify a quick return to the fear of not doing enough, which restarts the cycle. + +The anxiety-driven performance loop presents two challenges: it never ends, and it is based on a negative emotional state (fear and worry). + +We live in a world of short attention spans, high expectations, and significant competitive pressures. All of these are real challenges that fuel the idea that after each accomplishment we need to raise the bar higher and keep going. Having anxiety causes me to internalize these pressures, which triggers the "looping" effect. + +The result is that both my company and my career benefit. Mentally, though, I get exhausted. + +I have developed a few coping mechanisms to help me maintain balance: + + * **Mediation.** After I was first diagnosed with my conditions almost 20 years ago, I saw a therapist. After a round of sessions, the therapist referred me to a mediation center, which opened up a new world of thought for me. I've recently been working to reinvigorate my daily practice. + * **Exercise.** I'm a bit compulsive about exercise. I make time every single day for at least one hour of exercise (for me it's walking, cross country skiing, or running). + * **Self awareness, reality checks, and reminders.** Anxiety and OCD can lead to a distorted view of reality. I may overstate stakes, read too much into other people's motivations, or imagine consequences that are just not realistic. Reminding myself of the _true_ worst case scenario (which usually isn't that bad), realizing that other people have more important things to worry about than me, or reminding myself that this is "just a job" can all help bring me back to a realistic perspective. I also have a few other people who can help with this. + + + +So far I've focused primarily on the performance-enhancing aspects of anxiety. In future articles, I'll discuss some of its performance-reducing aspects, as well as the impact my condition has on my colleagues. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/1/leading-openly-anxiety + +作者:[Sam Knuth][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/samfw +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_wavegraph.png?itok=z4pXCf_c (A graph of a wave.) +[2]: http://www.third-story.com/listen/melissaclark +[3]: https://www.mayoclinic.org/diseases-conditions/generalized-anxiety-disorder/symptoms-causes/syc-20360803 +[4]: https://www.mayoclinic.org/diseases-conditions/obsessive-compulsive-disorder/symptoms-causes/syc-20354432 +[5]: https://www.bloomberg.com/news/articles/2019-11-13/mental-health-is-still-a-don-t-ask-don-t-tell-subject-at-work +[6]: https://ourworldindata.org/mental-health +[7]: https://opensource.com/sites/default/files/images/open-org/anxiety_performance_loop.png From 52ff94e4ead43565dbd8599ebed0134b7f177ac2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 22 Jan 2020 00:57:58 +0800 Subject: [PATCH 661/676] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200121=20Beyond?= =?UTF-8?q?=20Moore's=20Law:=20Neuromorphic=20computing=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md --- ...ond Moore-s Law- Neuromorphic computing.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md diff --git a/sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md b/sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md new file mode 100644 index 0000000000..cf2595c012 --- /dev/null +++ b/sources/talk/20200121 Beyond Moore-s Law- Neuromorphic computing.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Beyond Moore's Law: Neuromorphic computing?) +[#]: via: (https://www.networkworld.com/article/3514692/beyond-moores-law-neuromorphic-computing.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Beyond Moore's Law: Neuromorphic computing? +====== +Some researchers think brain-copying architectures should replace traditional computing. One group explains how that might work. +4x-image / Getty Images + +With the conceivable exhaustion of [Moore’s Law][1] – that the number of transistors on a microchip doubles every two years – the search is on for new paths that lead to reliable incremental processing gains over time. + +One possibility is that machines inspired by how the brain works could take over, fundamentally shifting computing to a revolutionary new tier, according to an explainer study released this month by Applied Physics Reviews. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“Today’s state-of-the-art computers process roughly as many instructions per second as an insect brain,” say [the paper’s][3] authors Jack Kendall, of Rain Neuromorphics, and Suhas Kumar, of Hewlett Packard Labs. The two write that processor architecture must now be completely re-thought if Moore’s law is to be perpetuated, and that replicating the “natural processing system of a [human] brain” is the way forward. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Deep neural networks (DNNs) should be the foundation, the group believes. A DNN is basically dynamic deep learning where layers pull high- and low-level detail features (edges and shapes, for example) from data. Kendall and Kumar explain that a human brain, which DNN copies, can sort through massive datasets and generally identify data  better than a traditional computer, so therefore it should be the starting point. + +This kind of thing is being attempted already. Existing artificial intelligence (AI) is a stab at getting computers to learn like a human brain. Much like the brain, AI engines learn from patterns in data. Algorithms are combined with processing power, and rewards are dished out when the machine gets it right. + +A brain-inspired neuromorphic computer, however, would take computing a step further, the team believes. Neuromorphic computing mimics neuro-biological architectures in a kind of hybrid digital-analog circuit, in a way like a body does biologically. + +The group says that they think there are 10 basics that need to be gotten right to get to this next level: + +**Parellelism** – Similar to how a brain works rapidly, numerous mathematical operations must be made to occur simultaneously. It’s an extension of what we see now in graphical processing units (GPUs) where large scale graphics are created using concurrent calculations called matrix multiplications. + +**In-memory computing** – It wastes resources to fetch data from remote places, and human brains, indeed, don’t do that; they store information in the same synapses that perform the thought. The introduction of electronic processing semiconductors that combine memory – [Memristors –][5] could help here. (I wrote a few weeks ago about [progress being made combining transistors with storage][6]. That combo could have similar resource advantages.) + +**Analog computing** – Numbers are analog, not digital, the authors point out. Most real-world numbers aren’t zeros and ones, so, for efficiency, any new computing architecture needs to accept that concept, adapt and handle the inherent precision problems that result. + +**Plasticity** – Real-time tuning needs to take place to account for things changing. + +**Probabilistic computing** – The authors suggest computers should get less precise, just like the human brain. Coming up with certain degrees of probability is faster than precise calculation, and it requires less information. + +**Scalability** – The depth of the network allows for complexity. By introducing more layers, one gains more scaling. + +**Sparsity** – Large-scale networks, including neural computers, can’t connect every node, just as not all neurons are connected to each other in the brain. It’s a redundancy that wastes resources. Hub-and-spoke topology works better and allows for better scaling. The same should happen in the next computers, the researchers say. + +**Learning (credit assignment)** – The adjustment of synaptic weights (the strength and amount of influence synapses have) needs attention related to new information presented. + +**Causality** – The relationship between cause and effect in a result has to be addressed. Causal interference is a problem, and machine learning generally has had problems with getting this bit right. + +**Nonlinearity** – The brain isn’t linear like a computer is. “The brain operates at the edge of chaos to produce the most optimal learning and computation,” the team says. The next computer architecture needs to encompass that brain-like nonlinearity, but also operate within linearity, like today’s electronics. + +“Our present hardware is not able to keep up,” Kendall and Kumar say in their paper, which also looks at materials. “The future of computing will not be about cramming more components on a chip but in rethinking processor architecture,” which should be neuromorphic. + +**Now see** [10 of the world's fastest supercomputers][7] + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3514692/beyond-moores-law-neuromorphic-computing.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3189051/its-time-to-dump-moores-law-to-advance-computing-researcher-says.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://aip.scitation.org/doi/10.1063/1.5129306 +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/2931818/brain-uploads-coming-as-pcs-get-more-powerful.html +[6]: https://www.networkworld.com/article/3510638/researchers-aim-to-build-transistors-that-can-compute-and-store-information-in-one-component.html +[7]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From b1498b9516849ebc7738b52927f2315c35caa130 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 22 Jan 2020 09:17:27 +0800 Subject: [PATCH 662/676] translated --- ...our activities with this Python program.md | 77 ------------------- ...our activities with this Python program.md | 75 ++++++++++++++++++ 2 files changed, 75 insertions(+), 77 deletions(-) delete mode 100644 sources/tech/20200118 Keep a journal of your activities with this Python program.md create mode 100644 translated/tech/20200118 Keep a journal of your activities with this Python program.md diff --git a/sources/tech/20200118 Keep a journal of your activities with this Python program.md b/sources/tech/20200118 Keep a journal of your activities with this Python program.md deleted file mode 100644 index bfa79a8893..0000000000 --- a/sources/tech/20200118 Keep a journal of your activities with this Python program.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Keep a journal of your activities with this Python program) -[#]: via: (https://opensource.com/article/20/1/python-journal) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Keep a journal of your activities with this Python program -====== -Jrnl creates a searchable, timestamped, exportable, and (if you want) -encrypted log of your daily activities. Learn more in the eighth in our -series on 20 ways to be more productive with open source in 2020. -![Writing in a notebook][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Journaling with jrnl - -At my workplace, many of us post an "end of day" status to Slack before we leave for the day. With a lot of projects going on and a global team, it is a pretty good way to share what you got done, what isn't done, and what you need help with. But some days are so busy, so hectic that I can't remember what I did. And this is where journaling comes in. - -![jrnl][2] - -It's pretty easy to keep a text editor open and just add a line when you do something. But it can be challenging to go back and figure out when you make a particular note or pull out related lines quickly and easily. Fortunately, [jrnl][3] is here to help. - -Jrnl allows you to enter a quick entry from your command line, search past entries, and export to rich text formats like HTML and Markdown. You can have multiple journals, meaning you can keep your work entries separated from private ones. It stores entries as plain text, so even if jrnl stops working, you have your data. - -Since jrnl is a Python program, the easiest way to install it is with **pip3 install jrnl**; this will make sure you get the latest and greatest version. On its first run, it will ask some questions, and then you are good to go. - -![jrnl's first run][4] - -Now, whenever you need to make a note or log work, simply type **jrnl <some text>,** and it will be logged with a timestamp to the default file. You can search for entries on a specific date with **jrnl -on YYYY-MM-DD**, entries since a date with **jrnl -from YYYY-MM-DD**, and entries up to a specific date with **jrnl -to YYYY-MM-DD**. Search terms can be combined with the **-and** parameter, allowing for searches like **jrnl -from 2019-01-01 -and -to 2019-12-31**. - -You can also edit entries in the journal with the **\--edit** command-line flag. Before you do, set up your default editor for entries by editing the file **~/.config/jrnl/jrnl.yaml**. This is also where you can specify what files to use for journals, what special character to use for tags, and a few other options. Right now, the important thing is to set the editor. I use Vim, and jrnl's documentation has some [helpful hints][5] for using other editors like VSCode and Sublime Text. - -![Example jrnl config file][6] - -Jrnl can also encrypt journal files. By setting the global **encrypt** variable, you'll tell jrnl to encrypt all the journals you have defined. Encryption can also be set per file by adding **encrypt: true** to the definition in the configuration file. - - -``` -journals: -  default: ~/journals/journal.txt -  work: ~/journals/work.txt -  private: -    journal: ~/journals/private.txt -    encrypt: true -``` - -If a journal isn't already encrypted, you will be prompted for the password on any actions for that journal. The journal file will be stored encrypted on disk and safe from prying eyes. [The jrnl documentation][7] has a lot more information on how it works, what ciphers it uses, and so on. - -![Encrypted jrnl file][8] - -Journaling helps me remember what I did when and find it later when I need it. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/python-journal - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook) -[2]: https://opensource.com/sites/default/files/uploads/productivity_8-1.png (jrnl) -[3]: https://jrnl.sh/ -[4]: https://opensource.com/sites/default/files/uploads/productivity_8-2.png (jrnl's first run) -[5]: https://jrnl.sh/recipes/#external-editors -[6]: https://opensource.com/sites/default/files/uploads/productivity_8-3.png (Example jrnl config file) -[7]: https://jrnl.sh/encryption/ -[8]: https://opensource.com/sites/default/files/uploads/productivity_8-4.png (Encrypted jrnl file) diff --git a/translated/tech/20200118 Keep a journal of your activities with this Python program.md b/translated/tech/20200118 Keep a journal of your activities with this Python program.md new file mode 100644 index 0000000000..ef9d39a396 --- /dev/null +++ b/translated/tech/20200118 Keep a journal of your activities with this Python program.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keep a journal of your activities with this Python program) +[#]: via: (https://opensource.com/article/20/1/python-journal) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用这个 Python 程序记录你的活动 +====== +Jrnl 可以创建可搜索、带时间戳、可导出、加密的(如果需要)的日常活动日志。在我们的 20 个使用开源提升生产力的系列的第八篇文章中了解更多。 +![Writing in a notebook][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 jrnl 记录日志 + +在我的公司,许多人会在下班之前发送一个“一天结束”的状态。在有着许多项目和全球化的团队里,这是一个分享你已完成、未完成以及你需要哪些帮助的一个很好的方式。但有时候我太忙了,以至于我忘了做了什么。这时候就需要记录日志了。 + +![jrnl][2] + +打开一个文本编辑器并在你做一些事的时候添加一行很容易。但是在需要找出你在什么时候做的笔记,或者要快速提取相关的行时会有挑战。幸运的是,[jrnl][3] 可以提供帮助,。 + +Jrnl 能让你在命令行中快速输入条目、搜索过去的条目并导出为 HTML 和 Markdown 等富文本格式。你可以有多个日志,这意味着你可以将工作条目与私有条目分开。它将条目存储为纯文本,因此即使 jrnl 停止工作,数据也不会丢失。 + +由于 jrnl 是一个 Python 程序,最简单的安装方法是使用 **pip3 install jrnl**。这将确保你获得最新和最好的版本。第一次运行它会询问一些问题,接下来就能正常使用。 + +![jrnl's first run][4] + +现在,每当你需要做笔记或记录日志时,只需输入 **jrnl <some text>**,它将带有时间戳的记录保存到默认文件中。你可以使用 **jrnl -on YYYY-MM-DD** 搜索特定日期条目,**jrnl -from YYYY-MM-DD** 搜索在那日期之后的条目,以及用 **jrnl -to YYYY-MM-DD** 搜索自那日期之后的条目。搜索词可以与 **-and** 参数结合使用,允许像 **jrnl -from 2019-01-01 -and -to 2019-12-31** 这类搜索。 + +你还可以使用 **\--edit** 标志编辑日志中的条目。开始之前,通过编辑文件 **~/.config/jrnl/jrnl.yaml** 来设置默认编辑器。你还可以指定使用什么日志文件、用于标签的特殊字符以及一些其他选项。现在,重要的是设置编辑器。我使用 Vim,jrnl 的文档中有一些使用其他编辑器如 VSCode 和 Sublime Text 的[有用提示][5] + +![Example jrnl config file][6] + +Jrnl 还可以加密日志文件。通过设置全局 **encrypt** 变量,你将告诉 jrnl 加密你定义的所有日志。还可在配置文件中的每个文件中设置 **encrypt: true** 来加密文件。 + + +``` +journals: +  default: ~/journals/journal.txt +  work: ~/journals/work.txt +  private: +    journal: ~/journals/private.txt +    encrypt: true +``` + +如果日志尚未加密,系统将提示你输入对它任何操作的密码。日志文件将加密保存在磁盘上,并免受窥探。[jrnl 文档][7] 中包含其工作原理、使用哪些加密方式等的更多信息。 + +![Encrypted jrnl file][8] + +日志记录帮助我记住什么时候做了什么事,并在我需要的时候能够找到它。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/python-journal + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook) +[2]: https://opensource.com/sites/default/files/uploads/productivity_8-1.png (jrnl) +[3]: https://jrnl.sh/ +[4]: https://opensource.com/sites/default/files/uploads/productivity_8-2.png (jrnl's first run) +[5]: https://jrnl.sh/recipes/#external-editors +[6]: https://opensource.com/sites/default/files/uploads/productivity_8-3.png (Example jrnl config file) +[7]: https://jrnl.sh/encryption/ +[8]: https://opensource.com/sites/default/files/uploads/productivity_8-4.png (Encrypted jrnl file) From 31d0d65c6842a5069beb2ed02e8af31c1b94aa56 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 22 Jan 2020 09:23:10 +0800 Subject: [PATCH 663/676] translating --- .../20200116 3 open source tools to manage your contacts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200116 3 open source tools to manage your contacts.md b/sources/tech/20200116 3 open source tools to manage your contacts.md index eeb7877de1..e763954bcc 100644 --- a/sources/tech/20200116 3 open source tools to manage your contacts.md +++ b/sources/tech/20200116 3 open source tools to manage your contacts.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d873de95346783768a34688fb1c3a82ef9f2b2f8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 22 Jan 2020 11:08:04 +0800 Subject: [PATCH 664/676] Rename sources/tech/20200121 What you need to know about System76-s open source firmware project.md to sources/talk/20200121 What you need to know about System76-s open source firmware project.md --- ... need to know about System76-s open source firmware project.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200121 What you need to know about System76-s open source firmware project.md (100%) diff --git a/sources/tech/20200121 What you need to know about System76-s open source firmware project.md b/sources/talk/20200121 What you need to know about System76-s open source firmware project.md similarity index 100% rename from sources/tech/20200121 What you need to know about System76-s open source firmware project.md rename to sources/talk/20200121 What you need to know about System76-s open source firmware project.md From a17fbce9ec61adcbdd960c6e67b470a73a84c79a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 11:24:07 +0800 Subject: [PATCH 665/676] PRF @geekpi --- ...200114 Organize your email with Notmuch.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/translated/tech/20200114 Organize your email with Notmuch.md b/translated/tech/20200114 Organize your email with Notmuch.md index 1d81905ea3..41467a81a3 100644 --- a/translated/tech/20200114 Organize your email with Notmuch.md +++ b/translated/tech/20200114 Organize your email with Notmuch.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Organize your email with Notmuch) @@ -9,8 +9,10 @@ 使用 Notmuch 组织你的邮件 ====== -Notmuch 索引、标记和排序电子邮件。在我们的 20 个使用开源提升生产力的系列的第四篇文章中了解该如何使用。 -![Filing cabinet for organization][1] + +> Notmuch 可以索引、标记和排序电子邮件。在我们的 20 个使用开源提升生产力的系列的第四篇文章中了解该如何使用它。 + +![](https://img.linux.net.cn/data/attachment/album/202001/22/112231xg5dgv6f6g5a1iv1.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 @@ -26,12 +28,11 @@ Notmuch 索引、标记和排序电子邮件。在我们的 20 个使用开源 ![Notmuch's first run][7] -Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 **.notmuch-config** 文件。接下来,运行 **notmuch new** 来索引并标记所有邮件。你可以使用 **notmuch search tag:new** 进行验证,它会找到所有带有 “new” 标签的消息。这可能会有很多邮件,因为 Notmuch 使用 “new” 标签来指示新邮件,因此你需要对其进行清理。 +Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 `.notmuch-config` 文件。接下来,运行 `notmuch new` 来索引并标记所有邮件。你可以使用 `notmuch search tag:new` 进行验证,它会找到所有带有 `new` 标签的消息。这可能会有很多邮件,因为 Notmuch 使用 `new` 标签来指示新邮件,因此你需要对其进行清理。 -运行 **notmuch search tag:unread** 来查找未读消息,这会减少很多邮件。要从你已阅读的消息中删除 “new” 标签,请运行 **notmuch tag -new not tag:unread**,它将搜索所有没有 “unread” 标签的消息,并从其中删除 “new” 标签。现在,当你运行 **notmuch search tag:new**时,它将仅显示未读邮件。 - -但是,批量标记消息可能更有用,因为在每次运行时手动更新标记可能非常繁琐。**\--batch** 命令行选项告诉 Notmuch 读取多行命令并执行它们。还有一个 **\--input=filename** 选项,该选项从文件中读取命令并应用它们。我有一个名为 **tagmail.notmuch** 的文件,用于给”新“邮件添加标签;它看起来像这样: +运行 `notmuch search tag:unread` 来查找未读消息,这会减少很多邮件。要从你已阅读的消息中删除 `new` 标签,请运行 `notmuch tag -new not tag:unread`,它将搜索所有没有 `unread` 标签的消息,并从其中删除 `new` 标签。现在,当你运行 `notmuch search tag:new` 时,它将仅显示未读邮件。 +但是,批量标记消息可能更有用,因为在每次运行时手动更新标记可能非常繁琐。`--batch` 命令行选项告诉 Notmuch 读取多行命令并执行它们。还有一个 `--input=filename` 选项,该选项从文件中读取命令并应用它们。我有一个名为 `tagmail.notmuch` 的文件,用于给“新”邮件添加标签;它看起来像这样: ``` # Manage sent, spam, and trash folders @@ -49,9 +50,9 @@ Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 -new tag:new ``` -我可以在运行 **notmuch new** 后运行 **notmuch tag --input=tagmail.notmuch** 批量处理我的邮件,之后我也可以搜索这些标签。 +我可以在运行 `notmuch new` 后运行 `notmuch tag --input=tagmail.notmuch` 批量处理我的邮件,之后我也可以搜索这些标签。 -Notmuch 还支持 pre-new 和 post-new 钩子。这些脚本存放在 **Maildir/.notmuch/hooks** 中,它们定义了在使用 **notmuch new** 索引新邮件之前(pre-new)和之后(post-new)要做的操作。在昨天的文章中,我谈到了使用 [OfflineIMAP][8] 同步来自 IMAP 服务器的邮件。从 “pre-new” 钩子运行它非常容易: +Notmuch 还支持 `pre-new` 和 `post-new` 钩子。这些脚本存放在 `Maildir/.notmuch/hooks` 中,它们定义了在使用 `notmuch new` 索引新邮件之前(`pre-new`)和之后(`post-new`)要做的操作。在昨天的文章中,我谈到了使用 [OfflineIMAP][8] 同步来自 IMAP 服务器的邮件。从 `pre-new` 钩子运行它非常容易: ``` @@ -63,8 +64,7 @@ notmuch tag -new tag:new offlineimap -a LocalSync -u quiet ``` -你还可以使用可以操作 Notmuch 数据库的 Python 应用 [afew][9],来为你标记_邮件列表_和_垃圾邮件_。你可以用类似的方法在 post-new 钩子中使用 afew: - +你还可以使用可以操作 Notmuch 数据库的 Python 应用 [afew][9],来为你标记*邮件列表*和*垃圾邮件*。你可以用类似的方法在 `post-new` 钩子中使用 `afew`: ``` #!/bin/bash @@ -75,7 +75,7 @@ notmuch tag --input=~/tagmail.notmuch afew -t -n ``` -我建议你在使用 afew 标记邮件时,不要使用 **[ListMailsFilter]**,因为某些邮件处理程序会在邮件中添加模糊或者完全的垃圾列表中的标头(我说的是你 Google)。 +我建议你在使用 `afew` 标记邮件时,不要使用 `[ListMailsFilter]`,因为某些邮件处理程序会在邮件中添加模糊或者彻头彻尾是垃圾的列表标头(我说的就是你 Google)。 ![alot email client][10] @@ -90,14 +90,14 @@ via: https://opensource.com/article/20/1/organize-email-notmuch 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/ksonney [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) -[2]: https://opensource.com/article/20/1/sync-email-offlineimap +[2]: https://linux.cn/article-11804-1.html [3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch) [4]: https://en.wikipedia.org/wiki/Maildir [5]: https://notmuchmail.org/ From c9ed6792836850877c48c39be0088497a7671986 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 22 Jan 2020 11:30:45 +0800 Subject: [PATCH 666/676] Rename sources/tech/20200121 Never enough- Working openly with anxiety.md to sources/talk/20200121 Never enough- Working openly with anxiety.md --- .../20200121 Never enough- Working openly with anxiety.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200121 Never enough- Working openly with anxiety.md (100%) diff --git a/sources/tech/20200121 Never enough- Working openly with anxiety.md b/sources/talk/20200121 Never enough- Working openly with anxiety.md similarity index 100% rename from sources/tech/20200121 Never enough- Working openly with anxiety.md rename to sources/talk/20200121 Never enough- Working openly with anxiety.md From 3260bfae7acce228ee6fe4e61a209f218ba63a1c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 11:42:23 +0800 Subject: [PATCH 667/676] PUB @geekpi https://linux.cn/article-11807-1.html --- .../20200114 Organize your email with Notmuch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200114 Organize your email with Notmuch.md (98%) diff --git a/translated/tech/20200114 Organize your email with Notmuch.md b/published/20200114 Organize your email with Notmuch.md similarity index 98% rename from translated/tech/20200114 Organize your email with Notmuch.md rename to published/20200114 Organize your email with Notmuch.md index 41467a81a3..dc9a67f7d6 100644 --- a/translated/tech/20200114 Organize your email with Notmuch.md +++ b/published/20200114 Organize your email with Notmuch.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11807-1.html) [#]: subject: (Organize your email with Notmuch) [#]: via: (https://opensource.com/article/20/1/organize-email-notmuch) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From af07e34d55fd86693675a397cdea5adfd907deda Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 11:56:12 +0800 Subject: [PATCH 668/676] APL --- ...0190619 Getting started with OpenSSL- Cryptography basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md index 0f3da1b13e..02d9f6f004 100644 --- a/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ b/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c8ba19eaaa506838d57191c97fd5a02028d47aab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 14:28:38 +0800 Subject: [PATCH 669/676] PART 1 --- ...arted with OpenSSL- Cryptography basics.md | 342 ------------------ ...arted with OpenSSL- Cryptography basics.md | 341 +++++++++++++++++ 2 files changed, 341 insertions(+), 342 deletions(-) delete mode 100644 sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md create mode 100644 translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md diff --git a/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md deleted file mode 100644 index 02d9f6f004..0000000000 --- a/sources/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ /dev/null @@ -1,342 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with OpenSSL: Cryptography basics) -[#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-1) -[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen) - -Getting started with OpenSSL: Cryptography basics -====== -Need a primer on cryptography basics, especially regarding OpenSSL? Read -on. -![A lock on the side of a building][1] - -This article is the first of two on cryptography basics using [OpenSSL][2], a production-grade library and toolkit popular on Linux and other systems. (To install the most recent version of OpenSSL, see [here][3].) OpenSSL utilities are available at the command line, and programs can call functions from the OpenSSL libraries. The sample program for this article is in C, the source language for the OpenSSL libraries. - -The two articles in this series cover—collectively—cryptographic hashes, digital signatures, encryption and decryption, and digital certificates. You can find the code and command-line examples in a ZIP file from [my website][4]. - -Let’s start with a review of the SSL in the OpenSSL name. - -### A quick history - -[Secure Socket Layer (SSL)][5] is a cryptographic protocol that [Netscape][6] released in 1995. This protocol layer can sit atop HTTP, thereby providing the _S_ for _secure_ in HTTPS. The SSL protocol provides various security services, including two that are central in HTTPS: - - * Peer authentication (aka mutual challenge): Each side of a connection authenticates the identity of the other side. If Alice and Bob are to exchange messages over SSL, then each first authenticates the identity of the other. - * Confidentiality: A sender encrypts messages before sending these over a channel. The receiver then decrypts each received message. This process safeguards network conversations. Even if eavesdropper Eve intercepts an encrypted message from Alice to Bob (a _man-in-the-middle_ attack), Eve finds it computationally infeasible to decrypt this message. - - - -These two key SSL services, in turn, are tied to others that get less attention. For example, SSL supports message integrity, which assures that a received message is the same as the one sent. This feature is implemented with hash functions, which likewise come with the OpenSSL toolkit. - -SSL is versioned (e.g., SSLv2 and SSLv3), and in 1999 Transport Layer Security (TLS) emerged as a similar protocol based upon SSLv3. TLSv1 and SSLv3 are alike, but not enough so to work together. Nonetheless, it is common to refer to SSL/TLS as if they are one and the same protocol. For example, OpenSSL functions often have SSL in the name even when TLS rather than SSL is in play. Furthermore, calling OpenSSL command-line utilities begins with the term **openssl**. - -The documentation for OpenSSL is spotty beyond the **man** pages, which become unwieldy given how big the OpenSSL toolkit is. Command-line and code examples are one way to bring the main topics into focus together. Let’s start with a familiar example—accessing a web site with HTTPS—and use this example to pick apart the cryptographic pieces of interest. - -### An HTTPS client - -The **client** program shown here connects over HTTPS to Google: - - -``` -/* compilation: gcc -o client client.c -lssl -lcrypto */ - -#include <stdio.h> - -#include <stdlib.h> - -#include <openssl/bio.h> /* BasicInput/Output streams */ - -#include <openssl/err.h> /* errors */ - -#include <openssl/ssl.h> /* core library */ - -#define BuffSize 1024 - -void report_and_exit(const char* msg) { -  [perror][7](msg); -  ERR_print_errors_fp(stderr); -  [exit][8](-1); -} - -void init_ssl() { -  SSL_load_error_strings(); -  SSL_library_init(); -} - -void cleanup(SSL_CTX* ctx, BIO* bio) { -  SSL_CTX_free(ctx); -  BIO_free_all(bio); -} - -void secure_connect(const char* hostname) { -  char name[BuffSize]; -  char request[BuffSize]; -  char response[BuffSize]; - -  const SSL_METHOD* method = TLSv1_2_client_method(); -  if (NULL == method) report_and_exit("TLSv1_2_client_method..."); - -  SSL_CTX* ctx = SSL_CTX_new(method); -  if (NULL == ctx) report_and_exit("SSL_CTX_new..."); - -  BIO* bio = BIO_new_ssl_connect(ctx); -  if (NULL == bio) report_and_exit("BIO_new_ssl_connect..."); - -  SSL* ssl = NULL; - -  /* link bio channel, SSL session, and server endpoint */ - -  [sprintf][9](name, "%s:%s", hostname, "https"); -  BIO_get_ssl(bio, &ssl); /* session */ -  SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* robustness */ -  BIO_set_conn_hostname(bio, name); /* prepare to connect */ - -  /* try to connect */ -  if (BIO_do_connect(bio) <= 0) { -    cleanup(ctx, bio); -    report_and_exit("BIO_do_connect..."); -  } - -  /* verify truststore, check cert */ -  if (!SSL_CTX_load_verify_locations(ctx, -                                      "/etc/ssl/certs/ca-certificates.crt", /* truststore */ -                                      "/etc/ssl/certs/")) /* more truststore */ -    report_and_exit("SSL_CTX_load_verify_locations..."); - -  long verify_flag = SSL_get_verify_result(ssl); -  if (verify_flag != X509_V_OK) -    [fprintf][10](stderr, -            "##### Certificate verification error (%i) but continuing...\n", -            (int) verify_flag); - -  /* now fetch the homepage as sample data */ -  [sprintf][9](request, -          "GET / HTTP/1.1\x0D\x0AHost: %s\x0D\x0A\x43onnection: Close\x0D\x0A\x0D\x0A", -          hostname); -  BIO_puts(bio, request); - -  /* read HTTP response from server and print to stdout */ -  while (1) { -    [memset][11](response, '\0', sizeof(response)); -    int n = BIO_read(bio, response, BuffSize); -    if (n <= 0) break; /* 0 is end-of-stream, < 0 is an error */ -  [puts][12](response); -  } - -  cleanup(ctx, bio); -} - -int main() { -  init_ssl(); - -  const char* hostname = "www.google.com:443"; -  [fprintf][10](stderr, "Trying an HTTPS connection to %s...\n", hostname); -  secure_connect(hostname); - -return 0; -} -``` - -This program can be compiled and executed from the command line (note the lowercase L in **-lssl** and **-lcrypto**): - -**gcc** **-o** **client client.c -lssl** **-lcrypto** - -This program tries to open a secure connection to the web site [www.google.com][13]. As part of the TLS handshake with the Google web server, the **client** program receives one or more digital certificates, which the program tries (but, on my system, fails) to verify. Nonetheless, the **client** program goes on to fetch the Google homepage through the secure channel. This program depends on the security artifacts mentioned earlier, although only a digital certificate stands out in the code. The other artifacts remain behind the scenes and are clarified later in detail. - -Generally, a client program in C or C++ that opened an HTTP (non-secure) channel would use constructs such as a _file descriptor_ for a _network socket_, which is an endpoint in a connection between two processes (e.g., the client program and the Google web server). A file descriptor, in turn, is a non-negative integer value that identifies, within a program, any file-like construct that the program opens. Such a program also would use a structure to specify details about the web server’s address. - -None of these relatively low-level constructs occurs in the client program, as the OpenSSL library wraps the socket infrastructure and address specification in high-level security constructs. The result is a straightforward API. Here’s a first look at the security details in the example **client** program. - - * The program begins by loading the relevant OpenSSL libraries, with my function **init_ssl** making two calls into OpenSSL: - -**SSL_library_init(); SSL_load_error_strings();** - - * The next initialization step tries to get a security _context_, a framework of information required to establish and maintain a secure channel to the web server. **TLS 1.2** is used in the example, as shown in this call to an OpenSSL library function: - -**const SSL_METHOD* method = TLSv1_2_client_method(); /* TLS 1.2 */** - -If the call succeeds, then the **method** pointer is passed to the library function that creates the context of type **SSL_CTX**: - -**SSL_CTX*** **ctx** **= SSL_CTX_new(method);** - -The **client** program checks for errors on each of these critical library calls, and then the program terminates if either call fails. - - * Two other OpenSSL artifacts now come into play: a security session of type **SSL**, which manages the secure connection from start to finish; and a secured stream of type **BIO** (Basic Input/Output), which is used to communicate with the web server. The **BIO** stream is generated with this call: - -**BIO* bio = BIO_new_ssl_connect(ctx);** - -Note that the all-important context is the argument. The **BIO** type is the OpenSSL wrapper for the **FILE** type in C. This wrapper secures the input and output streams between the **client** program and Google's web server. - - * With the **SSL_CTX** and **BIO** in hand, the program then links these together in an **SSL** session. Three library calls do the work: - -**BIO_get_ssl(bio, &ssl); /* get a TLS session */** - -**SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* for robustness */** - -**BIO_set_conn_hostname(bio, name); /* prepare to connect to Google */** - -The secure connection itself is established through this call: - -**BIO_do_connect(bio);** - -If this last call does not succeed, the **client** program terminates; otherwise, the connection is ready to support a confidential conversation between the **client** program and the Google web server. - - - - -During the handshake with the web server, the **client** program receives one or more digital certificates that authenticate the server’s identity. However, the **client** program does not send a certificate of its own, which means that the authentication is one-way. (Web servers typically are configured _not_ to expect a client certificate.) Despite the failed verification of the web server’s certificate, the **client** program continues by fetching the Google homepage through the secure channel to the web server. - -Why does the attempt to verify a Google certificate fail? A typical OpenSSL installation has the directory **/etc/ssl/certs**, which includes the **ca-certificates.crt** file. The directory and the file together contain digital certificates that OpenSSL trusts out of the box and accordingly constitute a _truststore_. The truststore can be updated as needed, in particular, to include newly trusted certificates and to remove ones no longer trusted. - -The client program receives three certificates from the Google web server, but the OpenSSL truststore on my machine does not contain exact matches. As presently written, the **client** program does not pursue the matter by, for example, verifying the digital signature on a Google certificate (a signature that vouches for the certificate). If that signature were trusted, then the certificate containing it should be trusted as well. Nonetheless, the client program goes on to fetch and then to print Google’s homepage. The next section gets into more detail. - -### The hidden security pieces in the client program - -Let’s start with the visible security artifact in the client example—the digital certificate—and consider how other security artifacts relate to it. The dominant layout standard for a digital certificate is X509, and a production-grade certificate is issued by a certificate authority (CA) such as [Verisign][14]. - -A digital certificate contains various pieces of information (e.g., activation and expiration dates, and a domain name for the owner), including the issuer’s identity and _digital signature_, which is an encrypted _cryptographic hash_ value. A certificate also has an unencrypted hash value that serves as its identifying _fingerprint_. - -A hash value results from mapping an arbitrary number of bits to a fixed-length digest. What the bits represent (an accounting report, a novel, or maybe a digital movie) is irrelevant. For example, the Message Digest version 5 (MD5) hash algorithm maps input bits of whatever length to a 128-bit hash value, whereas the SHA1 (Secure Hash Algorithm version 1) algorithm maps input bits to a 160-bit value. Different input bits result in different—indeed, statistically unique—hash values. The next article goes into further detail and focuses on what makes a hash function _cryptographic_. - -Digital certificates differ in type (e.g., _root_, _intermediate_, and _end-entity_ certificates) and form a hierarchy that reflects these types. As the name suggests, a _root_ certificate sits atop the hierarchy, and the certificates under it inherit whatever trust the root certificate has. The OpenSSL libraries and most modern programming languages have an X509 type together with functions that deal with such certificates. The certificate from Google has an X509 format, and the **client** program checks whether this certificate is **X509_V_OK**. - -X509 certificates are based upon public-key infrastructure (PKI), which includes algorithms—RSA is the dominant one—for generating _key pairs_: a public key and its paired private key. A public key is an identity: [Amazon’s][15] public key identifies it, and my public key identifies me. A private key is meant to be kept secret by its owner. - -The keys in a pair have standard uses. A public key can be used to encrypt a message, and the private key from the same pair can then be used to decrypt the message. A private key also can be used to sign a document or other electronic artifact (e.g., a program or an email), and the public key from the pair can then be used to verify the signature. The following two examples fill in some details. - -In the first example, Alice distributes her public key to the world, including Bob. Bob then encrypts a message with Alice’s public key, sending the encrypted message to Alice. The message encrypted with Alice’s public key is decrypted with her private key, which (by assumption) she alone has, like so: - - -``` -             +------------------+ encrypted msg  +-------------------+ -Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's msg -             +------------------+                +-------------------+ -``` - -Decrypting the message without Alice’s private key is possible in principle, but infeasible in practice given a sound cryptographic key-pair system such as RSA. - -Now, for the second example, consider signing a document to certify its authenticity. The signature algorithm uses a private key from a pair to process a cryptographic hash of the document to be signed: - - -``` -                    +-------------------+ -Hash of document--->|Alice's private key|--->Alice's digital signature of the document -                    +-------------------+ -``` - -Assume that Alice digitally signs a contract sent to Bob. Bob then can use Alice’s public key from the key pair to verify the signature: - - -``` -                                             +------------------+ -Alice's digital signature of the document--->|Alice's public key|--->verified or not -                                             +------------------+ -``` - -It is infeasible to forge Alice’s signature without Alice’s private key: hence, it is in Alice’s interest to keep her private key secret. - -None of these security pieces, except for digital certificates, is explicit in the **client** program. The next article fills in the details with examples that use the OpenSSL utilities and library functions. - -### OpenSSL from the command line - -In the meantime, let’s take a look at OpenSSL command-line utilities: in particular, a utility to inspect the certificates from a web server during the TLS handshake. Invoking the OpenSSL utilities begins with the **openssl** command and then adds a combination of arguments and flags to specify the desired operation. - -Consider this command: - -**openssl list-cipher-algorithms** - -The output is a list of associated algorithms that make up a _cipher suite_. Here’s the start of the list, with comments to clarify the acronyms: - - -``` -AES-128-CBC ## Advanced Encryption Standard, Cipher Block Chaining -AES-128-CBC-HMAC-SHA1 ## Hash-based Message Authentication Code with SHA1 hashes -AES-128-CBC-HMAC-SHA256 ## ditto, but SHA256 rather than SHA1 -... -``` - -The next command, using the argument **s_client**, opens a secure connection to **[www.google.com][13]** and prints screens full of information about this connection: - -**openssl s_client -connect [www.google.com:443][16] -showcerts** - -The port number 443 is the standard one used by web servers for receiving HTTPS rather than HTTP connections. (For HTTP, the standard port is 80.) The network address **[www.google.com:443][16]** also occurs in the **client** program's code. If the attempted connection succeeds, the three digital certificates from Google are displayed together with information about the secure session, the cipher suite in play, and related items. For example, here is a slice of output from near the start, which announces that a _certificate chain_ is forthcoming. The encoding for the certificates is base64: - - -``` -Certificate chain - 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=www.google.com - i:/C=US/O=Google Trust Services/CN=Google Internet Authority G3 -\-----BEGIN CERTIFICATE----- -MIIEijCCA3KgAwIBAgIQdCea9tmy/T6rK/dDD1isujANBgkqhkiG9w0BAQsFADBU -MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMSUw -... -``` - -A major web site such as Google usually sends multiple certificates for authentication. - -The output ends with summary information about the TLS session, including specifics on the cipher suite: - - -``` -SSL-Session: -    Protocol : TLSv1.2 -    Cipher : ECDHE-RSA-AES128-GCM-SHA256 -    Session-ID: A2BBF0E4991E6BBBC318774EEE37CFCB23095CC7640FFC752448D07C7F438573 -... -``` - -The protocol **TLS 1.2** is used in the **client** program, and the **Session-ID** uniquely identifies the connection between the **openssl** utility and the Google web server. The **Cipher** entry can be parsed as follows: - - * **ECDHE** (Elliptic Curve Diffie Hellman Ephemeral) is an effective and efficient algorithm for managing the TLS handshake. In particular, ECDHE solves the _key-distribution problem_ by ensuring that both parties in a connection (e.g., the client program and the Google web server) use the same encryption/decryption key, which is known as the _session key_. The follow-up article digs into the details. - - * **RSA** (Rivest Shamir Adleman) is the dominant public-key cryptosystem and named after the three academics who first described the system in the late 1970s. The key-pairs in play are generated with the RSA algorithm. - - * **AES128** (Advanced Encryption Standard) is a _block cipher_ that encrypts and decrypts blocks of bits. (The alternative is a _stream cipher_, which encrypts and decrypts bits one at a time.) The cipher is _symmetric_ in that the same key is used to encrypt and to decrypt, which raises the key-distribution problem in the first place. AES supports key sizes of 128 (used here), 192, and 256 bits: the larger the key, the better the protection. - -Key sizes for symmetric cryptosystems such as AES are, in general, smaller than those for asymmetric (key-pair based) systems such as RSA. For example, a 1024-bit RSA key is relatively small, whereas a 256-bit key is currently the largest for AES. - - * **GCM** (Galois Counter Mode) handles the repeated application of a cipher (in this case, AES128) during a secured conversation. AES128 blocks are only 128-bits in size, and a secure conversation is likely to consist of multiple AES128 blocks from one side to the other. GCM is efficient and commonly paired with AES128. - - * **SHA256** (Secure Hash Algorithm 256 bits) is the cryptographic hash algorithm in play. The hash values produced are 256 bits in size, although even larger values are possible with SHA. - - - - -Cipher suites are in continual development. Not so long ago, for example, Google used the RC4 stream cipher (Ron’s Cipher version 4 after Ron Rivest from RSA). RC4 now has known vulnerabilities, which presumably accounts, at least in part, for Google’s switch to AES128. - -### Wrapping up - -This first look at OpenSSL, through a secure C web client and various command-line examples, has brought to the fore a handful of topics in need of more clarification. [The next article gets into the details][17], starting with cryptographic hashes and ending with a fuller discussion of how digital certificates address the key distribution challenge. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 - -作者:[Marty Kalin][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) -[2]: https://www.openssl.org/ -[3]: https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ -[4]: http://condor.depaul.edu/mkalin -[5]: https://en.wikipedia.org/wiki/Transport_Layer_Security -[6]: https://en.wikipedia.org/wiki/Netscape -[7]: http://www.opengroup.org/onlinepubs/009695399/functions/perror.html -[8]: http://www.opengroup.org/onlinepubs/009695399/functions/exit.html -[9]: http://www.opengroup.org/onlinepubs/009695399/functions/sprintf.html -[10]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html -[11]: http://www.opengroup.org/onlinepubs/009695399/functions/memset.html -[12]: http://www.opengroup.org/onlinepubs/009695399/functions/puts.html -[13]: http://www.google.com -[14]: https://www.verisign.com -[15]: https://www.amazon.com -[16]: http://www.google.com:443 -[17]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 diff --git a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md new file mode 100644 index 0000000000..02b9005801 --- /dev/null +++ b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -0,0 +1,341 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with OpenSSL: Cryptography basics) +[#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-1) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen) + +OpenSSL 入门:密码学基础知识 +====== + +> 需要有关基础的密码学入门知识,尤其是有关 OpenSSL 的入门知识吗?继续阅读。 + +![A lock on the side of a building][1] + +本文是两篇使用 [OpenSSL][2] 的密码学基础知识的第一篇,OpenSSL 是在 Linux 和其他系统上流行的生产级库和工具包。(要安装 OpenSSL 的最新版本,请参阅[这里][3]。)OpenSSL 实用程序可在命令行使用,而程序可以从 OpenSSL 库中调用函数。本文的示例程序使用 C 语言,即 OpenSSL 库的源语言。 + +本系列的两篇文章共同介绍了加密哈希、数字签名、加密和解密以及数字证书。你可以从[我的网站][4]的 ZIP 文件中找到代码和命令行示例。 + +让我们首先回顾一下 OpenSSL 名称中的 SSL。 + +### OpenSSL 简史 + +[安全套接字层][5](SSL)是 Netscape 在 1995 年发布的一种加密协议。该协议层可以位于 HTTP 之上,从而为 HTTPS 提供了 S:安全。SSL 协议提供了各种安全服务,其中包括两项在 HTTPS 中至关重要的服务: + +* 对等身份验证Peer authentication(也称为相互挑战):连接的每一边都对另一边的身份进行身份验证。如果 Alice 和 Bob 要通过 SSL 交换消息,则每个人首先验证彼此的身份。 +* 机密性Confidentiality:发送者在通过通道发送消息之前先对其进行加密。接收者然后解密每个接收到的消息。此过程可保护网络对话。即使窃听者 Eve 截获了从 Alice 到 Bob 的加密消息(*中间人*攻击),Eve 仍发现他在计算上无法解密此消息。 +   +反过来,这两个关键 SSL 服务与其他获得较少关注的服务捆绑在一起。例如,SSL 支持消息完整性,从而确保接收到的消息与发送的消息相同。此功能是通过散列函数实现的,散列函数也随 OpenSSL 工具箱一起提供。 + +SSL 已版本化(例如 SSLv2 和 SSLv3),并且在 1999 年,传输层安全性Transport Layer Security(TLS)成为基于 SSLv3 的类似协议。TLSv1 和 SSLv3 相似,但不足以相互配合。 但是,通常将 SSL/TLS 称为同一协议。例如,即使正在使用的是 TLS(而非 SSL),OpenSSL 函数也经常在名称中包含 SSL。此外,调用 OpenSSL 命令行实用程序以术语 `openssl` 开始。 + +OpenSSL 在其 man 页面之外的文档是零散的,鉴于 OpenSSL 工具包有多大,这些页面变得难以查找使用。命令行和代码示例是将主要主题集中起来的一种方法。让我们从一个熟悉的示例开始(使用 HTTPS 访问网站),然后使用该示例来挑选我们感兴趣的加密部分。 + + + +### 一个 HTTPS 客户端 + +此处显示的 `client` 程序通过 HTTPS 连接到 Google: + +``` +/* compilation: gcc -o client client.c -lssl -lcrypto */ +#include +#include +#include /* BasicInput/Output streams */ +#include /* errors */ +#include /* core library */ +#define BuffSize 1024 + +void report_and_exit(const char* msg) { + perror(msg); + ERR_print_errors_fp(stderr); + exit(-1); +} + +void init_ssl() { + SSL_load_error_strings(); + SSL_library_init(); +} + +void cleanup(SSL_CTX* ctx, BIO* bio) { + SSL_CTX_free(ctx); + BIO_free_all(bio); +} + +void secure_connect(const char* hostname) { + char name[BuffSize]; + char request[BuffSize]; + char response[BuffSize]; + + const SSL_METHOD* method = TLSv1_2_client_method(); + if (NULL == method) report_and_exit("TLSv1_2_client_method..."); + + SSL_CTX* ctx = SSL_CTX_new(method); + if (NULL == ctx) report_and_exit("SSL_CTX_new..."); + + BIO* bio = BIO_new_ssl_connect(ctx); + if (NULL == bio) report_and_exit("BIO_new_ssl_connect..."); + + SSL* ssl = NULL; + + /* link bio channel, SSL session, and server endpoint */ + + sprintf(name, "%s:%s", hostname, "https"); + BIO_get_ssl(bio, &ssl); /* session */ + SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* robustness */ + BIO_set_conn_hostname(bio, name); /* prepare to connect */ + + /* try to connect */ + if (BIO_do_connect(bio) <= 0) { + cleanup(ctx, bio); + report_and_exit("BIO_do_connect..."); + } + + /* verify truststore, check cert */ + if (!SSL_CTX_load_verify_locations(ctx, + "/etc/ssl/certs/ca-certificates.crt", /* truststore */ + "/etc/ssl/certs/")) /* more truststore */ + report_and_exit("SSL_CTX_load_verify_locations..."); + + long verify_flag = SSL_get_verify_result(ssl); + if (verify_flag != X509_V_OK) + fprintf(stderr, + "##### Certificate verification error (%i) but continuing...\n", + (int) verify_flag); + + /* now fetch the homepage as sample data */ + sprintf(request, + "GET / HTTP/1.1\x0D\x0AHost: %s\x0D\x0A\x43onnection: Close\x0D\x0A\x0D\x0A", + hostname); + BIO_puts(bio, request); + + /* read HTTP response from server and print to stdout */ + while (1) { + memset(response, '\0', sizeof(response)); + int n = BIO_read(bio, response, BuffSize); + if (n <= 0) break; /* 0 is end-of-stream, < 0 is an error */ + puts(response); + } + + cleanup(ctx, bio); +} + +int main() { + init_ssl(); + + const char* hostname = "www.google.com:443"; + fprintf(stderr, "Trying an HTTPS connection to %s...\n", hostname); + secure_connect(hostname); + +return 0; +} +``` + +可以从命令行编译和执行该程序(请注意 `-lssl` 和 `-lcrypto` 中的小写字母 `L`): + + +``` +gcc -o client client.c -lssl -lcrypto +``` + +该程序尝试打开与网站 [www.google.com][13] 的安全连接。作为与 Google Web 服务器的 TLS 握手的一部分,`client` 程序会接收一个或多个数字证书,该程序会尝试对其进行验证(但在我的系统上失败了)。尽管如此,`client` 程序仍继续通过安全通道获取 Google 主页。该程序取决于前面提到的安全工件,尽管在代码中只突出了数字证书。其他工件仍在幕后,稍后将对其进行详细说明。 + +通常,打开 HTTP(非安全)通道的 C 或 C++ 客户端程序将使用诸如*文件描述符*或*网络套接字*之类的结构,这些是两个进程(例如,客户端程序和 Google Web 服务器)之间连接的端点。另一方面,文件描述符是一个非负整数值,它在程序中标识该程序打开的任何文件类的结构。这样的程序还将使用一种结构来指定有关 Web 服务器地址的详细信息。 + +这些相对较低级别的结构都不会出现在客户端程序中,因为 OpenSSL 库会将套接字基础设施和地址规范等封装在高级的安全结构中。其结果是一个简单的 API。下面首先看一下 `client` 程序示例中的安全性详细信息。 + +* 该程序首先加载相关的 OpenSSL 库,而我的函数 `init_ssl` 则对 OpenSSL 进行了两次调用: + + ``` +SSL_library_init(); SSL_load_error_strings(); +``` +* 下一个初始化步骤尝试获取安全*上下文*,这是建立和维护通往 Web 服务器的安全通道所需的信息框架。 在示例中使用了 TLS 1.2,如对 OpenSSL 库函数的调用所示: + + ``` +const SSL_METHOD* method = TLSv1_2_client_method(); /* TLS 1.2 */ +``` + + 如果调用成功,则将 `method ` 指针被传递给库函数,该函数创建类型为 `SSL_CTX` 的上下文: + + ``` +SSL_CTX* ctx = SSL_CTX_new(method); +``` + + `client` 程序检查每个关键库调用中的错误,然后如果其中一个调用失败,则程序终止。 +* 现在还有另外两个 OpenSSL 工件在起作用:SSL 类型的安全会话,从头到尾管理安全连接;以及类型为BIO(基本输入/输出)的安全流,用于与 Web 服务器进行通信。BIO 流是通过以下调用生成的: + + ``` +BIO* bio = BIO_new_ssl_connect(ctx); +``` + 请注意,最重要的上下文是参数。`BIO` 类型是 C 语言中 `FILE` 类型的 OpenSSL 封装器。此封装器可保护 `client` 程序与 Google 的网络服务器之间的输入和输出流。 +* 有了 `SSL_CTX` 和 `BIO`,然后程序在 SSL 会话中将它们组合在一起。三个库调用可以完成工作: + + ``` +BIO_get_ssl(bio, &ssl); /* get a TLS session */ +SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); /* for robustness */ +BIO_set_conn_hostname(bio, name); /* prepare to connect to Google */ +``` + 安全连接本身是通过以下调用建立的: + + ``` +BIO_do_connect(bio); +``` + 如果最后一次调用不成功,则 `client` 程序终止;否则,该连接已准备就绪,可以支持 `client` 程序与Google Web 服务器之间的机密对话。 + + +During the handshake with the web server, the `client` program receives one or more digital certificates that authenticate the server’s identity. However, the `client` program does not send a certificate of its own, which means that the authentication is one-way. (Web servers typically are configured _not_ to expect a client certificate.) Despite the failed verification of the web server’s certificate, the `client` program continues by fetching the Google homepage through the secure channel to the web server. + +Why does the attempt to verify a Google certificate fail? A typical OpenSSL installation has the directory `/etc/ssl/certs`, which includes the `ca-certificates.crt` file. The directory and the file together contain digital certificates that OpenSSL trusts out of the box and accordingly constitute a _truststore_. The truststore can be updated as needed, in particular, to include newly trusted certificates and to remove ones no longer trusted. + +The client program receives three certificates from the Google web server, but the OpenSSL truststore on my machine does not contain exact matches. As presently written, the `client` program does not pursue the matter by, for example, verifying the digital signature on a Google certificate (a signature that vouches for the certificate). If that signature were trusted, then the certificate containing it should be trusted as well. Nonetheless, the client program goes on to fetch and then to print Google’s homepage. The next section gets into more detail. + +### The hidden security pieces in the client program + +Let’s start with the visible security artifact in the client example—the digital certificate—and consider how other security artifacts relate to it. The dominant layout standard for a digital certificate is X509, and a production-grade certificate is issued by a certificate authority (CA) such as [Verisign][14]. + +A digital certificate contains various pieces of information (e.g., activation and expiration dates, and a domain name for the owner), including the issuer’s identity and _digital signature_, which is an encrypted _cryptographic hash_ value. A certificate also has an unencrypted hash value that serves as its identifying _fingerprint_. + +A hash value results from mapping an arbitrary number of bits to a fixed-length digest. What the bits represent (an accounting report, a novel, or maybe a digital movie) is irrelevant. For example, the Message Digest version 5 (MD5) hash algorithm maps input bits of whatever length to a 128-bit hash value, whereas the SHA1 (Secure Hash Algorithm version 1) algorithm maps input bits to a 160-bit value. Different input bits result in different—indeed, statistically unique—hash values. The next article goes into further detail and focuses on what makes a hash function _cryptographic_. + +Digital certificates differ in type (e.g., _root_, _intermediate_, and _end-entity_ certificates) and form a hierarchy that reflects these types. As the name suggests, a _root_ certificate sits atop the hierarchy, and the certificates under it inherit whatever trust the root certificate has. The OpenSSL libraries and most modern programming languages have an X509 type together with functions that deal with such certificates. The certificate from Google has an X509 format, and the `client` program checks whether this certificate is `X509_V_OK`. + +X509 certificates are based upon public-key infrastructure (PKI), which includes algorithms—RSA is the dominant one—for generating _key pairs_: a public key and its paired private key. A public key is an identity: [Amazon’s][15] public key identifies it, and my public key identifies me. A private key is meant to be kept secret by its owner. + +The keys in a pair have standard uses. A public key can be used to encrypt a message, and the private key from the same pair can then be used to decrypt the message. A private key also can be used to sign a document or other electronic artifact (e.g., a program or an email), and the public key from the pair can then be used to verify the signature. The following two examples fill in some details. + +In the first example, Alice distributes her public key to the world, including Bob. Bob then encrypts a message with Alice’s public key, sending the encrypted message to Alice. The message encrypted with Alice’s public key is decrypted with her private key, which (by assumption) she alone has, like so: + + +``` +             +------------------+ encrypted msg  +-------------------+ +Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's msg +             +------------------+                +-------------------+ +``` + +Decrypting the message without Alice’s private key is possible in principle, but infeasible in practice given a sound cryptographic key-pair system such as RSA. + +Now, for the second example, consider signing a document to certify its authenticity. The signature algorithm uses a private key from a pair to process a cryptographic hash of the document to be signed: + + +``` +                    +-------------------+ +Hash of document--->|Alice's private key|--->Alice's digital signature of the document +                    +-------------------+ +``` + +Assume that Alice digitally signs a contract sent to Bob. Bob then can use Alice’s public key from the key pair to verify the signature: + + +``` +                                             +------------------+ +Alice's digital signature of the document--->|Alice's public key|--->verified or not +                                             +------------------+ +``` + +It is infeasible to forge Alice’s signature without Alice’s private key: hence, it is in Alice’s interest to keep her private key secret. + +None of these security pieces, except for digital certificates, is explicit in the `client` program. The next article fills in the details with examples that use the OpenSSL utilities and library functions. + +### OpenSSL from the command line + +In the meantime, let’s take a look at OpenSSL command-line utilities: in particular, a utility to inspect the certificates from a web server during the TLS handshake. Invoking the OpenSSL utilities begins with the `openssl` command and then adds a combination of arguments and flags to specify the desired operation. + +Consider this command: + +`openssl list-cipher-algorithms` + +The output is a list of associated algorithms that make up a _cipher suite_. Here’s the start of the list, with comments to clarify the acronyms: + + +``` +AES-128-CBC ## Advanced Encryption Standard, Cipher Block Chaining +AES-128-CBC-HMAC-SHA1 ## Hash-based Message Authentication Code with SHA1 hashes +AES-128-CBC-HMAC-SHA256 ## ditto, but SHA256 rather than SHA1 +... +``` + +The next command, using the argument `s_client`, opens a secure connection to `[www.google.com][13]` and prints screens full of information about this connection: + +`openssl s_client -connect [www.google.com:443][16] -showcerts` + +The port number 443 is the standard one used by web servers for receiving HTTPS rather than HTTP connections. (For HTTP, the standard port is 80.) The network address `[www.google.com:443][16]` also occurs in the `client` program's code. If the attempted connection succeeds, the three digital certificates from Google are displayed together with information about the secure session, the cipher suite in play, and related items. For example, here is a slice of output from near the start, which announces that a _certificate chain_ is forthcoming. The encoding for the certificates is base64: + + +``` +Certificate chain + 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=www.google.com + i:/C=US/O=Google Trust Services/CN=Google Internet Authority G3 +\-----BEGIN CERTIFICATE----- +MIIEijCCA3KgAwIBAgIQdCea9tmy/T6rK/dDD1isujANBgkqhkiG9w0BAQsFADBU +MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMSUw +... +``` + +A major web site such as Google usually sends multiple certificates for authentication. + +The output ends with summary information about the TLS session, including specifics on the cipher suite: + + +``` +SSL-Session: +    Protocol : TLSv1.2 +    Cipher : ECDHE-RSA-AES128-GCM-SHA256 +    Session-ID: A2BBF0E4991E6BBBC318774EEE37CFCB23095CC7640FFC752448D07C7F438573 +... +``` + +The protocol `TLS 1.2` is used in the `client` program, and the `Session-ID` uniquely identifies the connection between the `openssl` utility and the Google web server. The `Cipher` entry can be parsed as follows: + + * `ECDHE` (Elliptic Curve Diffie Hellman Ephemeral) is an effective and efficient algorithm for managing the TLS handshake. In particular, ECDHE solves the _key-distribution problem_ by ensuring that both parties in a connection (e.g., the client program and the Google web server) use the same encryption/decryption key, which is known as the _session key_. The follow-up article digs into the details. + + * `RSA` (Rivest Shamir Adleman) is the dominant public-key cryptosystem and named after the three academics who first described the system in the late 1970s. The key-pairs in play are generated with the RSA algorithm. + + * `AES128` (Advanced Encryption Standard) is a _block cipher_ that encrypts and decrypts blocks of bits. (The alternative is a _stream cipher_, which encrypts and decrypts bits one at a time.) The cipher is _symmetric_ in that the same key is used to encrypt and to decrypt, which raises the key-distribution problem in the first place. AES supports key sizes of 128 (used here), 192, and 256 bits: the larger the key, the better the protection. + +Key sizes for symmetric cryptosystems such as AES are, in general, smaller than those for asymmetric (key-pair based) systems such as RSA. For example, a 1024-bit RSA key is relatively small, whereas a 256-bit key is currently the largest for AES. + + * `GCM` (Galois Counter Mode) handles the repeated application of a cipher (in this case, AES128) during a secured conversation. AES128 blocks are only 128-bits in size, and a secure conversation is likely to consist of multiple AES128 blocks from one side to the other. GCM is efficient and commonly paired with AES128. + + * `SHA256` (Secure Hash Algorithm 256 bits) is the cryptographic hash algorithm in play. The hash values produced are 256 bits in size, although even larger values are possible with SHA. + + + + +Cipher suites are in continual development. Not so long ago, for example, Google used the RC4 stream cipher (Ron’s Cipher version 4 after Ron Rivest from RSA). RC4 now has known vulnerabilities, which presumably accounts, at least in part, for Google’s switch to AES128. + +### Wrapping up + +This first look at OpenSSL, through a secure C web client and various command-line examples, has brought to the fore a handful of topics in need of more clarification. [The next article gets into the details][17], starting with cryptographic hashes and ending with a fuller discussion of how digital certificates address the key distribution challenge. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 + +作者:[Marty Kalin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mkalindepauledu/users/akritiko/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://www.openssl.org/ +[3]: https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/ +[4]: http://condor.depaul.edu/mkalin +[5]: https://en.wikipedia.org/wiki/Transport_Layer_Security +[6]: https://en.wikipedia.org/wiki/Netscape +[7]: http://www.opengroup.org/onlinepubs/009695399/functions/perror.html +[8]: http://www.opengroup.org/onlinepubs/009695399/functions/exit.html +[9]: http://www.opengroup.org/onlinepubs/009695399/functions/sprintf.html +[10]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html +[11]: http://www.opengroup.org/onlinepubs/009695399/functions/memset.html +[12]: http://www.opengroup.org/onlinepubs/009695399/functions/puts.html +[13]: http://www.google.com +[14]: https://www.verisign.com +[15]: https://www.amazon.com +[16]: http://www.google.com:443 +[17]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 From fb1a20e4a977b5982618084d16fea02e2557e038 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 14:45:41 +0800 Subject: [PATCH 670/676] APL --- sources/tech/20200108 How to setup multiple monitors in sway.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200108 How to setup multiple monitors in sway.md b/sources/tech/20200108 How to setup multiple monitors in sway.md index f156d204dc..8113f29c95 100644 --- a/sources/tech/20200108 How to setup multiple monitors in sway.md +++ b/sources/tech/20200108 How to setup multiple monitors in sway.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 68f6fcf5b8303d3d04ef6ab54ecc3b26a7bc10be Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 15:01:16 +0800 Subject: [PATCH 671/676] TSL --- ... How to setup multiple monitors in sway.md | 85 ------------------- ... How to setup multiple monitors in sway.md | 85 +++++++++++++++++++ 2 files changed, 85 insertions(+), 85 deletions(-) delete mode 100644 sources/tech/20200108 How to setup multiple monitors in sway.md create mode 100644 translated/tech/20200108 How to setup multiple monitors in sway.md diff --git a/sources/tech/20200108 How to setup multiple monitors in sway.md b/sources/tech/20200108 How to setup multiple monitors in sway.md deleted file mode 100644 index 8113f29c95..0000000000 --- a/sources/tech/20200108 How to setup multiple monitors in sway.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to setup multiple monitors in sway) -[#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) -[#]: author: (arte219 https://fedoramagazine.org/author/arte219/) - -How to setup multiple monitors in sway -====== - -![][1] - -Sway is a tiling Wayland compositor which has mostly the same features, look and workflow as the [i3 X11 window manager][2]. Because Sway uses Wayland instead of X11, the tools to setup X11 don’t always work in sway. This includes tools like _xrandr_, which are used in X11 window managers or desktops to setup monitors. This is why monitors have to be setup by editing the sway config file, and that’s what this article is about. - -## **Getting your monitor ID’s** - -First, you have to get the names sway uses to refer to your monitors. You can do this by running: - -``` -$ swaymsg -t get_outputs -``` - -You will get information about all of your monitors, every monitor separated by an empty line. - -You have to look for the first line of every section, and for what’s after “Output”. For example, when you see a line like “_Output DVI-D-1 ‘Philips Consumer Electronics Company’_”, the output ID is “DVI-D-1”. Note these ID’s and which physical monitors they belong to. - -## **Editing the config file** - -If you haven’t edited the Sway config file before, you have to copy it to your home directory by running this command: - -``` -cp -r /etc/sway/config ~/.config/sway/config -``` - -Now the default config file is located in _~/.config/sway_ and called “config”. You can edit it using any text editor. - -Now you have to do a little bit of math. Imagine a grid with the origin in the top left corner. The units of the X and Y coordinates are pixels. The Y axis is inverted. This means that if you, for example, start at the origin and you move 100 pixels to the right and 80 pixels down, your coordinates will be (100, 80). - -You have to calculate where your displays are going to end up on this grid. The locations of the displays are specified with the top left pixel. For example, if we want to have a monitor with name HDMI1 and a resolution of 1920×1080, and to the right of it a laptop monitor with name eDP1 and a resolution of 1600×900, you have to type this in your config file: - -``` -output HDMI1 pos 0 0 -output eDP1 pos 1920 0 -``` - -You can also specify the resolutions manually by using the _res_ option:  - -``` -output HDMI1 pos 0 0 res 1920x1080 -output eDP1 pos 1920 0 res 1600x900 -``` - -## **Binding workspaces to monitors** - -Using sway with multiple monitors can be a little bit tricky with workspace management. Luckily, you can bind workspaces to a specific monitor, so you can easily switch to that monitor and use your displays more efficiently. This can simply be done by the workspace command in your config file. For example, if you want to bind workspace 1 and 2 to monitor DVI-D-1 and workspace 8 and 9 to monitor HDMI-A-1, you can do that by using: - -``` -workspace 1 output DVI-D-1 -workspace 2 output DVI-D-1 -``` - -``` -workspace 8 output HDMI-A-1 -workspace 9 output HDMI-A-1 -``` - -That’s it! These are the basics of multi monitor setup in sway. A more detailed guide can be found at . - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ - -作者:[arte219][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/arte219/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/sway-multiple-monitors-816x345.png -[2]: https://fedoramagazine.org/getting-started-i3-window-manager/ diff --git a/translated/tech/20200108 How to setup multiple monitors in sway.md b/translated/tech/20200108 How to setup multiple monitors in sway.md new file mode 100644 index 0000000000..b27ab5fe98 --- /dev/null +++ b/translated/tech/20200108 How to setup multiple monitors in sway.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to setup multiple monitors in sway) +[#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) +[#]: author: (arte219 https://fedoramagazine.org/author/arte219/) + +如何在 sway 中设置多个显示器 +====== + +![][1] + +Sway 是一种平铺式 Wayland 合成器,具有与 [i3 X11 窗口管理器][2]相同的功能、外观和工作流程。 由于 Sway 使用 Wayland 而不是 X11,因此就不能一如既往地使用设置 X11 的工具。这包括 `xrandr` 之类的工具,这些工具在 X11 窗口管理器或桌面中用于设置监视器。这就是为什么必须通过编辑 Sway 配置文件来设置显示器的原因,这就是本文的目的。 + +### 获取你的显示器 ID + +首先,你必须获得 Sway 用来指代显示器的名称。你可以通过运行以下命令进行操作: + +``` +$ swaymsg -t get_outputs +``` + +你将获得所有显示器的相关信息,每个显示器都用空行分隔。 + +你必须查看每个部分的第一行,以及 “Output” 之后的内容。例如,当你看到 `Output DVI-D-1 'Philips Consumer Electronics Company'` 之类的行时,则该输出 ID 为 `DVI-D-1`。注意这些 ID 及其所属的物理监视器。 + +### 编辑配置文件 + +如果你之前没有编辑过 Sway 配置文件,则必须通过运行以下命令将其复制到主目录中: + +``` +cp -r /etc/sway/config ~/.config/sway/config +``` + +现在,默认配置文件位于 `~/.config/sway` 中,名为 `config`。你可以使用任何文本编辑器进行编辑。 + +现在你需要做一点数学。想象有一个网格,其原点在左上角。X 和 Y 坐标的单位是像素。Y 轴反转。这意味着,例如,如果你从原点开始,向右移动 100 像素,向下移动 80 像素,则坐标将为 `(100, 80)`。 + +你必须计算最终显示在此网格上的位置。显示器的位置由左上方的像素指定。例如,如果我们要使用名称为“HDMI1”且分辨率为 1920×1080 的显示器,并在其右侧使用名称为 “eDP1” 且分辨率为 1600×900 的笔记本电脑显示器,则必须在配置文件中键入 : + +``` +output HDMI1 pos 0 0 +output eDP1 pos 1920 0 +``` + +你还可以使用 `res` 选项手动指定分辨率: + +``` +output HDMI1 pos 0 0 res 1920x1080 +output eDP1 pos 1920 0 res 1600x900 +``` + +### 将工作空间绑定到显示器上 + +与多个监视器一起使用 Sway 在工作区管理中可能会有些棘手。幸运的是,你可以将工作区绑定到特定的监视器,因此你可以轻松地切换到该显示器并更有效地使用它。只需通过配置文件中的工作区命令即可完成。例如,如果要绑定工作区 1 和 2 到显示器 “DVI-D-1”,绑定工作区 8 和 9 到显示器 “HDMI-A-1”,则可以使用以下方法: + +``` +workspace 1 output DVI-D-1 +workspace 2 output DVI-D-1 +``` + +``` +workspace 8 output HDMI-A-1 +workspace 9 output HDMI-A-1 +``` + +就是这样。这就在 Sway 中多显示器设置的基础知识。可以在 中找到更详细的指南。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ + +作者:[arte219][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/arte219/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/sway-multiple-monitors-816x345.png +[2]: https://fedoramagazine.org/getting-started-i3-window-manager/ From 4f32c39367defe03262aa390ea8462e4c9d9527f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 15:09:57 +0800 Subject: [PATCH 672/676] PRF @wxy --- ...0200108 How to setup multiple monitors in sway.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20200108 How to setup multiple monitors in sway.md b/translated/tech/20200108 How to setup multiple monitors in sway.md index b27ab5fe98..c6f5b216e7 100644 --- a/translated/tech/20200108 How to setup multiple monitors in sway.md +++ b/translated/tech/20200108 How to setup multiple monitors in sway.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to setup multiple monitors in sway) [#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) [#]: author: (arte219 https://fedoramagazine.org/author/arte219/) -如何在 sway 中设置多个显示器 +如何在 Sway 中设置多个显示器 ====== ![][1] -Sway 是一种平铺式 Wayland 合成器,具有与 [i3 X11 窗口管理器][2]相同的功能、外观和工作流程。 由于 Sway 使用 Wayland 而不是 X11,因此就不能一如既往地使用设置 X11 的工具。这包括 `xrandr` 之类的工具,这些工具在 X11 窗口管理器或桌面中用于设置监视器。这就是为什么必须通过编辑 Sway 配置文件来设置显示器的原因,这就是本文的目的。 +Sway 是一种平铺式 Wayland 合成器,具有与 [i3 X11 窗口管理器][2]相同的功能、外观和工作流程。由于 Sway 使用 Wayland 而不是 X11,因此就不能一如既往地使用设置 X11 的工具。这包括 `xrandr` 之类的工具,这些工具在 X11 窗口管理器或桌面中用于设置显示器。这就是为什么必须通过编辑 Sway 配置文件来设置显示器的原因,这就是本文的目的。 ### 获取你的显示器 ID @@ -24,7 +24,7 @@ $ swaymsg -t get_outputs 你将获得所有显示器的相关信息,每个显示器都用空行分隔。 -你必须查看每个部分的第一行,以及 “Output” 之后的内容。例如,当你看到 `Output DVI-D-1 'Philips Consumer Electronics Company'` 之类的行时,则该输出 ID 为 `DVI-D-1`。注意这些 ID 及其所属的物理监视器。 +你必须查看每个部分的第一行,以及 `Output` 之后的内容。例如,当你看到 `Output DVI-D-1 'Philips Consumer Electronics Company'` 之类的行时,则该输出 ID 为 `DVI-D-1`。注意这些 ID 及其所属的物理监视器。 ### 编辑配置文件 @@ -54,7 +54,7 @@ output eDP1 pos 1920 0 res 1600x900 ### 将工作空间绑定到显示器上 -与多个监视器一起使用 Sway 在工作区管理中可能会有些棘手。幸运的是,你可以将工作区绑定到特定的监视器,因此你可以轻松地切换到该显示器并更有效地使用它。只需通过配置文件中的工作区命令即可完成。例如,如果要绑定工作区 1 和 2 到显示器 “DVI-D-1”,绑定工作区 8 和 9 到显示器 “HDMI-A-1”,则可以使用以下方法: +与多个监视器一起使用 Sway 在工作区管理中可能会有些棘手。幸运的是,你可以将工作区绑定到特定的显示器上,因此你可以轻松地切换到该显示器并更有效地使用它。只需通过配置文件中的 `workspace` 命令即可完成。例如,如果要绑定工作区 1 和 2 到显示器 “DVI-D-1”,绑定工作区 8 和 9 到显示器 “HDMI-A-1”,则可以使用以下方法: ``` workspace 1 output DVI-D-1 @@ -75,7 +75,7 @@ via: https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ 作者:[arte219][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 21d4784af8cea630c3a5ee60807c9c08440015f1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 22 Jan 2020 15:10:33 +0800 Subject: [PATCH 673/676] PUB @wxy https://linux.cn/article-11809-1.html --- .../20200108 How to setup multiple monitors in sway.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200108 How to setup multiple monitors in sway.md (98%) diff --git a/translated/tech/20200108 How to setup multiple monitors in sway.md b/published/20200108 How to setup multiple monitors in sway.md similarity index 98% rename from translated/tech/20200108 How to setup multiple monitors in sway.md rename to published/20200108 How to setup multiple monitors in sway.md index c6f5b216e7..153933d6be 100644 --- a/translated/tech/20200108 How to setup multiple monitors in sway.md +++ b/published/20200108 How to setup multiple monitors in sway.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11809-1.html) [#]: subject: (How to setup multiple monitors in sway) [#]: via: (https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/) [#]: author: (arte219 https://fedoramagazine.org/author/arte219/) From c31282e5bdbc3961e5d7dca105d55e2351999bcd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jan 2020 00:08:14 +0800 Subject: [PATCH 674/676] TSL --- ...arted with OpenSSL- Cryptography basics.md | 114 ++++++++---------- 1 file changed, 53 insertions(+), 61 deletions(-) diff --git a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md index 02b9005801..3fa15783dd 100644 --- a/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md +++ b/translated/tech/20190619 Getting started with OpenSSL- Cryptography basics.md @@ -185,69 +185,67 @@ BIO_do_connect(bio); 如果最后一次调用不成功,则 `client` 程序终止;否则,该连接已准备就绪,可以支持 `client` 程序与Google Web 服务器之间的机密对话。 -During the handshake with the web server, the `client` program receives one or more digital certificates that authenticate the server’s identity. However, the `client` program does not send a certificate of its own, which means that the authentication is one-way. (Web servers typically are configured _not_ to expect a client certificate.) Despite the failed verification of the web server’s certificate, the `client` program continues by fetching the Google homepage through the secure channel to the web server. +在与 Web 服务器握手期间,`client` 程序会接收一个或多个数字证书,以认证服务器的身份。 但是,`client` 程序不会发送自己的证书,这意味着身份验证是单向的。(通常将 Web 服务器配置为**不**需要客户端证书。)尽管对 Web 服务器证书的验证失败,但 `client` 程序仍通过到 Web 服务器的安全通道继续获取 Google 主页。 -Why does the attempt to verify a Google certificate fail? A typical OpenSSL installation has the directory `/etc/ssl/certs`, which includes the `ca-certificates.crt` file. The directory and the file together contain digital certificates that OpenSSL trusts out of the box and accordingly constitute a _truststore_. The truststore can be updated as needed, in particular, to include newly trusted certificates and to remove ones no longer trusted. +为什么验证 Google 证书的尝试失败?典型的 OpenSSL 安装目录为 `/etc/ssl/certs`,其中包含 `ca-certificates.crt` 文件。该目录和文件包含着 OpenSSL 自带的数字证书,以此构成信任库。可以根据需要更新信任库,尤其是可以包括新信任的证书,并删除不再受信任的证书。 -The client program receives three certificates from the Google web server, but the OpenSSL truststore on my machine does not contain exact matches. As presently written, the `client` program does not pursue the matter by, for example, verifying the digital signature on a Google certificate (a signature that vouches for the certificate). If that signature were trusted, then the certificate containing it should be trusted as well. Nonetheless, the client program goes on to fetch and then to print Google’s homepage. The next section gets into more detail. +`client` 程序从 Google Web 服务器接收了三个证书,但是我的计算机上的 OpenSSL 信任库不包含完全匹配项。如目前所写,`client` 程序不会通过例如验证 Google 证书上的数字签名(一个用来证明该证书的签名)来解决此问题。如果该签名是受信任的,则包含该签名的证书也应受信任。尽管如此,`client` 程序仍继续进行获取页面,然后打印 Google 的主页。下一节将更详细地介绍。 -### The hidden security pieces in the client program +### 客户端程序中隐藏的安全性 -Let’s start with the visible security artifact in the client example—the digital certificate—and consider how other security artifacts relate to it. The dominant layout standard for a digital certificate is X509, and a production-grade certificate is issued by a certificate authority (CA) such as [Verisign][14]. +让我们从客户端示例中的可见安全工件(数字证书)开始,然后考虑其他安全工件如何与之相关。数字证书的主要布局标准是 X509,生产级证书由诸如 [Verisign][14] 的证书颁发机构(CA)颁发。 -A digital certificate contains various pieces of information (e.g., activation and expiration dates, and a domain name for the owner), including the issuer’s identity and _digital signature_, which is an encrypted _cryptographic hash_ value. A certificate also has an unencrypted hash value that serves as its identifying _fingerprint_. +数字证书包含各种信息(例如,激活和有效日期以及所有者的域名),包括发行者的身份和*数字签名*(这是加密过的*加密哈希*值)。证书还具有未加密的哈希值,用作其标识*指纹*。 -A hash value results from mapping an arbitrary number of bits to a fixed-length digest. What the bits represent (an accounting report, a novel, or maybe a digital movie) is irrelevant. For example, the Message Digest version 5 (MD5) hash algorithm maps input bits of whatever length to a 128-bit hash value, whereas the SHA1 (Secure Hash Algorithm version 1) algorithm maps input bits to a 160-bit value. Different input bits result in different—indeed, statistically unique—hash values. The next article goes into further detail and focuses on what makes a hash function _cryptographic_. +哈希值来自将任意数量的位映射到固定长度的摘要。这些位代表什么(会计报告、小说或数字电影)无关紧要。例如,消息摘要版本 5Message Digest version 5(MD5)哈希算法将任意长度的输入位映射到 128 位哈希值,而 SHA1(安全哈希算法版本 1Secure Hash Algorithm version 1)算法将输入位映射到 160 位值。不同的输入位会导致不同的(实际上是统计学上唯一的)哈希值。下一篇文章将进行更详细的介绍,并着重介绍什么使哈希函数具有加密功能。 -Digital certificates differ in type (e.g., _root_, _intermediate_, and _end-entity_ certificates) and form a hierarchy that reflects these types. As the name suggests, a _root_ certificate sits atop the hierarchy, and the certificates under it inherit whatever trust the root certificate has. The OpenSSL libraries and most modern programming languages have an X509 type together with functions that deal with such certificates. The certificate from Google has an X509 format, and the `client` program checks whether this certificate is `X509_V_OK`. +数字证书的类型有所不同(例如根证书、中间证书和最终实体证书),并形成了反映这些类型的层次结构。 顾名思义,*根*证书位于层次结构的顶部,其下的证书继承了根证书所具有的信任。OpenSSL 库和大多数现代编程语言都具有 X509 类型以及处理此类证书的函数。来自 Google 的证书具有 X509 格式,`client` 程序会检查该证书是否为 `X509_V_OK`。 -X509 certificates are based upon public-key infrastructure (PKI), which includes algorithms—RSA is the dominant one—for generating _key pairs_: a public key and its paired private key. A public key is an identity: [Amazon’s][15] public key identifies it, and my public key identifies me. A private key is meant to be kept secret by its owner. +X509 证书基于公共密钥基础结构public-key infrastructure(PKI),其中包括的算法(RSA 是占主导地位的算法)用于生成*密钥对*:公共密钥及其配对的私有密钥。公钥是一种身份:[Amazon][15] 的公钥对其进行标识,而我的公钥对我进行标识。私钥应由其所有者保密。 -The keys in a pair have standard uses. A public key can be used to encrypt a message, and the private key from the same pair can then be used to decrypt the message. A private key also can be used to sign a document or other electronic artifact (e.g., a program or an email), and the public key from the pair can then be used to verify the signature. The following two examples fill in some details. - -In the first example, Alice distributes her public key to the world, including Bob. Bob then encrypts a message with Alice’s public key, sending the encrypted message to Alice. The message encrypted with Alice’s public key is decrypted with her private key, which (by assumption) she alone has, like so: +成对出现的密钥具有标准用途。可以使用公钥对消息进行加密,然后可以使用同一个密钥对中的私钥对消息进行解密。私钥也可以用于对文档或其他电子产品(例如程序或电子邮件)进行签名,然后可以使用该对密钥中的公钥来验证签名。以下两个示例填充了一些细节。 +在第一个示例中,Alice 将她的公钥分发给世界,包括 Bob。然后,Bob 用 Alice 的公钥加密邮件,然后将加密的邮件发送给 Alice。用 Alice 的公钥加密的邮件将用她的私钥解密(假设是她自己的私钥),如下所示: ``` -             +------------------+ encrypted msg  +-------------------+ -Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's msg -             +------------------+                +-------------------+ + +------------------+ encrypted msg +-------------------+ +Bob's msg--->|Alice's public key|--------------->|Alice's private key|---> Bob's msg + +------------------+ +-------------------+ ``` -Decrypting the message without Alice’s private key is possible in principle, but infeasible in practice given a sound cryptographic key-pair system such as RSA. - -Now, for the second example, consider signing a document to certify its authenticity. The signature algorithm uses a private key from a pair to process a cryptographic hash of the document to be signed: +原则上可以在没有 Alice 的私钥的情况下解密消息,但在实际情况下,如果使用像 RSA 这样的加密密钥对系统,则无法实现。 +现在,对于第二个示例,请考虑对文档签名以证明其真实性。签名算法使用密钥对中的私钥来处理要签名的文档的加密哈希: ``` -                    +-------------------+ -Hash of document--->|Alice's private key|--->Alice's digital signature of the document -                    +-------------------+ + +-------------------+ +Hash of document--->|Alice's private key|--->Alice's digital signature of the document + +-------------------+ ``` -Assume that Alice digitally signs a contract sent to Bob. Bob then can use Alice’s public key from the key pair to verify the signature: - +假设 Alice 以数字方式签署了发送给 Bob 的合同。然后,Bob 可以使用密钥对中的 Alice 的公钥来验证签名: ``` -                                             +------------------+ -Alice's digital signature of the document--->|Alice's public key|--->verified or not -                                             +------------------+ + +------------------+ +Alice's digital signature of the document--->|Alice's public key|--->verified or not + +------------------+ ``` -It is infeasible to forge Alice’s signature without Alice’s private key: hence, it is in Alice’s interest to keep her private key secret. +假若没有 Alice 的私钥,就无法伪造 Alice 的签名:因此,Alice 有必要保密她的私钥。 -None of these security pieces, except for digital certificates, is explicit in the `client` program. The next article fills in the details with examples that use the OpenSSL utilities and library functions. +在 `client` 程序中,除了数字证书以外,这些安全性都没有明确规定。下一篇文章使用使用 OpenSSL 实用程序和库函数的示例填充详细信息。 -### OpenSSL from the command line +### 命令行的 OpenSSL -In the meantime, let’s take a look at OpenSSL command-line utilities: in particular, a utility to inspect the certificates from a web server during the TLS handshake. Invoking the OpenSSL utilities begins with the `openssl` command and then adds a combination of arguments and flags to specify the desired operation. +同时,让我们看一下 OpenSSL 命令行实用程序:特别是在 TLS 握手期间检查来自 Web 服务器的证书的实用程序。调用 OpenSSL 实用程序从`openssl` 命令开始,然后添加参数和标志的组合以指定所需的操作。 -Consider this command: +看看以下命令: -`openssl list-cipher-algorithms` - -The output is a list of associated algorithms that make up a _cipher suite_. Here’s the start of the list, with comments to clarify the acronyms: +``` +openssl list-cipher-algorithms +``` +该输出是组成加密算法套件cipher suite的相关算法的列表。下面是列表的开头,注释以澄清首字母缩写词: ``` AES-128-CBC ## Advanced Encryption Standard, Cipher Block Chaining @@ -256,27 +254,28 @@ AES-128-CBC-HMAC-SHA256 ## ditto, but SHA256 rather than SHA1 ... ``` -The next command, using the argument `s_client`, opens a secure connection to `[www.google.com][13]` and prints screens full of information about this connection: +使用参数 `s_client` 的下一条命令将打开到 [www.google.com][13] 的安全连接,并在屏幕上显示有关此连接的所有信息: -`openssl s_client -connect [www.google.com:443][16] -showcerts` +``` +openssl s_client -connect www.google.com:443 -showcerts +``` -The port number 443 is the standard one used by web servers for receiving HTTPS rather than HTTP connections. (For HTTP, the standard port is 80.) The network address `[www.google.com:443][16]` also occurs in the `client` program's code. If the attempted connection succeeds, the three digital certificates from Google are displayed together with information about the secure session, the cipher suite in play, and related items. For example, here is a slice of output from near the start, which announces that a _certificate chain_ is forthcoming. The encoding for the certificates is base64: +端口号 443 是 Web 服务器用于接收 HTTPS 而不是 HTTP 连接的标准端口号。(对于 HTTP,标准端口为 80)网络地址 [www.google.com:443 也出现在 `client` 程序的代码中。如果尝试的连接成功,则将显示来自 Google 的三个数字证书以及有关安全会话、正在使用的加密算法套件以及相关项目的信息。例如,这是从头开始的一部分输出,它声明*证书链*即将到来。证书的编码为 base64: ``` Certificate chain - 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=www.google.com - i:/C=US/O=Google Trust Services/CN=Google Internet Authority G3 -\-----BEGIN CERTIFICATE----- + 0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=www.google.com + i:/C=US/O=Google Trust Services/CN=Google Internet Authority G3 +-----BEGIN CERTIFICATE----- MIIEijCCA3KgAwIBAgIQdCea9tmy/T6rK/dDD1isujANBgkqhkiG9w0BAQsFADBU MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMSUw ... ``` -A major web site such as Google usually sends multiple certificates for authentication. - -The output ends with summary information about the TLS session, including specifics on the cipher suite: +诸如 Google 之类的主要网站通常会发送多个证书进行身份验证。 +输出以有关 TLS 会话的摘要信息结尾,包括加密算法套件的详细信息: ``` SSL-Session: @@ -286,28 +285,21 @@ SSL-Session: ... ``` -The protocol `TLS 1.2` is used in the `client` program, and the `Session-ID` uniquely identifies the connection between the `openssl` utility and the Google web server. The `Cipher` entry can be parsed as follows: +`client` 程序中使用了协议 TLS 1.2,`Session-ID` 唯一地标识了 `openssl` 实用程序和 Google Web 服务器之间的连接。 `Cipher` 条目可以按以下方式进行解析: - * `ECDHE` (Elliptic Curve Diffie Hellman Ephemeral) is an effective and efficient algorithm for managing the TLS handshake. In particular, ECDHE solves the _key-distribution problem_ by ensuring that both parties in a connection (e.g., the client program and the Google web server) use the same encryption/decryption key, which is known as the _session key_. The follow-up article digs into the details. +* `ECDHE`(Elliptic Curve Diffie Hellman Ephemeral椭圆曲线 Diffie-Hellman(临时))是一种用于管理 TLS 握手的有效而高效的算法。尤其是,ECDHE 通过确保连接双方(例如,`client` 程序和 Google Web 服务器)使用相同的加密/解密密钥(称为*会话密钥*)来解决“密钥分发问题”。后续文章会深入探讨该细节。 +* `RSA`(Rivest Shamir Adleman)是主要的公共密钥密码系统,并以 1970 年代后期首次描述该系统的三位学者的名字命名。这个正在使用的密钥对是使用 RSA 算法生成的。 +* `AES128`(高级加密标准Advanced Encryption Standard)是一种块式加密算法block cipher,用于加密和解密位块blocks of bits。(另一种算法是流式加密算法stream cipher,它一次加密和解密一个位。)该加密算法是对称加密算法,因为使用同一个密钥进行加密和解密,这首先引起了密钥分发问题。AES 支持 128(此处使用)、192 和 256 位的密钥大小:密钥越大,保护越好。 - * `RSA` (Rivest Shamir Adleman) is the dominant public-key cryptosystem and named after the three academics who first described the system in the late 1970s. The key-pairs in play are generated with the RSA algorithm. + 通常,像 AES 这样的对称加密系统的密钥大小要小于像 RSA 这样的非对称(基于密钥对)系统的密钥大小。例如,1024 位 RSA 密钥相对较小,而 256 位密钥当前是 AES 最大的密钥。 +* `GCM`(伽罗瓦计数器模式Galois Counter Mode)处理在安全对话期间重复应用加密算法(在这种情况下为 AES128)。AES128 块的大小仅为 128 位,安全对话很可能包含从一侧到另一侧的多个 AES128 块。GCM 非常有效,通常与 AES128 搭配使用。 +* `SHA256` (256 位安全哈希算法Secure Hash Algorithm 256 bits)是正在使用的加密哈希算法。生成的哈希值的大小为 256 位,尽管使用 SHA 甚至可以更大。 - * `AES128` (Advanced Encryption Standard) is a _block cipher_ that encrypts and decrypts blocks of bits. (The alternative is a _stream cipher_, which encrypts and decrypts bits one at a time.) The cipher is _symmetric_ in that the same key is used to encrypt and to decrypt, which raises the key-distribution problem in the first place. AES supports key sizes of 128 (used here), 192, and 256 bits: the larger the key, the better the protection. +加密算法套件正在不断发展中。例如,不久前,Google 使用 RC4 流加密算法(是 RSA 的 Ron Rivest 后来开发的 Ron's Cipher 版本 4)。 RC4 现在有已知的漏洞,这至少部分导致了 Google 转换为 AES128。 -Key sizes for symmetric cryptosystems such as AES are, in general, smaller than those for asymmetric (key-pair based) systems such as RSA. For example, a 1024-bit RSA key is relatively small, whereas a 256-bit key is currently the largest for AES. +### 总结 - * `GCM` (Galois Counter Mode) handles the repeated application of a cipher (in this case, AES128) during a secured conversation. AES128 blocks are only 128-bits in size, and a secure conversation is likely to consist of multiple AES128 blocks from one side to the other. GCM is efficient and commonly paired with AES128. - - * `SHA256` (Secure Hash Algorithm 256 bits) is the cryptographic hash algorithm in play. The hash values produced are 256 bits in size, although even larger values are possible with SHA. - - - - -Cipher suites are in continual development. Not so long ago, for example, Google used the RC4 stream cipher (Ron’s Cipher version 4 after Ron Rivest from RSA). RC4 now has known vulnerabilities, which presumably accounts, at least in part, for Google’s switch to AES128. - -### Wrapping up - -This first look at OpenSSL, through a secure C web client and various command-line examples, has brought to the fore a handful of topics in need of more clarification. [The next article gets into the details][17], starting with cryptographic hashes and ending with a fuller discussion of how digital certificates address the key distribution challenge. +通过安全的 C Web 客户端和各种命令行示例对 OpenSSL 的首次了解,使一些需要进一步阐明的主题脱颖而出。[下一篇文章会详细介绍][17],从加密散列开始,到结束时对数字证书如何应对密钥分发挑战的更全面讨论。 -------------------------------------------------------------------------------- @@ -315,7 +307,7 @@ via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 作者:[Marty Kalin][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[wxy](https://github.com/wxy) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7f54abe36d01ae50815025e4d5dff3e2b203b7b8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 23 Jan 2020 09:17:22 +0800 Subject: [PATCH 675/676] translated --- ...nt for Linux to tweet from the terminal.md | 70 ------------------- ...nt for Linux to tweet from the terminal.md | 64 +++++++++++++++++ 2 files changed, 64 insertions(+), 70 deletions(-) delete mode 100644 sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md create mode 100644 translated/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md diff --git a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md deleted file mode 100644 index 1e9eda911f..0000000000 --- a/sources/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use this Twitter client for Linux to tweet from the terminal) -[#]: via: (https://opensource.com/article/20/1/tweet-terminal-rainbow-stream) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use this Twitter client for Linux to tweet from the terminal -====== -Keep up with your Twitter feed without leaving the terminal by using -Rainbow Stream in the tenth in our series on 20 ways to be more -productive with open source in 2020. -![Chat bubbles][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Keep up with Twitter with Rainbow Stream - -I love social networking and microblogging. It's quick, it's easy, and I can share my thoughts with the world really quickly. The drawback is, of course, that almost all the desktop options for non-Windows users are wrappers around the website. [Twitter][2] has a lot of clients, but what I really want is something lightweight, easy to use, and most importantly, attractive. - -![Rainbow Stream for Twitter][3] - -[Rainbow Stream][4] is one of the prettier Twitter clients. It is easy to use and installs quickly with a simple **pip3 install rainbowstream**. On the first run, it will open a browser window and have you authorize with Twitter. Once that is done, you land at a prompt, and your Twitter timeline will start scrolling by. - -![Rainbow Stream first run][5] - -The most important commands to know are **p** to pause the stream, **r** to resume the stream, **h** to get help, and **t** to post a new tweet. For example, **h tweets** will give you all the options for sending and replying to tweets. Another useful help screen is **h messages**, which gives the commands for working with direct messages, which is something my wife and I use a lot. There are a lot of other commands, and I refer back to help a lot. - -As your timeline scrolls by, you can see that it has full UTF-8 support and, with the right font, will show indicators for how many times something was retweeted and liked, as well as icons and emojis. - -![Kill this love][6] - -One of the _best_ things about Rainbow Stream is that you don't have to give up on photos and images. This feature is off by default, but you can try it out with the **config** command. - - -``` -`config IMAGE_ON_TERM = true` -``` - -This command renders any images as ASCII art. If you have a photo-heavy stream, this may be a bit much, but I like it. It has a very retro-1990s BBS feel, and I did love the BBS scene in the 1990s. - -You can also use Rainbow Stream to manage lists, mute people, block people, follow, unfollow, and everything else that is available with the Twitter API. There is also theme support, so you can customize the stream to your favorite color scheme. - -When I'm working and don't want to have yet-another-tab open on my browser, Rainbow Stream lets me keep up in a terminal off to the side. - -Without open source, Twitter wouldn't exist. Every Tweet you send and receive touches open source... - -Sergey Bronnikov shares why the OpenVZ team created Twisource, an open source social media tool. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) -[2]: https://twitter.com/home -[3]: https://opensource.com/sites/default/files/uploads/productivity_10-1.png (Rainbow Stream for Twitter) -[4]: https://rainbowstream.readthedocs.io/en/latest/ -[5]: https://opensource.com/sites/default/files/uploads/productivity_10-2.png (Rainbow Stream first run) -[6]: https://opensource.com/sites/default/files/uploads/day10-image3_1.png (Kill this love) diff --git a/translated/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/translated/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md new file mode 100644 index 0000000000..d67793031e --- /dev/null +++ b/translated/tech/20200120 Use this Twitter client for Linux to tweet from the terminal.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this Twitter client for Linux to tweet from the terminal) +[#]: via: (https://opensource.com/article/20/1/tweet-terminal-rainbow-stream) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用这个 Twitter 客户端在 Linux 终端中发推特 +====== +在我们的 20 个使用开源提升生产力的系列的第十篇文章中使用 Rainbow Stream 跟上你的 Twitter 流而无需离开终端。 +![Chat bubbles][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 通过 Rainbow Stream 跟上Twitter + +我喜欢社交网络和微博。它快速、简单,还有我可以与世界分享我的想法。当然,缺点是几乎所有非 Windows 的桌面客户端都是网站的封装。[Twitter][2] 有很多客户端,但我真正想要的是轻量、易于使用,最重要的是吸引人的客户端。 + +![Rainbow Stream for Twitter][3] + +[Rainbow Stream][4] 是好看的 Twitter 客户端之一。它简单易用,并且可以通过 **pip3 install rainbowstream** 快速安装。第一次运行时,它将打开浏览器窗口,并让你通过 Twitter 授权。完成后,你将回到命令行,你的 Twitter 时间线将开始滚动。 + +![Rainbow Stream first run][5] + +要了解的最重要的命令是 **p** 暂停推流、**r** 继续推流、**h** 得帮助,以及 **t** 发布新的推文。例如,**h tweets** 将提供发送和回复推文的所有选项。另一个有用的帮助页面是 **h messages**,它提供了处理直接消息的命令,这是我妻子和我经常使用的东西。还有很多其他命令,我会回头获得很多帮助。 + +随着时间线的滚动,你可以看到它有完整的 UTF-8 支持,并以正确的字体显示推文被转推以及喜欢的次数,图标和 emoji 也能正确显示。 + +![Kill this love][6] + +关于 Rainbow Stream 的_最好_功能之一就是你不必放弃照片和图像。默认情况下,此功能是关闭的,但是你可以使用 **config** 命令尝试它。 + + +``` +`config IMAGE_ON_TERM = true` +``` + +此命令将任何图像渲染为 ASCII 艺术。如果你有大量照片流,它可能会有点多,但是我喜欢。它有非常复古的 1990 年代 BBS 感觉,我也确实喜欢 1990 年代的 BBS 场景。 + +你还可以使用 Rainbow Stream 管理列表、屏蔽某人、拉黑某人、关注、取消关注以及 Twitter API 的所有其他功能。它还支持主题,因此你可以用喜欢的颜色方案自定义流。 + +当我正在工作并且不想在浏览器上打开另一个选项卡时,Rainbow Stream 让我可以留在终端中。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) +[2]: https://twitter.com/home +[3]: https://opensource.com/sites/default/files/uploads/productivity_10-1.png (Rainbow Stream for Twitter) +[4]: https://rainbowstream.readthedocs.io/en/latest/ +[5]: https://opensource.com/sites/default/files/uploads/productivity_10-2.png (Rainbow Stream first run) +[6]: https://opensource.com/sites/default/files/uploads/day10-image3_1.png (Kill this love) From e4fb4a2d9cc5f1022cf908f93fb149099bf6f0de Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 23 Jan 2020 09:21:41 +0800 Subject: [PATCH 676/676] translating --- .../tech/20200119 One open source chat tool to rule them all.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200119 One open source chat tool to rule them all.md b/sources/tech/20200119 One open source chat tool to rule them all.md index 963b7246d0..25f6728c84 100644 --- a/sources/tech/20200119 One open source chat tool to rule them all.md +++ b/sources/tech/20200119 One open source chat tool to rule them all.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( )